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

Re: [PATCH 00/26] git-log: implement new --diff-merge options

From
Sergey Organov <sorganov@gmail.com>
Date
Dec 9, 2020, 14:08 UTC
Message-ID
<87v9dbf4xd.fsf@osv.gnss.ru>
In-Reply-To
<xmqqpn3j32ka.fsf@gitster.c.googlers.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 37 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
> A clarification and a correction.
>
>> I suspect that the real reason why "-m" does not imply "-p" was
>> merely a historical implementation detail...
>
> Now I remember better.  The reason was pure oversight.
>
> In the beginning, there was no patch output for merges.  As most
> merges just resolve cleanly, and back then the first-parent chains
> were treated as much much less special than we treat them today,
> "git log -p" showed only patches for single-parent commits and
> everybody was happy.  It could have been a possible alternative
> design to show first-parent diff for a merge instead of showing no
> patch, but because the traversal went to side branches, the changes
> made by the merge to the mainline as a single big patch would have
> been redundant---we would be seeing individual patches from the side
> branch anyway.
>
> Then later we introduced "-m -p"; since the first-parent chain was
> not considered all that special, we treated each parent equally.
> Nobody, not even Linus and I, thought it was useful by itself even
> back then, but we didn't have anything better.
>
> I think it was Paul Mackerras's "gitk" that invented the concept of
> combined merges.  We liked it quite a lot, and added "-c" and "--cc"
> soon after that, to the core git and kept polishing, until "gitk"
> stopped combining the patches with each parent in tcl/tk script and
> instead started telling "git" to show with "--cc".
>
> By the time the change to make "--cc" imply "-p" was introduced, it
> was pretty much given that "-m -p" was useful to anybody, unless you
> are consuming these individual patches in a script or something like
> that.  So simply I didn't even think of making "-m" imply "-p".  It
> would be logical to make it so, but it would not add much practical
> value, I would have to say.

... and then later the "--first-parent implies -m" change has been made, that would't work as expected if -m implied -p in the fist place, as it'd break "git log --first-parent".

Show 13 quoted lines
>
>> If I were to decide now with hindsight, perhaps I'd make "--cc" and
>> "-m" imply "-p" only for merge commits, and the user can explicitly
>> give "--cc -p" and "-m -p" to ask patches for single-parent commits
>> to be shown as well.
>
> After "now with hindsight", I need to add "and without having to
> worry about backward compatibility issues" here.  IOW, the above is
> not my recommendation.  It would be the other way around: "--cc"
> implies "-p" for both merges and non-merges, "-m" implies "-p" for
> both merges and non-merges.  It is acceptable to add a new option
> "--no-patch-for-non-merge" so that the user can ask to see only the
> combined diff for merges and no patches for individual commits.

OK, so, do we decide that -c/--cc must continue to imply -p and thus request diffs for everything?

If so, I can rather change --diff-merges=combined/dense-combined behavior to /not/ imply -p, thus effectively making --cc a synonym for "--diff-merges=dense-combined --patch", that will have zero backward compatibility issues.

Looks like it'd have everything covered. Old options won't change their behavior at all, and the new set of options will behave differently, exactly if designed from scratch, providing new functionality.

Show 6 quoted lines
>
> Both "--no-patch-for-non-merge" option, and making "-m" imply "-p"
> are very low priority from my point of view, though, since our users
> (including me) lived without the former and have been happily using
> "log --cc" for a long time, and we've written off the latter as
> pretty much useless combination unless you are a script.

I think my above suggestion covers all the worries without need for this nasty "--no-patch-for-non-merge" option.

That said, -m is useless, period. It'd likely have some merit in plumbing, but definitely not in porcelain. So I'm inclined to let it rest in peace indeed, dying.

Thanks, -- Sergey

