Merge branch 'jk/diff-submodule-diff-inline'
authorJunio C Hamano <gitster@pobox.com>
Wed, 26 Oct 2016 20:14:51 +0000 (13:14 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 26 Oct 2016 20:14:51 +0000 (13:14 -0700)
A recently graduated topic regressed "git rev-list --header"
output, breaking "gitweb". This has been fixed.

* jk/diff-submodule-diff-inline:
rev-list: use hdr_termination instead of a always using a newline

builtin/rev-list.c
t/t6000-rev-list-misc.sh
index 8479f6ed28aa75d01350fc17eafbded0b52dca84..c43decda70112a9cdb7789dc81394286459aa3af 100644 (file)
@@ -145,7 +145,7 @@ static void show_commit(struct commit *commit, void *data)
                         */
                        if (buf.len && buf.buf[buf.len - 1] == '\n')
                                graph_show_padding(revs->graph);
-                       putchar('\n');
+                       putchar(info->hdr_termination);
                } else {
                        /*
                         * If the message buffer is empty, just show
index 3e752ce03280ff694fedb6657fe2ed334127f253..969e4e9e5261640dc690806ed06f8e58e760633f 100755 (executable)
@@ -100,4 +100,18 @@ 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' '
+       # We know that there is no Q in the true payload; names and
+       # addresses of the authors and the committers do not have
+       # any, and object names or header names do not, either.
+       git rev-list --header --max-count=2 HEAD |
+       nul_to_q |
+       grep "^Q" >actual &&
+       cat >expect <<-EOF &&
+       Q$(git rev-parse HEAD~1)
+       Q
+       EOF
+       test_cmp expect actual
+'
+
 test_done