Optimize ls-remote with --heads
Only looking at heads branches so optimize the query
by passing --heads option
Change-Id: I97a870b8e2964b90b77bdce333db1aea4115e5c2
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/build-unit-test-docker.sh b/build-unit-test-docker.sh
index 0f2040e..998e58c 100755
--- a/build-unit-test-docker.sh
+++ b/build-unit-test-docker.sh
@@ -65,12 +65,12 @@
local tip
# Need to continue if branch not found, hence || true at end
- tip=$(git ls-remote "https://github.com/openbmc/${package}" |
+ tip=$(git ls-remote --heads "https://github.com/openbmc/${package}" |
grep "refs/heads/$BRANCH" | awk '{ print $1 }' || true)
# If specific branch is not found then try master
if [ ! -n "$tip" ]; then
- tip=$(git ls-remote "https://github.com/openbmc/${package}" |
+ tip=$(git ls-remote --heads "https://github.com/openbmc/${package}" |
grep "refs/heads/master" | awk '{ print $1 }')
fi