aboutsummaryrefslogtreecommitdiff
path: root/t/test-lib.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2010-10-07 14:25:43 -0400
committerJunio C Hamano <gitster@pobox.com>2010-10-13 18:58:33 -0700
commit9130ac9fe17831445690ebbb60f09b86f96516b3 (patch)
tree36e2c5204978d544b6277526e5a31157acb818c9 /t/test-lib.sh
parent7c6eafa35af805578990e76b691ff7f1a25a3c57 (diff)
downloadgit-9130ac9fe17831445690ebbb60f09b86f96516b3.tar.gz
git-9130ac9fe17831445690ebbb60f09b86f96516b3.tar.xz
rev-list: handle %x00 NUL in user format
The code paths for showing commits in "git log" and "git rev-list --graph" correctly handle embedded NULs by looking only at the resulting strbuf's length, and never treating it as a C string. The code path for regular rev-list, however, used printf("%s"), which resulted in truncated output. This patch uses fwrite instead, like the --graph code path. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/test-lib.sh')
-rw-r--r--t/test-lib.sh4
1 files changed, 4 insertions, 0 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 830e5e736..25f8bf95c 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -248,6 +248,10 @@ test_decode_color () {
-e 's/.\[m/<RESET>/g'
}
+nul_to_q () {
+ perl -pe 'y/\000/Q/'
+}
+
q_to_nul () {
perl -pe 'y/Q/\000/'
}