git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/3] revision: add "--ignore-merges" option to counteract "-m"
Date: Tue, 28 Jul 2020 14:01:27 -0700	[thread overview]
Message-ID: <xmqqv9i7cq1k.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <20200728163853.GB2650252@coredump.intra.peff.net> (Jeff King's message of "Tue, 28 Jul 2020 12:38:53 -0400")

Jeff King <peff@peff.net> writes:

> The "-m" option sets revs->ignore_merges to "0", but there's no way to
> undo it. This probably isn't something anybody overly cares about, since
> "1" is already the default, but it will serve as an escape hatch when we
> flip the default for ignore_merges to "0" in more situations.
>
> We'll also add a few extra niceties:
>
>   - initialize the value to "-1" to indicate "not set", and then resolve
>     it to the normal 0/1 bool in setup_revisions(). This lets any tweak
>     functions, as well as setup_revisions() itself, avoid clobbering the
>     user's preference (which until now they couldn't actually express).
>
>   - since we now have --ignore-merges, let's add the matching
>     --no-ignore-merges, which is just a synonym for "-m". In fact, it's
>     simpler to just document --no-ignore-merges alongside "-m", and
>     leave it implied that its opposite countermands it.
>
> The new test shows that this behaves just the same as the current
> behavior without "-m".
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> I pulled the option name from the rev_info field name. It might be too
> broad (we are not ignoring merges during the traversal, only for the
> diff). It could be "--no-diff-merges" or something, but that would
> involve flipping the sense of the boolean (but that would just be in the
> code, not user-visible, so not that big a deal).
>
>  Documentation/rev-list-options.txt            |  1 +
>  builtin/log.c                                 |  4 +-
>  revision.c                                    | 10 ++-
>  revision.h                                    |  2 +-
>  t/t4013-diff-various.sh                       |  1 +
>  ...g_--ignore-merges_-p_--first-parent_master | 78 +++++++++++++++++++
>  6 files changed, 90 insertions(+), 6 deletions(-)
>  create mode 100644 t/t4013/diff.log_--ignore-merges_-p_--first-parent_master
>
> diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
> index b01b2b6773..fbd8fa0381 100644
> --- a/Documentation/rev-list-options.txt
> +++ b/Documentation/rev-list-options.txt
> @@ -1148,6 +1148,7 @@ options may be given. See linkgit:git-diff-files[1] for more options.
>  	rename or copy detection have been requested).
>  
>  -m::
> +--no-ignore-merges::

This invites a natural "does --ignore-merges exist, and if so what
does it do?"  Why not to have "--[no-]ignore-merges" as a separate
entry immediately after the existing "-m" instead?

>  	This flag makes the merge commits show the full diff like
>  	regular commits; for each merge parent, a separate log entry
>  	and diff is generated. An exception is that only diff against

That is,

	--[no-]ignore-merges::

		`--no-ignore-merges` is a synonym to `-m`.
		`--ignore-merges` countermands an earlier `-m` that
		is either explicitly or implicitly given.

or something along the line, perhaps?

> diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
> index 43267d6024..8f9181316f 100755
> --- a/t/t4013-diff-various.sh
> +++ b/t/t4013-diff-various.sh
> @@ -297,6 +297,7 @@ log --root --patch-with-stat --summary master
>  log --root -c --patch-with-stat --summary master
>  # improved by Timo's patch
>  log --root --cc --patch-with-stat --summary master
> +log --ignore-merges -p --first-parent master

This explicitly says "I do not want to see diff for merges" ...

>  log -p --first-parent master
>  log -m -p --first-parent master
>  log -m -p master
> diff --git a/t/t4013/diff.log_--ignore-merges_-p_--first-parent_master b/t/t4013/diff.log_--ignore-merges_-p_--first-parent_master
> new file mode 100644
> index 0000000000..fa0cdc8a23
> --- /dev/null
> +++ b/t/t4013/diff.log_--ignore-merges_-p_--first-parent_master
> @@ -0,0 +1,78 @@
> +$ git log --ignore-merges -p --first-parent master
> +commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
> +Merge: 9a6d494 c7a2ab9
> +Author: A U Thor <author@example.com>
> +Date:   Mon Jun 26 00:04:00 2006 +0000
> +
> +    Merge branch 'side' into master

