mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
build-system: avoid checkout when unneeded
Checkout only if current checked out version differs from expected. Signed-off-by: Murillo Bernardes <mfbernardes@gmail.com>
This commit is contained in:
parent
550b6f179f
commit
7d92f5f811
1 changed files with 9 additions and 4 deletions
|
@ -38,10 +38,15 @@ git_checkout_library() {
|
|||
fi
|
||||
pushd "$name"
|
||||
|
||||
git fetch origin
|
||||
if ! git checkout "$version" ; then
|
||||
echo "Can't find the right tag in $name - giving up"
|
||||
return -1
|
||||
local current_sha=$(git rev-parse HEAD)
|
||||
local target_sha=$(git rev-parse "$version")
|
||||
|
||||
if [ ! "$current_sha" = "$target_sha" ] ; then
|
||||
git fetch origin
|
||||
if ! git checkout "$version" ; then
|
||||
echo "Can't find the right tag in $name - giving up"
|
||||
return -1
|
||||
fi
|
||||
fi
|
||||
popd
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue