git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Why doesn't `git log -m` imply `-p`?

From
Sergey Organov <sorganov@gmail.com>
Date
May 5, 2021, 13:43 UTC
Message-ID
<87tunh9tye.fsf@osv.gnss.ru>
In-Reply-To
<xmqqy2cu58vo.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 10 quoted lines
> Sergey Organov <sorganov@gmail.com> writes:
>
>>> I thought I already said this, but in case I didn't, I think
>>> "--diff-merges=separate" should imply "some kind of diff", and not
>>> necessarily "-p".
>>
>> Is this a more polite way to say "no"? If not, how is it relevant for
>> -m, now being a synonym for --diff-merges=on?
>
> Sorry, I didn't mean to say "no" to anything.

To me "no" is as good answer as any, I just want to reach better understanding.

Show 14 quoted lines
>
> I wrote 'separate' not because I wanted to special case that (and
> treat others like 'on' differently), but simply because I didn't
> want to write "--diff-merges=<anything>" as "off/no" should not
> imply "show some kind of diff".
>
>> As for particular idea, I'll repeat myself as well and say that I'm
>> still against implying anything by any off --diff-merges, and even more
>> against implying something that affects non-merge commits. --diff-merges
>> are not convenience options that need to be short yet give specific
>> functionality, so there is no place for additional implications.
>
> So -m (a shorthand for --diff-merges=on) should not imply any patch
> generation, you mean?

No, I don't mean it. The idea is to let -m be alias for "--diff-merges=on -p", exactly the same way --cc is currently essentially an alias for "--diff-merges=dense-combined -p".

What I meant is that --diff-merges itself should not imply any patch generation for non-merge commits, so --diff-merges=on should not imply -p.

> It matches what we seem to have agreed on to be the purist view in a
> few messages ago. --diff-merges controls which parent(s) comparison is
> made against in a merge, -p/--cc/--raw/--stat etc. control how the
> result of that comparison is expressed.

I see this as your vision, but I don't recall we agree on it. At least that's not how it currently works, as far as I can tell, see command examples I gathered in one of my previous answers.

Show 6 quoted lines
>
> But I also remember that we agreed that the purist view design was
> cumbersome to use, so --diff-merges=<anything but no> implying "show
> some kind of diff" is OK, plus if nobody says "what kind" via the
> command line with -p/--cc/--raw/--stat etc., it is OK to default to
> '-p'.

The latter part of this sentence is something rather new to me, that only appeared in this particular thread of discussion recently, and it does not match my own vision. Neither my vision of the current implementation nor of what we should aim for.

Show 5 quoted lines
>
> One thing I think our unnecessary "disagreement" comes from is that
> among "-m", "--cc", "-c", you say "-m" is the only thing that does
> not imply "-p", but I do not view "--cc" and "-c" as sitting next to
> "-m" at all in the first place.

I was sure you rather did when we've discussed it the last time before this thread. Now your opinion seems to have changed, and I don't see why. In fact I'm very confused. As far as understood, that time you said that -m has been simply overlooked when --cc/-c started to imply -p, and that you actually don't care about -m that much anyway.

I also recall you said that -c (and later --cc) has been invented as alternative to not that useful -m, so -m, -c, and -cc have always been exactly sitting next to each other in my view.

> "-m" is on the "which parent(s) to compare with" side,
This has never been the case, has it? See:
  -m
      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 the first parent
      is shown when --first-parent option is given; in that case, the
      output represents the changes the merge brought into the
      then-current branch.
  -c
      With this option, diff output for a merge commit shows the
      differences from each of the parents to the merge result
      simultaneously instead of showing pairwise diff between a parent
      and the result one at a time. Furthermore, it lists only files
      which were modified from all parents.

First, -m doesn't select the parents at all and shows "full diff", so it rather defines the format. And second, -c is described exactly as being alternative format to -m, as far as I can tell, making -c sit right next to -m again, contrary to what you say above.

BTW, I recall I once suggested something like what you said, let -m match what in means in cherry-pick, to what parent(s) to compare, but it'd need -m to take (optional) argument(s), that has been considered unacceptable, so the idea has been rejected (and for the better.)

Show 5 quoted lines
> while "--cc" and "-c" are "now you decided which parent(s) to compare
> with, how does the result of comparison presented?" side. And because
> "--cc"/"-c" explicitly wants to work on merge commits (because it
> naturally degenerates to simple "--patch" for non merges), THEY are
> made to imply "-m" (i.e. compare with all parents).

That's a reasonable interpretation. The problem is that currently this does not match nor design, nor implementation, nor documentation at all, as far as I can tell.

> So from my point of view, "--cc/-c" implying "-m" has no relevance
> to whether "-m" should or should not imply "some kind of comparison
> should be shown".

What you describe is a different design that may well be a good one, but do we actually want to change what's already there? What for?

Show 5 quoted lines
>
> But because we agreed that we want to bend the purist view for
> usability and included cc/c among the choices diff-merges=<choice>
> can take, I think -m (but not log.diffMerges=no case) should imply
> "we should show some kind of patch".