... and that is honored here?  Good.


  parent reply	other threads:[~2020-07-28 21:01 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-28 16:36 [PATCH 0/3] making --first-parent imply -m Jeff King
2020-07-28 16:36 ` [PATCH 1/3] log: drop "--cc implies -m" logic Jeff King
2020-07-28 16:38 ` [PATCH 2/3] revision: add "--ignore-merges" option to counteract "-m" Jeff King
2020-07-28 17:52   ` Chris Torek
2020-07-29 18:42     ` Jeff King
2020-07-28 21:01   ` Junio C Hamano [this message]
2020-07-29 18:22     ` Jeff King
2020-07-29 18:30       ` Jeff King
2020-07-29 18:53         ` Junio C Hamano
2020-07-28 16:39 ` [PATCH 3/3] log: enable "-m" automatically with "--first-parent" Jeff King
2020-07-28 16:47 ` [PATCH 0/3] making --first-parent imply -m Jeff King
2020-07-28 16:48 ` Junio C Hamano
2020-07-28 16:53   ` Jeff King
2020-07-28 16:55 ` Taylor Blau
2020-07-29 20:10 ` [PATCH v2 0/7] making log " Jeff King
2020-07-29 20:10   ` [PATCH v2 1/7] log: drop "--cc implies -m" logic Jeff King
2020-07-29 20:10   ` [PATCH v2 2/7] revision: add "--no-diff-merges" option to counteract "-m" Jeff King
2020-07-29 20:10   ` [PATCH v2 3/7] log: enable "-m" automatically with "--first-parent" Jeff King
2020-07-29 20:28     ` Junio C Hamano
2020-07-29 20:11   ` [PATCH v2 4/7] doc/git-log: move "Diff Formatting" from rev-list-options Jeff King
2020-07-29 20:56     ` Junio C Hamano
2020-07-29 21:02       ` Jeff King
2020-07-29 20:11   ` [PATCH v2 5/7] doc/git-log: drop "-r" diff option Jeff King
2020-07-29 20:12   ` [PATCH v2 6/7] doc/git-log: move "-t" into diff-options list Jeff King
2020-07-29 21:10     ` Junio C Hamano
2020-07-29 21:55       ` Jeff King
2020-07-29 20:12   ` [PATCH v2 7/7] doc/git-log: clarify handling of merge commit diffs Jeff King
2020-07-29 21:03   ` [PATCH v2 0/7] making log --first-parent imply -m Chris Torek
2020-07-29 21:41   ` Sergey Organov
2020-07-31 23:08     ` Jeff King
2020-08-02 12:59       ` Sergey Organov
2020-08-02 17:35         ` Junio C Hamano
2020-08-03 15:47           ` Sergey Organov
2020-08-03 16:35             ` Junio C Hamano
2020-08-03 16:41               ` Sergey Organov
2020-08-03 17:21                 ` Junio C Hamano
2020-08-03 20:25                   ` Sergey Organov
2020-08-03 20:58                     ` Jeff King
2020-08-03 21:16                       ` Sergey Organov
2020-08-03 18:08             ` Jeff King
2020-08-03 20:00               ` Sergey Organov
2020-08-03 20:55                 ` Jeff King
2020-08-03 21:18                   ` Sergey Organov
2020-08-04 17:50               ` Sergey Organov
2020-08-04 19:42                 ` Junio C Hamano
2020-08-04 20:00                   ` Jeff King
2020-08-04 20:55                     ` Sergey Organov
2020-08-04 21:22                       ` Jeff King
2020-08-04 21:55                         ` Junio C Hamano
2020-08-04 22:06                           ` Sergey Organov
2020-08-04 22:14                             ` Jeff King
2020-08-04 22:49                               ` Junio C Hamano
2020-08-07  8:26                                 ` Jeff King
2020-08-07  9:25                                   ` Sergey Organov
2020-08-07 17:43                                   ` Junio C Hamano
2020-08-07 17:52                                     ` Sergey Organov
2020-08-07 19:01                                       ` Junio C Hamano
2020-08-07 19:12                                         ` Sergey Organov
2020-08-07 19:20                                           ` Jeff King
2020-08-07 19:28                                             ` Sergey Organov
2020-08-07 19:46                                           ` Junio C Hamano
2020-08-07 20:29                                             ` Sergey Organov
2020-08-07 20:39                                               ` Junio C Hamano
2020-08-07 21:08                                                 ` Sergey Organov
2020-08-07 21:54                                                   ` Junio C Hamano
2020-08-07 23:07                                                     ` Sergey Organov
2020-08-04 22:53                               ` Sergey Organov
2020-08-04 21:21                     ` Sergey Organov
2020-08-04 21:26                       ` Jeff King
2020-08-04 19:58                 ` Jeff King
2020-08-04 20:56                   ` Sergey Organov
2020-08-04 21:25                     ` Jeff King
2020-08-04 21:41                       ` Sergey Organov
2020-08-04 22:07                         ` Jeff King
2020-08-04 22:15                           ` Sergey Organov
2020-08-04 21:27                     ` Junio C Hamano
2020-08-04 21:44                       ` Sergey Organov
2020-08-04 21:58                   ` Sergey Organov
2020-08-04 22:08                     ` Jeff King
2020-08-04 22:26                       ` [PATCH] revision: fix die() message for "--unpacked=" Sergey Organov
2020-08-05  0:03                         ` Junio C Hamano
2020-08-05 15:37                   ` [PATCH v2 0/7] making log --first-parent imply -m Sergey Organov
2020-08-05 16:05                     ` Junio C Hamano
2020-08-05 17:55                       ` Sergey Organov
2020-08-05 19:24                         ` Junio C Hamano
2020-08-05 20:27                           ` Sergey Organov

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=xmqqv9i7cq1k.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /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).