git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jacob Keller <jacob.e.keller@intel.com>
Cc: git@vger.kernel.org, Jacob Keller <jacob.keller@gmail.com>
Subject: Re: [PATCH v3 2/2] diff: add SUBMODULE_DIFF format to display submodule diff
Date: Wed, 10 Aug 2016 15:05:23 -0700	[thread overview]
Message-ID: <xmqqziok2sbg.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20160810211710.23173-2-jacob.e.keller@intel.com> (Jacob Keller's message of "Wed, 10 Aug 2016 14:17:10 -0700")

Jacob Keller <jacob.e.keller@intel.com> writes:

> @@ -2305,6 +2311,15 @@ static void builtin_diff(const char *name_a,
>  	struct strbuf header = STRBUF_INIT;
>  	const char *line_prefix = diff_line_prefix(o);
>  
> +	diff_set_mnemonic_prefix(o, "a/", "b/");
> +	if (DIFF_OPT_TST(o, REVERSE_DIFF)) {
> +		a_prefix = o->b_prefix;
> +		b_prefix = o->a_prefix;
> +	} else {
> +		a_prefix = o->a_prefix;
> +		b_prefix = o->b_prefix;
> +	}
> +

Hmph, is it safe to raise this when SUBMODULE_DIFF is not in effect?
Not objecting, just asking.

>  	if (DIFF_OPT_TST(o, SUBMODULE_LOG) &&
> ...
> +	} else if (DIFF_OPT_TST(o, SUBMODULE_DIFF) &&

This makes clear that SUBMODULE_LOG and SUBMODULE_DIFF should not be
independent bits in the diff-opt flag word.  We used to run
something like "log --oneline --left-right A...B" and your new code
runs "diff A B", but the next month somebody else would want to do
"log -p --left-right A...B" or something else, and they are clearly
mutually exclusive.

> diff --git a/diff.h b/diff.h
> index 6a91a1139686..65df44b1fcba 100644
> --- a/diff.h
> +++ b/diff.h
> @@ -69,7 +69,7 @@ typedef struct strbuf *(*diff_prefix_fn_t)(struct diff_options *opt, void *data)
>  #define DIFF_OPT_FIND_COPIES_HARDER  (1 <<  6)
>  #define DIFF_OPT_FOLLOW_RENAMES      (1 <<  7)
>  #define DIFF_OPT_RENAME_EMPTY        (1 <<  8)
> -/* (1 <<  9) unused */
> +#define DIFF_OPT_SUBMODULE_DIFF      (1 <<  9)

So I'd really prefer not to see this change; instead, we should move
in the direction where we _REMOVE_ DIFF_OPT_SUBMODULE_LOG from these,
and introduce an enum to hold "how would we show submodule changes"
in the diff_options structure.

  reply	other threads:[~2016-08-10 22:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-10 21:17 [PATCH v3 1/2] diff: add --line-prefix option for passing in a prefix Jacob Keller
2016-08-10 21:17 ` [PATCH v3 2/2] diff: add SUBMODULE_DIFF format to display submodule diff Jacob Keller
2016-08-10 22:05   ` Junio C Hamano [this message]
2016-08-10 22:45     ` Jacob Keller
2016-08-10 21:58 ` [PATCH v3 1/2] diff: add --line-prefix option for passing in a prefix Junio C Hamano
2016-08-10 22:42   ` Jacob Keller
2016-08-10 22:53   ` Jacob Keller

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqziok2sbg.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=jacob.keller@gmail.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).