aboutsummaryrefslogtreecommitdiff
path: root/t/t6006-rev-list-format.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2010-01-13 12:35:31 -0500
committerJunio C Hamano <gitster@pobox.com>2010-01-14 09:24:42 -0800
commit0a0416a34a7ef5c64f4e0226371e4cab8c1ba982 (patch)
tree76ce0e33cbe408a9ead5d29f66a1ec171a8d106c /t/t6006-rev-list-format.sh
parent902f235378cb2b2f6dd5dd664b9630c95321f0ae (diff)
downloadgit-0a0416a34a7ef5c64f4e0226371e4cab8c1ba982.tar.gz
git-0a0416a34a7ef5c64f4e0226371e4cab8c1ba982.tar.xz
strbuf_expand: convert "%%" to "%"
The only way to safely quote arbitrary text in a pretty-print user format is to replace instances of "%" with "%x25". This is slightly unreadable, and many users would expect "%%" to produce a single "%", as that is what printf format specifiers do. This patch converts "%%" to "%" for all users of strbuf_expand(): (1) git-daemon interpolated paths (2) pretty-print user formats (3) merge driver command lines Case (1) was already doing the conversion itself outside of strbuf_expand(). Case (2) is the intended beneficiary of this patch. Case (3) users probably won't notice, but as this is user-facing behavior, consistently providing the quoting mechanism makes sense. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6006-rev-list-format.sh')
-rwxr-xr-xt/t6006-rev-list-format.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh
index 571931588..b0047d3c6 100755
--- a/t/t6006-rev-list-format.sh
+++ b/t/t6006-rev-list-format.sh
@@ -19,6 +19,13 @@ test_cmp expect.$1 output.$1
"
}
+test_format percent %%h <<'EOF'
+commit 131a310eb913d107dd3c09a65d1651175898735d
+%h
+commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873
+%h
+EOF
+
test_format hash %H%n%h <<'EOF'
commit 131a310eb913d107dd3c09a65d1651175898735d
131a310eb913d107dd3c09a65d1651175898735d