diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-06-11 13:31:07 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-06-11 13:31:07 -0700 |
commit | f4c52a05277f8f5901f7663f6ab339271b814872 (patch) | |
tree | 994c7cbe55b25f15a952eea7f6df7e8f3f39877b /t | |
parent | Merge branch 'rr/diffcore-pickaxe-doc' (diff) | |
parent | get_sha1: warn about full or short object names that look like refs (diff) | |
download | tgif-f4c52a05277f8f5901f7663f6ab339271b814872.tar.xz |
Merge branch 'nd/warn-ambiguous-object-name'
"git cmd <name>", when <name> happens to be a 40-hex string,
directly uses the 40-hex string as an object name, even if a ref
"refs/<some hierarchy>/<name>" exists. This disambiguation order
is unlikely to change, but we should warn about the ambiguity just
like we warn when more than one refs/ hierachies share the same
name.
* nd/warn-ambiguous-object-name:
get_sha1: warn about full or short object names that look like refs
Diffstat (limited to 't')
-rwxr-xr-x | t/t1512-rev-parse-disambiguation.sh | 18 |
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 |