Update git refs before comparing refs

The current check will work since an known tag is already at the right
ref and an unknown tag will give an unequal value from git rev-list. But
this fails to work if the version is, for example, 'origin/master'
rather than a git tag.

Change-Id: I746624649acaa7fab217b8ff5570f5822003b2f3
This commit is contained in:
K Jonathan Harker 2014-07-09 14:30:16 -07:00
parent dce27b9e1c
commit a0b5912853
1 changed files with 2 additions and 2 deletions

View File

@ -106,10 +106,10 @@ for MOD in ${!SOURCE_MODULES[*]} ; do
git clone $MOD "${MODULE_PATH}/${MODULE_NAME}"
fi
fi
# fetch the latest refs from the repo
$GIT_CMD_BASE fetch
# make sure the correct revision is installed, I have to use rev-list b/c rev-parse does not work with tags
if [ `${GIT_CMD_BASE} rev-list HEAD --max-count 1` != `${GIT_CMD_BASE} rev-list ${SOURCE_MODULES[$MOD]} --max-count 1` ]; then
# fetch the latest refs from the repo
$GIT_CMD_BASE fetch
# checkout correct revision
$GIT_CMD_BASE checkout ${SOURCE_MODULES[$MOD]}
fi