summaryrefslogtreecommitdiff
path: root/t/t6300-for-each-ref.sh
diff options
context:
space:
mode:
authorBert Wesarg <bert.wesarg@googlemail.com>2009-04-13 10:25:47 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-04-13 16:36:52 (GMT)
commit2bb98169be7b0ac4f70815b4490904c652edae61 (patch)
tree000a34fd8ca7712effc7de694eaca264f3681822 /t/t6300-for-each-ref.sh
parent6e7b3309d356077337b8222683a743c27fa7276c (diff)
downloadgit-2bb98169be7b0ac4f70815b4490904c652edae61.zip
git-2bb98169be7b0ac4f70815b4490904c652edae61.tar.gz
git-2bb98169be7b0ac4f70815b4490904c652edae61.tar.bz2
for-each-ref: utilize core.warnAmbiguousRefs for :short-format
core.warnAmbiguousRefs is used to select strict mode for the abbreviation for the ":short" format specifier of "refname" and "upstream". In strict mode, the abbreviated ref will never trigger the 'warn_ambiguous_refs' warning. I.e. for these refs: refs/heads/xyzzy refs/tags/xyzzy the abbreviated forms are: heads/xyzzy tags/xyzzy Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6300-for-each-ref.sh')
-rwxr-xr-xt/t6300-for-each-ref.sh18
1 files changed, 15 insertions, 3 deletions
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index daf02d5..8052c86 100755
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
@@ -301,10 +301,11 @@ test_expect_success 'Check for invalid refname format' '
cat >expected <<\EOF
heads/master
-master
+tags/master
EOF
-test_expect_success 'Check ambiguous head and tag refs' '
+test_expect_success 'Check ambiguous head and tag refs (strict)' '
+ git config --bool core.warnambiguousrefs true &&
git checkout -b newtag &&
echo "Using $datestamp" > one &&
git add one &&
@@ -316,11 +317,22 @@ test_expect_success 'Check ambiguous head and tag refs' '
'
cat >expected <<\EOF
+heads/master
+master
+EOF
+
+test_expect_success 'Check ambiguous head and tag refs (loose)' '
+ git config --bool core.warnambiguousrefs false &&
+ git for-each-ref --format "%(refname:short)" refs/heads/master refs/tags/master >actual &&
+ test_cmp expected actual
+'
+
+cat >expected <<\EOF
heads/ambiguous
ambiguous
EOF
-test_expect_success 'Check ambiguous head and tag refs II' '
+test_expect_success 'Check ambiguous head and tag refs II (loose)' '
git checkout master &&
git tag ambiguous testtag^0 &&
git branch ambiguous testtag^0 &&