From: Max Kirillov <max@max630.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH 1/2] git-show: fix 'git show -s' to not add extra terminator after merge commit
Date: Tue, 13 May 2014 01:42:34 +0300 [thread overview]
Message-ID: <20140512224234.GA32316@wheezy.local> (raw)
In-Reply-To: <20140512223517.GA32205@wheezy.local>
When git show -s is called for merge commit it prints extra newline
after any merge commit and the next one. This looks especially ugly for
--oneline and other single-line formats. Looks very much like a bug.
The code in question exists since commit 3969cf7db1. Probably the
correct condition should be in fact
"opt->output_format & DIFF_FORMAT_DIFFSTAT".
Test t7007-show.sh is also modified to cover this case.
---
combine-diff.c | 3 ++-
t/t7007-show.sh | 8 ++++++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/combine-diff.c b/combine-diff.c
index 3b92c448..ff6ceaf 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -1331,7 +1331,8 @@ void diff_tree_combined(const unsigned char *sha1,
if (show_log_first && i == 0) {
show_log(rev);
- if (rev->verbose_header && opt->output_format)
+ if (rev->verbose_header && opt->output_format &&
+ opt->output_format != DIFF_FORMAT_NO_OUTPUT)
printf("%s%c", diff_line_prefix(opt),
opt->line_termination);
}
diff --git a/t/t7007-show.sh b/t/t7007-show.sh
index e41fa00..de22812 100755
--- a/t/t7007-show.sh
+++ b/t/t7007-show.sh
@@ -25,6 +25,7 @@ test_expect_success 'set up a bit of history' '
git checkout -b side HEAD^^ &&
test_commit side2 &&
test_commit side3
+ test_merge merge main3
'
test_expect_success 'showing two commits' '
@@ -109,8 +110,11 @@ test_expect_success 'showing range' '
'
test_expect_success '-s suppresses diff' '
- echo main3 >expect &&
- git show -s --format=%s main3 >actual &&
+ cat >expect <<-\EOF &&
+ merge
+ main3
+ EOF
+ git show -s --format=%s merge main3 >actual &&
test_cmp expect actual
'
--
1.8.5.2.421.g4cdf8d0
next prev parent reply other threads:[~2014-05-12 22:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-12 22:35 [PATCH 0/2] fix 'git show -s' to not add extra terminator after merge commit Max Kirillov
2014-05-12 22:42 ` Max Kirillov [this message]
2014-05-12 22:43 ` [PATCH 2/2] t: git-show: adapt tests to fixed 'git show' Max Kirillov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140512224234.GA32316@wheezy.local \
--to=max@max630.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.