Previous: Junio C HamanoNext: Junio C Hamano
Message 111 of 232 in “git-log: implement new --diff-merge options”
  1. 00/26 git-log: implement new --diff-merge optionsSergey Organov, Nov 1, 2020
  2. 02/26 revision: factor out setup of diff-merge related settingsSergey Organov, Nov 1, 2020
  3. 03/26 revision: factor out initialization of diff-merge related settingsSergey Organov, Nov 1, 2020
  4. 01/26 revision: factor out parsing of diff-merge related optionsSergey Organov, Nov 1, 2020
  5. 05/26 revision: move diff merges functions to its own diff-merges.cSergey Organov, Nov 1, 2020
  6. 04/26 revision: provide implementation for diff merges tweaksSergey Organov, Nov 1, 2020
  7. 06/26 diff-merges: rename all functions to have common prefixSergey Organov, Nov 1, 2020
  8. 08/26 diff-merges: rename diff_merges_default_to_enable() to match semanticsSergey Organov, Nov 1, 2020
  9. 10/26 diff-merges: new function diff_merges_suppress()Sergey Organov, Nov 1, 2020
  10. Elijah NewrenDec 3, 2020
  11. Sergey OrganovDec 3, 2020
  12. Elijah NewrenDec 3, 2020
  13. Sergey OrganovDec 4, 2020
  14. 07/26 diff-merges: move checks for first_parent_only out of the moduleSergey Organov, Nov 1, 2020
  15. 13/26 diff-merges: revise revs->diff flag handlingSergey Organov, Nov 1, 2020
  16. 12/26 diff-merges: introduce revs->first_parent_merges flagSergey Organov, Nov 1, 2020
  17. 11/26 diff-merges: new function diff_merges_set_dense_combined_if_unset()Sergey Organov, Nov 1, 2020
  18. 18/26 diff-merges: group diff-merge flags next to each other inside 'rev_info'Sergey Organov, Nov 1, 2020
  19. 20/26 diff-merges: refactor opt settings into separate functionsSergey Organov, Nov 1, 2020
  20. 21/26 diff-merges: make -m/-c/--cc explicitly mutually exclusiveSergey Organov, Nov 1, 2020
  21. 19/26 diff-merges: get rid of now empty diff_merges_init_revs()Sergey Organov, Nov 1, 2020
  22. Philip OakleyNov 2, 2020
  23. 22/26 diff-merges: implement new values for --diff-mergesSergey Organov, Nov 1, 2020
  24. 09/26 diff-merges: re-arrange functions to match the order they are called inSergey Organov, Nov 1, 2020
  25. 23/26 t4013: add test for --diff-merges=first-parentSergey Organov, Nov 1, 2020
  26. 25/26 doc/diff-generate-patch: mention new --diff-merges optionSergey Organov, Nov 1, 2020
  27. 24/26 doc/git-log: describe new --diff-merges optionsSergey Organov, Nov 1, 2020
  28. 17/26 diff-merges: split 'ignore_merges' fieldSergey Organov, Nov 1, 2020
  29. Philip OakleyNov 2, 2020
  30. Sergey OrganovNov 2, 2020
  31. 16/26 diff-merges: fix -m to properly override -c/--ccSergey Organov, Nov 1, 2020
  32. 26/26 doc/rev-list-options: document --first-parent implies --diff-merges=first-parentSergey Organov, Nov 1, 2020
  33. 15/26 t4013: add tests for -m failing to override -c/--ccSergey Organov, Nov 1, 2020
  34. 14/26 t4013: support test_expect_failure through ':failure' magicSergey Organov, Nov 1, 2020
  35. 00/27 git-log: implement new --diff-merge optionsSergey Organov, Nov 8, 2020
  36. 01/27 revision: factor out parsing of diff-merge related optionsSergey Organov, Nov 8, 2020
  37. Junio C HamanoDec 3, 2020
  38. Sergey OrganovDec 3, 2020
  39. Junio C HamanoDec 4, 2020
  40. Sergey OrganovDec 4, 2020
  41. 02/27 revision: factor out setup of diff-merge related settingsSergey Organov, Nov 8, 2020
  42. Junio C HamanoDec 3, 2020
  43. 03/27 revision: factor out initialization of diff-merge related settingsSergey Organov, Nov 8, 2020
  44. Junio C HamanoDec 3, 2020
  45. Sergey OrganovDec 3, 2020
  46. 05/27 revision: move diff merges functions to its own diff-merges.cSergey Organov, Nov 8, 2020
  47. Junio C HamanoDec 3, 2020
  48. Sergey OrganovDec 3, 2020
  49. 04/27 revision: provide implementation for diff merges tweaksSergey Organov, Nov 8, 2020
  50. Junio C HamanoDec 3, 2020
  51. Junio C HamanoDec 3, 2020
  52. Sergey OrganovDec 3, 2020
  53. Sergey OrganovDec 3, 2020
  54. 07/27 diff-merges: move checks for first_parent_only out of the moduleSergey Organov, Nov 8, 2020
  55. Junio C HamanoDec 3, 2020
  56. Sergey OrganovDec 3, 2020
  57. 09/27 diff-merges: re-arrange functions to match the order they are called inSergey Organov, Nov 8, 2020
  58. Elijah NewrenDec 3, 2020
  59. Sergey OrganovDec 3, 2020
  60. 10/27 diff-merges: new function diff_merges_suppress()Sergey Organov, Nov 8, 2020
  61. 08/27 diff-merges: rename diff_merges_default_to_enable() to match semanticsSergey Organov, Nov 8, 2020
  62. 11/27 diff-merges: new function diff_merges_set_dense_combined_if_unset()Sergey Organov, Nov 8, 2020
  63. 12/27 diff-merges: introduce revs->first_parent_merges flagSergey Organov, Nov 8, 2020
  64. 13/27 diff-merges: revise revs->diff flag handlingSergey Organov, Nov 8, 2020
  65. 19/27 diff-merges: get rid of now empty diff_merges_init_revs()Sergey Organov, Nov 8, 2020
  66. 21/27 diff-merges: make -m/-c/--cc explicitly mutually exclusiveSergey Organov, Nov 8, 2020
  67. 20/27 diff-merges: refactor opt settings into separate functionsSergey Organov, Nov 8, 2020
  68. 23/27 t4013: add test for --diff-merges=first-parentSergey Organov, Nov 8, 2020
  69. 24/27 doc/git-log: describe new --diff-merges optionsSergey Organov, Nov 8, 2020
  70. Elijah NewrenDec 3, 2020
  71. Sergey OrganovDec 3, 2020
  72. Elijah NewrenDec 3, 2020
  73. Sergey OrganovDec 4, 2020
  74. Elijah NewrenDec 4, 2020
  75. Sergey OrganovDec 4, 2020
  76. Elijah NewrenDec 4, 2020
  77. 22/27 diff-merges: implement new values for --diff-mergesSergey Organov, Nov 8, 2020
  78. 26/27 doc/rev-list-options: document --first-parent implies --diff-merges=first-parentSergey Organov, Nov 8, 2020
  79. 27/27 doc/git-show: include --diff-merges descriptionSergey Organov, Nov 8, 2020
  80. Elijah NewrenDec 3, 2020
  81. Sergey OrganovDec 3, 2020
  82. 18/27 diff-merges: group diff-merge flags next to each other inside 'rev_info'Sergey Organov, Nov 8, 2020
  83. 25/27 doc/diff-generate-patch: mention new --diff-merges optionSergey Organov, Nov 8, 2020
  84. 17/27 diff-merges: split 'ignore_merges' fieldSergey Organov, Nov 8, 2020
  85. 14/27 t4013: support test_expect_failure through ':failure' magicSergey Organov, Nov 8, 2020
  86. 06/27 diff-merges: rename all functions to have common prefixSergey Organov, Nov 8, 2020
  87. Junio C HamanoDec 3, 2020
  88. Sergey OrganovDec 3, 2020
  89. 15/27 t4013: add tests for -m failing to override -c/--ccSergey Organov, Nov 8, 2020
  90. 16/27 diff-merges: fix -m to properly override -c/--ccSergey Organov, Nov 8, 2020
  91. Elijah NewrenDec 3, 2020
  92. Sergey OrganovDec 3, 2020
  93. Elijah NewrenDec 3, 2020
  94. Sergey OrganovDec 4, 2020
  95. Elijah NewrenDec 5, 2020
  96. Sergey OrganovDec 5, 2020
  97. Elijah NewrenDec 5, 2020
  98. Sergey OrganovDec 6, 2020
  99. Sergey OrganovDec 8, 2020
  100. Elijah NewrenDec 8, 2020
  101. Sergey OrganovDec 8, 2020
  102. Elijah NewrenDec 8, 2020
  103. Junio C HamanoDec 9, 2020
  104. Elijah NewrenDec 9, 2020
  105. Junio C HamanoDec 9, 2020
  106. Elijah NewrenDec 9, 2020
  107. Junio C HamanoDec 9, 2020
  108. Elijah NewrenDec 9, 2020
  109. Junio C HamanoDec 9, 2020
  110. Junio C HamanoDec 9, 2020
  111. Sergey OrganovDec 9, 2020
  112. Junio C HamanoDec 9, 2020
  113. Sergey OrganovDec 9, 2020
  114. Junio C HamanoDec 10, 2020
  115. Elijah NewrenDec 10, 2020
  116. Sergey OrganovDec 10, 2020
  117. Junio C HamanoDec 10, 2020
  118. Junio C HamanoDec 10, 2020
  119. Sergey OrganovDec 9, 2020
  120. 00/33 git-log: implement new --diff-merge optionsSergey Organov, Dec 16, 2020
  121. 01/33 revision: factor out parsing of diff-merge related optionsSergey Organov, Dec 16, 2020
  122. 02/33 revision: factor out setup of diff-merge related settingsSergey Organov, Dec 16, 2020
  123. 04/33 revision: provide implementation for diff merges tweaksSergey Organov, Dec 16, 2020
  124. 03/33 revision: factor out initialization of diff-merge related settingsSergey Organov, Dec 16, 2020
  125. 05/33 revision: move diff merges functions to its own diff-merges.cSergey Organov, Dec 16, 2020
  126. 06/33 diff-merges: rename all functions to have common prefixSergey Organov, Dec 16, 2020
  127. 08/33 diff-merges: rename diff_merges_default_to_enable() to match semanticsSergey Organov, Dec 16, 2020
  128. 07/33 diff-merges: move checks for first_parent_only out of the moduleSergey Organov, Dec 16, 2020
  129. 10/33 diff-merges: new function diff_merges_suppress()Sergey Organov, Dec 16, 2020
  130. 09/33 diff-merges: re-arrange functions to match the order they are called inSergey Organov, Dec 16, 2020
  131. 11/33 diff-merges: new function diff_merges_set_dense_combined_if_unset()Sergey Organov, Dec 16, 2020
  132. 13/33 diff-merges: revise revs->diff flag handlingSergey Organov, Dec 16, 2020
  133. 12/33 diff-merges: introduce revs->first_parent_merges flagSergey Organov, Dec 16, 2020
  134. 14/33 t4013: support test_expect_failure through ':failure' magicSergey Organov, Dec 16, 2020
  135. 15/33 t4013: add tests for -m failing to override -c/--ccSergey Organov, Dec 16, 2020
  136. 16/33 diff-merges: fix -m to properly override -c/--ccSergey Organov, Dec 16, 2020
  137. 20/33 diff-merges: refactor opt settings into separate functionsSergey Organov, Dec 16, 2020
  138. 19/33 diff-merges: get rid of now empty diff_merges_init_revs()Sergey Organov, Dec 16, 2020
  139. 23/33 diff-merges: fix style of functions definitionsSergey Organov, Dec 16, 2020
  140. Elijah NewrenDec 18, 2020
  141. Sergey OrganovDec 18, 2020
  142. Elijah NewrenDec 18, 2020
  143. Sergey OrganovDec 18, 2020
  144. Elijah NewrenDec 18, 2020
  145. Felipe ContrerasDec 19, 2020
  146. Sergey OrganovDec 19, 2020
  147. Sergey OrganovDec 20, 2020
  148. Felipe ContrerasDec 21, 2020
  149. Junio C HamanoDec 19, 2020
  150. 24/33 diff-merges: handle imply -p on -c/--cc logic for log.cSergey Organov, Dec 16, 2020
  151. Elijah NewrenDec 18, 2020
  152. Sergey OrganovDec 18, 2020
  153. Elijah NewrenDec 18, 2020
  154. Sergey OrganovDec 18, 2020
  155. Elijah NewrenDec 18, 2020
  156. Sergey OrganovDec 18, 2020
  157. 28/33 diff-merges: add '--diff-merges=1' as synonym for 'first-parent'Sergey Organov, Dec 16, 2020
  158. Elijah NewrenDec 18, 2020
  159. Sergey OrganovDec 18, 2020
  160. 27/33 diff-merges: add old mnemonic counterparts to --diff-mergesSergey Organov, Dec 16, 2020
  161. 31/33 doc/rev-list-options: document --first-parent changes merges formatSergey Organov, Dec 16, 2020
  162. 30/33 doc/diff-generate-patch: mention new --diff-merges optionSergey Organov, Dec 16, 2020
  163. 18/33 diff-merges: group diff-merge flags next to each other inside 'rev_info'Sergey Organov, Dec 16, 2020
  164. 17/33 diff-merges: split 'ignore_merges' fieldSergey Organov, Dec 16, 2020
  165. 21/33 diff-merges: make -m/-c/--cc explicitly mutually exclusiveSergey Organov, Dec 16, 2020
  166. 26/33 diff-merges: let new options enable diff without -pSergey Organov, Dec 16, 2020
  167. Elijah NewrenDec 18, 2020
  168. Sergey OrganovDec 18, 2020
  169. Elijah NewrenDec 18, 2020
  170. Sergey OrganovDec 18, 2020
  171. Elijah NewrenDec 18, 2020
  172. Sergey OrganovDec 18, 2020
  173. Sergey OrganovDec 18, 2020
  174. Sergey OrganovDec 19, 2020
  175. Felipe ContrerasDec 19, 2020
  176. Sergey OrganovDec 19, 2020
  177. Sergey OrganovDec 20, 2020
  178. Felipe ContrerasDec 19, 2020
  179. Sergey OrganovDec 19, 2020
  180. 25/33 diff-merges: do not imply -p for new optionsSergey Organov, Dec 16, 2020
  181. 29/33 doc/git-log: describe new --diff-merges optionsSergey Organov, Dec 16, 2020
  182. Elijah NewrenDec 18, 2020
  183. Sergey OrganovDec 18, 2020
  184. Elijah NewrenDec 18, 2020
  185. Sergey OrganovDec 18, 2020
  186. Elijah NewrenDec 18, 2020
  187. 32/33 doc/git-show: include --diff-merges descriptionSergey Organov, Dec 16, 2020
  188. 33/33 t4013: add tests for --diff-merges=first-parentSergey Organov, Dec 16, 2020
  189. 22/33 diff-merges: implement new values for --diff-mergesSergey Organov, Dec 16, 2020
  190. Elijah NewrenDec 18, 2020
  191. Sergey OrganovDec 18, 2020
  192. Elijah NewrenDec 18, 2020
  193. Sergey OrganovDec 18, 2020
  194. Elijah NewrenDec 18, 2020
  195. Sergey OrganovDec 18, 2020
  196. 00/32 git-log: implement new --diff-merge optionsSergey Organov, Dec 21, 2020
  197. 32/32 t4013: add tests for --diff-merges=first-parentSergey Organov, Dec 21, 2020
  198. 09/32 diff-merges: re-arrange functions to match the order they are called inSergey Organov, Dec 21, 2020
  199. 03/32 revision: factor out initialization of diff-merge related settingsSergey Organov, Dec 21, 2020
  200. 11/32 diff-merges: new function diff_merges_set_dense_combined_if_unset()Sergey Organov, Dec 21, 2020
  201. 23/32 diff-merges: implement new values for --diff-mergesSergey Organov, Dec 21, 2020
  202. 22/32 diff-merges: make -m/-c/--cc explicitly mutually exclusiveSergey Organov, Dec 21, 2020
  203. 18/32 diff-merges: split 'ignore_merges' fieldSergey Organov, Dec 21, 2020
  204. 24/32 diff-merges: do not imply -p for new optionsSergey Organov, Dec 21, 2020
  205. 17/32 diff-merges: fix -m to properly override -c/--ccSergey Organov, Dec 21, 2020
  206. 15/32 t4013: support test_expect_failure through ':failure' magicSergey Organov, Dec 21, 2020
  207. 26/32 diff-merges: add old mnemonic counterparts to --diff-mergesSergey Organov, Dec 21, 2020
  208. 19/32 diff-merges: group diff-merge flags next to each other inside 'rev_info'Sergey Organov, Dec 21, 2020
  209. 20/32 diff-merges: get rid of now empty diff_merges_init_revs()Sergey Organov, Dec 21, 2020
  210. 25/32 diff-merges: let new options enable diff without -pSergey Organov, Dec 21, 2020
  211. Felipe ContrerasDec 21, 2020
  212. Sergey OrganovDec 21, 2020
  213. 06/32 diff-merges: rename all functions to have common prefixSergey Organov, Dec 21, 2020
  214. 07/32 diff-merges: move checks for first_parent_only out of the moduleSergey Organov, Dec 21, 2020
  215. 31/32 doc/git-show: include --diff-merges descriptionSergey Organov, Dec 21, 2020
  216. 30/32 doc/rev-list-options: document --first-parent changes merges formatSergey Organov, Dec 21, 2020
  217. 12/32 diff-merges: introduce revs->first_parent_merges flagSergey Organov, Dec 21, 2020
  218. 21/32 diff-merges: refactor opt settings into separate functionsSergey Organov, Dec 21, 2020
  219. 27/32 diff-merges: add '--diff-merges=1' as synonym for 'first-parent'Sergey Organov, Dec 21, 2020
  220. 02/32 revision: factor out setup of diff-merge related settingsSergey Organov, Dec 21, 2020
  221. 05/32 revision: move diff merges functions to its own diff-merges.cSergey Organov, Dec 21, 2020
  222. 08/32 diff-merges: rename diff_merges_default_to_enable() to match semanticsSergey Organov, Dec 21, 2020
  223. 28/32 doc/git-log: describe new --diff-merges optionsSergey Organov, Dec 21, 2020
  224. 29/32 doc/diff-generate-patch: mention new --diff-merges optionSergey Organov, Dec 21, 2020
  225. 01/32 revision: factor out parsing of diff-merge related optionsSergey Organov, Dec 21, 2020
  226. 16/32 t4013: add tests for -m failing to override -c/--ccSergey Organov, Dec 21, 2020
  227. 14/32 diff-merges: revise revs->diff flag handlingSergey Organov, Dec 21, 2020
  228. 04/32 revision: provide implementation for diff merges tweaksSergey Organov, Dec 21, 2020
  229. 10/32 diff-merges: new function diff_merges_suppress()Sergey Organov, Dec 21, 2020
  230. 13/32 diff-merges: handle imply -p on -c/--cc logic for log.cSergey Organov, Dec 21, 2020
  231. Junio C HamanoJan 16, 2021
  232. Sergey OrganovJan 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.