diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-05-30 14:04:11 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-05-30 14:04:11 +0900 |
commit | ab48bc0aeadd7f6b661bc125a913e1c7d145cd5e (patch) | |
tree | 98bbbcf8dd2e210de83c71b2aecc508e9e7ba395 /t | |
parent | Merge branch 'jt/partial-clone-proto-v2' (diff) | |
parent | get_short_oid: sort ambiguous objects by type, then SHA-1 (diff) | |
download | tgif-ab48bc0aeadd7f6b661bc125a913e1c7d145cd5e.tar.xz |
Merge branch 'ab/get-short-oid'
When a short hexadecimal string is used to name an object but there
are multiple objects that share the string as the prefix of their
names, the code lists these ambiguous candidates in a help message.
These object names are now sorted according to their types for
easier eyeballing.
* ab/get-short-oid:
get_short_oid: sort ambiguous objects by type, then SHA-1
sha1-name.c: move around the collect_ambiguous() function
git-p4: change "commitish" typo to "committish"
sha1-array.h: align function arguments
sha1-name.c: remove stray newline
Diffstat (limited to 't')
-rwxr-xr-x | t/t1512-rev-parse-disambiguation.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/t/t1512-rev-parse-disambiguation.sh b/t/t1512-rev-parse-disambiguation.sh index 711704ba5a..2701462041 100755 --- a/t/t1512-rev-parse-disambiguation.sh +++ b/t/t1512-rev-parse-disambiguation.sh @@ -361,4 +361,25 @@ test_expect_success 'core.disambiguate does not override context' ' git -c core.disambiguate=committish rev-parse $sha1^{tree} ' +test_expect_success C_LOCALE_OUTPUT 'ambiguous commits are printed by type first, then hash order' ' + test_must_fail git rev-parse 0000 2>stderr && + grep ^hint: stderr >hints && + grep 0000 hints >objects && + cat >expected <<-\EOF && + tag + commit + tree + blob + EOF + awk "{print \$3}" <objects >objects.types && + uniq <objects.types >objects.types.uniq && + test_cmp expected objects.types.uniq && + for type in tag commit tree blob + do + grep $type objects >$type.objects && + sort $type.objects >$type.objects.sorted && + test_cmp $type.objects.sorted $type.objects + done +' + test_done |