summaryrefslogtreecommitdiff
path: root/t/t6300-for-each-ref.sh
diff options
context:
space:
mode:
authorJohannes Sixt <johannes.sixt@telecom.at>2007-12-06 13:24:39 +0100
committerJunio C Hamano <gitster@pobox.com>2007-12-06 07:53:20 -0800
commitc9ecf4f12aecabfad87507ebd133476ea99fe4cb (patch)
tree4a9e462c426f5b019d8741e9d240e2a8694027a7 /t/t6300-for-each-ref.sh
parent90e0653b1824f27559cbc5c9d1f2a00fdb9400ba (diff)
downloadgit-c9ecf4f12aecabfad87507ebd133476ea99fe4cb.tar.gz
for-each-ref: Fix quoting style constants.
for-each-ref can accept only one quoting style. For this reason it uses OPT_BIT for the quoting style switches so that it is easy to check for more than one bit being set. However, not all symbolic constants were actually single bit values. In particular: $ git for-each-ref --python error: more than one quoting style ? This fixes it. While we are here, let's also remove the space before the question mark. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> 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.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index c722635050..8a23aaf21b 100755
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
@@ -169,5 +169,44 @@ test_expect_success 'Verify descending sort' '
git diff expected actual
'
+cat >expected <<\EOF
+'refs/heads/master'
+'refs/tags/testtag'
+EOF
+
+test_expect_success 'Quoting style: shell' '
+ git for-each-ref --shell --format="%(refname)" >actual &&
+ git diff expected actual
+'
+
+test_expect_success 'Quoting style: perl' '
+ git for-each-ref --perl --format="%(refname)" >actual &&
+ git diff expected actual
+'
+
+test_expect_success 'Quoting style: python' '
+ git for-each-ref --python --format="%(refname)" >actual &&
+ git diff expected actual
+'
+
+cat >expected <<\EOF
+"refs/heads/master"
+"refs/tags/testtag"
+EOF
+
+test_expect_success 'Quoting style: tcl' '
+ git for-each-ref --tcl --format="%(refname)" >actual &&
+ git diff expected actual
+'
+
+for i in "--perl --shell" "-s --python" "--python --tcl" "--tcl --perl"; do
+ test_expect_success "more than one quoting style: $i" "
+ git for-each-ref $i 2>&1 | (read line &&
+ case \$line in
+ \"error: more than one quoting style\"*) : happy;;
+ *) false
+ esac)
+ "
+done
test_done