[PATCH] rev-list: restore the NUL commit separator in --header mode
From: Dennis Kaarsemaker <hidden>
Date: 2016-10-19 21:04:59
Subsystem:
the rest · Maintainer:
Linus Torvalds
Commit 660e113 (graph: add support for --line-prefix on all graph-aware output) changed the way commits were shown. Unfortunately this dropped the NUL between commits in --header mode. Restore the NUL and add a test for this feature. Signed-off-by: Dennis Kaarsemaker <redacted> --- builtin/rev-list.c | 4 ++++ t/t6000-rev-list-misc.sh | 7 +++++++ 2 files changed, 11 insertions(+)
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index 8479f6e..cfa6a7d 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c@@ -157,6 +157,10 @@ static void show_commit(struct commit *commit, void *data) if (revs->commit_format == CMIT_FMT_ONELINE) putchar('\n'); } + if (revs->commit_format == CMIT_FMT_RAW) { + putchar(info->hdr_termination); + } + strbuf_release(&buf); } else { if (graph_show_remainder(revs->graph))
diff --git a/t/t6000-rev-list-misc.sh b/t/t6000-rev-list-misc.sh
index 3e752ce..a2acff3 100755
--- a/t/t6000-rev-list-misc.sh
+++ b/t/t6000-rev-list-misc.sh@@ -100,4 +100,11 @@ test_expect_success '--bisect and --first-parent can not be combined' ' test_must_fail git rev-list --bisect --first-parent HEAD ' +test_expect_success '--header shows a NUL after each commit' ' + touch expect && + printf "\0" > expect && + git rev-list --header --max-count=1 HEAD | tail -n1 >actual && + test_cmp_bin expect actual +' + test_done
--
2.10.1-449-gab0f84c
--
Dennis Kaarsemaker <dennis@kaarsemaker.net>
http://twitter.com/seveas