Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Sean <seanlkml@sympatico.ca>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Allow pickaxe and diff-filter options to be used by git log.
Date: Thu, 18 May 2006 22:41:43 -0700	[thread overview]
Message-ID: <7vbqtuk1uw.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: BAYC1-PASMTP096010F052E9BF78B5FD4AAEA70@CEZ.ICE

Sean <seanlkml@sympatico.ca> writes:

> +	if (rev->always_show_header) {
> +		if (rev->diffopt.pickaxe || rev->diffopt.filter) {

I understand and agree to the change up to this part, but I do
not necessarily agree with what follows:

> +			rev->always_show_header = 0;
> +			if (rev->diffopt.output_format == DIFF_FORMAT_RAW)
> +				rev->diffopt.output_format = DIFF_FORMAT_NO_OUTPUT;

To me, if the user explicitly says --diff-filter or -S, it seems
more natural to interpret that the user wanted _some_ sort of
diff.  Now, there are people who say raw format is anti-human,
which I consider is a valid view, but I think it is better than
NO_OUTPUT in that case.

I wonder if doing something like this instead makes more sense
perhaps?

-- >8 --

diff --git a/builtin-log.c b/builtin-log.c
index 69f2911..e68bfad 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -23,6 +23,35 @@ static int cmd_log_wc(int argc, const ch
 	if (argc > 1)
 		die("unrecognized argument: %s", argv[1]);
 
+	if (rev->always_show_header) {
+		/* Log command is primarily about the message for human
+		 * consumption, but if the user asks for any diff, it
+		 * is human unfriendly to give the raw diff.
+		 *
+		 * Show command is the same way, but there the default is
+		 * always give patch output, so this does not trigger.
+		 */
+		if (rev->diffopt.output_format == DIFF_FORMAT_RAW) {
+			if (rev->diffopt.pickaxe)
+				rev->diffopt.output_format = DIFF_FORMAT_PATCH;
+			else {
+				rev->diffopt.output_format = DIFF_FORMAT_DIFFSTAT;
+				rev->diffopt.summary = 1;
+			}
+		}
+
+		/* If the user is limiting the commits to the ones
+		 * that have particular classes of diff, we should not
+		 * show the log message for irrelevant ones.
+		 *
+		 * git show --diff-filter=R -M --all can be used to view
+		 * the branch tips that renames something.  I do not know
+		 * how useful that is, though.
+		 */
+		if (rev->diffopt.pickaxe || rev->diffopt.filter)
+			rev->always_show_header = 0;
+	}
+
 	prepare_revision_walk(rev);
 	setup_pager();
 	while ((commit = get_revision(rev)) != NULL) {

  reply	other threads:[~2006-05-19  5:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20060518213124.6e731eef.seanlkml@sympatico.ca>
2006-05-19  1:31 ` [PATCH] Allow pickaxe to be used via git log Sean
2006-05-19  2:47   ` Junio C Hamano
     [not found]     ` <20060518225612.16c6441f.seanlkml@sympatico.ca>
2006-05-19  2:56       ` Sean
2006-05-19  3:05         ` Junio C Hamano
     [not found]           ` <20060518233803.7e4ca954.seanlkml@sympatico.ca>
2006-05-19  3:38             ` Sean
2006-05-19  3:39   ` Junio C Hamano
     [not found]     ` <20060519001920.42990900.seanlkml@sympatico.ca>
2006-05-19  4:19       ` [PATCH] Allow pickaxe and diff-filter options to be used by " Sean
2006-05-19  5:41         ` Junio C Hamano [this message]
     [not found]           ` <20060519014938.272dd7a1.seanlkml@sympatico.ca>
2006-05-19  5:49             ` Sean
2006-05-19  6:05               ` 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=7vbqtuk1uw.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=seanlkml@sympatico.ca \
    /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