git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Sergey Organov <sorganov@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Jeff King" <peff@peff.net>,
	"Philip Oakley" <philipoakley@iee.email>,
	"Elijah Newren" <newren@gmail.com>,
	"Felipe Contreras" <felipe.contreras@gmail.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Alex Henrie" <alexhenrie24@gmail.com>,
	"Jonathan Nieder" <jrnieder@gmail.com>,
	"huang guanlong" <gl041188@gmail.com>,
	git@vger.kernel.org, "Sergey Organov" <sorganov@gmail.com>
Subject: [PATCH v3 00/10] diff-merges: let -m imply -p
Date: Fri, 21 May 2021 00:46:53 +0300	[thread overview]
Message-ID: <20210520214703.27323-1-sorganov@gmail.com> (raw)
In-Reply-To: <CAMMLpeR-W35Qq6a343ifrxJ=mwBc_VcXZtVrBYDpJTySNBroFw@mail.gmail.com>

Fix long standing inconsistency between -c/--cc that do imply -p, on
one side, and -m that did not imply -p, on the other side.

Only the last patch is the actual functional change. The rest of
patches are additional tests and refactorings that are not expected to
alter existing behaviors.

After these patches

  git log -m

produces diffs without need to provide -p as well, that improves both
consistency and usability. It gets even more useful if one sets
"log.diffMerges" configuration variable to "first-parent" to force -m
produce usual diff with respect to first parent only.

These series, however, don't change behavior when specific diff format
is explicitly provided on the command-line, so that commands like

  git log -m --raw
  git log -m --stat

are not affected, nor do they change commands where specific diff
format is active by default, such as:

  git diff-tree -m

It's also worth to be noticed that exact historical semantics of -m is
still provided by --diff-merges=separate.

Updates in v3:

  * Add test for "diff-tree -m" and mention it in descriptions

  * Fix one more typo in descriptions

Updates in v2:

  * Fix style and typos in descriptions

Updates in v1:

  * Stop parsing distinct diff-index options beforehand, as it could
    cause unexpected behaviors. Implement different strategy to avoid
    clash of diff-index "-m" and diff-merges "-m".

  * Added tests for "git log -m --raw" and "git log -m".

Sergey Organov (10):
  t4013: test that "-m" alone has no effect in "git log"
  t4013: test "git log -m --raw"
  t4013: test "git log -m --stat"
  t4013: test "git diff-tree -m"
  t4013: test "git diff-index -m"
  diff-merges: move specific diff-index "-m" handling to diff-index
  git-svn: stop passing "-m" to "git rev-list"
  stash list: stop passing "-m" to "git log"
  diff-merges: rename "combined_imply_patch" to "merges_imply_patch"
  diff-merges: let "-m" imply "-p"

 Documentation/diff-options.txt    |  8 ++--
 builtin/diff-index.c              |  9 +++++
 builtin/stash.c                   |  2 +-
 diff-merges.c                     | 36 +++++++++--------
 diff-merges.h                     |  2 +
 perl/Git/SVN.pm                   |  2 +-
 revision.h                        |  2 +-
 t/t3903-stash.sh                  |  2 +-
 t/t4013-diff-various.sh           | 24 +++++++++++
 t/t4013/diff.diff-tree_-m_master  | 11 ++++++
 t/t4013/diff.log_-m_--raw_master  | 61 ++++++++++++++++++++++++++++
 t/t4013/diff.log_-m_--stat_master | 66 +++++++++++++++++++++++++++++++
 12 files changed, 200 insertions(+), 25 deletions(-)
 create mode 100644 t/t4013/diff.diff-tree_-m_master
 create mode 100644 t/t4013/diff.log_-m_--raw_master
 create mode 100644 t/t4013/diff.log_-m_--stat_master

Interdiff against v2:
diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
index 15ca3c75bff7..7fadc985cccd 100755
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
@@ -293,6 +293,7 @@ diff-tree --stat initial mode
 diff-tree --summary initial mode
 
 diff-tree master
+diff-tree -m master
 diff-tree -p master
 diff-tree -p -m master
 diff-tree -c master
