summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-07-12 10:09:50 -0700
committerJunio C Hamano <gitster@pobox.com>2013-07-12 10:09:50 -0700
commitee6e5843c11ca5cba0d5ce964325a3b529299e0d (patch)
treeb55e9ef8df9450ae6c760132fd4aa3f7277e4f7c /t
parent8b8dfd5132ce91f632b5303c39cda2dfe30790f1 (diff)
parent798c35fcd8a71a094ca68ac05d81e08c5ac8166d (diff)
downloadgit-ee6e5843c11ca5cba0d5ce964325a3b529299e0d.tar.gz
Merge branch 'nd/warn-ambiguous-object-name' into jk/cat-file-batch-optim
* nd/warn-ambiguous-object-name: get_sha1: warn about full or short object names that look like refs
Diffstat (limited to 't')
-rwxr-xr-xt/t1512-rev-parse-disambiguation.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/t/t1512-rev-parse-disambiguation.sh b/t/t1512-rev-parse-disambiguation.sh
index 6b3d797cea..db228086d3 100755
--- a/t/t1512-rev-parse-disambiguation.sh
+++ b/t/t1512-rev-parse-disambiguation.sh
@@ -261,4 +261,22 @@ test_expect_success 'rev-parse --disambiguate' '
test "$(sed -e "s/^\(.........\).*/\1/" actual | sort -u)" = 000000000
'
+test_expect_success 'ambiguous 40-hex ref' '
+ TREE=$(git mktree </dev/null) &&
+ REF=`git rev-parse HEAD` &&
+ VAL=$(git commit-tree $TREE </dev/null) &&
+ git update-ref refs/heads/$REF $VAL &&
+ test `git rev-parse $REF 2>err` = $REF &&
+ grep "refname.*${REF}.*ambiguous" err
+'
+
+test_expect_success 'ambiguous short sha1 ref' '
+ TREE=$(git mktree </dev/null) &&
+ REF=`git rev-parse --short HEAD` &&
+ VAL=$(git commit-tree $TREE </dev/null) &&
+ git update-ref refs/heads/$REF $VAL &&
+ test `git rev-parse $REF 2>err` = $VAL &&
+ grep "refname.*${REF}.*ambiguous" err
+'
+
test_done