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

Re: [PATCH v2 26/33] diff-merges: let new options enable diff without -p

From
Sergey Organov <sorganov@gmail.com>
Date
Dec 18, 2020, 22:19 UTC
Message-ID
<87ft427o69.fsf@osv.gnss.ru>
In-Reply-To
<CABPp-BF6YyNNYT1i_56=89TjtKEj09bs6TOXJWYKXsC6yAZ0Rw@mail.gmail.com>
Elijah Newren <newren@gmail.com> writes:
Show 82 quoted lines
> On Fri, Dec 18, 2020 at 12:32 PM Sergey Organov <sorganov@gmail.com> wrote:
>>
>> Elijah Newren <newren@gmail.com> writes:
>>
>> > On Fri, Dec 18, 2020 at 6:42 AM Sergey Organov <sorganov@gmail.com> wrote:
>> >>
>> >> Elijah Newren <newren@gmail.com> writes:
>> >>
>> >> > On Wed, Dec 16, 2020 at 10:50 AM Sergey Organov
>> >> > <sorganov@gmail.com> wrote:
>>
>> [...]
>>
>> >> >> diff --git a/log-tree.c b/log-tree.c
>> >> >> index f9385b1dae6f..67060492ca0a 100644
>> >> >> --- a/log-tree.c
>> >> >> +++ b/log-tree.c
>> >> >> @@ -899,15 +899,21 @@ static int log_tree_diff(struct rev_info
>> >> >> *opt, struct commit *commit, struct log
>> >> >>         int showed_log;
>> >> >>         struct commit_list *parents;
>> >> >>         struct object_id *oid;
>> >> >> +       int is_merge;
>> >> >> + int regulars_need_diff = opt->diff ||
>> >> >> opt->diffopt.flags.exit_with_status;
>> >> >
>> >> > So rev_info.diff has changed in meaning from
>> >> > commits-need-to-show-a-diff, to non-merge-commits-need-to-show-a-diff.
>> >> > That's a somewhat subtle semantic shift.  Perhaps it's worth adding a
>> >> > comment to the declaration of rev_info.diff to highlight this?  (And
>> >> > perhaps even rename the flag?)
>> >>
>> >> No, the meaning of rev_info.diff hopefully didn't change. rev_info.diff
>> >> still enables all the commits to pass further once set. It is still
>> >> exactly the same old condition, just assigned to a variable for reuse.
>> >> My aim was to avoid touching existing logic of this function and only
>> >> add a new functionality when opt->merges_need_diff is set.
>> >>
>> >> It looks like I rather choose confusing name for the variable, and it'd
>> >> be more clear if I'd call this, say:
>> >>
>> >>   int need_diff = opt->diff || opt->diffopt.flags.exit_with_status;
>> >>
>> >> ?
>> >>
>> >> What do you think?
>> >
>> > I think need_diff would actually be confusing.  It can be false when
>> > you need diffs (e.g. --diff-merges=cc with no -p, because then you'd
>> > need diffs for merge commits and not for non-merge commits).  I'd
>> > stick with your original local variable name.
>> >
>> > Perhaps opt->diff hasn't changed meaning and I just had a wrong mental
>> > model in my head for what it meant, but even then what seems like its
>> > obvious purpose given its name is mismatched with what it actually
>> > does.  Since you are already changing struct rev_info in this series,
>> > this was more a note that a name change or at least a comment for
>> > opt->diff might be useful.  I mean, you asked a couple times on the
>> > previous series for help trying to understand it, and I could only
>> > offer some flailing guesses and Junio responded with a couple bits of
>> > history.  Clearly, it isn't very clear and this patch reminded me of
>> > that and made me wonder if we're possibly making it a little harder
>> > for others further down the road to figure out.
>>
>> I still don't see why opt->diff is needed in the first place, and
>> second, why opt->diffopt.flags.exit_with_status check is here? Why
>> whoever sets opt->diffopt.flags.exit_with_status doesn't just set
>> opt->diff as well (provided opt->diff is needed in the first place)?
>>
>> From the aforementioned discussion it looks like opt->diff is an
>> optimization (maybe a remnant from the times when diff was a separate
>> script), and that apparently there is some code instance somewhere that
>> actually relies on the fact that clearing opt->diff is enough to disable
>> diff machinery (as followed from my experiment of removing the check
>> altogether and then getting only single seemingly unrelated test
>> failing.)
>>
>> Overall, neither have I any idea how to clarify this, nor do I want to
>> bother in this patch series. It'd be nice though if somebody who really
>> does understand diff machinery in Git does the job.
>
> Doh, I was hoping you had it all figured out.
I tried. I failed. :-)
> If not, then that's a fair enough argument not to attempt to clarify.
This.

Thanks, -- Sergey

Previous: Elijah NewrenNext: Sergey Organov
Message 172 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.