diff --git a/t/t4013/diff.diff-tree_-m_master b/t/t4013/diff.diff-tree_-m_master
new file mode 100644
index 000000000000..6d0a2207fb30
--- /dev/null
+++ b/t/t4013/diff.diff-tree_-m_master
@@ -0,0 +1,11 @@
+$ git diff-tree -m master
+59d314ad6f356dd08601a4cd5e530381da3e3c64
+:040000 040000 65f5c9dd60ce3b2b3324b618ac7accf8d912c113 0564e026437809817a64fff393079714b6dd4628 M	dir
+:100644 100644 b414108e81e5091fe0974a1858b4d0d22b107f70 10a8a9f3657f91a156b9f0184ed79a20adef9f7f M	file0
+59d314ad6f356dd08601a4cd5e530381da3e3c64
+:040000 040000 f977ed46ae6873c1c30ab878e15a4accedc3618b 0564e026437809817a64fff393079714b6dd4628 M	dir
+:100644 100644 f4615da674c09df322d6ba8d6b21ecfb1b1ba510 10a8a9f3657f91a156b9f0184ed79a20adef9f7f M	file0
+:000000 100644 0000000000000000000000000000000000000000 b1e67221afe8461efd244b487afca22d46b95eb8 A	file1
+:100644 000000 01e79c32a8c99c557f0757da7cb6d65b3414466d 0000000000000000000000000000000000000000 D	file2
+:100644 000000 7289e35bff32727c08dda207511bec138fdb9ea5 0000000000000000000000000000000000000000 D	file3
+$
-- 
2.25.1


  parent reply	other threads:[~2021-05-20 21:47 UTC|newest]