Once again, this doesn't fit into the current design, as far as I can tell, or I misunderstand the design, that could well be the case as well.

Show 13 quoted lines
>
> Which would mean that unless when log.diffMerges or --diff-merges
> say off/no, and unless there is any option to specify how the result
> of comparison should bepresented on the command line:
>
>  - when log.diffMerges or --diff-merges say cc or c, default to --cc
>    or -c.
>
>  - otherwise,default to --patch.
>
> is what I think should happen.  But the reason I think so is not
> because "--cc" and "-c" gives output without "-m" (i.e. "-p" does
> not imply "-m" and it should not).

I don't like this so far. Considering -m to be just one of different formats to represent merge commits (among -c and --cc), as it has always been, looks more straightforward and useful to me.

Besides, all the recent design I authored assumed -m to be just that, one of multiple ways to specify how to represent merge commits, the other 2 being -c and --cc. If we decide to change this view, it'd likely need significant re-design, and I'm yet to see any actual advantages.

If, on the other hand, it's just me who fundamentally misunderstands the design, then I need to be corrected fast, before I make significant damage.

Thanks,
-- Sergey Organov
Previous: Junio C HamanoNext: Junio C Hamano
Message 20 of 129 in “Why doesn't `git log -m` imply `-p`?”
  1. Alex HenrieApr 29, 2021
  2. Junio C HamanoApr 29, 2021
  3. Sergey OrganovApr 29, 2021
  4. Alex HenrieApr 29, 2021
  5. Sergey OrganovApr 29, 2021
  6. Alex HenrieApr 29, 2021
  7. Sergey OrganovApr 29, 2021
  8. Felipe ContrerasMay 4, 2021
  9. Sergey OrganovMay 4, 2021
  10. Junio C HamanoApr 29, 2021
  11. Junio C HamanoApr 30, 2021
  12. Sergey OrganovApr 30, 2021
  13. Junio C HamanoMay 1, 2021
  14. Sergey OrganovMay 3, 2021
  15. Junio C HamanoMay 4, 2021
  16. Sergey OrganovMay 4, 2021
  17. Junio C HamanoMay 4, 2021
  18. Sergey OrganovMay 4, 2021
  19. Junio C HamanoMay 5, 2021
  20. Sergey OrganovMay 5, 2021
  21. Junio C HamanoMay 6, 2021
  22. Sergey OrganovMay 6, 2021
  23. Junio C HamanoMay 6, 2021
  24. Sergey OrganovMay 6, 2021
  25. Alex HenrieMay 7, 2021
  26. Sergey OrganovMay 10, 2021
  27. Alex HenrieMay 10, 2021
  28. 0/6 diff-merges: let -m imply -pSergey Organov, May 10, 2021
  29. 1/6 t4013: add test for "git diff-index -m"Sergey Organov, May 10, 2021
  30. 2/6 diff-merges: move specific diff-index "-m" handling to diff-indexSergey Organov, May 10, 2021
  31. Junio C HamanoMay 11, 2021
  32. Junio C HamanoMay 11, 2021
  33. Junio C HamanoMay 11, 2021
  34. Sergey OrganovMay 11, 2021
  35. 3/6 git-svn: stop passing "-m" to "git rev-list"Sergey Organov, May 10, 2021
  36. 4/6 stash list: stop passing "-m" to "git list"Sergey Organov, May 10, 2021
  37. 5/6 diff-merges: rename "combined_imply_patch" to "merges_imply_patch"Sergey Organov, May 10, 2021
  38. 6/6 diff-merges: let -m imply -pSergey Organov, May 10, 2021
  39. Junio C HamanoMay 11, 2021
  40. Junio C HamanoMay 11, 2021
  41. Sergey OrganovMay 11, 2021
  42. Alex HenrieMay 11, 2021
  43. Sergey OrganovMay 11, 2021
  44. Alex HenrieMay 11, 2021
  45. Sergey OrganovMay 11, 2021
  46. Felipe ContrerasMay 12, 2021
  47. Elijah NewrenMay 11, 2021
  48. Sergey OrganovMay 11, 2021
  49. Elijah NewrenMay 11, 2021
  50. Sergey OrganovMay 11, 2021
  51. Junio C HamanoMay 11, 2021
  52. Sergey OrganovMay 11, 2021
  53. Junio C HamanoMay 11, 2021
  54. Jonathan NiederMay 19, 2021
  55. Sergey OrganovMay 20, 2021
  56. Felipe ContrerasMay 21, 2021
  57. Sergey OrganovMay 11, 2021
  58. Sergey OrganovMay 17, 2021
  59. Sergey OrganovMay 11, 2021
  60. Jonathan NiederMay 19, 2021
  61. Sergey OrganovMay 19, 2021
  62. Junio C HamanoMay 19, 2021
  63. Sergey OrganovMay 20, 2021
  64. Jonathan NiederMay 20, 2021
  65. Sergey OrganovMay 20, 2021
  66. 0/9 diff-merges: let -m imply -pSergey Organov, May 17, 2021
  67. 1/9 t4013: test that "-m" alone has no effect in "git log"Sergey Organov, May 17, 2021
  68. 4/9 t4013: test "git diff-index -m"Sergey Organov, May 17, 2021
  69. 3/9 t4013: test "git -m --stat"Sergey Organov, May 17, 2021
  70. 2/9 t4013: test "git -m --raw"Sergey Organov, May 17, 2021
  71. Bagas SanjayaMay 18, 2021
  72. Sergey OrganovMay 18, 2021
  73. 6/9 git-svn: stop passing "-m" to "git rev-list"Sergey Organov, May 17, 2021
  74. 8/9 diff-merges: rename "combined_imply_patch" to "merges_imply_patch"Sergey Organov, May 17, 2021
  75. 5/9 diff-merges: move specific diff-index "-m" handling to diff-indexSergey Organov, May 17, 2021
  76. Junio C HamanoMay 17, 2021
  77. Sergey OrganovMay 17, 2021
  78. Junio C HamanoMay 17, 2021
  79. Sergey OrganovMay 17, 2021
  80. 9/9 diff-merges: let "-m" imply "-p"Sergey Organov, May 17, 2021
  81. 7/9 stash list: stop passing "-m" to "git list"Sergey Organov, May 17, 2021
  82. Junio C HamanoMay 17, 2021
  83. Sergey OrganovMay 17, 2021
  84. Bagas SanjayaMay 18, 2021
  85. Sergey OrganovMay 18, 2021
  86. Sergey OrganovMay 18, 2021
  87. Junio C HamanoMay 18, 2021
  88. Sergey OrganovMay 18, 2021
  89. 0/9 diff-merges: let -m imply -pSergey Organov, May 19, 2021
  90. 1/9 t4013: test that "-m" alone has no effect in "git log"Sergey Organov, May 19, 2021
  91. 2/9 t4013: test "git log -m --raw"Sergey Organov, May 19, 2021
  92. 3/9 t4013: test "git log -m --stat"Sergey Organov, May 19, 2021
  93. 4/9 t4013: test "git diff-index -m"Sergey Organov, May 19, 2021
  94. 5/9 diff-merges: move specific diff-index "-m" handling to diff-indexSergey Organov, May 19, 2021
  95. 6/9 git-svn: stop passing "-m" to "git rev-list"Sergey Organov, May 19, 2021
  96. 7/9 stash list: stop passing "-m" to "git log"Sergey Organov, May 19, 2021
  97. 8/9 diff-merges: rename "combined_imply_patch" to "merges_imply_patch"Sergey Organov, May 19, 2021
  98. 9/9 diff-merges: let "-m" imply "-p"Sergey Organov, May 19, 2021
  99. 00/10 diff-merges: let -m imply -pSergey Organov, May 20, 2021
  100. 02/10 t4013: test "git log -m --raw"Sergey Organov, May 20, 2021
  101. 01/10 t4013: test that "-m" alone has no effect in "git log"Sergey Organov, May 20, 2021
  102. 03/10 t4013: test "git log -m --stat"Sergey Organov, May 20, 2021
  103. 04/10 t4013: test "git diff-tree -m"Sergey Organov, May 20, 2021
  104. 05/10 t4013: test "git diff-index -m"Sergey Organov, May 20, 2021
  105. 06/10 diff-merges: move specific diff-index "-m" handling to diff-indexSergey Organov, May 20, 2021
  106. 07/10 git-svn: stop passing "-m" to "git rev-list"Sergey Organov, May 20, 2021
  107. 08/10 stash list: stop passing "-m" to "git log"Sergey Organov, May 20, 2021
  108. 09/10 diff-merges: rename "combined_imply_patch" to "merges_imply_patch"Sergey Organov, May 20, 2021
  109. 10/10 diff-merges: let "-m" imply "-p"Sergey Organov, May 20, 2021
  110. Jonathan NiederAug 5, 2021
  111. Revert 'diff-merges: let "-m" imply "-p"'Jonathan Nieder, Aug 6, 2021
  112. Junio C HamanoAug 6, 2021
  113. Junio C HamanoAug 6, 2021
  114. Jonathan NiederAug 6, 2021
  115. Junio C HamanoAug 8, 2021
  116. Sergey OrganovAug 17, 2021
  117. Junio C HamanoAug 17, 2021
  118. Sergey OrganovAug 18, 2021
  119. Junio C HamanoAug 19, 2021
  120. Junio C HamanoAug 19, 2021
  121. Sergey OrganovAug 20, 2021
  122. Jonathan NiederAug 7, 2021
  123. Johannes SixtAug 7, 2021
  124. Jonathan NiederAug 7, 2021
  125. Junio C HamanoAug 7, 2021
  126. Jonathan NiederAug 7, 2021
  127. Junio C HamanoAug 8, 2021
  128. Sergey OrganovAug 17, 2021
  129. Sergey OrganovAug 16, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.