From 41f1ca2ad4ac8cdb684745bb7df2dc09714a1faf Mon Sep 17 00:00:00 2001 From: Jon-Paul Sullivan Date: Fri, 28 Feb 2014 12:21:07 +0000 Subject: [PATCH] Replace use of show-ref with name-rev Testing showed that show-ref did not accurately determine whether a git repository contained the given reference. Testing with name-rev showed that it did. Change the HAS_REF determination appropriately to avoid unnecessary cache updates when using fixed references. Change-Id: Iece213348516358af84417807f8dd36e959139eb --- .../source-repositories/extra-data.d/98-source-repositories | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elements/source-repositories/extra-data.d/98-source-repositories b/elements/source-repositories/extra-data.d/98-source-repositories index 7239a473..6685f291 100755 --- a/elements/source-repositories/extra-data.d/98-source-repositories +++ b/elements/source-repositories/extra-data.d/98-source-repositories @@ -64,7 +64,7 @@ function get_repos_for_element(){ mv ${CACHE_PATH}{.tmp,} fi - HAS_REF=$(git --git-dir=$CACHE_PATH/.git show-ref $REPOREF || true) + HAS_REF=$(git --git-dir=$CACHE_PATH/.git name-rev $REPOREF 2>/dev/null || true) if [ -z "$DIB_OFFLINE" -o -z "$HAS_REF" ] ; then echo "Updating cache of $REPOLOCATION in $CACHE_PATH with ref $REPOREF" git --git-dir=$CACHE_PATH/.git fetch --update-head-ok $REPOLOCATION ${REPOREF}:${REPOREF}