Thread overview: 129+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29  1:44 Why doesn't `git log -m` imply `-p`? Alex Henrie
2021-04-29  3:22 ` Junio C Hamano
2021-04-29 12:38   ` Sergey Organov
2021-04-29 15:25     ` Alex Henrie
2021-04-29 16:35       ` Sergey Organov
2021-04-29 17:24         ` Alex Henrie
2021-04-29 19:07           ` Sergey Organov
2021-05-04 20:09       ` Felipe Contreras
2021-05-04 20:34         ` Sergey Organov
2021-04-29 23:27     ` Junio C Hamano
2021-04-30  4:50       ` Junio C Hamano
2021-04-30 14:00         ` Sergey Organov
2021-05-01  0:41           ` Junio C Hamano
2021-05-03 17:42             ` Sergey Organov
2021-05-04  1:15               ` Junio C Hamano
2021-05-04  9:10                 ` Sergey Organov
2021-05-04 12:38                   ` Junio C Hamano
2021-05-04 14:18                     ` Sergey Organov
2021-05-05  0:20                       ` Junio C Hamano
2021-05-05 13:43                         ` Sergey Organov
2021-05-06  0:27                           ` Junio C Hamano
2021-05-06 12:59                             ` Sergey Organov
2021-05-06 20:29                               ` Junio C Hamano
2021-05-06 20:48                                 ` Sergey Organov
2021-05-07  1:31                                   ` Alex Henrie
2021-05-10 12:11 ` Sergey Organov
2021-05-10 16:56   ` Alex Henrie
2021-05-10 15:34 ` [PATCH 0/6] diff-merges: let -m imply -p Sergey Organov
2021-05-10 15:34   ` [PATCH 1/6] t4013: add test for "git diff-index -m" Sergey Organov
2021-05-10 15:34   ` [PATCH 2/6] diff-merges: move specific diff-index "-m" handling to diff-index Sergey Organov
2021-05-11  4:09     ` Junio C Hamano
2021-05-11  5:23       ` Junio C Hamano
2021-05-11  5:41         ` Junio C Hamano
2021-05-11 13:43       ` Sergey Organov
2021-05-10 15:34   ` [PATCH 3/6] git-svn: stop passing "-m" to "git rev-list" Sergey Organov
2021-05-10 15:34   ` [PATCH 4/6] stash list: stop passing "-m" to "git list" Sergey Organov
2021-05-10 15:34   ` [PATCH 5/6] diff-merges: rename "combined_imply_patch" to "merges_imply_patch" Sergey Organov
2021-05-10 15:34   ` [PATCH 6/6] diff-merges: let -m imply -p Sergey Organov
2021-05-11  4:14     ` Junio C Hamano
2021-05-11  4:56       ` Junio C Hamano
2021-05-11 14:03         ` Sergey Organov
2021-05-11 17:13           ` Alex Henrie
2021-05-11 18:46             ` Sergey Organov
2021-05-11 19:53               ` Alex Henrie
2021-05-11 20:27                 ` Sergey Organov
2021-05-12  1:16                   ` Felipe Contreras
2021-05-11 18:31           ` Elijah Newren
2021-05-11 19:00             ` Sergey Organov
2021-05-11 19:56               ` Elijah Newren
2021-05-11 20:32                 ` Sergey Organov
2021-05-11 20:43             ` Junio C Hamano
2021-05-11 21:38               ` Sergey Organov
2021-05-11 23:40                 ` Junio C Hamano
2021-05-19 21:44             ` Jonathan Nieder
2021-05-20 20:39               ` Sergey Organov
2021-05-21 18:14                 ` Felipe Contreras
2021-05-11 16:29         ` Sergey Organov
2021-05-17 12:57         ` Sergey Organov
2021-05-11 16:30       ` Sergey Organov
2021-05-19 21:48     ` Jonathan Nieder
2021-05-19 22:03       ` Sergey Organov
2021-05-19 23:32       ` Junio C Hamano
2021-05-20 13:14         ` Sergey Organov
2021-05-20 18:50           ` Jonathan Nieder
2021-05-20 19:38             ` Sergey Organov
2021-05-17 15:58 ` [PATCH v1 0/9] " Sergey Organov
2021-05-17 15:58   ` [PATCH v1 1/9] t4013: test that "-m" alone has no effect in "git log" Sergey Organov
2021-05-17 15:58   ` [PATCH v1 2/9] t4013: test "git -m --raw" Sergey Organov
2021-05-18  3:27     ` Bagas Sanjaya
2021-05-18 12:13       ` Sergey Organov
2021-05-17 15:58   ` [PATCH v1 3/9] t4013: test "git -m --stat" Sergey Organov
2021-05-17 15:58   ` [PATCH v1 4/9] t4013: test "git diff-index -m" Sergey Organov
2021-05-17 15:58   ` [PATCH v1 5/9] diff-merges: move specific diff-index "-m" handling to diff-index Sergey Organov
2021-05-17 20:10     ` Junio C Hamano
2021-05-17 20:24       ` Sergey Organov
2021-05-17 20:29     ` Junio C Hamano
2021-05-17 21:00       ` Sergey Organov
2021-05-17 15:58   ` [PATCH v1 6/9] git-svn: stop passing "-m" to "git rev-list" Sergey Organov
2021-05-17 15:58   ` [PATCH v1 7/9] stash list: stop passing "-m" to "git list" Sergey Organov
2021-05-17 15:58   ` [PATCH v1 8/9] diff-merges: rename "combined_imply_patch" to "merges_imply_patch" Sergey Organov
2021-05-17 15:58   ` [PATCH v1 9/9] diff-merges: let "-m" imply "-p" Sergey Organov
2021-05-17 19:51   ` [PATCH v1 0/9] diff-merges: let -m imply -p Junio C Hamano
2021-05-17 20:11     ` Sergey Organov
2021-05-18  3:18   ` Bagas Sanjaya
2021-05-18 12:03     ` Sergey Organov
2021-05-18 12:17     ` Sergey Organov
2021-05-18 14:17   ` Junio C Hamano
2021-05-18 15:52     ` Sergey Organov
2021-05-19 11:45 ` [PATCH v2 " Sergey Organov
2021-05-19 11:45   ` [PATCH v2 1/9] t4013: test that "-m" alone has no effect in "git log" Sergey Organov
2021-05-19 11:45   ` [PATCH v2 2/9] t4013: test "git log -m --raw" Sergey Organov
2021-05-19 11:45   ` [PATCH v2 3/9] t4013: test "git log -m --stat" Sergey Organov
2021-05-19 11:45   ` [PATCH v2 4/9] t4013: test "git diff-index -m" Sergey Organov
2021-05-19 11:45   ` [PATCH v2 5/9] diff-merges: move specific diff-index "-m" handling to diff-index Sergey Organov
2021-05-19 11:45   ` [PATCH v2 6/9] git-svn: stop passing "-m" to "git rev-list" Sergey Organov
2021-05-19 11:45   ` [PATCH v2 7/9] stash list: stop passing "-m" to "git log" Sergey Organov
2021-05-19 11:45   ` [PATCH v2 8/9] diff-merges: rename "combined_imply_patch" to "merges_imply_patch" Sergey Organov
2021-05-19 11:45   ` [PATCH v2 9/9] diff-merges: let "-m" imply "-p" Sergey Organov
2021-05-20 21:46 ` Sergey Organov [this message]
2021-05-20 21:46   ` [PATCH v3 01/10] t4013: test that "-m" alone has no effect in "git log" Sergey Organov
2021-05-20 21:46   ` [PATCH v3 02/10] t4013: test "git log -m --raw" Sergey Organov
2021-05-20 21:46   ` [PATCH v3 03/10] t4013: test "git log -m --stat" Sergey Organov
2021-05-20 21:46   ` [PATCH v3 04/10] t4013: test "git diff-tree -m" Sergey Organov
2021-05-20 21:46   ` [PATCH v3 05/10] t4013: test "git diff-index -m" Sergey Organov
2021-05-20 21:46   ` [PATCH v3 06/10] diff-merges: move specific diff-index "-m" handling to diff-index Sergey Organov
2021-05-20 21:47   ` [PATCH v3 07/10] git-svn: stop passing "-m" to "git rev-list" Sergey Organov
2021-05-20 21:47   ` [PATCH v3 08/10] stash list: stop passing "-m" to "git log" Sergey Organov
2021-05-20 21:47   ` [PATCH v3 09/10] diff-merges: rename "combined_imply_patch" to "merges_imply_patch" Sergey Organov
2021-05-20 21:47   ` [PATCH v3 10/10] diff-merges: let "-m" imply "-p" Sergey Organov
2021-08-05  3:16     ` Jonathan Nieder
2021-08-06  1:45       ` [PATCH] Revert 'diff-merges: let "-m" imply "-p"' Jonathan Nieder
2021-08-06 17:21         ` Junio C Hamano
2021-08-06 17:55           ` Junio C Hamano
2021-08-06 19:57             ` Jonathan Nieder
2021-08-08 17:55               ` Junio C Hamano
2021-08-17  9:13                 ` Sergey Organov
2021-08-17 22:10                   ` Junio C Hamano
2021-08-18  8:56                     ` Sergey Organov
2021-08-19 18:50                       ` Junio C Hamano
2021-08-19 18:51                         ` Junio C Hamano
2021-08-20 10:24                         ` Sergey Organov
2021-08-07  1:55           ` Jonathan Nieder
2021-08-07  6:49             ` Johannes Sixt
2021-08-07 13:51               ` Jonathan Nieder
2021-08-07 17:00                 ` Junio C Hamano
2021-08-07 18:08                   ` Jonathan Nieder
2021-08-08  0:42                     ` Junio C Hamano
2021-08-17  9:17                       ` Sergey Organov
2021-08-16  9:09       ` [PATCH v3 10/10] diff-merges: let "-m" imply "-p" 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=20210520214703.27323-1-sorganov@gmail.com \
    --to=sorganov@gmail.com \
    --cc=alexhenrie24@gmail.com \
    --cc=avarab@gmail.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=gl041188@gmail.com \
    --cc=jrnieder@gmail.com \
    --cc=newren@gmail.com \
    --cc=peff@peff.net \
    --cc=philipoakley@iee.email \
    /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).