CyCoreSystems / docker-meteor

Dockerfile and script for running Meteor on Docker
MIT License
120 stars 73 forks source link

Not getting the latest git commits #9

Closed greggman closed 9 years ago

greggman commented 9 years ago

Maybe this is intended but this code

   echo "Getting ${REPO}..."
   if [ -e /usr/src/app/.git ]; then
      pushd /usr/src/app
      git fetch
      popd
   else
      git clone ${REPO} /usr/src/app
   fi

   cd /usr/src/app

   echo "Switching to branch/tag ${BRANCH}..."
   git checkout ${BRANCH}

Basically says, if there's no '.git' folder clone the git repo. If there is a '.git' folder fetch the data. NOTE: fetch does not change any files in the current folder, it only grabs the latest blobs and puts them inside the .git folder

The script then checks out the branch. All that does it is switch to the branch in its current state on the machine

Did you mean to update to the latest? The git fetch should be git pull origin ${BRANCH}

either that or add a

git reset --hard origin/${BRANCH}

after the git checkout

Otherwise there's not much point to the git fetch. I won't effect anything.

you also might want it to be

git reset --hard origin/${BRANCH}
git clean -d -f  

That will delete any directories and files that git doesn't know about, basically making sure the current folder is exactly the state it should be after checking out. (of course maybe the app wrote stuff should stick around?)

Ulexus commented 9 years ago

Yes, thanks; you are quite correct. I'll get this patched a bit later, or feel free to submit a PR.