From de50cec19b4f7e4c5a6da5ecc5cddd7a52ac3725 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Thu, 13 Dec 2012 12:36:07 +0000 Subject: Always use `git rev-parse --verify` to resolve refs Previously some code used `git show-ref`, which is wrong -- given two refs named 'alpha/master' and 'master', `git show-ref master` will return both, sorted alphabetically. This can lead to build failures, etc. due to refs resolving to the wrong SHAs. We should also use `git rev-parse --verify` to verify SHA1s, which we previously did with `git rev-list`. Finally, `git rev-parse --verify` is more than twice as fast as `git show-ref`. --- tests/update-gits-chunk.script | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/update-gits-chunk.script b/tests/update-gits-chunk.script index c2ad08d0..288438ec 100755 --- a/tests/update-gits-chunk.script +++ b/tests/update-gits-chunk.script @@ -31,7 +31,7 @@ REPO_ALIAS='test=git://localhost:9419/%s#git://localhost:9419/%s' cd "$DATADIR/chunk-repo" git checkout --quiet farrokh git commit --quiet --allow-empty --allow-empty-message -m "" -NEWREF="$(git show-ref --hash farrokh)" +NEWREF="$(git rev-parse --verify farrokh)" "$SRCDIR/scripts/test-morph" --repo-alias=$REPO_ALIAS update-gits \ test:chunk-repo farrokh hello @@ -40,4 +40,4 @@ kill $(cat "$DATADIR/git.pid") # Check the top commit of the cached repo's farrokh branch cd "$DATADIR/cache/gits/"*chunk?repo* -test "$(git show-ref --hash refs/heads/farrokh)" = "$NEWREF" +test "$(git rev-parse --verify refs/heads/farrokh)" = "$NEWREF" -- cgit v1.2.1