git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH 2/3] log: when --cc is given, default to -p unless told otherwise
Date: Thu, 20 Aug 2015 15:43:10 -0700	[thread overview]
Message-ID: <1440110591-12941-3-git-send-email-gitster@pobox.com> (raw)
In-Reply-To: <1440110591-12941-1-git-send-email-gitster@pobox.com>

The "--cc" option to "git log" is clearly a request to show some
sort of combined diff (be it --patch or --raw), but traditionally
we required the command line to explicitly ask for "git log -p --cc".

Teach the command line parser to treat a lone "--cc" as if the user
specified "-p --cc".  Formats that do ask for other forms of diff
output, e.g. "log --raw --cc", are not overriden.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 builtin/log.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/builtin/log.c b/builtin/log.c
index 8651105..e37c27a 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -633,6 +633,10 @@ static void log_setup_revisions_tweak(struct rev_info *rev,
 	if (DIFF_OPT_TST(&rev->diffopt, DEFAULT_FOLLOW_RENAMES) &&
 	    rev->prune_data.nr == 1)
 		DIFF_OPT_SET(&rev->diffopt, FOLLOW_RENAMES);
+
+	/* Turn --cc/-c into -p --cc/-c when -p was not given */
+	if (!rev->diffopt.output_format && rev->combine_merges)
+		rev->diffopt.output_format = DIFF_FORMAT_PATCH;
 }
 
 int cmd_log(int argc, const char **argv, const char *prefix)
-- 
2.5.0-546-gb1bbc0d

  parent reply	other threads:[~2015-08-20 22:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-20 22:43 [PATCH 0/3] Showing merges easier with "git log" Junio C Hamano
2015-08-20 22:43 ` [PATCH 1/3] log: rename "tweak" helpers Junio C Hamano
2015-08-20 22:43 ` Junio C Hamano [this message]
2015-08-20 22:43 ` [PATCH 3/3] log: show merge commit when --cc is given Junio C Hamano
2015-08-21 18:03 ` [PATCH 4/3] builtin/log.c: minor reformat Junio C Hamano
2015-08-21 21:40 ` [PATCH 3z/3] log: make '-p' imply '-m --cc' Junio C Hamano

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=1440110591-12941-3-git-send-email-gitster@pobox.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).