{"thread":{"id":"55579","subject":"Why doesn't `git log -m` imply `-p`?","startedAt":"2021-04-29T01:44:38Z","lastAt":"2021-08-20T10:24:48Z","messageCount":129,"participants":["Alex Henrie","Junio C Hamano","Sergey Organov","Felipe Contreras","Elijah Newren","Bagas Sanjaya","Jonathan Nieder","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"423226","messageId":"CAMMLpeR-W35Qq6a343ifrxJ=mwBc_VcXZtVrBYDpJTySNBroFw@mail.gmail.com","threadId":"55579","inReplyTo":null,"subject":"Why doesn't `git log -m` imply `-p`?","fromName":"Alex Henrie","fromEmail":"alexhenrie24@gmail.com","sentAt":"2021-04-29T01:44:19Z","receivedAt":"2021-04-29T01:44:38Z","isPatch":false,"sender":{"key":"alexhenrie24@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5951993?v=4"},"body":"I read the following in `man git-log` today:\n\n--diff-merges=separate, --diff-merges=m, -m\n    This makes merge commits show the full diff with respect to each of\n    the parents. Separate log entry and diff is generated for each\n    parent.  -m doesn't produce any output without -p.\n\n--diff-merges=combined, --diff-merges=c, -c\n    With this option, diff output for a merge commit shows the\n    differences from each of the parents to the merge result\n    simultaneously instead of showing pairwise diff between a parent and\n    the result one at a time. Furthermore, it lists only files which\n    were modified from all parents.  -c implies -p.\n\n--diff-merges=dense-combined, --diff-merges=cc, --cc\n    With this option the output produced by --diff-merges=combined is\n    further compressed by omitting uninteresting hunks whose contents\n    in the parents have only two variants and the merge result picks one\n    of them without modification.  --cc implies -p.\n\nWhy do -c and -cc imply -p, but -m does not? I tried to use both `git\nlog -c` and `git log -m` today and was confused when the latter didn't\nproduce any output. Could we change this behavior in a future version\nof Git?\n\n-Alex\n"},{"id":"423232","messageId":"xmqqwnsl93m3.fsf@gitster.g","threadId":"55579","inReplyTo":"CAMMLpeR-W35Qq6a343ifrxJ=mwBc_VcXZtVrBYDpJTySNBroFw@mail.gmail.com","subject":"Re: Why doesn't `git log -m` imply `-p`?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-04-29T03:22:28Z","receivedAt":"2021-04-29T03:22:32Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alex Henrie <alexhenrie24@gmail.com> writes:\n\n> Why do -c and -cc imply -p, but -m does not? I tried to use both `git\n> log -c` and `git log -m` today and was confused when the latter didn't\n> produce any output. Could we change this behavior in a future version\n> of Git?\n\n\"[alias] lm = log -m\" can be used when you only want the logs\n\n    $ git lm maint..master\n\nor when you want to also view patches your preference is to see all\nsides of diffs of merges\n\n    $ git lm -p maint..mater\n\nbut depending on who you are that may be of dubious utility.\n\nIt is best to move on, writing it off as historical accident, and\nembrace the new --diff-merges=m option, instead of wasting time on\npondering \"why\", because accidents do not have to have a deep reason\nbehind them ;-)\n"},{"id":"423264","messageId":"87im45clkp.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"xmqqwnsl93m3.fsf@gitster.g","subject":"Re: Why doesn't `git log -m` imply `-p`?","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-04-29T12:38:30Z","receivedAt":"2021-04-29T12:38:36Z","isPatch":false,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Alex Henrie <alexhenrie24@gmail.com> writes:\n>\n>> Why do -c and -cc imply -p, but -m does not? I tried to use both `git\n>> log -c` and `git log -m` today and was confused when the latter didn't\n>> produce any output. Could we change this behavior in a future version\n>> of Git?\n>\n> \"[alias] lm = log -m\" can be used when you only want the logs\n>\n>     $ git lm maint..master\n>\n> or when you want to also view patches your preference is to see all\n> sides of diffs of merges\n>\n>     $ git lm -p maint..mater\n>\n> but depending on who you are that may be of dubious utility.\n>\n> It is best to move on, writing it off as historical accident, and\n> embrace the new --diff-merges=m option, instead of wasting time on\n> pondering \"why\", because accidents do not have to have a deep reason\n> behind them ;-)\n\nYep, but --diff-merges=m doesn't imply -p either, though it does produce\ndiff output without -p, for merge commits only.\n\nAs the final purpose of all this is to have -m as user-friendly short\noption, I'd incline to finally let it imply -p, as --diff-merges=m now\ncovers another side of the coin.\n\nWhat do you think?\n\n-- Sergey Organov\n"},{"id":"423273","messageId":"CAMMLpeS4pkP_xRw_qT3mCTP4hS3iLP9TwdDf8LV+3+an9aJ3Hw@mail.gmail.com","threadId":"55579","inReplyTo":"87im45clkp.fsf@osv.gnss.ru","subject":"Re: Why doesn't `git log -m` imply `-p`?","fromName":"Alex Henrie","fromEmail":"alexhenrie24@gmail.com","sentAt":"2021-04-29T15:25:44Z","receivedAt":"2021-04-29T15:26:01Z","isPatch":false,"sender":{"key":"alexhenrie24@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5951993?v=4"},"body":"On Wed, Apr 28, 2021 at 9:22 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Alex Henrie <alexhenrie24@gmail.com> writes:\n>\n> > Why do -c and -cc imply -p, but -m does not? I tried to use both `git\n> > log -c` and `git log -m` today and was confused when the latter didn't\n> > produce any output. Could we change this behavior in a future version\n> > of Git?\n>\n> \"[alias] lm = log -m\" can be used when you only want the logs\n>\n>     $ git lm maint..master\n>\n> or when you want to also view patches your preference is to see all\n> sides of diffs of merges\n>\n>     $ git lm -p maint..mater\n>\n> but depending on who you are that may be of dubious utility.\n>\n> It is best to move on, writing it off as historical accident, and\n> embrace the new --diff-merges=m option, instead of wasting time on\n> pondering \"why\", because accidents do not have to have a deep reason\n> behind them ;-)\n\nIf the behavior is an idiosyncratic accident of dubious utility, let's\nreplace it with something that makes sense and is useful :-) If we\nmake -m imply -p then no alias is necessary, `git log` would display\nthe log without diffs and `git log -m` would display the log with all\nthe diffs.\n\nOn Thu, Apr 29, 2021 at 6:38 AM Sergey Organov <sorganov@gmail.com> wrote:\n>\n> As the final purpose of all this is to have -m as user-friendly short\n> option, I'd incline to finally let it imply -p, as --diff-merges=m now\n> covers another side of the coin.\n>\n> What do you think?\n\nI am 100% in favor of that proposal, and I can work on the code this weekend.\n\n-Alex\n"},{"id":"423284","messageId":"87eeet9hhl.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"CAMMLpeS4pkP_xRw_qT3mCTP4hS3iLP9TwdDf8LV+3+an9aJ3Hw@mail.gmail.com","subject":"Re: Why doesn't `git log -m` imply `-p`?","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-04-29T16:35:02Z","receivedAt":"2021-04-29T16:35:08Z","isPatch":false,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Alex Henrie <alexhenrie24@gmail.com> writes:\n\n> On Wed, Apr 28, 2021 at 9:22 PM Junio C Hamano <gitster@pobox.com> wrote:\n>>\n>> Alex Henrie <alexhenrie24@gmail.com> writes:\n>>\n>> > Why do -c and -cc imply -p, but -m does not? I tried to use both `git\n>> > log -c` and `git log -m` today and was confused when the latter didn't\n>> > produce any output. Could we change this behavior in a future version\n>> > of Git?\n>>\n>> \"[alias] lm = log -m\" can be used when you only want the logs\n>>\n>>     $ git lm maint..master\n>>\n>> or when you want to also view patches your preference is to see all\n>> sides of diffs of merges\n>>\n>>     $ git lm -p maint..mater\n>>\n>> but depending on who you are that may be of dubious utility.\n>>\n>> It is best to move on, writing it off as historical accident, and\n>> embrace the new --diff-merges=m option, instead of wasting time on\n>> pondering \"why\", because accidents do not have to have a deep reason\n>> behind them ;-)\n>\n> If the behavior is an idiosyncratic accident of dubious utility, let's\n> replace it with something that makes sense and is useful :-) If we\n> make -m imply -p then no alias is necessary, `git log` would display\n> the log without diffs and `git log -m` would display the log with all\n> the diffs.\n>\n> On Thu, Apr 29, 2021 at 6:38 AM Sergey Organov <sorganov@gmail.com> wrote:\n>>\n>> As the final purpose of all this is to have -m as user-friendly short\n>> option, I'd incline to finally let it imply -p, as --diff-merges=m now\n>> covers another side of the coin.\n>>\n>> What do you think?\n>\n> I am 100% in favor of that proposal, and I can work on the code this\n> weekend.\n\nNo need to bother. If we agree, I'll send a patch atop of my recent\nchanges that make -m format configurable.\n\nAlternatively, we can add a configuration option, or let -m imply -p\nonly when -m format is explicitly configured by the user.\n\n-- Sergey Organov\n"},{"id":"423286","messageId":"CAMMLpeQE5zY2KAu7rA=kGBGh5xeNUK8CRMf4FxKd-BoMjZzLJA@mail.gmail.com","threadId":"55579","inReplyTo":"87eeet9hhl.fsf@osv.gnss.ru","subject":"Re: Why doesn't `git log -m` imply `-p`?","fromName":"Alex Henrie","fromEmail":"alexhenrie24@gmail.com","sentAt":"2021-04-29T17:24:22Z","receivedAt":"2021-04-29T17:24:38Z","isPatch":false,"sender":{"key":"alexhenrie24@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5951993?v=4"},"body":"On Thu, Apr 29, 2021 at 10:35 AM Sergey Organov <sorganov@gmail.com> wrote:\n>\n> Alex Henrie <alexhenrie24@gmail.com> writes:\n>\n> > On Thu, Apr 29, 2021 at 6:38 AM Sergey Organov <sorganov@gmail.com> wrote:\n> >>\n> >> As the final purpose of all this is to have -m as user-friendly short\n> >> option, I'd incline to finally let it imply -p, as --diff-merges=m now\n> >> covers another side of the coin.\n> >>\n> >> What do you think?\n> >\n> > I am 100% in favor of that proposal, and I can work on the code this\n> > weekend.\n>\n> No need to bother. If we agree, I'll send a patch atop of my recent\n> changes that make -m format configurable.\n\nGreat, thank you!\n\n> Alternatively, we can add a configuration option, or let -m imply -p\n> only when -m format is explicitly configured by the user.\n\nSince the goal here is simple, easily understandable, and\nuser-friendly behavior, I think -m should imply -p all the time, or at\nleast imply -p by default. The less I have to explain to new Git\nusers, the better.\n\n-Alex\n"},{"id":"423292","messageId":"87a6pgaozw.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"CAMMLpeQE5zY2KAu7rA=kGBGh5xeNUK8CRMf4FxKd-BoMjZzLJA@mail.gmail.com","subject":"Re: Why doesn't `git log -m` imply `-p`?","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-04-29T19:07:31Z","receivedAt":"2021-04-29T19:23:47Z","isPatch":false,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Alex Henrie <alexhenrie24@gmail.com> writes:\n\n> On Thu, Apr 29, 2021 at 10:35 AM Sergey Organov <sorganov@gmail.com> wrote:\n>>\n>> Alex Henrie <alexhenrie24@gmail.com> writes:\n>>\n>> > On Thu, Apr 29, 2021 at 6:38 AM Sergey Organov <sorganov@gmail.com> wrote:\n>> >>\n>> >> As the final purpose of all this is to have -m as user-friendly short\n>> >> option, I'd incline to finally let it imply -p, as --diff-merges=m now\n>> >> covers another side of the coin.\n>> >>\n>> >> What do you think?\n>> >\n>> > I am 100% in favor of that proposal, and I can work on the code this\n>> > weekend.\n>>\n>> No need to bother. If we agree, I'll send a patch atop of my recent\n>> changes that make -m format configurable.\n>\n> Great, thank you!\n>\n>> Alternatively, we can add a configuration option, or let -m imply -p\n>> only when -m format is explicitly configured by the user.\n>\n> Since the goal here is simple, easily understandable, and\n> user-friendly behavior, I think -m should imply -p all the time, or at\n> least imply -p by default. The less I have to explain to new Git\n> users, the better.\n\nYep, but OTOH -m never implied -p before, and it'll take time for the\nchange get to release and then to reach distributions... So the actual\nquestion here is if anybody cares enough about backward compatibility in\nthis particular case to complicate transition?\n\n-- Sergey Organov\n"},{"id":"423302","messageId":"xmqqmttgfz8e.fsf@gitster.g","threadId":"55579","inReplyTo":"87im45clkp.fsf@osv.gnss.ru","subject":"Re: Why doesn't `git log -m` imply `-p`?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-04-29T23:27:29Z","receivedAt":"2021-04-29T23:27:36Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sergey Organov <sorganov@gmail.com> writes:\n\n> Yep, but --diff-merges=m doesn't imply -p either, though it does produce\n> diff output without -p, for merge commits only.\n\nI misspoke without thinking it through.  It is absolutely wrong for\nthe \"-m\" option (or \"--diff-merges=m\" for that matter) to imply\n\"-p\".\n\n$ git log --stat --summary\n\nwould show \"diff\", but the kind of \"diff\" requested is not a textual\npatch but just diffstat and the summary of new/removed files, and\nthe \"diff\" is shown only for single-parent commits, and it omits\n\"diff\" for merge commits.  Adding \"-m\" to this command line is *not*\na request to show the textual patch.  It is to ask \"diff\" to be\nshown pairwise with each of the parent.\n\n$ git log -m --stat --summary\n\nIt is probably OK to special case \"-m\" given alone without any other\noption [*1*] that specifies what kind of \"diff\" is requested and\nmake it imply \"-p\".  But unconditionally flipping \"-p\" on only\nbecause you saw \"-m\" (or \"--diff-merges=m\" for that matter) is just\nwrong.\n\n\n[Footnote]\n\n*1* They are not limited to \"-p\", \"--stat\" and \"--summary\", but\nyou'd need to also pay attention to \"--raw\", \"--name-only\", etc.)\n"},{"id":"423319","messageId":"xmqqy2d0cr5l.fsf@gitster.g","threadId":"55579","inReplyTo":"xmqqmttgfz8e.fsf@gitster.g","subject":"Re: Why doesn't `git log -m` imply `-p`?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-04-30T04:50:14Z","receivedAt":"2021-04-30T04:50:20Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Sergey Organov <sorganov@gmail.com> writes:\n>\n>> Yep, but --diff-merges=m doesn't imply -p either, though it does produce\n>> diff output without -p, for merge commits only.\n>\n> I misspoke without thinking it through.  It is absolutely wrong for\n> the \"-m\" option (or \"--diff-merges=m\" for that matter) to imply\n> \"-p\".\n>\n> $ git log --stat --summary\n>\n> would show \"diff\", but the kind of \"diff\" requested is not a textual\n> patch but just diffstat and the summary of new/removed files, and\n> the \"diff\" is shown only for single-parent commits, and it omits\n> \"diff\" for merge commits.  Adding \"-m\" to this command line is *not*\n> a request to show the textual patch.  It is to ask \"diff\" to be\n> shown pairwise with each of the parent.\n>\n> $ git log -m --stat --summary\n>\n> It is probably OK to special case \"-m\" given alone without any other\n> option [*1*] that specifies what kind of \"diff\" is requested and\n> make it imply \"-p\".  But unconditionally flipping \"-p\" on only\n> because you saw \"-m\" (or \"--diff-merges=m\" for that matter) is just\n> wrong.\n\nLuckily,\n\n    $ git log [--stat] --diff-merges=first-parent master..seen\n\nseems to do almost the right thing, with respect to the \"It is\nprobably OK to special case\" I gave above.\n\nIt only \"enables diff\" for merge commits, which does not quite feel\nright and we may want to do the same \"enable diff\" for single parent\ncommits, but the good part is that it does not blindly imply \"-p\".\n\nIt seems to do the \"enable diff\" the right way by honoring other\ncommand line options that specify the format of the diff, so with\n\"--stat\" included in the sample command line above, we get the\ndiffstat for single parent commits (because we ask for \"--stat\" from\nthe command line to show it throughout the history) and also for\nmerge commits (because --diff-merges=first-parent does *not* blindly\nturn the textual patch '-p' on).\n\n> [Footnote]\n>\n> *1* They are not limited to \"-p\", \"--stat\" and \"--summary\", but\n> you'd need to also pay attention to \"--raw\", \"--name-only\", etc.)\n\nI've merged the so/log-diff-merge topic to 'master', with this\n(possibly) known breakage that it does not do anything for single\nparent commits.  We may want to fix this last mile before the\nrelease that is scheduled to happen around early June.\n\nNote that I didn't check if you are doing the right thing for all\nformats, or if I was lucky and --stat was only one of them you paid\nattention to, when you needed to notice all others that you don't.\nBut if you used the same logic that allows \"git show\" to by default\ngive \"-p/--cc\" output while \"git show --stat\" to squelch the patch\noutput, you should be OK.\n\nThanks.\n"},{"id":"423338","messageId":"87v9837tzm.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"xmqqy2d0cr5l.fsf@gitster.g","subject":"Re: Why doesn't `git log -m` imply `-p`?","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-04-30T14:00:13Z","receivedAt":"2021-04-30T14:00:19Z","isPatch":false,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> Sergey Organov <sorganov@gmail.com> writes:\n>>\n>>> Yep, but --diff-merges=m doesn't imply -p either, though it does produce\n>>> diff output without -p, for merge commits only.\n>>\n>> I misspoke without thinking it through.  It is absolutely wrong for\n>> the \"-m\" option (or \"--diff-merges=m\" for that matter) to imply\n>> \"-p\".\n>>\n>> $ git log --stat --summary\n>>\n>> would show \"diff\", but the kind of \"diff\" requested is not a textual\n>> patch but just diffstat and the summary of new/removed files, and\n>> the \"diff\" is shown only for single-parent commits, and it omits\n>> \"diff\" for merge commits.  Adding \"-m\" to this command line is *not*\n>> a request to show the textual patch.  It is to ask \"diff\" to be\n>> shown pairwise with each of the parent.\n>>\n>> $ git log -m --stat --summary\n>>\n>> It is probably OK to special case \"-m\" given alone without any other\n>> option [*1*] that specifies what kind of \"diff\" is requested and\n>> make it imply \"-p\".  But unconditionally flipping \"-p\" on only\n>> because you saw \"-m\" (or \"--diff-merges=m\" for that matter) is just\n>> wrong.\n>\n> Luckily,\n>\n>     $ git log [--stat] --diff-merges=first-parent master..seen\n>\n> seems to do almost the right thing, with respect to the \"It is\n> probably OK to special case\" I gave above.\n\nI believe any special-casing is to be a last resort, and definitely is\nnot the right thing to do in this particular case.\n\n>\n> It only \"enables diff\" for merge commits, which does not quite feel\n> right and we may want to do the same \"enable diff\" for single parent\n> commits, but the good part is that it does not blindly imply \"-p\".\n>\n> It seems to do the \"enable diff\" the right way by honoring other\n> command line options that specify the format of the diff, so with\n> \"--stat\" included in the sample command line above, we get the\n> diffstat for single parent commits (because we ask for \"--stat\" from\n> the command line to show it throughout the history) and also for\n> merge commits (because --diff-merges=first-parent does *not* blindly\n> turn the textual patch '-p' on).\n\nGood to know! I must admit I did nothing special in this regard, just\npaid attention to avoid breaking any existing logic, at least knowingly.\n\n>\n>> [Footnote]\n>>\n>> *1* They are not limited to \"-p\", \"--stat\" and \"--summary\", but\n>> you'd need to also pay attention to \"--raw\", \"--name-only\", etc.)\n>\n> I've merged the so/log-diff-merge topic to 'master', with this\n> (possibly) known breakage that it does not do anything for single\n> parent commits.  We may want to fix this last mile before the\n> release that is scheduled to happen around early June.\n\nI have no idea what the breakage is or could be. Do we have any relevant\ntests in place already, or can somebody suggest some to check for\npossible breakage?\n\n> Note that I didn't check if you are doing the right thing for all\n> formats, or if I was lucky and --stat was only one of them you paid\n> attention to, when you needed to notice all others that you don't.\n> But if you used the same logic that allows \"git show\" to by default\n> give \"-p/--cc\" output while \"git show --stat\" to squelch the patch\n> output, you should be OK.\n\nIn fact I didn't do anything specific to --stat, nor to other options\nyou mention (--raw, --name-only, --summary), so I'd expect all of them\nstill work the same way they were before my --diff-merges series. Need\nto be checked anyway, sure thing, and that gets us back to the questions\nof tests. I personally don't know what expectations are, so it's hard\nfor me to implement needed tests.\n\nThanks,\n-- Sergey Organov\n\n"},{"id":"423393","messageId":"xmqqzgxfb80r.fsf@gitster.g","threadId":"55579","inReplyTo":"87v9837tzm.fsf@osv.gnss.ru","subject":"Re: Why doesn't `git log -m` imply `-p`?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-05-01T00:41:08Z","receivedAt":"2021-05-01T00:41:14Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sergey Organov <sorganov@gmail.com> writes:\n\n>> Luckily,\n>>\n>>     $ git log [--stat] --diff-merges=first-parent master..seen\n>>\n>> seems to do almost the right thing, with respect to the \"It is\n>> probably OK to special case\" I gave above.\n>\n> I believe any special-casing is to be a last resort, and definitely is\n> not the right thing to do in this particular case.\n\nI do not know if I get it.  \"log --diff-merges=<kind>\" giving the\nsame output as \"log\" (i.e. no trace of any kind of diff) would be\npuzzling to users, and to help them, it is OK to say that\n\n * \"--diff-merges=<kind>\" enables some kind of diff output\n   automatially (for both merges and non-merges), and\n\n * when there is no user preference given as to what kind of diff is\n   desired, we default to \"-p\".\n\nAs it is natural to expect \"--stat --diff-merges=<kind> would give\nonly the diffstat without patch, we end up \"special casing\"\n\"--diff-merges=<kind>\" that is given alone, without specifying what\nkind of diff is desired, and behave as if \"-p\" was given.  So I\nwould have expected you to call this kind of \"special casing\" a good\nthing.\n\n>> It only \"enables diff\" for merge commits, which does not quite feel\n>> right and we may want to do the same \"enable diff\" for single parent\n>> commits, but the good part is that it does not blindly imply \"-p\".\n>>\n>> It seems to do the \"enable diff\" the right way by honoring other\n>> command line options that specify the format of the diff, so with\n>> \"--stat\" included in the sample command line above, we get the\n>> diffstat for single parent commits (because we ask for \"--stat\" from\n>> the command line to show it throughout the history) and also for\n>> merge commits (because --diff-merges=first-parent does *not* blindly\n>> turn the textual patch '-p' on).\n>\n> Good to know! I must admit I did nothing special in this regard, just\n> paid attention to avoid breaking any existing logic, at least knowingly.\n>\n>>\n>>> [Footnote]\n>>>\n>>> *1* They are not limited to \"-p\", \"--stat\" and \"--summary\", but\n>>> you'd need to also pay attention to \"--raw\", \"--name-only\", etc.)\n>>\n>> I've merged the so/log-diff-merge topic to 'master', with this\n>> (possibly) known breakage that it does not do anything for single\n>> parent commits.  We may want to fix this last mile before the\n>> release that is scheduled to happen around early June.\n>\n> I have no idea what the breakage is or could be.\n\nBecause I view\n\n * \"--diff-merges\" is a way to specify how merge commits are passed\n   to the diff machinery (e.g. pass nothing to the diff machinery,\n   compare only with the first parent, etc.), and\n\n * \"--patch\", \"--stat\", \"--cc\" etc are to specify if we use the diff\n   machinery and what kind of output is desired.\n\nbut we are conflating the \"enable diff\" feature into the former to\nmatch end-user expectation, if \"--diff-merges\" without any of the\n\"--patch\", \"--stat\", etc. enables the \"--patch\" output for merge\ncommits, it would be confusing if we do not give the same \"--patch\"\noutput for single-parent commits, too.\n\nBut the current code gives \"--patch\" output only for merge commits,\ndoesn't it?  E.g.\n\n    $ git log --diff-merges=first-parent master..next\n\nwould give patches only for merge commits, but\n\n    $ git log --stat --diff-merges=first-parent master..next\n\nwould give us diffstat for all commits, including merges (against\ntheir first parents).\n"},{"id":"423513","messageId":"87czu7u32v.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"xmqqzgxfb80r.fsf@gitster.g","subject":"Re: Why doesn't `git log -m` imply `-p`?","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-03T17:42:00Z","receivedAt":"2021-05-03T17:42:06Z","isPatch":false,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Sergey Organov <sorganov@gmail.com> writes:\n>\n>>> Luckily,\n>>>\n>>>     $ git log [--stat] --diff-merges=first-parent master..seen\n>>>\n>>> seems to do almost the right thing, with respect to the \"It is\n>>> probably OK to special case\" I gave above.\n>>\n>> I believe any special-casing is to be a last resort, and definitely is\n>> not the right thing to do in this particular case.\n>\n> I do not know if I get it.  \"log --diff-merges=<kind>\" giving the\n> same output as \"log\" (i.e. no trace of any kind of diff) would be\n> puzzling to users, and to help them, it is OK to say that\n\nI thought (apparently wrong) that the idea was to special-case \"-m\", and\nonly \"-m\". I.e., if -m is alone, let it imply -p, otherwise not. That\nwas the thing I was in opposition to.\n\n>\n>  * \"--diff-merges=<kind>\" enables some kind of diff output\n>    automatially (for both merges and non-merges), and\n\nNo, I don't think this is OK, sorry. I fail to see why --diff-merges\nshould affect non-merge commits. I believe it shouldn't.\n\n>\n>  * when there is no user preference given as to what kind of diff is\n>    desired, we default to \"-p\".\n\nWhat kind of diff \"-p\" gives for merge commits, exactly? As far as I can\ntell, it's \"none\".\n\n>\n> As it is natural to expect \"--stat --diff-merges=<kind> would give\n> only the diffstat without patch, we end up \"special casing\"\n> \"--diff-merges=<kind>\" that is given alone, without specifying what\n> kind of diff is desired, and behave as if \"-p\" was given.\n\nIn general, I hate dependencies between options. The only thing that is\nactually needed for convenience is an ability for an option to imply\nother options. What's currently there is already too complex for my\npersonal taste, and I'd hate to add even more complexity on top.\n\nRight now --diff-merges is pretty simple and straightforward: it\nspecifies diff output for merge commits, and only for merge commits. If\nany other option disables diff machinery altogether, it will disable\ndiff for merges as well.\n\nOTOH, we have --patch that deals with non-merge commits.\n\nPersonally, I don't like the resulting interface very much, but it's\nhistorical, and can't be easily changed.\n\n> So I would have expected you to call this kind of \"special casing\" a\n> good thing.\n\nWell, even though I was originally commenting about -m only, I must\nadmit I'm in general against any \"special casing\", unless there is\nextremely strong reason to consider it.\n\n>\n>>> It only \"enables diff\" for merge commits, which does not quite feel\n>>> right and we may want to do the same \"enable diff\" for single parent\n>>> commits,\n\nI fail to see why --diff-merges should ever affect non-merge commits.\nIt'd be at least counter-intuitive, not to say directly opposite to the\noriginal design goal.\n\n>>> but the good part is that it does not blindly imply \"-p\".\n\nYep.\n\n>>>\n>>> It seems to do the \"enable diff\" the right way by honoring other\n>>> command line options that specify the format of the diff, so with\n>>> \"--stat\" included in the sample command line above, we get the\n>>> diffstat for single parent commits (because we ask for \"--stat\" from\n>>> the command line to show it throughout the history) and also for\n>>> merge commits (because --diff-merges=first-parent does *not* blindly\n>>> turn the textual patch '-p' on).\n>>\n>> Good to know! I must admit I did nothing special in this regard, just\n>> paid attention to avoid breaking any existing logic, at least knowingly.\n>>\n>>>\n>>>> [Footnote]\n>>>>\n>>>> *1* They are not limited to \"-p\", \"--stat\" and \"--summary\", but\n>>>> you'd need to also pay attention to \"--raw\", \"--name-only\", etc.)\n>>>\n>>> I've merged the so/log-diff-merge topic to 'master', with this\n>>> (possibly) known breakage that it does not do anything for single\n>>> parent commits.  We may want to fix this last mile before the\n>>> release that is scheduled to happen around early June.\n>>\n>> I have no idea what the breakage is or could be.\n>\n> Because I view\n>\n>  * \"--diff-merges\" is a way to specify how merge commits are passed\n>    to the diff machinery (e.g. pass nothing to the diff machinery,\n>    compare only with the first parent, etc.), and\n\nAs I see it, it only defines the way they are to be represented by the\ndiff machinery once passed to it, though it obviously depends on where\nwe put the margin of \"diff machinery\".\n\n>\n>  * \"--patch\", \"--stat\", \"--cc\" etc are to specify if we use the diff\n>    machinery and what kind of output is desired.\n\nSo, in your view, --cc output is not a product of \"diff machinery\"?\n\n> but we are conflating the \"enable diff\" feature into the former to\n> match end-user expectation, if \"--diff-merges\" without any of the\n> \"--patch\", \"--stat\", etc. enables the \"--patch\" output for merge\n> commits, it would be confusing if we do not give the same \"--patch\"\n> output for single-parent commits, too.\n>\n> But the current code gives \"--patch\" output only for merge commits,\n> doesn't it?  E.g.\n\nNo, as far as I understand it, \"--patch\" output is for non-merge commits\nonly. One can't sensibly use patch utility to pick merge commits anyway,\nso \"--patch\" makes no sense for merge commits and doesn't affect them,\nat least for now.\n\n>\n>     $ git log --diff-merges=first-parent master..next\n>\n> would give patches only for merge commits, but\n\nIt will give the output similar to what \"--patch\" would give for\nnon-merge commits, yes, but in fact it's not \"--patch\" output, I think,\nso I doubt it should be called \"give patches\". It's just happens to be\nthe same diff format.\n\n>\n>     $ git log --stat --diff-merges=first-parent master..next\n>\n> would give us diffstat for all commits, including merges (against\n> their first parents).\n\nYep, but I think it just matches the old behavior that has been always\nthere, see below.\n\nI'd start from the behavior even before my patches. Let's see:\n\n  git log -n1 -p <merge_commit>\n  git log -n1 --stat <merge_commit>\n  git log -n1 --stat -p <merge_commit>\n\nall give no diff no stat. No surprise for diff, though not that sure about\nstat, but it could be argued either way.\n\n  git log -n1 -c <merge_commit>\n\ndoes give diff output in particular format, nice!\n\n  git log -n1 --stat -c <merge_commit>\n\ngives stat output, but no diff! That's not what I expected at all.\nEffectively, this looks like --stat *disables* -c/-cc output?\n\nFinally, the way to get both diff and stat for merge commits is... who'd\nguess, adding -p to the command, and that provided -p is already\nsupposedly implied by -c (!):\n\n  git log -n1 --stat -c -p <merge_commit>\n\nIn particular, this means that contrary to documentation, -c does not\nimply -p in the common sense of the word \"imply\", and interdependencies\nbetween all these options are already too complex to easily grok for a\nhuman being.\n\nAs for newer --diff-merges, they behave similar to -c here that seems\nreasonable. Overall, I still don't see any breakage introduced by\n--diff-merges, and it seems to behave according to its documentation, so\nshouldn't break any expectations either.\n\nGetting back to the original question of letting -m imply -p, it\nshouldn't behave differently than -c/-cc, that do imply -p, so I don't\nsee any significant problem that'd be added to the current status.\n\nRight now the following two give exactly the same output:\n\n  git log -n1 --stat -c <merge_commit>\n  git log -n1 --stat -m <merge_commit>\n\nthe stat to the first parent, and it shouldn't change if we let -m \"imply\"\n-p the same way -c \"implies\" -p, whatever it actually means.\n\nBest Regards,\n\n-- Sergey Organov\n"},{"id":"423544","messageId":"xmqqtunj70zy.fsf@gitster.g","threadId":"55579","inReplyTo":"87czu7u32v.fsf@osv.gnss.ru","subject":"Re: Why doesn't `git log -m` imply `-p`?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-05-04T01:15:29Z","receivedAt":"2021-05-04T01:15:37Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sergey Organov <sorganov@gmail.com> writes:\n\n>>  * \"--patch\", \"--stat\", \"--cc\" etc are to specify if we use the diff\n>>    machinery and what kind of output is desired.\n>\n> So, in your view, --cc output is not a product of \"diff machinery\"?\n\nI view --cc and -c as an enhanced form of --patch that is also\ncapable of handling multi-way diffs, in other words, choosing --cc\nshould be to say \"give me textual patch for all commits; when there\nare multiple parents, condense multi-way patches\".\n\nSo, yes, strictly speaking, --diff-merges=cc was probably a mistake,\nand in the ideal world, --diff-merges should have taken only one of\n\"compare with nothing\" (optional), \"compare with first-parent\", and\n\"compare with all parents\".  The last choice could output diffs in\nvarious forms, like traditional -m (i.e. patch output separately for\neach parent), --cc, -c, etc.  \"compare with nothing\" is optional\nbecause we could also control on the \"output format\" side to say\n\"produce no output\" (ala \"git show -s\").\n\nBut such an idealized orthogonal design without special casing will\noften lead to usability problems and complaints that -m alone does\nnot produce anything, so I am OK to have cc and friends as the value\nfor --diff-merges for that reason.\n"},{"id":"423563","messageId":"87eeemhnj4.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"xmqqtunj70zy.fsf@gitster.g","subject":"Re: Why doesn't `git log -m` imply `-p`?","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-04T09:10:55Z","receivedAt":"2021-05-04T09:11:01Z","isPatch":false,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Sergey Organov <sorganov@gmail.com> writes:\n>\n>>>  * \"--patch\", \"--stat\", \"--cc\" etc are to specify if we use the diff\n>>>    machinery and what kind of output is desired.\n>>\n>> So, in your view, --cc output is not a product of \"diff machinery\"?\n>\n> I view --cc and -c as an enhanced form of --patch that is also\n> capable of handling multi-way diffs, in other words, choosing --cc\n> should be to say \"give me textual patch for all commits; when there\n> are multiple parents, condense multi-way patches\".\n>\n> So, yes, strictly speaking, --diff-merges=cc was probably a mistake,\n> and in the ideal world, --diff-merges should have taken only one of\n> \"compare with nothing\" (optional), \"compare with first-parent\", and\n> \"compare with all parents\".  The last choice could output diffs in\n> various forms, like traditional -m (i.e. patch output separately for\n> each parent), --cc, -c, etc.  \"compare with nothing\" is optional\n> because we could also control on the \"output format\" side to say\n> \"produce no output\" (ala \"git show -s\").\n>\n> But such an idealized orthogonal design without special casing will\n> often lead to usability problems and complaints that -m alone does\n> not produce anything, so I am OK to have cc and friends as the value\n> for --diff-merges for that reason.\n\nI basically agree with what you say here, and it's in fact very close to\nthe first variant of the design that originally came to my mind, and it\nwas reality that shifted things to the way they are implemented now.\n\nThat said, what do we decide about -m to finally join -c/--cc party and\nstart to imply -p? Last time we've discussed it, we decided that -m has\nbeen simply overlooked when -c/--cc started to imply -p. Should we\nfinally fix this?\n\n\nThanks,\n\n-- Sergey Organov\n"},{"id":"423573","messageId":"xmqqbl9q7jxf.fsf@gitster.g","threadId":"55579","inReplyTo":"87eeemhnj4.fsf@osv.gnss.ru","subject":"Re: Why doesn't `git log -m` imply `-p`?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-05-04T12:38:52Z","receivedAt":"2021-05-04T12:38:58Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sergey Organov <sorganov@gmail.com> writes:\n\n> That said, what do we decide about -m to finally join -c/--cc party and\n> start to imply -p? Last time we've discussed it, we decided that -m has\n> been simply overlooked when -c/--cc started to imply -p. Should we\n> finally fix this?\n\nI thought I already said this, but in case I didn't, I think\n\"--diff-merges=separate\" should imply \"some kind of diff\", and not\nnecessarily \"-p\".\n"},{"id":"423577","messageId":"87r1imbmzz.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"xmqqbl9q7jxf.fsf@gitster.g","subject":"Re: Why doesn't `git log -m` imply `-p`?","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-04T14:18:56Z","receivedAt":"2021-05-04T14:19:02Z","isPatch":false,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Sergey Organov <sorganov@gmail.com> writes:\n>\n>> That said, what do we decide about -m to finally join -c/--cc party and\n>> start to imply -p? Last time we've discussed it, we decided that -m has\n>> been simply overlooked when -c/--cc started to imply -p. Should we\n>> finally fix this?\n>\n> I thought I already said this, but in case I didn't, I think\n> \"--diff-merges=separate\" should imply \"some kind of diff\", and not\n> necessarily \"-p\".\n\nIs this a more polite way to say \"no\"? If not, how is it relevant for\n-m, now being a synonym for --diff-merges=on?\n\nAs for particular idea, I'll repeat myself as well and say that I'm\nstill against implying anything by any off --diff-merges, and even more\nagainst implying something that affects non-merge commits. --diff-merges\nare not convenience options that need to be short yet give specific\nfunctionality, so there is no place for additional implications.\n\nThat said, I think that something like your idea could be fine if we\nintroduce another convenience option, say, -d, that will imply both\n--diff-merges=separate and \"some kind of diff\" (whatever the latter\nactually means, I'm not sure yet.) But then again, why don't just reuse\n-m that, as we've decided before, is not that useful in its current\nstate anyway?\n\nI must admit that I don't entirely understand your idea above yet. Maybe\nyou could provide a draft of manual entry for proposed behavior of\n--diff-merges=separate, for better understanding? For convenience, right\nnow it reads:\n\n   --diff-merges=separate\n       This makes merge commits show the full diff with respect to\n       each of the parents. Separate log entry and diff is generated\n       for each parent.\n\nThanks,\n\n-- Sergey Organov\n"},{"id":"423606","messageId":"6091aa0dee8f4_b34a8208ba@natae.notmuch","threadId":"55579","inReplyTo":"CAMMLpeS4pkP_xRw_qT3mCTP4hS3iLP9TwdDf8LV+3+an9aJ3Hw@mail.gmail.com","subject":"Re: Why doesn't `git log -m` imply `-p`?","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2021-05-04T20:09:49Z","receivedAt":"2021-05-04T20:09:57Z","isPatch":false,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Alex Henrie wrote:\n> On Wed, Apr 28, 2021 at 9:22 PM Junio C Hamano <gitster@pobox.com> wrote:\n> > Alex Henrie <alexhenrie24@gmail.com> writes:\n\n> > It is best to move on, writing it off as historical accident, and\n> > embrace the new --diff-merges=m option, instead of wasting time on\n> > pondering \"why\", because accidents do not have to have a deep reason\n> > behind them ;-)\n> \n> If the behavior is an idiosyncratic accident of dubious utility, let's\n> replace it with something that makes sense and is useful :-) If we\n> make -m imply -p then no alias is necessary, `git log` would display\n> the log without diffs and `git log -m` would display the log with all\n> the diffs.\n\nIndeed. Mistakes in the design of the UI should not be carried on\nforever.\n\nEither all --diff-merges={m,c,cc} imply -p, or none should.\n\n-- \nFelipe Contreras\n"},{"id":"423609","messageId":"87y2cu5jcv.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"6091aa0dee8f4_b34a8208ba@natae.notmuch","subject":"Re: Why doesn't `git log -m` imply `-p`?","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-04T20:34:08Z","receivedAt":"2021-05-04T20:34:16Z","isPatch":false,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Felipe Contreras <felipe.contreras@gmail.com> writes:\n\n> Alex Henrie wrote:\n>> On Wed, Apr 28, 2021 at 9:22 PM Junio C Hamano <gitster@pobox.com> wrote:\n>> > Alex Henrie <alexhenrie24@gmail.com> writes:\n>\n>> > It is best to move on, writing it off as historical accident, and\n>> > embrace the new --diff-merges=m option, instead of wasting time on\n>> > pondering \"why\", because accidents do not have to have a deep reason\n>> > behind them ;-)\n>> \n>> If the behavior is an idiosyncratic accident of dubious utility, let's\n>> replace it with something that makes sense and is useful :-) If we\n>> make -m imply -p then no alias is necessary, `git log` would display\n>> the log without diffs and `git log -m` would display the log with all\n>> the diffs.\n>\n> Indeed. Mistakes in the design of the UI should not be carried on\n> forever.\n>\n> Either all --diff-merges={m,c,cc} imply -p, or none should.\n\nNone of --diff-merges imply -p, and none should, -- that's one of the\ngoals of introducing --diff-merges.\n\nOTOH, -c/--cc do imply -p, and then -m doesn't. That's the historical\ninconsistency, not anything about recently implemented --diff-merges,\nand the natural way to fix it is to let -m imply -p.\n\nThanks,\n\n-- Sergey Organov\n"},{"id":"423625","messageId":"xmqqy2cu58vo.fsf@gitster.g","threadId":"55579","inReplyTo":"87r1imbmzz.fsf@osv.gnss.ru","subject":"Re: Why doesn't `git log -m` imply `-p`?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-05-05T00:20:27Z","receivedAt":"2021-05-05T00:20:33Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sergey Organov <sorganov@gmail.com> writes:\n\n>> I thought I already said this, but in case I didn't, I think\n>> \"--diff-merges=separate\" should imply \"some kind of diff\", and not\n>> necessarily \"-p\".\n>\n> Is this a more polite way to say \"no\"? If not, how is it relevant for\n> -m, now being a synonym for --diff-merges=on?\n\nSorry, I didn't mean to say \"no\" to anything.  \n\nI wrote 'separate' not because I wanted to special case that (and\ntreat others like 'on' differently), but simply because I didn't\nwant to write \"--diff-merges=<anything>\" as \"off/no\" should not\nimply \"show some kind of diff\".\n\n> As for particular idea, I'll repeat myself as well and say that I'm\n> still against implying anything by any off --diff-merges, and even more\n> against implying something that affects non-merge commits. --diff-merges\n> are not convenience options that need to be short yet give specific\n> functionality, so there is no place for additional implications.\n\nSo -m (a shorthand for --diff-merges=on) should not imply any patch\ngeneration, you mean?  It matches what we seem to have agreed on to\nbe the purist view in a few messages ago.  --diff-merges controls\nwhich parent(s) comparison is made against in a merge,\n-p/--cc/--raw/--stat etc. control how the result of that comparison\nis expressed.\n\nBut I also remember that we agreed that the purist view design was\ncumbersome to use, so --diff-merges=<anything but no> implying \"show\nsome kind of diff\" is OK, plus if nobody says \"what kind\" via the\ncommand line with -p/--cc/--raw/--stat etc., it is OK to default to\n'-p'.\n\nOne thing I think our unnecessary \"disagreement\" comes from is that\namong \"-m\", \"--cc\", \"-c\", you say \"-m\" is the only thing that does\nnot imply \"-p\", but I do not view \"--cc\" and \"-c\" as sitting next to\n\"-m\" at all in the first place.\n\n\"-m\" is on the \"which parent(s) to compare with\" side, while \"--cc\"\nand \"-c\" are \"now you decided which parent(s) to compare with, how\ndoes the result of comparison presented?\" side.  And because\n\"--cc\"/\"-c\" explicitly wants to work on merge commits (because it\nnaturally degenerates to simple \"--patch\" for non merges), THEY are\nmade to imply \"-m\" (i.e. compare with all parents).\n\nSo from my point of view, \"--cc/-c\" implying \"-m\" has no relevance\nto whether \"-m\" should or should not imply \"some kind of comparison\nshould be shown\".\n\nBut because we agreed that we want to bend the purist view for\nusability and included cc/c among the choices diff-merges=<choice>\ncan take, I think -m (but not log.diffMerges=no case) should imply\n\"we should show some kind of patch\".\n\nWhich would mean that unless when log.diffMerges or --diff-merges\nsay off/no, and unless there is any option to specify how the result\nof comparison should bepresented on the command line:\n\n - when log.diffMerges or --diff-merges say cc or c, default to --cc\n   or -c.\n\n - otherwise,default to --patch.\n\nis what I think should happen.  But the reason I think so is not\nbecause \"--cc\" and \"-c\" gives output without \"-m\" (i.e. \"-p\" does\nnot imply \"-m\" and it should not).\n"},{"id":"423675","messageId":"87tunh9tye.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"xmqqy2cu58vo.fsf@gitster.g","subject":"Re: Why doesn't `git log -m` imply `-p`?","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-05T13:43:53Z","receivedAt":"2021-05-05T13:43:59Z","isPatch":false,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Sergey Organov <sorganov@gmail.com> writes:\n>\n>>> I thought I already said this, but in case I didn't, I think\n>>> \"--diff-merges=separate\" should imply \"some kind of diff\", and not\n>>> necessarily \"-p\".\n>>\n>> Is this a more polite way to say \"no\"? If not, how is it relevant for\n>> -m, now being a synonym for --diff-merges=on?\n>\n> Sorry, I didn't mean to say \"no\" to anything.\n\nTo me \"no\" is as good answer as any, I just want to reach better\nunderstanding.  \n\n>\n> I wrote 'separate' not because I wanted to special case that (and\n> treat others like 'on' differently), but simply because I didn't\n> want to write \"--diff-merges=<anything>\" as \"off/no\" should not\n> imply \"show some kind of diff\".\n>\n>> As for particular idea, I'll repeat myself as well and say that I'm\n>> still against implying anything by any off --diff-merges, and even more\n>> against implying something that affects non-merge commits. --diff-merges\n>> are not convenience options that need to be short yet give specific\n>> functionality, so there is no place for additional implications.\n>\n> So -m (a shorthand for --diff-merges=on) should not imply any patch\n> generation, you mean?\n\nNo, I don't mean it. The idea is to let -m be alias for\n\"--diff-merges=on -p\", exactly the same way --cc is currently\nessentially an alias for \"--diff-merges=dense-combined -p\".\n\nWhat I meant is that --diff-merges itself should not imply any patch\ngeneration for non-merge commits, so --diff-merges=on should not imply\n-p.\n\n> It matches what we seem to have agreed on to be the purist view in a\n> few messages ago. --diff-merges controls which parent(s) comparison is\n> made against in a merge, -p/--cc/--raw/--stat etc. control how the\n> result of that comparison is expressed.\n\nI see this as your vision, but I don't recall we agree on it. At least\nthat's not how it currently works, as far as I can tell, see command\nexamples I gathered in one of my previous answers.\n\n>\n> But I also remember that we agreed that the purist view design was\n> cumbersome to use, so --diff-merges=<anything but no> implying \"show\n> some kind of diff\" is OK, plus if nobody says \"what kind\" via the\n> command line with -p/--cc/--raw/--stat etc., it is OK to default to\n> '-p'.\n\nThe latter part of this sentence is something rather new to me, that\nonly appeared in this particular thread of discussion recently, and it\ndoes not match my own vision. Neither my vision of the current\nimplementation nor of what we should aim for.\n\n>\n> One thing I think our unnecessary \"disagreement\" comes from is that\n> among \"-m\", \"--cc\", \"-c\", you say \"-m\" is the only thing that does\n> not imply \"-p\", but I do not view \"--cc\" and \"-c\" as sitting next to\n> \"-m\" at all in the first place.\n\nI was sure you rather did when we've discussed it the last time before\nthis thread. Now your opinion seems to have changed, and I don't see\nwhy. In fact I'm very confused. As far as understood, that time you said\nthat -m has been simply overlooked when --cc/-c started to imply -p, and\nthat you actually don't care about -m that much anyway.\n\nI also recall you said that -c (and later --cc) has been invented as\nalternative to not that useful -m, so -m, -c, and -cc have always been\nexactly sitting next to each other in my view.\n\n> \"-m\" is on the \"which parent(s) to compare with\" side,\n\nThis has never been the case, has it? See:\n\n  -m\n      This flag makes the merge commits show the full diff like regular\n      commits; for each merge parent, a separate log entry and diff is\n      generated. An exception is that only diff against the first parent\n      is shown when --first-parent option is given; in that case, the\n      output represents the changes the merge brought into the\n      then-current branch.\n\n  -c\n      With this option, diff output for a merge commit shows the\n      differences from each of the parents to the merge result\n      simultaneously instead of showing pairwise diff between a parent\n      and the result one at a time. Furthermore, it lists only files\n      which were modified from all parents.\n\nFirst, -m doesn't select the parents at all and shows \"full diff\", so it\nrather defines the format. And second, -c is described exactly as being\nalternative format to -m, as far as I can tell, making -c sit right next\nto -m again, contrary to what you say above.\n\nBTW, I recall I once suggested something like what you said, let -m\nmatch what in means in cherry-pick, to what parent(s) to compare, but\nit'd need -m to take (optional) argument(s), that has been considered\nunacceptable, so the idea has been rejected (and for the better.)\n\n> while \"--cc\" and \"-c\" are \"now you decided which parent(s) to compare\n> with, how does the result of comparison presented?\" side. And because\n> \"--cc\"/\"-c\" explicitly wants to work on merge commits (because it\n> naturally degenerates to simple \"--patch\" for non merges), THEY are\n> made to imply \"-m\" (i.e. compare with all parents).\n\nThat's a reasonable interpretation. The problem is that currently this\ndoes not match nor design, nor implementation, nor documentation at all,\nas far as I can tell.\n\n> So from my point of view, \"--cc/-c\" implying \"-m\" has no relevance\n> to whether \"-m\" should or should not imply \"some kind of comparison\n> should be shown\".\n\nWhat you describe is a different design that may well be a good one, but\ndo we actually want to change what's already there? What for?\n\n>\n> But because we agreed that we want to bend the purist view for\n> usability and included cc/c among the choices diff-merges=<choice>\n> can take, I think -m (but not log.diffMerges=no case) should imply\n> \"we should show some kind of patch\".\n\nOnce again, this doesn't fit into the current design, as far as I can\ntell, or I misunderstand the design, that could well be the case as\nwell.\n\n>\n> Which would mean that unless when log.diffMerges or --diff-merges\n> say off/no, and unless there is any option to specify how the result\n> of comparison should bepresented on the command line:\n>\n>  - when log.diffMerges or --diff-merges say cc or c, default to --cc\n>    or -c.\n>\n>  - otherwise,default to --patch.\n>\n> is what I think should happen.  But the reason I think so is not\n> because \"--cc\" and \"-c\" gives output without \"-m\" (i.e. \"-p\" does\n> not imply \"-m\" and it should not).\n\nI don't like this so far. Considering -m to be just one of different\nformats to represent merge commits (among -c and --cc), as it has always\nbeen, looks more straightforward and useful to me.\n\nBesides, all the recent design I authored assumed -m to be just that,\none of multiple ways to specify how to represent merge commits, the\nother 2 being -c and --cc. If we decide to change this view, it'd likely\nneed significant re-design, and I'm yet to see any actual advantages.\n\nIf, on the other hand, it's just me who fundamentally misunderstands the\ndesign, then I need to be corrected fast, before I make significant\ndamage.\n\nThanks,\n\n-- Sergey Organov\n"},{"id":"423722","messageId":"xmqqim3w3dvx.fsf@gitster.g","threadId":"55579","inReplyTo":"87tunh9tye.fsf@osv.gnss.ru","subject":"Re: Why doesn't `git log -m` imply `-p`?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-05-06T00:27:30Z","receivedAt":"2021-05-06T00:27:39Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sergey Organov <sorganov@gmail.com> writes:\n\n> No, I don't mean it. The idea is to let -m be alias for\n> \"--diff-merges=on -p\",...\n\nAhhhh, that makes a whole lot of difference.  Thanks.\n\n> If, on the other hand, it's just me who fundamentally misunderstands the\n> design, then I need to be corrected fast, before I make significant\n> damage.\n\nNo, it was I who was confused, as I somehow incorrectly thoguht that\nyour plan was to make \"-m\" identical to \"--diff-merges=on\".\n\nBut if your plan is to make\n\n    \"git log -m\"    (no other option)\n    \"git log -m -p\"\n\nbehave identically to \"git log --diff-merges=on -p\", and similarly\nmake\n\n    \"git log -m --stat\"\n    \"git log -m --raw\"\n\nbehave identically to \"git log --diff-merges=on --stat/--raw\", I\nthink that such a design makes quite a lot of sense.\n\nIt will still keep the purity of \"--diff-merges=<choice>\" (that is,\nit only is about if/how a merge is expressed in some form of diff),\nwhile solving the longstanding usability issue of \"-m\" that led to\nAlex's \"when a user says -m, diff output is expected\", that came\nquite early in this thread.\n"},{"id":"423771","messageId":"87wnscuif9.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"xmqqim3w3dvx.fsf@gitster.g","subject":"Re: Why doesn't `git log -m` imply `-p`?","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-06T12:59:38Z","receivedAt":"2021-05-06T12:59:45Z","isPatch":false,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Sergey Organov <sorganov@gmail.com> writes:\n>\n>> No, I don't mean it. The idea is to let -m be alias for\n>> \"--diff-merges=on -p\",...\n>\n> Ahhhh, that makes a whole lot of difference.  Thanks.\n>\n>> If, on the other hand, it's just me who fundamentally misunderstands the\n>> design, then I need to be corrected fast, before I make significant\n>> damage.\n>\n> No, it was I who was confused, as I somehow incorrectly thoguht that\n> your plan was to make \"-m\" identical to \"--diff-merges=on\".\n>\n> But if your plan is to make\n>\n>     \"git log -m\"    (no other option)\n>     \"git log -m -p\"\n>\n> behave identically to \"git log --diff-merges=on -p\",\n\nYep, exactly.\n\n> and similarly make\n>\n>     \"git log -m --stat\"\n>     \"git log -m --raw\"\n>\n> behave identically to \"git log --diff-merges=on --stat/--raw\", I\n> think that such a design makes quite a lot of sense.\n\nThese I honestly didn't even think about before, but now, after you've\nbrought them, I'll pay attention, thanks!\n\n>\n> It will still keep the purity of \"--diff-merges=<choice>\" (that is,\n> it only is about if/how a merge is expressed in some form of diff),\n> while solving the longstanding usability issue of \"-m\" that led to\n> Alex's \"when a user says -m, diff output is expected\", that came\n> quite early in this thread.\n\nIt's nice we've reached mutual understanding!\n\nThe only remaining issue then is if we just go and do the change of -m\nsemantics, or do we need to take some backward compatibility measures?\nLooks like we are rather safe to just go, as it's unlikely there will be\nany real breakage. What do you think?\n\nThanks,\n-- Sergey Organov\n"},{"id":"423815","messageId":"xmqqpmy3y5ar.fsf@gitster.g","threadId":"55579","inReplyTo":"87wnscuif9.fsf@osv.gnss.ru","subject":"Re: Why doesn't `git log -m` imply `-p`?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-05-06T20:29:32Z","receivedAt":"2021-05-06T20:29:36Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sergey Organov <sorganov@gmail.com> writes:\n\n> It's nice we've reached mutual understanding!\n\nYes, and thanks for correcting me.\n\n> The only remaining issue then is if we just go and do the change of -m\n> semantics, or do we need to take some backward compatibility measures?\n> Looks like we are rather safe to just go, as it's unlikely there will be\n> any real breakage. What do you think?\n\nI still wish I could come up with the usual backward compatibility\ntransition dance for this case, but I do not think there is one.\n\nHowever.\n\nIf \"-m\" were doing a more useful thing than \"compare with each\nparent separately\", people may have aliased \"log -m\" to something so\nthat their \"git aliased-log\" and \"git aliased-log -p\" would work\nbetter for them than \"git log\" and \"git log -p\", but quite honestly,\nI do not think \"git log -m -p\" output is readable by humans (after\nall, that is why we invented -c and --cc), so the population that\nget hit by this incompatible change may be very tiny minority in\nrelative terms.\n"},{"id":"423817","messageId":"87sg2zr3l0.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"xmqqpmy3y5ar.fsf@gitster.g","subject":"Re: Why doesn't `git log -m` imply `-p`?","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-06T20:48:27Z","receivedAt":"2021-05-06T20:48:34Z","isPatch":false,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\nF> Sergey Organov <sorganov@gmail.com> writes:\n>\n>> It's nice we've reached mutual understanding!\n>\n> Yes, and thanks for correcting me.\n>\n>> The only remaining issue then is if we just go and do the change of -m\n>> semantics, or do we need to take some backward compatibility measures?\n>> Looks like we are rather safe to just go, as it's unlikely there will be\n>> any real breakage. What do you think?\n>\n> I still wish I could come up with the usual backward compatibility\n> transition dance for this case, but I do not think there is one.\n\nFine, thanks, so I'll prepare and submit a patch.\n\n>\n> However.\n>\n> If \"-m\" were doing a more useful thing than \"compare with each\n> parent separately\", people may have aliased \"log -m\" to something so\n> that their \"git aliased-log\" and \"git aliased-log -p\" would work\n> better for them than \"git log\" and \"git log -p\", but quite honestly,\n> I do not think \"git log -m -p\" output is readable by humans (after\n> all, that is why we invented -c and --cc), so the population that\n> get hit by this incompatible change may be very tiny minority in\n> relative terms.\n\nWell, honestly, I can't even come up with an alias that would break by\nthis change, but it's likely I'm just not creative enough :)\n\nThanks,\n-- Sergey Organov\n"},{"id":"423833","messageId":"CAMMLpeQ9q+XRP7eyk4UhmSRDnrw-c57hAkcT+_gEKXFprx4qeQ@mail.gmail.com","threadId":"55579","inReplyTo":"87sg2zr3l0.fsf@osv.gnss.ru","subject":"Re: Why doesn't `git log -m` imply `-p`?","fromName":"Alex Henrie","fromEmail":"alexhenrie24@gmail.com","sentAt":"2021-05-07T01:31:01Z","receivedAt":"2021-05-07T01:31:17Z","isPatch":false,"sender":{"key":"alexhenrie24@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5951993?v=4"},"body":"On Thu, May 6, 2021 at 2:48 PM Sergey Organov <sorganov@gmail.com> wrote:\n>\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n> F> Sergey Organov <sorganov@gmail.com> writes:\n> >\n> >> It's nice we've reached mutual understanding!\n> >\n> > Yes, and thanks for correcting me.\n> >\n> >> The only remaining issue then is if we just go and do the change of -m\n> >> semantics, or do we need to take some backward compatibility measures?\n> >> Looks like we are rather safe to just go, as it's unlikely there will be\n> >> any real breakage. What do you think?\n> >\n> > I still wish I could come up with the usual backward compatibility\n> > transition dance for this case, but I do not think there is one.\n>\n> Fine, thanks, so I'll prepare and submit a patch.\n\nThanks guys! I am so glad you were able to reach a consensus!\n\n-Alex\n"},{"id":"424023","messageId":"87a6p2hjpe.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"CAMMLpeR-W35Qq6a343ifrxJ=mwBc_VcXZtVrBYDpJTySNBroFw@mail.gmail.com","subject":"Re: Why doesn't `git log -m` imply `-p`?","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-10T12:11:41Z","receivedAt":"2021-05-10T12:51:10Z","isPatch":false,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Alex Henrie <alexhenrie24@gmail.com> writes:\n\n> I read the following in `man git-log` today:\n>\n> --diff-merges=separate, --diff-merges=m, -m\n>     This makes merge commits show the full diff with respect to each of\n>     the parents. Separate log entry and diff is generated for each\n>     parent.  -m doesn't produce any output without -p.\n>\n> --diff-merges=combined, --diff-merges=c, -c\n>     With this option, diff output for a merge commit shows the\n>     differences from each of the parents to the merge result\n>     simultaneously instead of showing pairwise diff between a parent and\n>     the result one at a time. Furthermore, it lists only files which\n>     were modified from all parents.  -c implies -p.\n>\n> --diff-merges=dense-combined, --diff-merges=cc, --cc\n>     With this option the output produced by --diff-merges=combined is\n>     further compressed by omitting uninteresting hunks whose contents\n>     in the parents have only two variants and the merge result picks one\n>     of them without modification.  --cc implies -p.\n>\n> Why do -c and -cc imply -p, but -m does not? I tried to use both `git\n> log -c` and `git log -m` today and was confused when the latter didn't\n> produce any output. Could we change this behavior in a future version\n> of Git?\n\nPatches to fix this are almost ready, but I'd like to make a warning\nthat you'd likely be even more confused by the current output of \"-m\",\nunless you set \"log.diffMerges\" configuration option to \"first-parent\".\nThese diffs with respect to /second/ parent at the end of the output\nmade me really mad once upon a time.\n\n-- Sergey Organov\n"},{"id":"424049","messageId":"20210510153451.15090-1-sorganov@gmail.com","threadId":"55579","inReplyTo":"CAMMLpeR-W35Qq6a343ifrxJ=mwBc_VcXZtVrBYDpJTySNBroFw@mail.gmail.com","subject":"[PATCH 0/6] diff-merges: let -m imply -p","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-10T15:34:45Z","receivedAt":"2021-05-10T15:35:04Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Fix long standing inconsistency between -c/--cc that do imply -p, on\none side, and -m that did not imply -p, on the other side.\n\nAfter these patches\n\n  git log -m\n\nwill start to produce diffs without need to provide -p as well, that\nimproves both consistency and usability. It gets even more useful if\none sets \"log.diffMerges\" configuration variable to \"first-parent\" to\nforce -m produce usual diff with respect to first parent only.\n\nPrevious semantics of -m could still be accessed using\n--diff-merges=separate option.\n\nFirst 5 patches in the series are refactoring that is not expected to\nchange existing behavior, and the last one is the actual functional\nchange.\n\nSergey Organov (6):\n  t4013: add test for \"git diff-index -m\"\n  diff-merges: move specific diff-index \"-m\" handling to diff-index\n  git-svn: stop passing \"-m\" to \"git rev-list\"\n  stash list: stop passing \"-m\" to \"git list\"\n  diff-merges: rename \"combined_imply_patch\" to \"merges_imply_patch\"\n  diff-merges: let -m imply -p\n\n Documentation/diff-options.txt |  8 +++---\n builtin/diff-index.c           | 45 ++++++++++++++++++++++++++--------\n builtin/stash.c                |  2 +-\n diff-merges.c                  | 24 ++++++------------\n perl/Git/SVN.pm                |  2 +-\n revision.h                     |  2 +-\n t/t3903-stash.sh               |  2 +-\n t/t4013-diff-various.sh        | 13 ++++++++++\n 8 files changed, 63 insertions(+), 35 deletions(-)\n\n-- \n2.25.1\n\n"},{"id":"424050","messageId":"20210510153451.15090-2-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210510153451.15090-1-sorganov@gmail.com","subject":"[PATCH 1/6] t4013: add test for \"git diff-index -m\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-10T15:34:46Z","receivedAt":"2021-05-10T15:35:17Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"-m in \"git diff-index\" means \"match missing\", that differs\nfrom its meaning in \"git diff\". Let's check it in diff-index.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n t/t4013-diff-various.sh | 13 +++++++++++++\n 1 file changed, 13 insertions(+)\n\ndiff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh\nindex 87def81699bf..bd16d4885cfd 100755\n--- a/t/t4013-diff-various.sh\n+++ b/t/t4013-diff-various.sh\n@@ -483,6 +483,19 @@ test_expect_success 'git config log.diffMerges first-parent vs -m' '\n \ttest_cmp expected actual\n '\n \n+# -m in \"git diff-index\" means \"match missing\", that differs\n+# from its meaning in \"git diff\". Let's check it in diff-index.\n+# The line in the output for removed file should disappear when\n+# we provide -m in diff-index.\n+test_expect_success 'git diff-index -m' '\n+\trm -f file1 &&\n+\tgit diff-index HEAD >without-m &&\n+\tlines_count=$(wc -l <without-m) &&\n+\tgit diff-index -m HEAD >with-m &&\n+\tgit restore file1 &&\n+\ttest_line_count = $((lines_count - 1)) with-m\n+'\n+\n test_expect_success 'log -S requires an argument' '\n \ttest_must_fail git log -S\n '\n-- \n2.25.1\n\n"},{"id":"424051","messageId":"20210510153451.15090-3-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210510153451.15090-1-sorganov@gmail.com","subject":"[PATCH 2/6] diff-merges: move specific diff-index \"-m\" handling to diff-index","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-10T15:34:47Z","receivedAt":"2021-05-10T15:35:25Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Move specific handling of \"-m\" for diff-index to diff-index.c, so\ndiff-merges is left to handle only diff for merges options.\n\nBeing a better design by itself, this is especially essential in\npreparation for letting -m imply -p, as \"diff-index -m\" obviously\nshould not imply -p, as it's entirely unrelated.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n builtin/diff-index.c | 45 ++++++++++++++++++++++++++++++++++----------\n diff-merges.c        | 13 +------------\n 2 files changed, 36 insertions(+), 22 deletions(-)\n\ndiff --git a/builtin/diff-index.c b/builtin/diff-index.c\nindex 176fe7ff2b4e..28bc51d0d8f4 100644\n--- a/builtin/diff-index.c\n+++ b/builtin/diff-index.c\n@@ -12,11 +12,37 @@ static const char diff_cache_usage[] =\n \"[<common-diff-options>] <tree-ish> [<path>...]\"\n COMMON_DIFF_OPTIONS_HELP;\n \n+static int parse_distinct_options(int argc, const char **argv,\n+\t\t\t\t  struct rev_info *revs, unsigned int *options)\n+{\n+\tint i, left;\n+\n+\tfor (i = left = 1; i < argc; i++) {\n+\t\tconst char *arg = argv[i];\n+\t\tint leave = 0;\n+\n+\t\tif (!strcmp(arg, \"--cached\"))\n+\t\t\t*options |= DIFF_INDEX_CACHED;\n+\t\telse if (!strcmp(arg, \"--merge-base\"))\n+\t\t\t*options |= DIFF_INDEX_MERGE_BASE;\n+\t\telse if (!strcmp(arg, \"-m\"))\n+\t\t\trevs->match_missing = 1;\n+\t\telse\n+\t\t\tleave = 1;\n+\n+\t\tif (leave)\n+\t\t\targv[left++] = arg;\n+\t}\n+\n+\targv[left] = NULL;\n+\n+\treturn left;\n+}\n+\n int cmd_diff_index(int argc, const char **argv, const char *prefix)\n {\n \tstruct rev_info rev;\n \tunsigned int option = 0;\n-\tint i;\n \tint result;\n \n \tif (argc == 2 && !strcmp(argv[1], \"-h\"))\n@@ -27,17 +53,16 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)\n \trev.abbrev = 0;\n \tprefix = precompose_argv_prefix(argc, argv, prefix);\n \n+\t/*\n+\t * It's essential to parse our distinct options before calling\n+\t * setup_revisions(), for the latter not to see \"-m\".\n+\t */\n+\targc = parse_distinct_options(argc, argv, &rev, &option);\n \targc = setup_revisions(argc, argv, &rev, NULL);\n-\tfor (i = 1; i < argc; i++) {\n-\t\tconst char *arg = argv[i];\n \n-\t\tif (!strcmp(arg, \"--cached\"))\n-\t\t\toption |= DIFF_INDEX_CACHED;\n-\t\telse if (!strcmp(arg, \"--merge-base\"))\n-\t\t\toption |= DIFF_INDEX_MERGE_BASE;\n-\t\telse\n-\t\t\tusage(diff_cache_usage);\n-\t}\n+\tif (argc > 1)\n+\t\tusage(diff_cache_usage);\n+\n \tif (!rev.diffopt.output_format)\n \t\trev.diffopt.output_format = DIFF_FORMAT_RAW;\n \ndiff --git a/diff-merges.c b/diff-merges.c\nindex f3a9daed7e05..4016800c422c 100644\n--- a/diff-merges.c\n+++ b/diff-merges.c\n@@ -30,17 +30,6 @@ static void set_first_parent(struct rev_info *revs)\n \trevs->first_parent_merges = 1;\n }\n \n-static void set_m(struct rev_info *revs)\n-{\n-\t/*\n-\t * To \"diff-index\", \"-m\" means \"match missing\", and to the \"log\"\n-\t * family of commands, it means \"show default diff for merges\". Set\n-\t * both fields appropriately.\n-\t */\n-\tset_to_default(revs);\n-\trevs->match_missing = 1;\n-}\n-\n static void set_combined(struct rev_info *revs)\n {\n \tsuppress(revs);\n@@ -108,7 +97,7 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv)\n \tconst char *arg = argv[0];\n \n \tif (!strcmp(arg, \"-m\")) {\n-\t\tset_m(revs);\n+\t\tset_to_default(revs);\n \t} else if (!strcmp(arg, \"-c\")) {\n \t\tset_combined(revs);\n \t\trevs->combined_imply_patch = 1;\n-- \n2.25.1\n\n"},{"id":"424052","messageId":"20210510153451.15090-4-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210510153451.15090-1-sorganov@gmail.com","subject":"[PATCH 3/6] git-svn: stop passing \"-m\" to \"git rev-list\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-10T15:34:48Z","receivedAt":"2021-05-10T15:35:28Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"rev-list doesn't utilize -m. It happens to eat it silently, so this\nbug went unnoticed.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n perl/Git/SVN.pm | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm\nindex f6f1dc03c608..35ff5a68963d 100644\n--- a/perl/Git/SVN.pm\n+++ b/perl/Git/SVN.pm\n@@ -1636,7 +1636,7 @@ sub has_no_changes {\n \tmy $commit = shift;\n \n \tmy @revs = split / /, command_oneline(\n-\t\tqw(rev-list --parents -1 -m), $commit);\n+\t\tqw(rev-list --parents -1), $commit);\n \n \t# Commits with no parents, e.g. the start of a partial branch,\n \t# have changes by definition.\n-- \n2.25.1\n\n"},{"id":"424053","messageId":"20210510153451.15090-5-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210510153451.15090-1-sorganov@gmail.com","subject":"[PATCH 4/6] stash list: stop passing \"-m\" to \"git list\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-10T15:34:49Z","receivedAt":"2021-05-10T15:35:40Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Passing \"-m\" in \"git list --first-parent -m\" is not needed as\n--first-parent implies --diff-merges=first-parent anyway. OTOH, it\nwill stop being harmless once we let \"-m\" imply \"-p\".\n\nWhile we are at it, fix corresponding test description in t3903-stash\nto match what it actually tests.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n builtin/stash.c  | 2 +-\n t/t3903-stash.sh | 2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex d68ed784d2af..fe8e97428808 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -761,7 +761,7 @@ static int list_stash(int argc, const char **argv, const char *prefix)\n \n \tcp.git_cmd = 1;\n \tstrvec_pushl(&cp.args, \"log\", \"--format=%gd: %gs\", \"-g\",\n-\t\t     \"--first-parent\", \"-m\", NULL);\n+\t\t     \"--first-parent\", NULL);\n \tstrvec_pushv(&cp.args, argv);\n \tstrvec_push(&cp.args, ref_stash);\n \tstrvec_push(&cp.args, \"--\");\ndiff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\nindex 5f282ecf6175..873aa56e359d 100755\n--- a/t/t3903-stash.sh\n+++ b/t/t3903-stash.sh\n@@ -859,7 +859,7 @@ test_expect_success 'setup stash with index and worktree changes' '\n \tgit stash\n '\n \n-test_expect_success 'stash list implies --first-parent -m' '\n+test_expect_success 'stash list -p shows simple diff' '\n \tcat >expect <<-EOF &&\n \tstash@{0}\n \n-- \n2.25.1\n\n"},{"id":"424054","messageId":"20210510153451.15090-6-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210510153451.15090-1-sorganov@gmail.com","subject":"[PATCH 5/6] diff-merges: rename \"combined_imply_patch\" to \"merges_imply_patch\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-10T15:34:50Z","receivedAt":"2021-05-10T15:35:52Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"This is refactoring change in preparation for the next commit that\nwill let -m imply -p.\n\nThe old name doesn't match the intention to let not only -c/-cc imply\n-p, but also -m, that is not a \"combined\" format, so we rename the\nflag accordingly.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n diff-merges.c | 10 +++++-----\n revision.h    |  2 +-\n 2 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/diff-merges.c b/diff-merges.c\nindex 4016800c422c..211c99482cac 100644\n--- a/diff-merges.c\n+++ b/diff-merges.c\n@@ -14,7 +14,7 @@ static void suppress(struct rev_info *revs)\n \trevs->combine_merges = 0;\n \trevs->dense_combined_merges = 0;\n \trevs->combined_all_paths = 0;\n-\trevs->combined_imply_patch = 0;\n+\trevs->merges_imply_patch = 0;\n \trevs->merges_need_diff = 0;\n }\n \n@@ -100,10 +100,10 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv)\n \t\tset_to_default(revs);\n \t} else if (!strcmp(arg, \"-c\")) {\n \t\tset_combined(revs);\n-\t\trevs->combined_imply_patch = 1;\n+\t\trevs->merges_imply_patch = 1;\n \t} else if (!strcmp(arg, \"--cc\")) {\n \t\tset_dense_combined(revs);\n-\t\trevs->combined_imply_patch = 1;\n+\t\trevs->merges_imply_patch = 1;\n \t} else if (!strcmp(arg, \"--no-diff-merges\")) {\n \t\tsuppress(revs);\n \t} else if (!strcmp(arg, \"--combined-all-paths\")) {\n@@ -150,9 +150,9 @@ void diff_merges_setup_revs(struct rev_info *revs)\n \t\trevs->first_parent_merges = 0;\n \tif (revs->combined_all_paths && !revs->combine_merges)\n \t\tdie(\"--combined-all-paths makes no sense without -c or --cc\");\n-\tif (revs->combined_imply_patch)\n+\tif (revs->merges_imply_patch)\n \t\trevs->diff = 1;\n-\tif (revs->combined_imply_patch || revs->merges_need_diff) {\n+\tif (revs->merges_imply_patch || revs->merges_need_diff) {\n \t\tif (!revs->diffopt.output_format)\n \t\t\trevs->diffopt.output_format = DIFF_FORMAT_PATCH;\n \t}\ndiff --git a/revision.h b/revision.h\nindex 93aa012f518e..17698cb51aca 100644\n--- a/revision.h\n+++ b/revision.h\n@@ -193,10 +193,10 @@ struct rev_info {\n \t\t\t/* Diff-merge flags */\n \t\t\texplicit_diff_merges: 1,\n \t\t\tmerges_need_diff: 1,\n+\t\t\tmerges_imply_patch:1,\n \t\t\tseparate_merges: 1,\n \t\t\tcombine_merges:1,\n \t\t\tcombined_all_paths:1,\n-\t\t\tcombined_imply_patch:1,\n \t\t\tdense_combined_merges:1,\n \t\t\tfirst_parent_merges:1;\n \n-- \n2.25.1\n\n"},{"id":"424055","messageId":"20210510153451.15090-7-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210510153451.15090-1-sorganov@gmail.com","subject":"[PATCH 6/6] diff-merges: let -m imply -p","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-10T15:34:51Z","receivedAt":"2021-05-10T15:36:17Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Fix long standing inconsistency between -c/--cc that do imply -p, on\none side, and -m that did not imply -p, on the other side.\n\nAfter this patch\n\n  git log -m\n\nwill start to produce diffs without need to provide -p as well, that\nimproves both consistency and usability. It gets even more useful if\none sets \"log.diffMerges\" configuration variable to \"first-parent\" to\nforce -m produce usual diff with respect to first parent only.\n\nPrevious semantics of -m could still be accessed using\n--diff-merges=separate option.\n\nChange documentation accordingly.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n Documentation/diff-options.txt | 8 ++++----\n diff-merges.c                  | 1 +\n 2 files changed, 5 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex 530d1159141f..32e6dee5ac3b 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -49,10 +49,9 @@ ifdef::git-log[]\n --diff-merges=m:::\n -m:::\n \tThis option makes diff output for merge commits to be shown in\n-\tthe default format. `-m` will produce the output only if `-p`\n-\tis given as well. The default format could be changed using\n+\tthe default format. The default format could be changed using\n \t`log.diffMerges` configuration parameter, which default value\n-\tis `separate`.\n+\tis `separate`. `-m` implies `-p`.\n +\n --diff-merges=first-parent:::\n --diff-merges=1:::\n@@ -62,7 +61,8 @@ ifdef::git-log[]\n --diff-merges=separate:::\n \tThis makes merge commits show the full diff with respect to\n \teach of the parents. Separate log entry and diff is generated\n-\tfor each parent.\n+\tfor each parent. This is the format that `-m` produced\n+\thistorically.\n +\n --diff-merges=combined:::\n --diff-merges=c:::\ndiff --git a/diff-merges.c b/diff-merges.c\nindex 211c99482cac..a827482a97ff 100644\n--- a/diff-merges.c\n+++ b/diff-merges.c\n@@ -98,6 +98,7 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv)\n \n \tif (!strcmp(arg, \"-m\")) {\n \t\tset_to_default(revs);\n+\t\trevs->merges_imply_patch = 1;\n \t} else if (!strcmp(arg, \"-c\")) {\n \t\tset_combined(revs);\n \t\trevs->merges_imply_patch = 1;\n-- \n2.25.1\n\n"},{"id":"424058","messageId":"CAMMLpeT+afQFjB=wDQYz=ECA8m=FXMnUkX7gekOZ3=YtAOJ5EQ@mail.gmail.com","threadId":"55579","inReplyTo":"87a6p2hjpe.fsf@osv.gnss.ru","subject":"Re: Why doesn't `git log -m` imply `-p`?","fromName":"Alex Henrie","fromEmail":"alexhenrie24@gmail.com","sentAt":"2021-05-10T16:56:52Z","receivedAt":"2021-05-10T16:57:08Z","isPatch":false,"sender":{"key":"alexhenrie24@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5951993?v=4"},"body":"On Mon, May 10, 2021 at 6:11 AM Sergey Organov <sorganov@gmail.com> wrote:\n>\n> Alex Henrie <alexhenrie24@gmail.com> writes:\n>\n> > I read the following in `man git-log` today:\n> >\n> > --diff-merges=separate, --diff-merges=m, -m\n> >     This makes merge commits show the full diff with respect to each of\n> >     the parents. Separate log entry and diff is generated for each\n> >     parent.  -m doesn't produce any output without -p.\n> >\n> > --diff-merges=combined, --diff-merges=c, -c\n> >     With this option, diff output for a merge commit shows the\n> >     differences from each of the parents to the merge result\n> >     simultaneously instead of showing pairwise diff between a parent and\n> >     the result one at a time. Furthermore, it lists only files which\n> >     were modified from all parents.  -c implies -p.\n> >\n> > --diff-merges=dense-combined, --diff-merges=cc, --cc\n> >     With this option the output produced by --diff-merges=combined is\n> >     further compressed by omitting uninteresting hunks whose contents\n> >     in the parents have only two variants and the merge result picks one\n> >     of them without modification.  --cc implies -p.\n> >\n> > Why do -c and -cc imply -p, but -m does not? I tried to use both `git\n> > log -c` and `git log -m` today and was confused when the latter didn't\n> > produce any output. Could we change this behavior in a future version\n> > of Git?\n>\n> Patches to fix this are almost ready, but I'd like to make a warning\n> that you'd likely be even more confused by the current output of \"-m\",\n> unless you set \"log.diffMerges\" configuration option to \"first-parent\".\n> These diffs with respect to /second/ parent at the end of the output\n> made me really mad once upon a time.\n\nGood observation. I'm not sure what would be the ideal default here,\nbut certainly having -m turn on /some/ kind of diff is better than\nnothing. Thanks!\n\n-Alex\n"},{"id":"424096","messageId":"xmqqwns5oqrm.fsf@gitster.g","threadId":"55579","inReplyTo":"20210510153451.15090-3-sorganov@gmail.com","subject":"Re: [PATCH 2/6] diff-merges: move specific diff-index \"-m\" handling to diff-index","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-05-11T04:09:33Z","receivedAt":"2021-05-11T04:09:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sergey Organov <sorganov@gmail.com> writes:\n\n>  int cmd_diff_index(int argc, const char **argv, const char *prefix)\n>  {\n>  \tstruct rev_info rev;\n>  \tunsigned int option = 0;\n> -\tint i;\n>  \tint result;\n>  \n>  \tif (argc == 2 && !strcmp(argv[1], \"-h\"))\n> @@ -27,17 +53,16 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)\n>  \trev.abbrev = 0;\n>  \tprefix = precompose_argv_prefix(argc, argv, prefix);\n>  \n> +\t/*\n> +\t * It's essential to parse our distinct options before calling\n> +\t * setup_revisions(), for the latter not to see \"-m\".\n> +\t */\n> +\targc = parse_distinct_options(argc, argv, &rev, &option);\n>  \targc = setup_revisions(argc, argv, &rev, NULL);\n\nThis change is risky, as the loop below (which this patch moves to\nparse_distinct_options()) has no knowledge of other options that\nsetup_revisions() helper is prepared to handle and that takes an\nargument.  When parsing \"git cmd --opt --cached A\", setup_revisions()\nmay know that --opt takes an argument and eat both (i.e. the\n\"--cached\" is not an option but an arg given to \"--opt\"), but the\nnew parse_distinct_options() helper does not; it will happily skip\n\"--opt\" and leave it in, mistake \"--cached\" as an option and remove,\nand instead make \"A\" the arg given to \"--opt\".\n\nPicking up the remnant _after_ setup_revisions() ate what it\nunderstands would not have such a downside, as long as none of our\n\"distinct options\" take any argument.\n\nCan't we make \"-m means something special for diff-index\" without\nbutchering the command line processing in this step?  diff-index\ndoes not care about --diff-merges, so letting setup_revisions()\nremember only the fact that \"-m\" was given while parsing, and then\npostprocess what \"-m\" means depending on the command (i.e. everybody\nelse would treat it as a short-hand for \"--diff-merges=m\" plus \"we\nneed some form of diff output, while allowing \"diff-index\" to treat\nit differently) should not be rocket science.\n\nThanks.\n"},{"id":"424097","messageId":"xmqqsg2toqik.fsf@gitster.g","threadId":"55579","inReplyTo":"20210510153451.15090-7-sorganov@gmail.com","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-05-11T04:14:59Z","receivedAt":"2021-05-11T04:15:03Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sergey Organov <sorganov@gmail.com> writes:\n\n> Fix long standing inconsistency between -c/--cc that do imply -p, on\n> one side, and -m that did not imply -p, on the other side.\n>\n> After this patch\n>\n>   git log -m\n>\n> will start to produce diffs without need to provide -p as well, that\n> improves both consistency and usability. It gets even more useful if\n> one sets \"log.diffMerges\" configuration variable to \"first-parent\" to\n> force -m produce usual diff with respect to first parent only.\n\nPlease make sure that you clearly state that you do not blindly\nforce --patch output in the proposed log message.  Explicitly\nmentioning that \"git log --stat -m\" would not give a patch but just\ndiffstat would be assuring.\n\nAlso this needs a test to ensure that is what happens.  Having a\ntest for \"log -m\" and another for \"log -m --stat\" would be\nsufficient.\n\nAnd in the context of this step, the rename of the member in the\nprevious step makes quite a lot of sense.\n\nThanks for working on this topic.\n"},{"id":"424099","messageId":"xmqqo8dhool7.fsf@gitster.g","threadId":"55579","inReplyTo":"xmqqsg2toqik.fsf@gitster.g","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-05-11T04:56:36Z","receivedAt":"2021-05-11T04:56:43Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Sergey Organov <sorganov@gmail.com> writes:\n>\n>> Fix long standing inconsistency between -c/--cc that do imply -p, on\n>> one side, and -m that did not imply -p, on the other side.\n>>\n>> After this patch\n>>\n>>   git log -m\n>>\n>> will start to produce diffs without need to provide -p as well, that\n>> improves both consistency and usability. It gets even more useful if\n>> one sets \"log.diffMerges\" configuration variable to \"first-parent\" to\n>> force -m produce usual diff with respect to first parent only.\n>\n> Please make sure that you clearly state that you do not blindly\n> force --patch output in the proposed log message.  Explicitly\n> mentioning that \"git log --stat -m\" would not give a patch but just\n> diffstat would be assuring.\n\nAlso, avoid \"-p\" in the title.  \"let -m imply diff generation\" might\nbe a good compromise.\n\nWhat --cc/-c implies is to show some kind of diff for merges\n(dense_combined_merges, combine_merges and !ignore_merges are the\nmembers of the revs field that controls how merge commits) and they\nask for specific kind of diff is shown.  So \"-c/--cc imply -p\" is\nquite wrong (you never get straight --patch output for merges when\nyou give -c/--cc---you get combined diff).  In a sense, you could\nsay -c/--cc implies -m (i.e. do show some kind of diff for merges).\n\nTaken together, perhaps:\n\n    Subject: diff: let -m imply diff generation\n\n    The \"-c/--cc\" options to \"git log\" asks for merges to be shown\n    with patch-like output, implicitly enabling the \"-m\" option\n    (which is used to tell \"do not ignore merge commits when showing\n    patches).  However, the opposite is not true; giving \"-m\" alone\n    does not tell \"git log\" that the user wants some form of patches.\n    \n    Make \"-m\" imply \"we want some form of diff output\", so that \"git\n    log -m\" would behave identically to \"git log -m -p\".  When the\n    user explicitly asks for what kind of diff output is desired,\n    e.g. \"git log -m --stat\", there is no need to imply anything,\n    specifically, do NOT blindly turn on the \"-p: option to turn it\n    into \"git log -m --stat -p:.\n\nor something like that.\n\nIf we enable \"some kind of diff\" for \"-m\", I actually think that by\ndefault \"git log -m\" should be turned into \"log --cc\".  As you told\nAlex in your response, \"log -m -p\" is a quite unpleasant format to\nread---it is there only because it was the only thing we had before\nwe invented \"-c/--cc\".\n\nBut that might be outside the scope of this series.  I dunno, but if\nthere is no other constraints (like backward compatibility issues),\nI have a moderately strong preference to use \"--cc\" over \"-m -p\"\nfrom the get go for unconfigured people, rather than forcing\neverybody to configure\n\n> Also this needs a test to ensure that is what happens.  Having a\n> test for \"log -m\" and another for \"log -m --stat\" would be\n> sufficient.\n>\n> And in the context of this step, the rename of the member in the\n> previous step makes quite a lot of sense.\n>\n> Thanks for working on this topic.\n"},{"id":"424103","messageId":"xmqqfsytonbx.fsf@gitster.g","threadId":"55579","inReplyTo":"xmqqwns5oqrm.fsf@gitster.g","subject":"Re: [PATCH 2/6] diff-merges: move specific diff-index \"-m\" handling to diff-index","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-05-11T05:23:46Z","receivedAt":"2021-05-11T05:23:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> This change is risky, as the loop below (which this patch moves to\n> parse_distinct_options()) has no knowledge of other options that\n> setup_revisions() helper is prepared to handle and that takes an\n> argument.  When parsing \"git cmd --opt --cached A\", setup_revisions()\n> may know that --opt takes an argument and eat both (i.e. the\n> \"--cached\" is not an option but an arg given to \"--opt\"), but the\n> new parse_distinct_options() helper does not; it will happily skip\n> \"--opt\" and leave it in, mistake \"--cached\" as an option and remove,\n> and instead make \"A\" the arg given to \"--opt\".\n\nThe above is not theoretical.  The series breaks\n\n    $ git checkout master\n    $ git diff-index -S --cached maint\n\nIOW, what I predicted in the previous message with s/--opt/-S/\nhappens with this step.\n\n> Picking up the remnant _after_ setup_revisions() ate what it\n> understands would not have such a downside, as long as none of our\n> \"distinct options\" take any argument.\n>\n> Can't we make \"-m means something special for diff-index\" without\n> butchering the command line processing in this step?  diff-index\n> does not care about --diff-merges, so letting setup_revisions()\n> remember only the fact that \"-m\" was given while parsing, and then\n> postprocess what \"-m\" means depending on the command (i.e. everybody\n> else would treat it as a short-hand for \"--diff-merges=m\" plus \"we\n> need some form of diff output, while allowing \"diff-index\" to treat\n> it differently) should not be rocket science.\n>\n> Thanks.\n"},{"id":"424104","messageId":"xmqqbl9homj7.fsf@gitster.g","threadId":"55579","inReplyTo":"xmqqfsytonbx.fsf@gitster.g","subject":"Re: [PATCH 2/6] diff-merges: move specific diff-index \"-m\" handling to diff-index","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-05-11T05:41:00Z","receivedAt":"2021-05-11T05:41:05Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I'll insert the following immediately after this step as a reminder\nfor ourselves while queuing.\n\n---- >8 -------- >8 -------- >8 -------- >8 -------- >8 ----\nSubject: [PATCH] t4062: diff-index -S can take its string as a separate arg\n\nButchering the command line parser in a wrong way can break this\ntest, confusing the parser to mistake \"--cached\" which is a mere\nargument to the \"-S\" option as \"compare the tree with the index\"\noption.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t4062-diff-pickaxe.sh | 5 +++++\n 1 file changed, 5 insertions(+)\n\ndiff --git a/t/t4062-diff-pickaxe.sh b/t/t4062-diff-pickaxe.sh\nindex 1130c8019b..1c93812378 100755\n--- a/t/t4062-diff-pickaxe.sh\n+++ b/t/t4062-diff-pickaxe.sh\n@@ -26,4 +26,9 @@ test_expect_success '-S --pickaxe-regex' '\n \tverbose test 4096-zeroes.txt = \"$(cat out)\"\n '\n \n+test_expect_failure '-S with separate option should not error out' '\n+\t# \"--cached\" here is not an option---it is an arg to \"-S\"\n+\tgit diff-index -S --cached HEAD^\n+'\n+\n test_done\n-- \n2.31.1-734-g054d640baf\n\n"},{"id":"424133","messageId":"871radwfl7.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"xmqqwns5oqrm.fsf@gitster.g","subject":"Re: [PATCH 2/6] diff-merges: move specific diff-index \"-m\" handling to diff-index","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-11T13:43:48Z","receivedAt":"2021-05-11T13:43:54Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Sergey Organov <sorganov@gmail.com> writes:\n>\n>>  int cmd_diff_index(int argc, const char **argv, const char *prefix)\n>>  {\n>>  \tstruct rev_info rev;\n>>  \tunsigned int option = 0;\n>> -\tint i;\n>>  \tint result;\n>>  \n>>  \tif (argc == 2 && !strcmp(argv[1], \"-h\"))\n>> @@ -27,17 +53,16 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)\n>>  \trev.abbrev = 0;\n>>  \tprefix = precompose_argv_prefix(argc, argv, prefix);\n>>  \n>> +\t/*\n>> +\t * It's essential to parse our distinct options before calling\n>> +\t * setup_revisions(), for the latter not to see \"-m\".\n>> +\t */\n>> +\targc = parse_distinct_options(argc, argv, &rev, &option);\n>>  \targc = setup_revisions(argc, argv, &rev, NULL);\n>\n> This change is risky, as the loop below (which this patch moves to\n> parse_distinct_options()) has no knowledge of other options that\n> setup_revisions() helper is prepared to handle and that takes an\n> argument.  When parsing \"git cmd --opt --cached A\", setup_revisions()\n> may know that --opt takes an argument and eat both (i.e. the\n> \"--cached\" is not an option but an arg given to \"--opt\"), but the\n> new parse_distinct_options() helper does not; it will happily skip\n> \"--opt\" and leave it in, mistake \"--cached\" as an option and remove,\n> and instead make \"A\" the arg given to \"--opt\".\n>\n> Picking up the remnant _after_ setup_revisions() ate what it\n> understands would not have such a downside, as long as none of our\n> \"distinct options\" take any argument.\n>\n> Can't we make \"-m means something special for diff-index\" without\n> butchering the command line processing in this step?  diff-index\n> does not care about --diff-merges, so letting setup_revisions()\n> remember only the fact that \"-m\" was given while parsing, and then\n> postprocess what \"-m\" means depending on the command (i.e. everybody\n> else would treat it as a short-hand for \"--diff-merges=m\" plus \"we\n> need some form of diff output, while allowing \"diff-index\" to treat\n> it differently) should not be rocket science.\n\nI have already considered a few ways of doing it, and what I came up\nwith looked least destructive to me at the moment, especially as it\nbroke no tests whatsoever.\n\nI'll now re-consider my approach because of your observations, thanks!\n\n-- Sergey Organov\n"},{"id":"424134","messageId":"87v97pv04p.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"xmqqo8dhool7.fsf@gitster.g","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-11T14:03:02Z","receivedAt":"2021-05-11T14:03:11Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n\n[...]\n\n> If we enable \"some kind of diff\" for \"-m\", I actually think that by\n> default \"git log -m\" should be turned into \"log --cc\".  As you told\n> Alex in your response, \"log -m -p\" is a quite unpleasant format to\n> read---it is there only because it was the only thing we had before\n> we invented \"-c/--cc\".\n\nPlease, no! --cc has unfortunate feature of outputting exactly nothing\nfor a lot of merge commits, causing even more confusion than historical\n\"-m -p\" format.\n\nThe best default for -m output is --diff-merges=first-parent. Everybody\nis familiar with it, and it's useful.\n\n> But that might be outside the scope of this series.  I dunno, but if\n> there is no other constraints (like backward compatibility issues),\n> I have a moderately strong preference to use \"--cc\" over \"-m -p\"\n> from the get go for unconfigured people, rather than forcing\n> everybody to configure\n\nI rather have strong preference for --diff-merges=first-parent. --cc is\nonly suitable for Git experts, and they know how to get what they want\nanyway. Yep, by using --cc. Why spare yet another short option for that?\n\nOverall, let's rather make -m give diff to the first parent by default.\nSimple. Useful. Not confusing.\n\nThanks,\n-- Sergey Organov\n"},{"id":"424141","messageId":"87pmxxqln9.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"xmqqo8dhool7.fsf@gitster.g","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-11T16:29:30Z","receivedAt":"2021-05-11T16:29:38Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> Sergey Organov <sorganov@gmail.com> writes:\n>>\n>>> Fix long standing inconsistency between -c/--cc that do imply -p, on\n>>> one side, and -m that did not imply -p, on the other side.\n>>>\n>>> After this patch\n>>>\n>>>   git log -m\n>>>\n>>> will start to produce diffs without need to provide -p as well, that\n>>> improves both consistency and usability. It gets even more useful if\n>>> one sets \"log.diffMerges\" configuration variable to \"first-parent\" to\n>>> force -m produce usual diff with respect to first parent only.\n>>\n>> Please make sure that you clearly state that you do not blindly\n>> force --patch output in the proposed log message.  Explicitly\n>> mentioning that \"git log --stat -m\" would not give a patch but just\n>> diffstat would be assuring.\n>\n> Also, avoid \"-p\" in the title.  \"let -m imply diff generation\" might\n> be a good compromise.\n>\n> What --cc/-c implies is to show some kind of diff for merges\n> (dense_combined_merges, combine_merges and !ignore_merges are the\n> members of the revs field that controls how merge commits) and they\n> ask for specific kind of diff is shown.  So \"-c/--cc imply -p\" is\n> quite wrong (you never get straight --patch output for merges when\n> you give -c/--cc---you get combined diff).  In a sense, you could\n> say -c/--cc implies -m (i.e. do show some kind of diff for merges).\n>\n> Taken together, perhaps:\n>\n>     Subject: diff: let -m imply diff generation\n>\n>     The \"-c/--cc\" options to \"git log\" asks for merges to be shown\n>     with patch-like output, implicitly enabling the \"-m\" option\n>     (which is used to tell \"do not ignore merge commits when showing\n>     patches).  However, the opposite is not true; giving \"-m\" alone\n>     does not tell \"git log\" that the user wants some form of patches.\n>     \n>     Make \"-m\" imply \"we want some form of diff output\", so that \"git\n>     log -m\" would behave identically to \"git log -m -p\".  When the\n>     user explicitly asks for what kind of diff output is desired,\n>     e.g. \"git log -m --stat\", there is no need to imply anything,\n>     specifically, do NOT blindly turn on the \"-p: option to turn it\n>     into \"git log -m --stat -p:.\n>\n> or something like that.\n\n\nFine with me, will do, thanks!\n\n-- Sergey Organov\n"},{"id":"424142","messageId":"87o8dhqlm0.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"xmqqsg2toqik.fsf@gitster.g","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-11T16:30:15Z","receivedAt":"2021-05-11T16:30:23Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Sergey Organov <sorganov@gmail.com> writes:\n>\n>> Fix long standing inconsistency between -c/--cc that do imply -p, on\n>> one side, and -m that did not imply -p, on the other side.\n>>\n>> After this patch\n>>\n>>   git log -m\n>>\n>> will start to produce diffs without need to provide -p as well, that\n>> improves both consistency and usability. It gets even more useful if\n>> one sets \"log.diffMerges\" configuration variable to \"first-parent\" to\n>> force -m produce usual diff with respect to first parent only.\n>\n> Please make sure that you clearly state that you do not blindly\n> force --patch output in the proposed log message.  Explicitly\n> mentioning that \"git log --stat -m\" would not give a patch but just\n> diffstat would be assuring.\n>\n> Also this needs a test to ensure that is what happens.  Having a\n> test for \"log -m\" and another for \"log -m --stat\" would be\n> sufficient.\n\nOK, will do, thanks!\n\n-- Sergey Organov\n"},{"id":"424144","messageId":"CAMMLpeTL9ZOuHLhqonFOwMu8yC9bETMVzkCZ__F2JsR=0umL3A@mail.gmail.com","threadId":"55579","inReplyTo":"87v97pv04p.fsf@osv.gnss.ru","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Alex Henrie","fromEmail":"alexhenrie24@gmail.com","sentAt":"2021-05-11T17:13:19Z","receivedAt":"2021-05-11T17:13:35Z","isPatch":true,"sender":{"key":"alexhenrie24@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5951993?v=4"},"body":"On Tue, May 11, 2021 at 8:03 AM Sergey Organov <sorganov@gmail.com> wrote:\n>\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n> > Junio C Hamano <gitster@pobox.com> writes:\n>\n> [...]\n>\n> > If we enable \"some kind of diff\" for \"-m\", I actually think that by\n> > default \"git log -m\" should be turned into \"log --cc\".  As you told\n> > Alex in your response, \"log -m -p\" is a quite unpleasant format to\n> > read---it is there only because it was the only thing we had before\n> > we invented \"-c/--cc\".\n>\n> Please, no! --cc has unfortunate feature of outputting exactly nothing\n> for a lot of merge commits, causing even more confusion than historical\n> \"-m -p\" format.\n>\n> The best default for -m output is --diff-merges=first-parent. Everybody\n> is familiar with it, and it's useful.\n>\n> > But that might be outside the scope of this series.  I dunno, but if\n> > there is no other constraints (like backward compatibility issues),\n> > I have a moderately strong preference to use \"--cc\" over \"-m -p\"\n> > from the get go for unconfigured people, rather than forcing\n> > everybody to configure\n>\n> I rather have strong preference for --diff-merges=first-parent. --cc is\n> only suitable for Git experts, and they know how to get what they want\n> anyway. Yep, by using --cc. Why spare yet another short option for that?\n>\n> Overall, let's rather make -m give diff to the first parent by default.\n> Simple. Useful. Not confusing.\n\nHonestly --diff-merges=separate is fine. Two weeks ago, when I started\nthis discussion, I was trying to use `git log -m` and `git show -m` to\nfind which merge commit introduced a particular change. Extremely\nverbose diff output would have been great for that, the confusing part\nwas just that `git show -m` produced diff output and `git log -m` did\nnot.\n\nMaybe what we really want is a new short option like `git log -m1`\nwhich would both enable diff output and set --diff-merges=1.\n\nBut again, I don't have a strong opinion on which particular diff\noutput is \"the best\", so I'm happy to leave that decision to the\nexperts.\n\n-Alex\n"},{"id":"424158","messageId":"CABPp-BEwp5bWWaBkv-G+OAJgd+pcsB=GoMCBd+gnhK5JAAnFgQ@mail.gmail.com","threadId":"55579","inReplyTo":"87v97pv04p.fsf@osv.gnss.ru","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2021-05-11T18:31:03Z","receivedAt":"2021-05-11T18:31:18Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Tue, May 11, 2021 at 7:03 AM Sergey Organov <sorganov@gmail.com> wrote:\n>\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n> > Junio C Hamano <gitster@pobox.com> writes:\n>\n> [...]\n>\n> > If we enable \"some kind of diff\" for \"-m\", I actually think that by\n> > default \"git log -m\" should be turned into \"log --cc\".  As you told\n> > Alex in your response, \"log -m -p\" is a quite unpleasant format to\n> > read---it is there only because it was the only thing we had before\n> > we invented \"-c/--cc\".\n>\n> Please, no! --cc has unfortunate feature of outputting exactly nothing\n> for a lot of merge commits, causing even more confusion than historical\n> \"-m -p\" format.\n>\n> The best default for -m output is --diff-merges=first-parent. Everybody\n> is familiar with it, and it's useful.\n>\n> > But that might be outside the scope of this series.  I dunno, but if\n> > there is no other constraints (like backward compatibility issues),\n> > I have a moderately strong preference to use \"--cc\" over \"-m -p\"\n> > from the get go for unconfigured people, rather than forcing\n> > everybody to configure\n>\n> I rather have strong preference for --diff-merges=first-parent. --cc is\n> only suitable for Git experts, and they know how to get what they want\n> anyway. Yep, by using --cc. Why spare yet another short option for that?\n\nInteresting.  I have a strong preference for --diff-merges=remerge\n(yeah, I know it's not upstream, but it's been ready to submit for\nmonths, but just backed up behind the other ort changes.  Sorry, I\ncan't push those through any faster).  I've had others using it for\nabout 9 months now.\n\nI think --cc is a lot better than -m for helping you find what users\nchanged when they did the merge, but I agree the format is somewhat\ndifficult for many users to understand.  (--diff-merges=remerge, or\n--remerge-diff, fixes these problems, IMO.)  I think\n--diff-merges=first-parent, while fine when explicitly requested on\nthe command line, would be wildly misleading as a default because it\nwould attribute changes to a merge commit that were made elsewhere.\n\n> Overall, let's rather make -m give diff to the first parent by default.\n> Simple. Useful. Not confusing.\n\nI think it's confusing.\n"},{"id":"424171","messageId":"878s4lqfbk.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"CAMMLpeTL9ZOuHLhqonFOwMu8yC9bETMVzkCZ__F2JsR=0umL3A@mail.gmail.com","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-11T18:46:07Z","receivedAt":"2021-05-11T18:46:15Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Alex Henrie <alexhenrie24@gmail.com> writes:\n\n> On Tue, May 11, 2021 at 8:03 AM Sergey Organov <sorganov@gmail.com> wrote:\n>>\n>> Junio C Hamano <gitster@pobox.com> writes:\n>>\n>> > Junio C Hamano <gitster@pobox.com> writes:\n>>\n>> [...]\n>>\n>> > If we enable \"some kind of diff\" for \"-m\", I actually think that by\n>> > default \"git log -m\" should be turned into \"log --cc\".  As you told\n>> > Alex in your response, \"log -m -p\" is a quite unpleasant format to\n>> > read---it is there only because it was the only thing we had before\n>> > we invented \"-c/--cc\".\n>>\n>> Please, no! --cc has unfortunate feature of outputting exactly nothing\n>> for a lot of merge commits, causing even more confusion than historical\n>> \"-m -p\" format.\n>>\n>> The best default for -m output is --diff-merges=first-parent. Everybody\n>> is familiar with it, and it's useful.\n>>\n>> > But that might be outside the scope of this series.  I dunno, but if\n>> > there is no other constraints (like backward compatibility issues),\n>> > I have a moderately strong preference to use \"--cc\" over \"-m -p\"\n>> > from the get go for unconfigured people, rather than forcing\n>> > everybody to configure\n>>\n>> I rather have strong preference for --diff-merges=first-parent. --cc is\n>> only suitable for Git experts, and they know how to get what they want\n>> anyway. Yep, by using --cc. Why spare yet another short option for that?\n>>\n>> Overall, let's rather make -m give diff to the first parent by default.\n>> Simple. Useful. Not confusing.\n>\n> Honestly --diff-merges=separate is fine. Two weeks ago, when I started\n> this discussion, I was trying to use `git log -m` and `git show -m` to\n> find which merge commit introduced a particular change. Extremely\n> verbose diff output would have been great for that, the confusing part\n> was just that `git show -m` produced diff output and `git log -m` did\n> not.\n\nThis is not a case in favor of \"separate\" over \"first-parent\" as the\ndefault for \"-m\", right?\n\n\"Which merge commit introduced particular change\" is exactly what\n--diff-merges=1 achieves, so \"--diff-merges=separate\" was not in fact\nneeded, as I see it. Moreover, it could have produced wrong positives.\nLooks like --diff-merges=1 is a better fit.\n\n> Maybe what we really want is a new short option like `git log -m1`\n> which would both enable diff output and set --diff-merges=1.\n\nHopefully this will be simply \"-m\" soon. \"-m1\" is no-go as optional\narguments to short options is a bad idea. It could have been \"--m1\", but\nI believe that's not needed.\n\n>\n> But again, I don't have a strong opinion on which particular diff\n> output is \"the best\", so I'm happy to leave that decision to the\n> experts.\n\nThere is no \"the best\", and at least \"first-parent\" and \"dense-combined\"\nare to survive, and \"dense-combined\" already has its \"--cc\" rather short\nvariant, so it's logical to give -m the other one, especially as it\nalready has this meaning when --first-parent is provided as well.\n\nAlso, I'm not sure if -c is being in use, and if it isn't, then it could\nbe changed to produce dense-combined format, especially as one still\nhave --diff-merges=condensed nowadays anyway, so that -m and -c will\nfinally give 2 most useful formats.\n\nOverall, I still find a lot of sense in giving \"-m\" exactly first-parent\ndefault meaning.\n\nThanks,\n-- Sergey Organov\n\nP.S. If generic options machinery were in use, it could have been\npossible to say:\n\n  git log -pm\n\nreducing the issue to consistency only. I wonder if anybody have plans\nto convert setup_revisions() to parse_options() utility?\n\n"},{"id":"424174","messageId":"874kf9qeof.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"CABPp-BEwp5bWWaBkv-G+OAJgd+pcsB=GoMCBd+gnhK5JAAnFgQ@mail.gmail.com","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-11T19:00:00Z","receivedAt":"2021-05-11T19:00:06Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Elijah Newren <newren@gmail.com> writes:\n\n> On Tue, May 11, 2021 at 7:03 AM Sergey Organov <sorganov@gmail.com> wrote:\n>>\n>> Junio C Hamano <gitster@pobox.com> writes:\n>>\n>> > Junio C Hamano <gitster@pobox.com> writes:\n>>\n>> [...]\n>>\n>> > If we enable \"some kind of diff\" for \"-m\", I actually think that by\n>> > default \"git log -m\" should be turned into \"log --cc\".  As you told\n>> > Alex in your response, \"log -m -p\" is a quite unpleasant format to\n>> > read---it is there only because it was the only thing we had before\n>> > we invented \"-c/--cc\".\n>>\n>> Please, no! --cc has unfortunate feature of outputting exactly nothing\n>> for a lot of merge commits, causing even more confusion than historical\n>> \"-m -p\" format.\n>>\n>> The best default for -m output is --diff-merges=first-parent. Everybody\n>> is familiar with it, and it's useful.\n>>\n>> > But that might be outside the scope of this series.  I dunno, but if\n>> > there is no other constraints (like backward compatibility issues),\n>> > I have a moderately strong preference to use \"--cc\" over \"-m -p\"\n>> > from the get go for unconfigured people, rather than forcing\n>> > everybody to configure\n>>\n>> I rather have strong preference for --diff-merges=first-parent. --cc is\n>> only suitable for Git experts, and they know how to get what they want\n>> anyway. Yep, by using --cc. Why spare yet another short option for that?\n>\n> Interesting.  I have a strong preference for --diff-merges=remerge\n> (yeah, I know it's not upstream, but it's been ready to submit for\n> months, but just backed up behind the other ort changes.  Sorry, I\n> can't push those through any faster).  I've had others using it for\n> about 9 months now.\n\nOnce somebody uses it for 9 months and starts to understand what it is\nand really loves it, she can still set log.diffMerges=remerge (new\nfeature) and have fun.\n\n>\n> I think --cc is a lot better than -m for helping you find what users\n> changed when they did the merge,\n\nYes, but it doesn't mean it should be the default.\n\nIn my workflows, the first thing that matters is what commit did what\nchanges on the current branch. I don't typically care what the user\nchanged during the merge operation, only about the result. If I do care,\nthen only after I find the merge commit is responsible, and I can then\nuse --cc if I want to.\n\n> but I agree the format is somewhat difficult for many users to\n> understand. (--diff-merges=remerge, or --remerge-diff, fixes these\n> problems, IMO.) I think --diff-merges=first-parent, while fine when\n> explicitly requested on the command line, would be wildly misleading\n> as a default because it would attribute changes to a merge commit that\n> were made elsewhere.\n\nNo, it's exactly this merge commit that made these changes to the\ncurrent branch. The changes you refer to have been made on another\nbranch, and not by this particular merge commit, and we fortunately have\nthe reference to those commits through the second parent of this one.\n\n>\n>> Overall, let's rather make -m give diff to the first parent by default.\n>> Simple. Useful. Not confusing.\n>\n> I think it's confusing.\n\nI think it isn't, once you accept that merge commit does introduce\nchanges to the branch, by itself.\n\nThanks,\n-- Sergey Organov\n"},{"id":"424187","messageId":"CAMMLpeR0eeM1droa3sxeToxw+8ACtJM3+3=SkWR9qrWbK_9sDQ@mail.gmail.com","threadId":"55579","inReplyTo":"878s4lqfbk.fsf@osv.gnss.ru","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Alex Henrie","fromEmail":"alexhenrie24@gmail.com","sentAt":"2021-05-11T19:53:22Z","receivedAt":"2021-05-11T19:53:40Z","isPatch":true,"sender":{"key":"alexhenrie24@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5951993?v=4"},"body":"On Tue, May 11, 2021 at 12:46 PM Sergey Organov <sorganov@gmail.com> wrote:\n>\n> Alex Henrie <alexhenrie24@gmail.com> writes:\n>\n> > On Tue, May 11, 2021 at 8:03 AM Sergey Organov <sorganov@gmail.com> wrote:\n> >>\n> >> Junio C Hamano <gitster@pobox.com> writes:\n> >>\n> >> > Junio C Hamano <gitster@pobox.com> writes:\n> >>\n> >> [...]\n> >>\n> >> > If we enable \"some kind of diff\" for \"-m\", I actually think that by\n> >> > default \"git log -m\" should be turned into \"log --cc\".  As you told\n> >> > Alex in your response, \"log -m -p\" is a quite unpleasant format to\n> >> > read---it is there only because it was the only thing we had before\n> >> > we invented \"-c/--cc\".\n> >>\n> >> Please, no! --cc has unfortunate feature of outputting exactly nothing\n> >> for a lot of merge commits, causing even more confusion than historical\n> >> \"-m -p\" format.\n> >>\n> >> The best default for -m output is --diff-merges=first-parent. Everybody\n> >> is familiar with it, and it's useful.\n> >>\n> >> > But that might be outside the scope of this series.  I dunno, but if\n> >> > there is no other constraints (like backward compatibility issues),\n> >> > I have a moderately strong preference to use \"--cc\" over \"-m -p\"\n> >> > from the get go for unconfigured people, rather than forcing\n> >> > everybody to configure\n> >>\n> >> I rather have strong preference for --diff-merges=first-parent. --cc is\n> >> only suitable for Git experts, and they know how to get what they want\n> >> anyway. Yep, by using --cc. Why spare yet another short option for that?\n> >>\n> >> Overall, let's rather make -m give diff to the first parent by default.\n> >> Simple. Useful. Not confusing.\n> >\n> > Honestly --diff-merges=separate is fine. Two weeks ago, when I started\n> > this discussion, I was trying to use `git log -m` and `git show -m` to\n> > find which merge commit introduced a particular change. Extremely\n> > verbose diff output would have been great for that, the confusing part\n> > was just that `git show -m` produced diff output and `git log -m` did\n> > not.\n>\n> This is not a case in favor of \"separate\" over \"first-parent\" as the\n> default for \"-m\", right?\n>\n> \"Which merge commit introduced particular change\" is exactly what\n> --diff-merges=1 achieves, so \"--diff-merges=separate\" was not in fact\n> needed, as I see it. Moreover, it could have produced wrong positives.\n> Looks like --diff-merges=1 is a better fit.\n\nI didn't know which branch the change came from. If the change came\nfrom the first branch, it would not have appeared under the merge\ncommit with --diff-merges=first-parent. But the change would\ndefinitely appear with --diff-merges=separate, which enabled me to\nidentify the merge commit that included it. So yes, this is a case in\nfavor of \"separate\" over \"first-parent\", but it's probably not a\ncommon enough scenario to demand keeping \"separate\" for -m.\n\nOn Tue, May 11, 2021 at 12:31 PM Elijah Newren <newren@gmail.com> wrote:\n>\n> Interesting.  I have a strong preference for --diff-merges=remerge\n> (yeah, I know it's not upstream, but it's been ready to submit for\n> months, but just backed up behind the other ort changes.  Sorry, I\n> can't push those through any faster).  I've had others using it for\n> about 9 months now.\n\n--diff-merges=remerge is the default I would expect when no options\nhave been configured or passed on the command line (although it would\nnot have helped in the scenario I described above). I look forward to\nusing it!\n\n-Alex\n"},{"id":"424188","messageId":"CABPp-BHf45K3P8kKfTEWu-acWMdjTz74xvSPJwZVS_o=qagA6w@mail.gmail.com","threadId":"55579","inReplyTo":"874kf9qeof.fsf@osv.gnss.ru","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2021-05-11T19:56:32Z","receivedAt":"2021-05-11T19:56:47Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Tue, May 11, 2021 at 12:00 PM Sergey Organov <sorganov@gmail.com> wrote:\n>\n> Elijah Newren <newren@gmail.com> writes:\n>\n> > On Tue, May 11, 2021 at 7:03 AM Sergey Organov <sorganov@gmail.com> wrote:\n> >>\n> >> Junio C Hamano <gitster@pobox.com> writes:\n> >>\n> >> > Junio C Hamano <gitster@pobox.com> writes:\n> >>\n> >> [...]\n> >>\n> >> > If we enable \"some kind of diff\" for \"-m\", I actually think that by\n> >> > default \"git log -m\" should be turned into \"log --cc\".  As you told\n> >> > Alex in your response, \"log -m -p\" is a quite unpleasant format to\n> >> > read---it is there only because it was the only thing we had before\n> >> > we invented \"-c/--cc\".\n> >>\n> >> Please, no! --cc has unfortunate feature of outputting exactly nothing\n> >> for a lot of merge commits, causing even more confusion than historical\n> >> \"-m -p\" format.\n> >>\n> >> The best default for -m output is --diff-merges=first-parent. Everybody\n> >> is familiar with it, and it's useful.\n> >>\n> >> > But that might be outside the scope of this series.  I dunno, but if\n> >> > there is no other constraints (like backward compatibility issues),\n> >> > I have a moderately strong preference to use \"--cc\" over \"-m -p\"\n> >> > from the get go for unconfigured people, rather than forcing\n> >> > everybody to configure\n> >>\n> >> I rather have strong preference for --diff-merges=first-parent. --cc is\n> >> only suitable for Git experts, and they know how to get what they want\n> >> anyway. Yep, by using --cc. Why spare yet another short option for that?\n> >\n> > Interesting.  I have a strong preference for --diff-merges=remerge\n> > (yeah, I know it's not upstream, but it's been ready to submit for\n> > months, but just backed up behind the other ort changes.  Sorry, I\n> > can't push those through any faster).  I've had others using it for\n> > about 9 months now.\n>\n> Once somebody uses it for 9 months and starts to understand what it is\n> and really loves it, she can still set log.diffMerges=remerge (new\n> feature) and have fun.\n>\n> >\n> > I think --cc is a lot better than -m for helping you find what users\n> > changed when they did the merge,\n>\n> Yes, but it doesn't mean it should be the default.\n\nI didn't say it should be.\n\n> In my workflows, the first thing that matters is what commit did what\n> changes on the current branch. I don't typically care what the user\n> changed during the merge operation, only about the result. If I do care,\n> then only after I find the merge commit is responsible, and I can then\n> use --cc if I want to.\n>\n> > but I agree the format is somewhat difficult for many users to\n> > understand. (--diff-merges=remerge, or --remerge-diff, fixes these\n> > problems, IMO.) I think --diff-merges=first-parent, while fine when\n> > explicitly requested on the command line, would be wildly misleading\n> > as a default because it would attribute changes to a merge commit that\n> > were made elsewhere.\n>\n> No, it's exactly this merge commit that made these changes to the\n> current branch. The changes you refer to have been made on another\n> branch, and not by this particular merge commit, and we fortunately have\n> the reference to those commits through the second parent of this one.\n\nIf you only care about \"what introduced these changes to the current\nbranch\", then it's not only the diff against second parent that is\nirrelevant: ALL commits that are part of the history only via the\nsecond or later parents are also irrelevant and thus you should be\nusing --first-parent when asking this question.  That changes both\nhistory traversal and the diff output.  It's a reasonable question,\nsure, but I didn't see you suggest that -m should change both.\nPerhaps you did mean that, in which case I think that's a proposal\nthat would make -m become useful.  It'd be a drastically different\noption than what -m is today, which would normally make me wonder if\nit'd be considered a backward compatibility issue, but given how\nuseless -m has been and since Junio apparently even suggested changing\n-m, this might be okay.\n\n> >> Overall, let's rather make -m give diff to the first parent by default.\n> >> Simple. Useful. Not confusing.\n> >\n> > I think it's confusing.\n>\n> I think it isn't, once you accept that merge commit does introduce\n> changes to the branch, by itself.\n\nAsking what commits introduced changes to the branch is a useful\nquestion, but one which requires changing history traversal.  Unless\nmaking -m imply --first-parent is part of the proposal, I still find\nit somewhat confusing.\n\nGranted, \"what changes were introduced to the branch?\" is certainly\nnot the only question you might be looking for answers to.  Others\ninclude \"what changes were people making in each commit\" or \"who added\ncalls to this function and why\" (e.g. with git log S$function -p\n$maybe_some_merge_diff_flag) or \"who caused this function to end up\nthe way it is\" (e.g. with git log -L :<funcname>:<file> -p\n$some_diff_merge_flag).  For any of those, a first parent diff is\npretty terrible and highly misleading.  A separate diff is no better.\n--cc would often be useful, with some caveats -- the biggest of which\nis just how esoteric combined-diffs are.  --remerge-diff is way more\nnatural for each of these questions I'm coming up with.  Are there\nother questions that -m helps us answer where first-parent diffs make\nsense and are generally correct without also needing --first-parent?\nI'm not thinking of any right now.\n"},{"id":"424196","messageId":"87v97pnhi5.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"CAMMLpeR0eeM1droa3sxeToxw+8ACtJM3+3=SkWR9qrWbK_9sDQ@mail.gmail.com","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-11T20:27:14Z","receivedAt":"2021-05-11T20:27:20Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Alex Henrie <alexhenrie24@gmail.com> writes:\n\n> On Tue, May 11, 2021 at 12:46 PM Sergey Organov <sorganov@gmail.com> wrote:\n>>\n>> Alex Henrie <alexhenrie24@gmail.com> writes:\n>>\n>> > On Tue, May 11, 2021 at 8:03 AM Sergey Organov <sorganov@gmail.com> wrote:\n>> >>\n>> >> Junio C Hamano <gitster@pobox.com> writes:\n>> >>\n>> >> > Junio C Hamano <gitster@pobox.com> writes:\n>> >>\n>> >> [...]\n>> >>\n>> >> > If we enable \"some kind of diff\" for \"-m\", I actually think that by\n>> >> > default \"git log -m\" should be turned into \"log --cc\".  As you told\n>> >> > Alex in your response, \"log -m -p\" is a quite unpleasant format to\n>> >> > read---it is there only because it was the only thing we had before\n>> >> > we invented \"-c/--cc\".\n>> >>\n>> >> Please, no! --cc has unfortunate feature of outputting exactly nothing\n>> >> for a lot of merge commits, causing even more confusion than historical\n>> >> \"-m -p\" format.\n>> >>\n>> >> The best default for -m output is --diff-merges=first-parent. Everybody\n>> >> is familiar with it, and it's useful.\n>> >>\n>> >> > But that might be outside the scope of this series.  I dunno, but if\n>> >> > there is no other constraints (like backward compatibility issues),\n>> >> > I have a moderately strong preference to use \"--cc\" over \"-m -p\"\n>> >> > from the get go for unconfigured people, rather than forcing\n>> >> > everybody to configure\n>> >>\n>> >> I rather have strong preference for --diff-merges=first-parent. --cc is\n>> >> only suitable for Git experts, and they know how to get what they want\n>> >> anyway. Yep, by using --cc. Why spare yet another short option for that?\n>> >>\n>> >> Overall, let's rather make -m give diff to the first parent by default.\n>> >> Simple. Useful. Not confusing.\n>> >\n>> > Honestly --diff-merges=separate is fine. Two weeks ago, when I started\n>> > this discussion, I was trying to use `git log -m` and `git show -m` to\n>> > find which merge commit introduced a particular change. Extremely\n>> > verbose diff output would have been great for that, the confusing part\n>> > was just that `git show -m` produced diff output and `git log -m` did\n>> > not.\n>>\n>> This is not a case in favor of \"separate\" over \"first-parent\" as the\n>> default for \"-m\", right?\n>>\n>> \"Which merge commit introduced particular change\" is exactly what\n>> --diff-merges=1 achieves, so \"--diff-merges=separate\" was not in fact\n>> needed, as I see it. Moreover, it could have produced wrong positives.\n>> Looks like --diff-merges=1 is a better fit.\n>\n> I didn't know which branch the change came from. If the change came\n> from the first branch, it would not have appeared under the merge\n> commit with --diff-merges=first-parent.\n\nThe change in question either came from this merge, or it didn't. If it\ncame from this merge, it will be there in --diff-merges=first-parent\neven if you have octopus merge and multiple parents, in which case it\nwill be cumulative change from all the side parents.\n\n> But the change would definitely appear with --diff-merges=separate,\n> which enabled me to identify the merge commit that included it.\n\nThe second part of --diff-merges=separate, that is absent in\n--diff-merges=first-parent, shows the diff that this merge would have\nmade to the side branch, if you had considered the result of merge the\ntip of that branch, and you didn't. This second part just makes no sense\nat all when you care about changes to your files in any typical git\nworkflow, as far as I can tell.\n\n> So yes, this is a case in favor of \"separate\" over \"first-parent\", but\n> it's probably not a common enough scenario to demand keeping\n> \"separate\" for -m.\n\nTo me it looks like it rather only shows how deeply confusing\n--diff-merges=separate actually is. I'd just kill it.\n\n\nThanks,\n\n-- Sergey Organov\n"},{"id":"424197","messageId":"87lf8lnh8x.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"CABPp-BHf45K3P8kKfTEWu-acWMdjTz74xvSPJwZVS_o=qagA6w@mail.gmail.com","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-11T20:32:46Z","receivedAt":"2021-05-11T20:32:52Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Elijah Newren <newren@gmail.com> writes:\n\n> On Tue, May 11, 2021 at 12:00 PM Sergey Organov <sorganov@gmail.com> wrote:\n>>\n>> Elijah Newren <newren@gmail.com> writes:\n>>\n>> > On Tue, May 11, 2021 at 7:03 AM Sergey Organov <sorganov@gmail.com> wrote:\n>> >>\n>> >> Junio C Hamano <gitster@pobox.com> writes:\n>> >>\n>> >> > Junio C Hamano <gitster@pobox.com> writes:\n>> >>\n>> >> [...]\n>> >>\n>> >> > If we enable \"some kind of diff\" for \"-m\", I actually think that by\n>> >> > default \"git log -m\" should be turned into \"log --cc\".  As you told\n>> >> > Alex in your response, \"log -m -p\" is a quite unpleasant format to\n>> >> > read---it is there only because it was the only thing we had before\n>> >> > we invented \"-c/--cc\".\n>> >>\n>> >> Please, no! --cc has unfortunate feature of outputting exactly nothing\n>> >> for a lot of merge commits, causing even more confusion than historical\n>> >> \"-m -p\" format.\n>> >>\n>> >> The best default for -m output is --diff-merges=first-parent. Everybody\n>> >> is familiar with it, and it's useful.\n>> >>\n>> >> > But that might be outside the scope of this series.  I dunno, but if\n>> >> > there is no other constraints (like backward compatibility issues),\n>> >> > I have a moderately strong preference to use \"--cc\" over \"-m -p\"\n>> >> > from the get go for unconfigured people, rather than forcing\n>> >> > everybody to configure\n>> >>\n>> >> I rather have strong preference for --diff-merges=first-parent. --cc is\n>> >> only suitable for Git experts, and they know how to get what they want\n>> >> anyway. Yep, by using --cc. Why spare yet another short option for that?\n>> >\n>> > Interesting.  I have a strong preference for --diff-merges=remerge\n>> > (yeah, I know it's not upstream, but it's been ready to submit for\n>> > months, but just backed up behind the other ort changes.  Sorry, I\n>> > can't push those through any faster).  I've had others using it for\n>> > about 9 months now.\n>>\n>> Once somebody uses it for 9 months and starts to understand what it is\n>> and really loves it, she can still set log.diffMerges=remerge (new\n>> feature) and have fun.\n>>\n>> >\n>> > I think --cc is a lot better than -m for helping you find what users\n>> > changed when they did the merge,\n>>\n>> Yes, but it doesn't mean it should be the default.\n>\n> I didn't say it should be.\n>\n>> In my workflows, the first thing that matters is what commit did what\n>> changes on the current branch. I don't typically care what the user\n>> changed during the merge operation, only about the result. If I do care,\n>> then only after I find the merge commit is responsible, and I can then\n>> use --cc if I want to.\n>>\n>> > but I agree the format is somewhat difficult for many users to\n>> > understand. (--diff-merges=remerge, or --remerge-diff, fixes these\n>> > problems, IMO.) I think --diff-merges=first-parent, while fine when\n>> > explicitly requested on the command line, would be wildly misleading\n>> > as a default because it would attribute changes to a merge commit that\n>> > were made elsewhere.\n>>\n>> No, it's exactly this merge commit that made these changes to the\n>> current branch. The changes you refer to have been made on another\n>> branch, and not by this particular merge commit, and we fortunately have\n>> the reference to those commits through the second parent of this one.\n>\n> If you only care about \"what introduced these changes to the current\n> branch\", then it's not only the diff against second parent that is\n> irrelevant: ALL commits that are part of the history only via the\n> second or later parents are also irrelevant and thus you should be\n> using --first-parent when asking this question.  That changes both\n> history traversal and the diff output.\n\nNo, it's exactly why I don't always want --first-parent. I want to\ntraverse *all* the history, yet to see what's changed by every commit on\n*this* branch in the process of traversal, be it a merge on not a merge\ncommit.\n\nThanks,\n\n-- Sergey Organov\n"},{"id":"424200","messageId":"xmqqtun9knmy.fsf@gitster.g","threadId":"55579","inReplyTo":"CABPp-BEwp5bWWaBkv-G+OAJgd+pcsB=GoMCBd+gnhK5JAAnFgQ@mail.gmail.com","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-05-11T20:43:01Z","receivedAt":"2021-05-11T20:43:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Elijah Newren <newren@gmail.com> writes:\n\n> On Tue, May 11, 2021 at 7:03 AM Sergey Organov <sorganov@gmail.com> wrote:\n>> ...\n> I think --cc is a lot better than -m for helping you find what users\n> changed when they did the merge, but I agree the format is somewhat\n> difficult for many users to understand.  (--diff-merges=remerge, or\n> --remerge-diff, fixes these problems, IMO.)  I think\n> --diff-merges=first-parent, while fine when explicitly requested on\n> the command line, would be wildly misleading as a default because it\n> would attribute changes to a merge commit that were made elsewhere.\n>\n>> Overall, let's rather make -m give diff to the first parent by default.\n>> Simple. Useful. Not confusing.\n>\n> I think it's confusing.\n\nI do not think it is particularly confusing---after all, it shows\n\"here is a comparison between two trees\" the users are familiar with\nin a single strand of pearls.\n\nBut I do think that it is an utterly misleading option to show\nmerges in general.  When \"log\" is used with the \"--first-parent\"\ntraversal, \"compare with the first parent to show everything the\nside branch did\" is an acceptable alternative, but even there, it is\nfar less suitable than the \"remerge\" or \"cc\", I would think, as the\ndefault format.\n\nThanks.\n\n"},{"id":"424209","messageId":"87h7j9ne7j.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"xmqqtun9knmy.fsf@gitster.g","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-11T21:38:24Z","receivedAt":"2021-05-11T21:38:42Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Elijah Newren <newren@gmail.com> writes:\n>\n>> On Tue, May 11, 2021 at 7:03 AM Sergey Organov <sorganov@gmail.com> wrote:\n>>> ...\n>> I think --cc is a lot better than -m for helping you find what users\n>> changed when they did the merge, but I agree the format is somewhat\n>> difficult for many users to understand.  (--diff-merges=remerge, or\n>> --remerge-diff, fixes these problems, IMO.)  I think\n>> --diff-merges=first-parent, while fine when explicitly requested on\n>> the command line, would be wildly misleading as a default because it\n>> would attribute changes to a merge commit that were made elsewhere.\n>>\n>>> Overall, let's rather make -m give diff to the first parent by default.\n>>> Simple. Useful. Not confusing.\n>>\n>> I think it's confusing.\n>\n> I do not think it is particularly confusing---after all, it shows\n> \"here is a comparison between two trees\" the users are familiar with\n> in a single strand of pearls.\n\nMoreover, it's comparison between two most natural trees, the same trees\nas for non-merge commits.\n\n>\n> But I do think that it is an utterly misleading option to show\n> merges in general.  When \"log\" is used with the \"--first-parent\"\n> traversal, \"compare with the first parent to show everything the\n> side branch did\" is an acceptable alternative, but even there, it is\n> far less suitable than the \"remerge\" or \"cc\", I would think, as the\n> default format.\n\nWhat I still fail to see is why somebody wants to mix traversal rules\nwith representation of merge commits, sorry.\n\nIf I want to see merges in --cc, I want them in --cc, no matter which\nway I get to particular commit through the DAG. If I want to see them in\n--diff-merges=1, I want them this way, no matter how I happened to get\nto particular commit.\n\nIs it more likely that I want to see merges in --diff-merges=1 when I\nuse --first-parent? Yes, of course! That's why --first-parent implies\n--diff-merges=1. Vice versa? No, why?\n\nThanks,\n\n-- Sergey Organov\n"},{"id":"424225","messageId":"xmqqcztwj0ty.fsf@gitster.g","threadId":"55579","inReplyTo":"87h7j9ne7j.fsf@osv.gnss.ru","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-05-11T23:40:57Z","receivedAt":"2021-05-11T23:41:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sergey Organov <sorganov@gmail.com> writes:\n\n>> But I do think that it is an utterly misleading option to show\n>> merges in general.  When \"log\" is used with the \"--first-parent\"\n>> traversal, \"compare with the first parent to show everything the\n>> side branch did\" is an acceptable alternative, but even there, it is\n>> far less suitable than the \"remerge\" or \"cc\", I would think, as the\n>> default format.\n>\n> What I still fail to see is why somebody wants to mix traversal rules\n> with representation of merge commits, sorry.\n\nIt is not about \"mixing\".\n\nWhat I meant was that diff between the pre-merge state and the merge\nresult as two-tree comparison may be an acceptable view of \"what did\nthis _merge_ contribute to the history\" and that is in line is what\nthe first-parent traversal is trying to show the reader of the\nhistory, which is \"this merge contributed to the history, and then\nthis other merge contributed to the history, ...\".  It also may make\nsense when one is inspecting a merge in isolation, i.e. \"git show M\".\n\nWhen one is viewing individual commits without omitting commits on\nthe side branch, however, showing \"what did the side branch as a\nwhole contributed to the history at this merge\" makes little sense\nand is misleading.  Such a patch given for a merge mostly overlaps\nwith what the reader sees immediately after seeing the merge\n(i.e. the commits on the side branch, with their own patches, each\nof which has already been shown in the first-parent comparison of\nthe merge).  In other words, \"git log --no-first-parent\" is about\ncontribution of each single commit (whether it is a merge or a\nnon-merge) makes, and the --diff-merges=1 presentation is not in\nline with that worldview, in which the contribution to the history\nthe merge alone makes is what --cc or remerge tries to show,\ni.e. \"what did the merge do, on top of what the commits on the side\nbranch contributed to the history?\"\n\nSo, it is not like two unrelated things are mixed together.  It is\nmore like showing the result of a merge as a diff relative to its\nfirst-parent is tied to and consistent with the viewpoint of history\nas single strand of pearls that is a series of merges into the\nfirst-parent chain, but not with non-first-parent presentation of\nthe history.\n"},{"id":"424244","messageId":"609b2c71c62ff_678ff208f7@natae.notmuch","threadId":"55579","inReplyTo":"87v97pnhi5.fsf@osv.gnss.ru","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2021-05-12T01:16:33Z","receivedAt":"2021-05-12T01:16:38Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Sergey Organov wrote:\n> Alex Henrie <alexhenrie24@gmail.com> writes:\n> \n> > I didn't know which branch the change came from. If the change came\n> > from the first branch, it would not have appeared under the merge\n> > commit with --diff-merges=first-parent.\n> \n> The change in question either came from this merge, or it didn't. If it\n> came from this merge, it will be there in --diff-merges=first-parent\n> even if you have octopus merge and multiple parents, in which case it\n> will be cumulative change from all the side parents.\n\nPrecisely.\n\nThe primary thing I care about is what is the status of the branch\n*after* the merge. In other words; if I rewind history and I hadn't done\nthe merge, what would be diffent?\n\nThat in my mind is the actual content of the merge.\n\n-- \nFelipe Contreras\n"},{"id":"424735","messageId":"87eee5v7q0.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"xmqqo8dhool7.fsf@gitster.g","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-17T12:57:11Z","receivedAt":"2021-05-17T12:57:20Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> Sergey Organov <sorganov@gmail.com> writes:\n>>\n>>> Fix long standing inconsistency between -c/--cc that do imply -p, on\n>>> one side, and -m that did not imply -p, on the other side.\n>>>\n>>> After this patch\n>>>\n>>>   git log -m\n>>>\n>>> will start to produce diffs without need to provide -p as well, that\n>>> improves both consistency and usability. It gets even more useful if\n>>> one sets \"log.diffMerges\" configuration variable to \"first-parent\" to\n>>> force -m produce usual diff with respect to first parent only.\n>>\n>> Please make sure that you clearly state that you do not blindly\n>> force --patch output in the proposed log message.  Explicitly\n>> mentioning that \"git log --stat -m\" would not give a patch but just\n>> diffstat would be assuring.\n>\n> Also, avoid \"-p\" in the title.  \"let -m imply diff generation\" might\n> be a good compromise.\n>\n> What --cc/-c implies is to show some kind of diff for merges\n> (dense_combined_merges, combine_merges and !ignore_merges are the\n> members of the revs field that controls how merge commits) and they\n> ask for specific kind of diff is shown.  So \"-c/--cc imply -p\" is\n> quite wrong (you never get straight --patch output for merges when\n> you give -c/--cc---you get combined diff).  In a sense, you could\n> say -c/--cc implies -m (i.e. do show some kind of diff for merges).\n>\n> Taken together, perhaps:\n>\n>     Subject: diff: let -m imply diff generation\n>\n>     The \"-c/--cc\" options to \"git log\" asks for merges to be shown\n>     with patch-like output, implicitly enabling the \"-m\" option\n>     (which is used to tell \"do not ignore merge commits when showing\n>     patches).  However, the opposite is not true; giving \"-m\" alone\n>     does not tell \"git log\" that the user wants some form of patches.\n>     \n>     Make \"-m\" imply \"we want some form of diff output\", so that \"git\n>     log -m\" would behave identically to \"git log -m -p\".  When the\n>     user explicitly asks for what kind of diff output is desired,\n>     e.g. \"git log -m --stat\", there is no need to imply anything,\n>     specifically, do NOT blindly turn on the \"-p: option to turn it\n>     into \"git log -m --stat -p:.\n>\n> or something like that.\n\nWhile working on this, I've added more tests and explanations to the\nnext re-roll as I've promised, but I didn't change the subject nor did I\ntry to explain that much, as my original subject is consistent with\ncurrent Git documentation, concise, and straight to the point.\n\n\"<opt> implies -p\" -- that's how current Git manual describes the\nbehavior, and that's how I described it in these patches. Whatever\n\"imply\" actually means for -c/--cc, it now means for -m as well, and\nthat's the essence of the patches, so I stand for my original subject.\n\nI think that if we realize that \"<opt> implies -p\" is not precise enough\ndescription of actual behavior, it should be a separate topic of\ndocumentation improvements, and doesn't belong to these series anyway.\n\nThanks,\n-- Sergey Organov\n"},{"id":"424749","messageId":"20210517155818.32224-2-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210517155818.32224-1-sorganov@gmail.com","subject":"[PATCH v1 1/9] t4013: test that \"-m\" alone has no effect in \"git log\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-17T15:58:10Z","receivedAt":"2021-05-17T16:43:31Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"This is to notice current behavior that we are going to change when\nwhen we start to imply \"-p\" by \"-m\".\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n t/t4013-diff-various.sh | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\ndiff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh\nindex 87def81699bf..e9f67cd24351 100755\n--- a/t/t4013-diff-various.sh\n+++ b/t/t4013-diff-various.sh\n@@ -452,6 +452,14 @@ diff-tree --stat --compact-summary initial mode\n diff-tree -R --stat --compact-summary initial mode\n EOF\n \n+test_expect_success 'log -m matches pure log' '\n+\tgit log master >result &&\n+\tprocess_diffs result >expected &&\n+\tgit log -m >result &&\n+\tprocess_diffs result >actual &&\n+\ttest_cmp expected actual\n+'\n+\n test_expect_success 'log --diff-merges=on matches --diff-merges=separate' '\n \tgit log -p --diff-merges=separate master >result &&\n \tprocess_diffs result >expected &&\n-- \n2.25.1\n\n"},{"id":"424750","messageId":"20210517155818.32224-5-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210517155818.32224-1-sorganov@gmail.com","subject":"[PATCH v1 4/9] t4013: test \"git diff-index -m\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-17T15:58:13Z","receivedAt":"2021-05-17T16:43:32Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"-m in \"git diff-index\" means \"match missing\", that differs\nfrom its meaning in \"git diff\". Let's check it in diff-index.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n t/t4013-diff-various.sh | 13 +++++++++++++\n 1 file changed, 13 insertions(+)\n\ndiff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh\nindex e53ca7aa503f..c35cc73d08bd 100755\n--- a/t/t4013-diff-various.sh\n+++ b/t/t4013-diff-various.sh\n@@ -493,6 +493,19 @@ test_expect_success 'git config log.diffMerges first-parent vs -m' '\n \ttest_cmp expected actual\n '\n \n+# -m in \"git diff-index\" means \"match missing\", that differs\n+# from its meaning in \"git diff\". Let's check it in diff-index.\n+# The line in the output for removed file should disappear when\n+# we provide -m in diff-index.\n+test_expect_success 'git diff-index -m' '\n+\trm -f file1 &&\n+\tgit diff-index HEAD >without-m &&\n+\tlines_count=$(wc -l <without-m) &&\n+\tgit diff-index -m HEAD >with-m &&\n+\tgit restore file1 &&\n+\ttest_line_count = $((lines_count - 1)) with-m\n+'\n+\n test_expect_success 'log -S requires an argument' '\n \ttest_must_fail git log -S\n '\n-- \n2.25.1\n\n"},{"id":"424751","messageId":"20210517155818.32224-4-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210517155818.32224-1-sorganov@gmail.com","subject":"[PATCH v1 3/9] t4013: test \"git -m --stat\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-17T15:58:12Z","receivedAt":"2021-05-17T16:43:33Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"This is to ensure we won't break different diff formats when we start\nto imply \"-p\" by \"-m\".\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n t/t4013-diff-various.sh           |  1 +\n t/t4013/diff.log_-m_--stat_master | 66 +++++++++++++++++++++++++++++++\n 2 files changed, 67 insertions(+)\n create mode 100644 t/t4013/diff.log_-m_--stat_master\n\ndiff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh\nindex 1809355f9bb1..e53ca7aa503f 100755\n--- a/t/t4013-diff-various.sh\n+++ b/t/t4013-diff-various.sh\n@@ -338,6 +338,7 @@ log -m -p master\n log --cc -m -p master\n log -c -m -p master\n log -m --raw master\n+log -m --stat master\n log -SF master\n log -S F master\n log -SF -p master\ndiff --git a/t/t4013/diff.log_-m_--stat_master b/t/t4013/diff.log_-m_--stat_master\nnew file mode 100644\nindex 000000000000..c7db084fd905\n--- /dev/null\n+++ b/t/t4013/diff.log_-m_--stat_master\n@@ -0,0 +1,66 @@\n+$ git log -m --stat master\n+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0)\n+Merge: 9a6d494 c7a2ab9\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:04:00 2006 +0000\n+\n+    Merge branch 'side'\n+\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ 2 files changed, 5 insertions(+)\n+\n+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a)\n+Merge: 9a6d494 c7a2ab9\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:04:00 2006 +0000\n+\n+    Merge branch 'side'\n+\n+ dir/sub | 4 ++++\n+ file0   | 3 +++\n+ file1   | 3 +++\n+ file2   | 3 ---\n+ file3   | 4 ----\n+ 5 files changed, 10 insertions(+), 7 deletions(-)\n+\n+commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:03:00 2006 +0000\n+\n+    Side\n+\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n+ 3 files changed, 9 insertions(+)\n+\n+commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:02:00 2006 +0000\n+\n+    Third\n+\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n+ 2 files changed, 5 insertions(+)\n+\n+commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:01:00 2006 +0000\n+\n+    Second\n+    \n+    This is the second commit.\n+\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n+ 3 files changed, 5 insertions(+), 3 deletions(-)\n+\n+commit 444ac553ac7612cc88969031b02b3767fb8a353a\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:00:00 2006 +0000\n+\n+    Initial\n+$\n-- \n2.25.1\n\n"},{"id":"424752","messageId":"20210517155818.32224-3-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210517155818.32224-1-sorganov@gmail.com","subject":"[PATCH v1 2/9] t4013: test \"git -m --raw\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-17T15:58:11Z","receivedAt":"2021-05-17T16:43:34Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"This is to ensure we won't break different diff formats when we start\nto imply \"-p\" by \"-m\".\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n t/t4013-diff-various.sh          |  1 +\n t/t4013/diff.log_-m_--raw_master | 61 ++++++++++++++++++++++++++++++++\n 2 files changed, 62 insertions(+)\n create mode 100644 t/t4013/diff.log_-m_--raw_master\n\ndiff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh\nindex e9f67cd24351..1809355f9bb1 100755\n--- a/t/t4013-diff-various.sh\n+++ b/t/t4013-diff-various.sh\n@@ -337,6 +337,7 @@ log -m -p --first-parent master\n log -m -p master\n log --cc -m -p master\n log -c -m -p master\n+log -m --raw master\n log -SF master\n log -S F master\n log -SF -p master\ndiff --git a/t/t4013/diff.log_-m_--raw_master b/t/t4013/diff.log_-m_--raw_master\nnew file mode 100644\nindex 000000000000..cd2ecc462832\n--- /dev/null\n+++ b/t/t4013/diff.log_-m_--raw_master\n@@ -0,0 +1,61 @@\n+$ git log -m --raw master\n+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0)\n+Merge: 9a6d494 c7a2ab9\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:04:00 2006 +0000\n+\n+    Merge branch 'side'\n+\n+:100644 100644 cead32e... 992913c... M\tdir/sub\n+:100644 100644 b414108... 10a8a9f... M\tfile0\n+\n+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a)\n+Merge: 9a6d494 c7a2ab9\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:04:00 2006 +0000\n+\n+    Merge branch 'side'\n+\n+:100644 100644 7289e35... 992913c... M\tdir/sub\n+:100644 100644 f4615da... 10a8a9f... M\tfile0\n+:000000 100644 0000000... b1e6722... A\tfile1\n+:100644 000000 01e79c3... 0000000... D\tfile2\n+:100644 000000 7289e35... 0000000... D\tfile3\n+\n+commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:03:00 2006 +0000\n+\n+    Side\n+\n+:100644 100644 35d242b... 7289e35... M\tdir/sub\n+:100644 100644 01e79c3... f4615da... M\tfile0\n+:000000 100644 0000000... 7289e35... A\tfile3\n+\n+commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:02:00 2006 +0000\n+\n+    Third\n+\n+:100644 100644 8422d40... cead32e... M\tdir/sub\n+:000000 100644 0000000... b1e6722... A\tfile1\n+\n+commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:01:00 2006 +0000\n+\n+    Second\n+    \n+    This is the second commit.\n+\n+:100644 100644 35d242b... 8422d40... M\tdir/sub\n+:100644 100644 01e79c3... b414108... M\tfile0\n+:100644 000000 01e79c3... 0000000... D\tfile2\n+\n+commit 444ac553ac7612cc88969031b02b3767fb8a353a\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:00:00 2006 +0000\n+\n+    Initial\n+$\n-- \n2.25.1\n\n"},{"id":"424753","messageId":"20210517155818.32224-1-sorganov@gmail.com","threadId":"55579","inReplyTo":"CAMMLpeR-W35Qq6a343ifrxJ=mwBc_VcXZtVrBYDpJTySNBroFw@mail.gmail.com","subject":"[PATCH v1 0/9] diff-merges: let -m imply -p","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-17T15:58:09Z","receivedAt":"2021-05-17T16:43:39Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Fix long standing inconsistency between -c/--cc that do imply -p, on\none side, and -m that did not imply -p, on the other side.\n\nOnly the last patch is the actual functional change. The reset of\npatches are additional tests and refactorings that are not expected to\nalter existing behaviors.\n\nAfter these patches\n\n  git log -m\n\nwill start to produce diffs without need to provide -p as well, that\nimproves both consistency and usability. It gets even more useful if\none sets \"log.diffMerges\" configuration variable to \"first-parent\" to\nforce -m produce usual diff with respect to first parent only.\n\nThese patches don't change behavior when specific diff format is\nexplicitly provided on the command-line, so that commands like\n\n  git log -m --raw\n  git log -m --stat\n\nare not affected.\n\nExact historical semantics of -m is still provided by\n--diff-merges=separate.\n\nUpdates in v1:\n\n  * Stop parsing distinct diff-index options beforehand, as it could\n    cause unexpected behaviors. Implement different strategy to avoid\n    clash of diff-index \"-m\" and diff-merges \"-m\".\n\n  * Added tests for \"git log -m --raw\" and \"git log -m\".\n\nSergey Organov (9):\n  t4013: test that \"-m\" alone has no effect in \"git log\"\n  t4013: test \"git -m --raw\"\n  t4013: test \"git -m --stat\"\n  t4013: test \"git diff-index -m\"\n  diff-merges: move specific diff-index \"-m\" handling to diff-index\n  git-svn: stop passing \"-m\" to \"git rev-list\"\n  stash list: stop passing \"-m\" to \"git list\"\n  diff-merges: rename \"combined_imply_patch\" to \"merges_imply_patch\"\n  diff-merges: let \"-m\" imply \"-p\"\n\n Documentation/diff-options.txt    |  8 ++--\n builtin/diff-index.c              |  9 +++++\n builtin/stash.c                   |  2 +-\n diff-merges.c                     | 36 +++++++++--------\n diff-merges.h                     |  2 +\n perl/Git/SVN.pm                   |  2 +-\n revision.h                        |  2 +-\n t/t3903-stash.sh                  |  2 +-\n t/t4013-diff-various.sh           | 23 +++++++++++\n t/t4013/diff.log_-m_--raw_master  | 61 ++++++++++++++++++++++++++++\n t/t4013/diff.log_-m_--stat_master | 66 +++++++++++++++++++++++++++++++\n 11 files changed, 188 insertions(+), 25 deletions(-)\n create mode 100644 t/t4013/diff.log_-m_--raw_master\n create mode 100644 t/t4013/diff.log_-m_--stat_master\n\nInterdiff against v0:\ndiff --git a/builtin/diff-index.c b/builtin/diff-index.c\nindex 28bc51d0d8f4..cf09559e422d 100644\n--- a/builtin/diff-index.c\n+++ b/builtin/diff-index.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"diff.h\"\n+#include \"diff-merges.h\"\n #include \"commit.h\"\n #include \"revision.h\"\n #include \"builtin.h\"\n@@ -12,37 +13,11 @@ static const char diff_cache_usage[] =\n \"[<common-diff-options>] <tree-ish> [<path>...]\"\n COMMON_DIFF_OPTIONS_HELP;\n \n-static int parse_distinct_options(int argc, const char **argv,\n-\t\t\t\t  struct rev_info *revs, unsigned int *options)\n-{\n-\tint i, left;\n-\n-\tfor (i = left = 1; i < argc; i++) {\n-\t\tconst char *arg = argv[i];\n-\t\tint leave = 0;\n-\n-\t\tif (!strcmp(arg, \"--cached\"))\n-\t\t\t*options |= DIFF_INDEX_CACHED;\n-\t\telse if (!strcmp(arg, \"--merge-base\"))\n-\t\t\t*options |= DIFF_INDEX_MERGE_BASE;\n-\t\telse if (!strcmp(arg, \"-m\"))\n-\t\t\trevs->match_missing = 1;\n-\t\telse\n-\t\t\tleave = 1;\n-\n-\t\tif (leave)\n-\t\t\targv[left++] = arg;\n-\t}\n-\n-\targv[left] = NULL;\n-\n-\treturn left;\n-}\n-\n int cmd_diff_index(int argc, const char **argv, const char *prefix)\n {\n \tstruct rev_info rev;\n \tunsigned int option = 0;\n+\tint i;\n \tint result;\n \n \tif (argc == 2 && !strcmp(argv[1], \"-h\"))\n@@ -54,15 +29,24 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)\n \tprefix = precompose_argv_prefix(argc, argv, prefix);\n \n \t/*\n-\t * It's essential to parse our distinct options before calling\n-\t * setup_revisions(), for the latter not to see \"-m\".\n+\t * We need no diff for merges options, and we need to avoid conflict\n+\t * with our own meaning of \"-m\".\n \t */\n-\targc = parse_distinct_options(argc, argv, &rev, &option);\n+\tdiff_merges_suppress_options_parsing();\n+\n \targc = setup_revisions(argc, argv, &rev, NULL);\n+\tfor (i = 1; i < argc; i++) {\n+\t\tconst char *arg = argv[i];\n \n-\tif (argc > 1)\n-\t\tusage(diff_cache_usage);\n-\n+\t\tif (!strcmp(arg, \"--cached\"))\n+\t\t\toption |= DIFF_INDEX_CACHED;\n+\t\telse if (!strcmp(arg, \"--merge-base\"))\n+\t\t\toption |= DIFF_INDEX_MERGE_BASE;\n+\t\telse if (!strcmp(arg, \"-m\"))\n+\t\t\trev.match_missing = 1;\n+\t\telse\n+\t\t\tusage(diff_cache_usage);\n+\t}\n \tif (!rev.diffopt.output_format)\n \t\trev.diffopt.output_format = DIFF_FORMAT_RAW;\n \ndiff --git a/diff-merges.c b/diff-merges.c\nindex a827482a97ff..0dfcaa1b11b0 100644\n--- a/diff-merges.c\n+++ b/diff-merges.c\n@@ -6,6 +6,7 @@ typedef void (*diff_merges_setup_func_t)(struct rev_info *);\n static void set_separate(struct rev_info *revs);\n \n static diff_merges_setup_func_t set_to_default = set_separate;\n+static int suppress_parsing;\n \n static void suppress(struct rev_info *revs)\n {\n@@ -90,12 +91,20 @@ int diff_merges_config(const char *value)\n \treturn 0;\n }\n \n+void diff_merges_suppress_options_parsing(void)\n+{\n+\tsuppress_parsing = 1;\n+}\n+\n int diff_merges_parse_opts(struct rev_info *revs, const char **argv)\n {\n \tint argcount = 1;\n \tconst char *optarg;\n \tconst char *arg = argv[0];\n \n+\tif (suppress_parsing)\n+\t\treturn 0;\n+\n \tif (!strcmp(arg, \"-m\")) {\n \t\tset_to_default(revs);\n \t\trevs->merges_imply_patch = 1;\n@@ -145,6 +154,9 @@ void diff_merges_set_dense_combined_if_unset(struct rev_info *revs)\n \n void diff_merges_setup_revs(struct rev_info *revs)\n {\n+\tif (suppress_parsing)\n+\t\treturn;\n+\n \tif (revs->combine_merges == 0)\n \t\trevs->dense_combined_merges = 0;\n \tif (revs->separate_merges == 0)\ndiff --git a/diff-merges.h b/diff-merges.h\nindex 09d9a6c9a4fb..b5d57f6563e3 100644\n--- a/diff-merges.h\n+++ b/diff-merges.h\n@@ -11,6 +11,8 @@ struct rev_info;\n \n int diff_merges_config(const char *value);\n \n+void diff_merges_suppress_options_parsing(void);\n+\n int diff_merges_parse_opts(struct rev_info *revs, const char **argv);\n \n void diff_merges_suppress(struct rev_info *revs);\ndiff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh\nindex bd16d4885cfd..15ca3c75bff7 100755\n--- a/t/t4013-diff-various.sh\n+++ b/t/t4013-diff-various.sh\n@@ -337,6 +337,8 @@ log -m -p --first-parent master\n log -m -p master\n log --cc -m -p master\n log -c -m -p master\n+log -m --raw master\n+log -m --stat master\n log -SF master\n log -S F master\n log -SF -p master\n@@ -452,6 +454,14 @@ diff-tree --stat --compact-summary initial mode\n diff-tree -R --stat --compact-summary initial mode\n EOF\n \n+test_expect_success 'log -m matches log -m -p' '\n+\tgit log -m -p master >result &&\n+\tprocess_diffs result >expected &&\n+\tgit log -m >result &&\n+\tprocess_diffs result >actual &&\n+\ttest_cmp expected actual\n+'\n+\n test_expect_success 'log --diff-merges=on matches --diff-merges=separate' '\n \tgit log -p --diff-merges=separate master >result &&\n \tprocess_diffs result >expected &&\ndiff --git a/t/t4013/diff.log_-m_--raw_master b/t/t4013/diff.log_-m_--raw_master\nnew file mode 100644\nindex 000000000000..cd2ecc462832\n--- /dev/null\n+++ b/t/t4013/diff.log_-m_--raw_master\n@@ -0,0 +1,61 @@\n+$ git log -m --raw master\n+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0)\n+Merge: 9a6d494 c7a2ab9\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:04:00 2006 +0000\n+\n+    Merge branch 'side'\n+\n+:100644 100644 cead32e... 992913c... M\tdir/sub\n+:100644 100644 b414108... 10a8a9f... M\tfile0\n+\n+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a)\n+Merge: 9a6d494 c7a2ab9\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:04:00 2006 +0000\n+\n+    Merge branch 'side'\n+\n+:100644 100644 7289e35... 992913c... M\tdir/sub\n+:100644 100644 f4615da... 10a8a9f... M\tfile0\n+:000000 100644 0000000... b1e6722... A\tfile1\n+:100644 000000 01e79c3... 0000000... D\tfile2\n+:100644 000000 7289e35... 0000000... D\tfile3\n+\n+commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:03:00 2006 +0000\n+\n+    Side\n+\n+:100644 100644 35d242b... 7289e35... M\tdir/sub\n+:100644 100644 01e79c3... f4615da... M\tfile0\n+:000000 100644 0000000... 7289e35... A\tfile3\n+\n+commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:02:00 2006 +0000\n+\n+    Third\n+\n+:100644 100644 8422d40... cead32e... M\tdir/sub\n+:000000 100644 0000000... b1e6722... A\tfile1\n+\n+commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:01:00 2006 +0000\n+\n+    Second\n+    \n+    This is the second commit.\n+\n+:100644 100644 35d242b... 8422d40... M\tdir/sub\n+:100644 100644 01e79c3... b414108... M\tfile0\n+:100644 000000 01e79c3... 0000000... D\tfile2\n+\n+commit 444ac553ac7612cc88969031b02b3767fb8a353a\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:00:00 2006 +0000\n+\n+    Initial\n+$\ndiff --git a/t/t4013/diff.log_-m_--stat_master b/t/t4013/diff.log_-m_--stat_master\nnew file mode 100644\nindex 000000000000..c7db084fd905\n--- /dev/null\n+++ b/t/t4013/diff.log_-m_--stat_master\n@@ -0,0 +1,66 @@\n+$ git log -m --stat master\n+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0)\n+Merge: 9a6d494 c7a2ab9\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:04:00 2006 +0000\n+\n+    Merge branch 'side'\n+\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ 2 files changed, 5 insertions(+)\n+\n+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a)\n+Merge: 9a6d494 c7a2ab9\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:04:00 2006 +0000\n+\n+    Merge branch 'side'\n+\n+ dir/sub | 4 ++++\n+ file0   | 3 +++\n+ file1   | 3 +++\n+ file2   | 3 ---\n+ file3   | 4 ----\n+ 5 files changed, 10 insertions(+), 7 deletions(-)\n+\n+commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:03:00 2006 +0000\n+\n+    Side\n+\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n+ 3 files changed, 9 insertions(+)\n+\n+commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:02:00 2006 +0000\n+\n+    Third\n+\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n+ 2 files changed, 5 insertions(+)\n+\n+commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:01:00 2006 +0000\n+\n+    Second\n+    \n+    This is the second commit.\n+\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n+ 3 files changed, 5 insertions(+), 3 deletions(-)\n+\n+commit 444ac553ac7612cc88969031b02b3767fb8a353a\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:00:00 2006 +0000\n+\n+    Initial\n+$\n-- \n2.25.1\n\n"},{"id":"424754","messageId":"20210517155818.32224-7-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210517155818.32224-1-sorganov@gmail.com","subject":"[PATCH v1 6/9] git-svn: stop passing \"-m\" to \"git rev-list\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-17T15:58:15Z","receivedAt":"2021-05-17T16:43:42Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"rev-list doesn't utilize -m. It happens to eat it silently, so this\nbug went unnoticed.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n perl/Git/SVN.pm | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm\nindex f6f1dc03c608..35ff5a68963d 100644\n--- a/perl/Git/SVN.pm\n+++ b/perl/Git/SVN.pm\n@@ -1636,7 +1636,7 @@ sub has_no_changes {\n \tmy $commit = shift;\n \n \tmy @revs = split / /, command_oneline(\n-\t\tqw(rev-list --parents -1 -m), $commit);\n+\t\tqw(rev-list --parents -1), $commit);\n \n \t# Commits with no parents, e.g. the start of a partial branch,\n \t# have changes by definition.\n-- \n2.25.1\n\n"},{"id":"424755","messageId":"20210517155818.32224-9-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210517155818.32224-1-sorganov@gmail.com","subject":"[PATCH v1 8/9] diff-merges: rename \"combined_imply_patch\" to \"merges_imply_patch\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-17T15:58:17Z","receivedAt":"2021-05-17T16:43:46Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"This is refactoring change in preparation for the next commit that\nwill let -m imply -p.\n\nThe old name doesn't match the intention to let not only -c/-cc imply\n-p, but also -m, that is not a \"combined\" format, so we rename the\nflag accordingly.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n diff-merges.c | 10 +++++-----\n revision.h    |  2 +-\n 2 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/diff-merges.c b/diff-merges.c\nindex 9ca00cdd0cc6..d897fd8a2933 100644\n--- a/diff-merges.c\n+++ b/diff-merges.c\n@@ -15,7 +15,7 @@ static void suppress(struct rev_info *revs)\n \trevs->combine_merges = 0;\n \trevs->dense_combined_merges = 0;\n \trevs->combined_all_paths = 0;\n-\trevs->combined_imply_patch = 0;\n+\trevs->merges_imply_patch = 0;\n \trevs->merges_need_diff = 0;\n }\n \n@@ -109,10 +109,10 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv)\n \t\tset_to_default(revs);\n \t} else if (!strcmp(arg, \"-c\")) {\n \t\tset_combined(revs);\n-\t\trevs->combined_imply_patch = 1;\n+\t\trevs->merges_imply_patch = 1;\n \t} else if (!strcmp(arg, \"--cc\")) {\n \t\tset_dense_combined(revs);\n-\t\trevs->combined_imply_patch = 1;\n+\t\trevs->merges_imply_patch = 1;\n \t} else if (!strcmp(arg, \"--no-diff-merges\")) {\n \t\tsuppress(revs);\n \t} else if (!strcmp(arg, \"--combined-all-paths\")) {\n@@ -162,9 +162,9 @@ void diff_merges_setup_revs(struct rev_info *revs)\n \t\trevs->first_parent_merges = 0;\n \tif (revs->combined_all_paths && !revs->combine_merges)\n \t\tdie(\"--combined-all-paths makes no sense without -c or --cc\");\n-\tif (revs->combined_imply_patch)\n+\tif (revs->merges_imply_patch)\n \t\trevs->diff = 1;\n-\tif (revs->combined_imply_patch || revs->merges_need_diff) {\n+\tif (revs->merges_imply_patch || revs->merges_need_diff) {\n \t\tif (!revs->diffopt.output_format)\n \t\t\trevs->diffopt.output_format = DIFF_FORMAT_PATCH;\n \t}\ndiff --git a/revision.h b/revision.h\nindex 93aa012f518e..17698cb51aca 100644\n--- a/revision.h\n+++ b/revision.h\n@@ -193,10 +193,10 @@ struct rev_info {\n \t\t\t/* Diff-merge flags */\n \t\t\texplicit_diff_merges: 1,\n \t\t\tmerges_need_diff: 1,\n+\t\t\tmerges_imply_patch:1,\n \t\t\tseparate_merges: 1,\n \t\t\tcombine_merges:1,\n \t\t\tcombined_all_paths:1,\n-\t\t\tcombined_imply_patch:1,\n \t\t\tdense_combined_merges:1,\n \t\t\tfirst_parent_merges:1;\n \n-- \n2.25.1\n\n"},{"id":"424756","messageId":"20210517155818.32224-6-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210517155818.32224-1-sorganov@gmail.com","subject":"[PATCH v1 5/9] diff-merges: move specific diff-index \"-m\" handling to diff-index","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-17T15:58:14Z","receivedAt":"2021-05-17T16:43:49Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Move specific handling of \"-m\" for diff-index to diff-index.c, so\ndiff-merges is left to handle only diff for merges options.\n\nBeing a better design by itself, this is especially essential in\npreparation for letting -m imply -p, as \"diff-index -m\" obviously\nshould not imply -p, as it's entirely unrelated.\n\nTo handle this, in addition to moving specific diff-index \"-m\" code\nout of diff-merges, we introduce new\n\n  diff_merges_suppress_options_parsing()\n\nand call it before generic options processing in cmd_diff_index().\n\nThis new diff_merges_suppress_options_parsing() could then be reused\nand called before invocations of setup_revisions() for other commands\nthat don't need --diff-merges options, but that's outside of the scope\nof these patch series.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n builtin/diff-index.c |  9 +++++++++\n diff-merges.c        | 25 +++++++++++++------------\n diff-merges.h        |  2 ++\n 3 files changed, 24 insertions(+), 12 deletions(-)\n\ndiff --git a/builtin/diff-index.c b/builtin/diff-index.c\nindex 176fe7ff2b4e..cf09559e422d 100644\n--- a/builtin/diff-index.c\n+++ b/builtin/diff-index.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"diff.h\"\n+#include \"diff-merges.h\"\n #include \"commit.h\"\n #include \"revision.h\"\n #include \"builtin.h\"\n@@ -27,6 +28,12 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)\n \trev.abbrev = 0;\n \tprefix = precompose_argv_prefix(argc, argv, prefix);\n \n+\t/*\n+\t * We need no diff for merges options, and we need to avoid conflict\n+\t * with our own meaning of \"-m\".\n+\t */\n+\tdiff_merges_suppress_options_parsing();\n+\n \targc = setup_revisions(argc, argv, &rev, NULL);\n \tfor (i = 1; i < argc; i++) {\n \t\tconst char *arg = argv[i];\n@@ -35,6 +42,8 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)\n \t\t\toption |= DIFF_INDEX_CACHED;\n \t\telse if (!strcmp(arg, \"--merge-base\"))\n \t\t\toption |= DIFF_INDEX_MERGE_BASE;\n+\t\telse if (!strcmp(arg, \"-m\"))\n+\t\t\trev.match_missing = 1;\n \t\telse\n \t\t\tusage(diff_cache_usage);\n \t}\ndiff --git a/diff-merges.c b/diff-merges.c\nindex f3a9daed7e05..9ca00cdd0cc6 100644\n--- a/diff-merges.c\n+++ b/diff-merges.c\n@@ -6,6 +6,7 @@ typedef void (*diff_merges_setup_func_t)(struct rev_info *);\n static void set_separate(struct rev_info *revs);\n \n static diff_merges_setup_func_t set_to_default = set_separate;\n+static int suppress_parsing;\n \n static void suppress(struct rev_info *revs)\n {\n@@ -30,17 +31,6 @@ static void set_first_parent(struct rev_info *revs)\n \trevs->first_parent_merges = 1;\n }\n \n-static void set_m(struct rev_info *revs)\n-{\n-\t/*\n-\t * To \"diff-index\", \"-m\" means \"match missing\", and to the \"log\"\n-\t * family of commands, it means \"show default diff for merges\". Set\n-\t * both fields appropriately.\n-\t */\n-\tset_to_default(revs);\n-\trevs->match_missing = 1;\n-}\n-\n static void set_combined(struct rev_info *revs)\n {\n \tsuppress(revs);\n@@ -101,14 +91,22 @@ int diff_merges_config(const char *value)\n \treturn 0;\n }\n \n+void diff_merges_suppress_options_parsing(void)\n+{\n+\tsuppress_parsing = 1;\n+}\n+\n int diff_merges_parse_opts(struct rev_info *revs, const char **argv)\n {\n \tint argcount = 1;\n \tconst char *optarg;\n \tconst char *arg = argv[0];\n \n+\tif (suppress_parsing)\n+\t\treturn 0;\n+\n \tif (!strcmp(arg, \"-m\")) {\n-\t\tset_m(revs);\n+\t\tset_to_default(revs);\n \t} else if (!strcmp(arg, \"-c\")) {\n \t\tset_combined(revs);\n \t\trevs->combined_imply_patch = 1;\n@@ -155,6 +153,9 @@ void diff_merges_set_dense_combined_if_unset(struct rev_info *revs)\n \n void diff_merges_setup_revs(struct rev_info *revs)\n {\n+\tif (suppress_parsing)\n+\t\treturn;\n+\n \tif (revs->combine_merges == 0)\n \t\trevs->dense_combined_merges = 0;\n \tif (revs->separate_merges == 0)\ndiff --git a/diff-merges.h b/diff-merges.h\nindex 09d9a6c9a4fb..b5d57f6563e3 100644\n--- a/diff-merges.h\n+++ b/diff-merges.h\n@@ -11,6 +11,8 @@ struct rev_info;\n \n int diff_merges_config(const char *value);\n \n+void diff_merges_suppress_options_parsing(void);\n+\n int diff_merges_parse_opts(struct rev_info *revs, const char **argv);\n \n void diff_merges_suppress(struct rev_info *revs);\n-- \n2.25.1\n\n"},{"id":"424757","messageId":"20210517155818.32224-10-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210517155818.32224-1-sorganov@gmail.com","subject":"[PATCH v1 9/9] diff-merges: let \"-m\" imply \"-p\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-17T15:58:18Z","receivedAt":"2021-05-17T16:43:50Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Fix long standing inconsistency between -c/--cc that do imply -p, on\none side, and -m that did not imply -p, on the other side.\n\nChange corresponding test accordingly, as \"log -m\" output should now\nmatch one from \"log -m -p\", rather than from just \"log\".\n\nChange documentation accordingly.\n\nNOTES:\n\nAfter this patch\n\n  git log -m\n\nwill start to produce diffs without need to provide -p as well, that\nimproves both consistency and usability. It gets even more useful if\none sets \"log.diffMerges\" configuration variable to \"first-parent\" to\nforce -m produce usual diff with respect to first parent only.\n\nThis patch does not change behavior when specific diff format is\nexplicitly provided on the command-line, so that commands like\n\n  git log -m --raw\n  git log -m --stat\n\nare not affected.\n\nExact historical semantics of -m is still provided by\n--diff-merges=separate.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n Documentation/diff-options.txt | 8 ++++----\n diff-merges.c                  | 1 +\n t/t4013-diff-various.sh        | 4 ++--\n 3 files changed, 7 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex 530d1159141f..32e6dee5ac3b 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -49,10 +49,9 @@ ifdef::git-log[]\n --diff-merges=m:::\n -m:::\n \tThis option makes diff output for merge commits to be shown in\n-\tthe default format. `-m` will produce the output only if `-p`\n-\tis given as well. The default format could be changed using\n+\tthe default format. The default format could be changed using\n \t`log.diffMerges` configuration parameter, which default value\n-\tis `separate`.\n+\tis `separate`. `-m` implies `-p`.\n +\n --diff-merges=first-parent:::\n --diff-merges=1:::\n@@ -62,7 +61,8 @@ ifdef::git-log[]\n --diff-merges=separate:::\n \tThis makes merge commits show the full diff with respect to\n \teach of the parents. Separate log entry and diff is generated\n-\tfor each parent.\n+\tfor each parent. This is the format that `-m` produced\n+\thistorically.\n +\n --diff-merges=combined:::\n --diff-merges=c:::\ndiff --git a/diff-merges.c b/diff-merges.c\nindex d897fd8a2933..0dfcaa1b11b0 100644\n--- a/diff-merges.c\n+++ b/diff-merges.c\n@@ -107,6 +107,7 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv)\n \n \tif (!strcmp(arg, \"-m\")) {\n \t\tset_to_default(revs);\n+\t\trevs->merges_imply_patch = 1;\n \t} else if (!strcmp(arg, \"-c\")) {\n \t\tset_combined(revs);\n \t\trevs->merges_imply_patch = 1;\ndiff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh\nindex c35cc73d08bd..15ca3c75bff7 100755\n--- a/t/t4013-diff-various.sh\n+++ b/t/t4013-diff-various.sh\n@@ -454,8 +454,8 @@ diff-tree --stat --compact-summary initial mode\n diff-tree -R --stat --compact-summary initial mode\n EOF\n \n-test_expect_success 'log -m matches pure log' '\n-\tgit log master >result &&\n+test_expect_success 'log -m matches log -m -p' '\n+\tgit log -m -p master >result &&\n \tprocess_diffs result >expected &&\n \tgit log -m >result &&\n \tprocess_diffs result >actual &&\n-- \n2.25.1\n\n"},{"id":"424758","messageId":"20210517155818.32224-8-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210517155818.32224-1-sorganov@gmail.com","subject":"[PATCH v1 7/9] stash list: stop passing \"-m\" to \"git list\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-17T15:58:16Z","receivedAt":"2021-05-17T16:43:52Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Passing \"-m\" in \"git list --first-parent -m\" is not needed as\n--first-parent implies --diff-merges=first-parent anyway. OTOH, it\nwill stop being harmless once we let \"-m\" imply \"-p\".\n\nWhile we are at it, fix corresponding test description in t3903-stash\nto match what it actually tests.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n builtin/stash.c  | 2 +-\n t/t3903-stash.sh | 2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex d68ed784d2af..fe8e97428808 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -761,7 +761,7 @@ static int list_stash(int argc, const char **argv, const char *prefix)\n \n \tcp.git_cmd = 1;\n \tstrvec_pushl(&cp.args, \"log\", \"--format=%gd: %gs\", \"-g\",\n-\t\t     \"--first-parent\", \"-m\", NULL);\n+\t\t     \"--first-parent\", NULL);\n \tstrvec_pushv(&cp.args, argv);\n \tstrvec_push(&cp.args, ref_stash);\n \tstrvec_push(&cp.args, \"--\");\ndiff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\nindex 5f282ecf6175..873aa56e359d 100755\n--- a/t/t3903-stash.sh\n+++ b/t/t3903-stash.sh\n@@ -859,7 +859,7 @@ test_expect_success 'setup stash with index and worktree changes' '\n \tgit stash\n '\n \n-test_expect_success 'stash list implies --first-parent -m' '\n+test_expect_success 'stash list -p shows simple diff' '\n \tcat >expect <<-EOF &&\n \tstash@{0}\n \n-- \n2.25.1\n\n"},{"id":"424780","messageId":"xmqq1ra56svo.fsf@gitster.g","threadId":"55579","inReplyTo":"20210517155818.32224-1-sorganov@gmail.com","subject":"Re: [PATCH v1 0/9] diff-merges: let -m imply -p","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-05-17T19:51:39Z","receivedAt":"2021-05-17T19:51:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sergey Organov <sorganov@gmail.com> writes:\n\n> Fix long standing inconsistency between -c/--cc that do imply -p, on\n> one side, and -m that did not imply -p, on the other side.\n> ...\n> Exact historical semantics of -m is still provided by\n> --diff-merges=separate.\n>\n> Updates in v1:\n\nOK, so this is [v2] not v1 ;-)\n\nWill replace.  Thanks.\n"},{"id":"424781","messageId":"xmqqwnrx5dfv.fsf@gitster.g","threadId":"55579","inReplyTo":"20210517155818.32224-6-sorganov@gmail.com","subject":"Re: [PATCH v1 5/9] diff-merges: move specific diff-index \"-m\" handling to diff-index","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-05-17T20:10:28Z","receivedAt":"2021-05-17T20:11:26Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sergey Organov <sorganov@gmail.com> writes:\n\n> Move specific handling of \"-m\" for diff-index to diff-index.c, so\n> diff-merges is left to handle only diff for merges options.\n>\n> Being a better design by itself, this is especially essential in\n> preparation for letting -m imply -p, as \"diff-index -m\" obviously\n> should not imply -p, as it's entirely unrelated.\n>\n> To handle this, in addition to moving specific diff-index \"-m\" code\n> out of diff-merges, we introduce new\n>\n>   diff_merges_suppress_options_parsing()\n>\n> and call it before generic options processing in cmd_diff_index().\n\nThis change has a small but obvious fallout.\n\n    $ git diff-index -c --cached HEAD^\n\nnow starts failing loudly.  Earlier, it silently fell back to\n\"combined\" diff of one parent, which is \"-p\".\n\nI think the end result is good (and luckily, \"DIFF FORMAT FOR\nMERGES\" section explicitly limits \"-c\" and \"--cc\" to diff-tree,\ndiff-files and diff (and by implication excludes diff-index) so I am\nsure there are small but non-zero number of people somewhere in the\nworld who has \"diff-index -c\" in their scripts that suddenly starts\nfailing with the version of Git with this change, but we can just\nsay their use was broken ;-)\n"},{"id":"424782","messageId":"875yzhf7cq.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"xmqq1ra56svo.fsf@gitster.g","subject":"Re: [PATCH v1 0/9] diff-merges: let -m imply -p","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-17T20:11:49Z","receivedAt":"2021-05-17T20:12:02Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Sergey Organov <sorganov@gmail.com> writes:\n>\n>> Fix long standing inconsistency between -c/--cc that do imply -p, on\n>> one side, and -m that did not imply -p, on the other side.\n>> ...\n>> Exact historical semantics of -m is still provided by\n>> --diff-merges=separate.\n>>\n>> Updates in v1:\n>\n> OK, so this is [v2] not v1 ;-)\n\nI dunno. Actually, I'm a bit confused.\n\nIs simple [PATCH] v0 or v1? For me, as C-programmer, it's obviously v0,\nand that's what\n\n  git format-patch --reroll-count=0\n \nproduces anyway, and the next one is\n\n  git format-patch --reroll-count=1\n\nthat produces [PATCH v1]. That's how it became v1.\n\n>\n> Will replace.  Thanks.\n\nThanks!\n\n-- Sergey Organov\n"},{"id":"424784","messageId":"871ra5f6s5.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"xmqqwnrx5dfv.fsf@gitster.g","subject":"Re: [PATCH v1 5/9] diff-merges: move specific diff-index \"-m\" handling to diff-index","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-17T20:24:10Z","receivedAt":"2021-05-17T20:24:23Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Sergey Organov <sorganov@gmail.com> writes:\n>\n>> Move specific handling of \"-m\" for diff-index to diff-index.c, so\n>> diff-merges is left to handle only diff for merges options.\n>>\n>> Being a better design by itself, this is especially essential in\n>> preparation for letting -m imply -p, as \"diff-index -m\" obviously\n>> should not imply -p, as it's entirely unrelated.\n>>\n>> To handle this, in addition to moving specific diff-index \"-m\" code\n>> out of diff-merges, we introduce new\n>>\n>>   diff_merges_suppress_options_parsing()\n>>\n>> and call it before generic options processing in cmd_diff_index().\n>\n> This change has a small but obvious fallout.\n>\n>     $ git diff-index -c --cached HEAD^\n>\n> now starts failing loudly.  Earlier, it silently fell back to\n> \"combined\" diff of one parent, which is \"-p\".\n>\n> I think the end result is good (and luckily, \"DIFF FORMAT FOR\n> MERGES\" section explicitly limits \"-c\" and \"--cc\" to diff-tree,\n> diff-files and diff (and by implication excludes diff-index) so I am\n> sure there are small but non-zero number of people somewhere in the\n> world who has \"diff-index -c\" in their scripts that suddenly starts\n> failing with the version of Git with this change, but we can just\n> say their use was broken ;-)\n\nWell, I'm not sure. If it's a problem, I think I can add -c/--cc parsing\nto diff-index that will simply imply -p. This way we will be more\nbackward-compatible.\n\nThanks,\n\n-- Sergey Organov.\n"},{"id":"424785","messageId":"xmqqv97h5ckn.fsf@gitster.g","threadId":"55579","inReplyTo":"20210517155818.32224-6-sorganov@gmail.com","subject":"Re: [PATCH v1 5/9] diff-merges: move specific diff-index \"-m\" handling to diff-index","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-05-17T20:29:12Z","receivedAt":"2021-05-17T20:29:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sergey Organov <sorganov@gmail.com> writes:\n\n> Move specific handling of \"-m\" for diff-index to diff-index.c, so\n> diff-merges is left to handle only diff for merges options.\n>\n> Being a better design by itself, this is especially essential in\n> preparation for letting -m imply -p, as \"diff-index -m\" obviously\n> should not imply -p, as it's entirely unrelated.\n>\n> To handle this, in addition to moving specific diff-index \"-m\" code\n> out of diff-merges, we introduce new\n>\n>   diff_merges_suppress_options_parsing()\n>\n> and call it before generic options processing in cmd_diff_index().\n\nThis change has a small but obvious fallout.\n\n    $ git diff-index -c --cached HEAD^\n\nnow starts failing loudly.  Earlier, it silently fell back to\n\"combined\" diff of one parent, which is \"-p\".\n\nI think the end result is good (and luckily, \"DIFF FORMAT FOR\nMERGES\" section explicitly limits \"-c\" and \"--cc\" to diff-tree,\ndiff-files and diff (and by implication excludes diff-index) so I am\nsure there are small but non-zero number of people somewhere in the\nworld who has \"diff-index -c\" in their scripts that suddenly starts\nfailing with the version of Git with this change, but we can just\nsay their use was broken ;-)\n\nHaving said all that, I have to wonder if it still is needed to keep\nthe \"diff-index -m\" working, or we would be better off breaking it\nto avoid a change like this that makes us bend over backwards to\nwork around the command line parsing infrastructure.\n\nThe only reason why \"diff-index -m\" exists is because it was part of\nthe idea Linus had for the merge implementation that we ended up\ndeciding not taking, where merges and possibly other bulk operations\nthat would affect the working tree is done in a separate, temporary\ndirectory that is sparsely populated, the user is asked to edit away\nconflicts in the temporary directory and expected to monitor his or\nher own progress using \"diff-index -m\".  Our plan was to populate\nsuch a temporary directory with only paths that are involved in the\noperation in progress, without instantiating paths that are not\ntouched, so \"treat missing files as if they haven't been modified\"\nwas a handy ingredient for such a mode of operation.\n\nBut we ended up going with a different design, in which the main\nworking tree area is used to perform merges and to resolve\nconflicts, which made this \"pretend missing files as unmodified\"\nunnecessary feature.  In the end, we made a good move, as the\ncurrent design allows users to verify their changes in the context\nof a full checkout (e.g. \"make\" would not have been a good way to\nvalidate the conflict resolution if it is done in a separate\ntemporary directory that is sparsely populated with only the paths\ninvolved in the merge---you need all files for building, including\nthe ones that are not modified, and \"make\" does not know to treat\nmissing files as if they are unmodified).\n\n\n"},{"id":"424786","messageId":"87cztpyt28.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"xmqqv97h5ckn.fsf@gitster.g","subject":"Re: [PATCH v1 5/9] diff-merges: move specific diff-index \"-m\" handling to diff-index","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-17T21:00:15Z","receivedAt":"2021-05-17T21:00:32Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Sergey Organov <sorganov@gmail.com> writes:\n>\n>> Move specific handling of \"-m\" for diff-index to diff-index.c, so\n>> diff-merges is left to handle only diff for merges options.\n>>\n>> Being a better design by itself, this is especially essential in\n>> preparation for letting -m imply -p, as \"diff-index -m\" obviously\n>> should not imply -p, as it's entirely unrelated.\n>>\n>> To handle this, in addition to moving specific diff-index \"-m\" code\n>> out of diff-merges, we introduce new\n>>\n>>   diff_merges_suppress_options_parsing()\n>>\n>> and call it before generic options processing in cmd_diff_index().\n>\n> This change has a small but obvious fallout.\n>\n>     $ git diff-index -c --cached HEAD^\n>\n> now starts failing loudly.  Earlier, it silently fell back to\n> \"combined\" diff of one parent, which is \"-p\".\n>\n> I think the end result is good (and luckily, \"DIFF FORMAT FOR\n> MERGES\" section explicitly limits \"-c\" and \"--cc\" to diff-tree,\n> diff-files and diff (and by implication excludes diff-index) so I am\n> sure there are small but non-zero number of people somewhere in the\n> world who has \"diff-index -c\" in their scripts that suddenly starts\n> failing with the version of Git with this change, but we can just\n> say their use was broken ;-)\n>\n> Having said all that, I have to wonder if it still is needed to keep\n> the \"diff-index -m\" working, or we would be better off breaking it\n> to avoid a change like this that makes us bend over backwards to\n> work around the command line parsing infrastructure.\n>\n> The only reason why \"diff-index -m\" exists is because it was part of\n> the idea Linus had for the merge implementation that we ended up\n> deciding not taking, where merges and possibly other bulk operations\n> that would affect the working tree is done in a separate, temporary\n> directory that is sparsely populated, the user is asked to edit away\n> conflicts in the temporary directory and expected to monitor his or\n> her own progress using \"diff-index -m\".  Our plan was to populate\n> such a temporary directory with only paths that are involved in the\n> operation in progress, without instantiating paths that are not\n> touched, so \"treat missing files as if they haven't been modified\"\n> was a handy ingredient for such a mode of operation.\n>\n> But we ended up going with a different design, in which the main\n> working tree area is used to perform merges and to resolve\n> conflicts, which made this \"pretend missing files as unmodified\"\n> unnecessary feature.  In the end, we made a good move, as the\n> current design allows users to verify their changes in the context\n> of a full checkout (e.g. \"make\" would not have been a good way to\n> validate the conflict resolution if it is done in a separate\n> temporary directory that is sparsely populated with only the paths\n> involved in the merge---you need all files for building, including\n> the ones that are not modified, and \"make\" does not know to treat\n> missing files as if they are unmodified).\n\nThis could be a good thing to do, but as I wrote in the description,\nthere are in fact other commands that don't need diff-merges options and\ncurrently just eat them silently instead of bailing out.\n\nIt's likely that 90% of uses of setup_revisions() don't need\ndiff-merges, so a feature to exclude diff-merges parsing seems to be\nuseful by itself.\n\nThanks,\n\n-- Sergey Organov\n"},{"id":"424811","messageId":"321ca7e8-0ccb-20dd-e2de-2f3c2845e515@gmail.com","threadId":"55579","inReplyTo":"20210517155818.32224-1-sorganov@gmail.com","subject":"Re: [PATCH v1 0/9] diff-merges: let -m imply -p","fromName":"Bagas Sanjaya","fromEmail":"bagasdotme@gmail.com","sentAt":"2021-05-18T03:18:17Z","receivedAt":"2021-05-18T03:18:26Z","isPatch":true,"sender":{"key":"bagasdotme@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40219486?v=4"},"body":"On 17/05/21 22.58, Sergey Organov wrote:\n> Fix long standing inconsistency between -c/--cc that do imply -p, on\n> one side, and -m that did not imply -p, on the other side.\n> \n\nThe commas are unnecessary.\n\n> Only the last patch is the actual functional change. The reset of\n> patches are additional tests and refactorings that are not expected to\n> alter existing behaviors.\n> \n\nOops, s/reset/rest/.\n\n> After these patches\n> \n>    git log -m\n> \n> will start to produce diffs without need to provide -p as well, that\n> improves both consistency and usability. It gets even more useful if\n> one sets \"log.diffMerges\" configuration variable to \"first-parent\" to\n> force -m produce usual diff with respect to first parent only.\n> \n\nBetter say \"After this patch series, git log -m produces diffs (implies\n-p)\".\n\n> These patches don't change behavior when specific diff format is\n> explicitly provided on the command-line, so that commands like\n> \n>    git log -m --raw\n>    git log -m --stat\n> \n> are not affected.\n> \n\nBetter say \"This series, however, don't change behavior...\".\n\n> Exact historical semantics of -m is still provided by\n> --diff-merges=separate.\n> \n\nBetter say \"Previously, the -m semantics is same as --diff-merges=separate\".\n\nThanks.\n\n-- \nAn old man doll... just what I always wanted! - Clara\n"},{"id":"424813","messageId":"1a78e837-13a0-f9bb-1ee2-a54534af37b1@gmail.com","threadId":"55579","inReplyTo":"20210517155818.32224-3-sorganov@gmail.com","subject":"Re: [PATCH v1 2/9] t4013: test \"git -m --raw\"","fromName":"Bagas Sanjaya","fromEmail":"bagasdotme@gmail.com","sentAt":"2021-05-18T03:27:39Z","receivedAt":"2021-05-18T03:28:04Z","isPatch":true,"sender":{"key":"bagasdotme@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40219486?v=4"},"body":"On 17/05/21 22.58, Sergey Organov wrote:\n> This is to ensure we won't break different diff formats when we start\n> to imply \"-p\" by \"-m\".\n> \n\nThis patch, and patch 3, have the same commit message (and thus the logic),\nso these can be squashed.\n\n> Signed-off-by: Sergey Organov <sorganov@gmail.com>\n> ---\n>   t/t4013-diff-various.sh          |  1 +\n>   t/t4013/diff.log_-m_--raw_master | 61 ++++++++++++++++++++++++++++++++\n>   2 files changed, 62 insertions(+)\n>   create mode 100644 t/t4013/diff.log_-m_--raw_master\n> \n> diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh\n> index e9f67cd24351..1809355f9bb1 100755\n> --- a/t/t4013-diff-various.sh\n> +++ b/t/t4013-diff-various.sh\n> @@ -337,6 +337,7 @@ log -m -p --first-parent master\n>   log -m -p master\n>   log --cc -m -p master\n>   log -c -m -p master\n> +log -m --raw master\n>   log -SF master\n>   log -S F master\n>   log -SF -p master\n\nIn near future, we will switch default branch created by `git init` to\nmain. Had the test be prepared?\n\n> +:100644 100644 7289e35... 992913c... M\tdir/sub\n> +:100644 100644 f4615da... 10a8a9f... M\tfile0\n> +:000000 100644 0000000... b1e6722... A\tfile1\n> +:100644 000000 01e79c3... 0000000... D\tfile2\n> +:100644 000000 7289e35... 0000000... D\tfile3\n> +\n> +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a\n> +Author: A U Thor <author@example.com>\n> +Date:   Mon Jun 26 00:03:00 2006 +0000\n> +\n> +    Side\n> +\n> +:100644 100644 35d242b... 7289e35... M\tdir/sub\n> +:100644 100644 01e79c3... f4615da... M\tfile0\n> +:000000 100644 0000000... 7289e35... A\tfile3\n> +\n> +commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0\n> +Author: A U Thor <author@example.com>\n> +Date:   Mon Jun 26 00:02:00 2006 +0000\n> +\n> +    Third\n> +\n> +:100644 100644 8422d40... cead32e... M\tdir/sub\n> +:000000 100644 0000000... b1e6722... A\tfile1\n> +\n> +commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44\n> +Author: A U Thor <author@example.com>\n> +Date:   Mon Jun 26 00:01:00 2006 +0000\n> +\n> +    Second\n> +\n> +    This is the second commit.\n> +\n\nThe rest of commits only have commit title, why do this second commit\nhave also commit message body?\n\n> +:100644 100644 35d242b... 8422d40... M\tdir/sub\n> +:100644 100644 01e79c3... b414108... M\tfile0\n> +:100644 000000 01e79c3... 0000000... D\tfile2\n> +\n> +commit 444ac553ac7612cc88969031b02b3767fb8a353a\n> +Author: A U Thor <author@example.com>\n> +Date:   Mon Jun 26 00:00:00 2006 +0000\n> +\n> +    Initial\n> +$\n> \n\nThanks.\n\n-- \nAn old man doll... just what I always wanted! - Clara\n"},{"id":"424856","messageId":"87eee4ckpc.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"321ca7e8-0ccb-20dd-e2de-2f3c2845e515@gmail.com","subject":"Re: [PATCH v1 0/9] diff-merges: let -m imply -p","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-18T12:03:59Z","receivedAt":"2021-05-18T12:04:12Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Bagas Sanjaya <bagasdotme@gmail.com> writes:\n\n> On 17/05/21 22.58, Sergey Organov wrote:\n>> Fix long standing inconsistency between -c/--cc that do imply -p, on\n>> one side, and -m that did not imply -p, on the other side.\n>> \n>\n> The commas are unnecessary.\n>\n>> Only the last patch is the actual functional change. The reset of\n>> patches are additional tests and refactorings that are not expected to\n>> alter existing behaviors.\n>> \n>\n> Oops, s/reset/rest/.\n>\n>> After these patches\n>>    git log -m\n>> will start to produce diffs without need to provide -p as well, that\n>> improves both consistency and usability. It gets even more useful if\n>> one sets \"log.diffMerges\" configuration variable to \"first-parent\" to\n>> force -m produce usual diff with respect to first parent only.\n>> \n>\n> Better say \"After this patch series, git log -m produces diffs (implies\n> -p)\".\n>\n>> These patches don't change behavior when specific diff format is\n>> explicitly provided on the command-line, so that commands like\n>>    git log -m --raw\n>>    git log -m --stat\n>> are not affected.\n>> \n>\n> Better say \"This series, however, don't change behavior...\".\n>\n>> Exact historical semantics of -m is still provided by\n>> --diff-merges=separate.\n>> \n>\n> Better say \"Previously, the -m semantics is same as\n> --diff-merges=separate\".\n\nAgreed, will fix, thanks!\n\n-- Sergey Organov\n"},{"id":"424859","messageId":"87a6osck9e.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"1a78e837-13a0-f9bb-1ee2-a54534af37b1@gmail.com","subject":"Re: [PATCH v1 2/9] t4013: test \"git -m --raw\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-18T12:13:33Z","receivedAt":"2021-05-18T12:13:39Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Bagas Sanjaya <bagasdotme@gmail.com> writes:\n\n> On 17/05/21 22.58, Sergey Organov wrote:\n>> This is to ensure we won't break different diff formats when we start\n>> to imply \"-p\" by \"-m\".\n>> \n>\n> This patch, and patch 3, have the same commit message (and thus the logic),\n> so these can be squashed.\n\nYep, but they have different subjects. Usually I need a serious reason\nto squash otherwise independent changes, but if you guys prefer them\nsquashed, we'd need to come up with suitable squashed subject, and I'll\nsquash them no problem.\n\n>\n>> Signed-off-by: Sergey Organov <sorganov@gmail.com>\n>> ---\n>>   t/t4013-diff-various.sh          |  1 +\n>>   t/t4013/diff.log_-m_--raw_master | 61 ++++++++++++++++++++++++++++++++\n>>   2 files changed, 62 insertions(+)\n>>   create mode 100644 t/t4013/diff.log_-m_--raw_master\n>> diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh\n>> index e9f67cd24351..1809355f9bb1 100755\n>> --- a/t/t4013-diff-various.sh\n>> +++ b/t/t4013-diff-various.sh\n>> @@ -337,6 +337,7 @@ log -m -p --first-parent master\n>>   log -m -p master\n>>   log --cc -m -p master\n>>   log -c -m -p master\n>> +log -m --raw master\n>>   log -SF master\n>>   log -S F master\n>>   log -SF -p master\n>\n> In near future, we will switch default branch created by `git init` to\n> main. Had the test be prepared?\n\nNo idea, sorry. I'd personally rather change preparation stage of this\ntest file to explicitly create \"master\".\n\n>\n>> +:100644 100644 7289e35... 992913c... M\tdir/sub\n>> +:100644 100644 f4615da... 10a8a9f... M\tfile0\n>> +:000000 100644 0000000... b1e6722... A\tfile1\n>> +:100644 000000 01e79c3... 0000000... D\tfile2\n>> +:100644 000000 7289e35... 0000000... D\tfile3\n>> +\n>> +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a\n>> +Author: A U Thor <author@example.com>\n>> +Date:   Mon Jun 26 00:03:00 2006 +0000\n>> +\n>> +    Side\n>> +\n>> +:100644 100644 35d242b... 7289e35... M\tdir/sub\n>> +:100644 100644 01e79c3... f4615da... M\tfile0\n>> +:000000 100644 0000000... 7289e35... A\tfile3\n>> +\n>> +commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0\n>> +Author: A U Thor <author@example.com>\n>> +Date:   Mon Jun 26 00:02:00 2006 +0000\n>> +\n>> +    Third\n>> +\n>> +:100644 100644 8422d40... cead32e... M\tdir/sub\n>> +:000000 100644 0000000... b1e6722... A\tfile1\n>> +\n>> +commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44\n>> +Author: A U Thor <author@example.com>\n>> +Date:   Mon Jun 26 00:01:00 2006 +0000\n>> +\n>> +    Second\n>> +\n>> +    This is the second commit.\n>> +\n>\n> The rest of commits only have commit title, why do this second commit\n> have also commit message body?\n\nProbably for testing of messages bodies? Anyway, that's how these tests\nare arranged, doesn't come with these particular patches.\n\nBTW, in the original there are trailing whitespaces on otherwise empty\nline between \"Second\" and \"This is the seconds commit\".\n\n>\n>> +:100644 100644 35d242b... 8422d40... M\tdir/sub\n>> +:100644 100644 01e79c3... b414108... M\tfile0\n>> +:100644 000000 01e79c3... 0000000... D\tfile2\n>> +\n>> +commit 444ac553ac7612cc88969031b02b3767fb8a353a\n>> +Author: A U Thor <author@example.com>\n>> +Date:   Mon Jun 26 00:00:00 2006 +0000\n>> +\n>> +    Initial\n>> +$\n>> \n>\n> Thanks.\n\nThanks,\n\n-- Sergey Organov\n"},{"id":"424860","messageId":"87a6osb5i5.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"321ca7e8-0ccb-20dd-e2de-2f3c2845e515@gmail.com","subject":"Re: [PATCH v1 0/9] diff-merges: let -m imply -p","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-18T12:17:38Z","receivedAt":"2021-05-18T12:17:44Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Bagas Sanjaya <bagasdotme@gmail.com> writes:\n\n\n[...]\n\n>> Exact historical semantics of -m is still provided by\n>> --diff-merges=separate.\n>> \n>\n> Better say \"Previously, the -m semantics is same as\n> --diff-merges=separate\".\n\nOops, unlike the rest of your suggestions, this one I don't get, sorry.\n\nThanks,\n\n-- Sergey Organov\n"},{"id":"424877","messageId":"xmqqr1i42kje.fsf@gitster.g","threadId":"55579","inReplyTo":"20210517155818.32224-1-sorganov@gmail.com","subject":"Re: [PATCH v1 0/9] diff-merges: let -m imply -p","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-05-18T14:17:41Z","receivedAt":"2021-05-18T14:17:45Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sergey Organov <sorganov@gmail.com> writes:\n\n> Sergey Organov (9):\n>   t4013: test that \"-m\" alone has no effect in \"git log\"\n>   t4013: test \"git -m --raw\"\n>   t4013: test \"git -m --stat\"\n\nThese two are mistitled (s/git -m/git log -m/).  Not a big deal as I\ncould \"rebase -i\" locally if there is no other changes needed, but\nif you are going to have a reroll for other reasons, please correct\nthem.\n\n>   stash list: stop passing \"-m\" to \"git list\"\n\ns/git list/git log/, I would think.\n\n>   diff-merges: rename \"combined_imply_patch\" to \"merges_imply_patch\"\n>   diff-merges: let \"-m\" imply \"-p\"\n"},{"id":"424888","messageId":"87bl989h03.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"xmqqr1i42kje.fsf@gitster.g","subject":"Re: [PATCH v1 0/9] diff-merges: let -m imply -p","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-18T15:52:12Z","receivedAt":"2021-05-18T15:52:17Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Sergey Organov <sorganov@gmail.com> writes:\n>\n>> Sergey Organov (9):\n>>   t4013: test that \"-m\" alone has no effect in \"git log\"\n>>   t4013: test \"git -m --raw\"\n>>   t4013: test \"git -m --stat\"\n>\n> These two are mistitled (s/git -m/git log -m/).  Not a big deal as I\n> could \"rebase -i\" locally if there is no other changes needed, but\n> if you are going to have a reroll for other reasons, please correct\n> them.\n\nI'll correct and re-roll, please don't bother rebasing.\n\n>\n>>   stash list: stop passing \"-m\" to \"git list\"\n>\n> s/git list/git log/, I would think.\n\nYep, and the description itself is as buggy.\n\nThanks,\n\n-- Sergey Organov\n\n[...]\n\n"},{"id":"424943","messageId":"20210519114552.4180-2-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210519114552.4180-1-sorganov@gmail.com","subject":"[PATCH v2 1/9] t4013: test that \"-m\" alone has no effect in \"git log\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-19T11:45:44Z","receivedAt":"2021-05-19T11:48:37Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"This is to notice current behavior that we are going to change when\nwhen we start to imply \"-p\" by \"-m\".\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n t/t4013-diff-various.sh | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\ndiff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh\nindex 87def81699bf..e9f67cd24351 100755\n--- a/t/t4013-diff-various.sh\n+++ b/t/t4013-diff-various.sh\n@@ -452,6 +452,14 @@ diff-tree --stat --compact-summary initial mode\n diff-tree -R --stat --compact-summary initial mode\n EOF\n \n+test_expect_success 'log -m matches pure log' '\n+\tgit log master >result &&\n+\tprocess_diffs result >expected &&\n+\tgit log -m >result &&\n+\tprocess_diffs result >actual &&\n+\ttest_cmp expected actual\n+'\n+\n test_expect_success 'log --diff-merges=on matches --diff-merges=separate' '\n \tgit log -p --diff-merges=separate master >result &&\n \tprocess_diffs result >expected &&\n-- \n2.25.1\n\n"},{"id":"424945","messageId":"20210519114552.4180-1-sorganov@gmail.com","threadId":"55579","inReplyTo":"CAMMLpeR-W35Qq6a343ifrxJ=mwBc_VcXZtVrBYDpJTySNBroFw@mail.gmail.com","subject":"[PATCH v2 0/9] diff-merges: let -m imply -p","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-19T11:45:43Z","receivedAt":"2021-05-19T11:48:37Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Fix long standing inconsistency between -c/--cc that do imply -p, on\none side, and -m that did not imply -p, on the other side.\n\nOnly the last patch is the actual functional change. The rest of\npatches are additional tests and refactorings that are not expected to\nalter existing behaviors.\n\nAfter these patches\n\n  git log -m\n\nproduces diffs without need to provide -p as well, that improves both\nconsistency and usability. It gets even more useful if one sets\n\"log.diffMerges\" configuration variable to \"first-parent\" to force -m\nproduce usual diff with respect to first parent only.\n\nThese series, however, don't change behavior when specific diff format\nis explicitly provided on the command-line, so that commands like\n\n  git log -m --raw\n  git log -m --stat\n\nare not affected.\n\nExact historical semantics of -m is still provided by\n--diff-merges=separate.\n\nUpdates in v2:\n\n  * Fix style and typos in descriptions\n\nUpdates in v1:\n\n  * Stop parsing distinct diff-index options beforehand, as it could\n    cause unexpected behaviors. Implement different strategy to avoid\n    clash of diff-index \"-m\" and diff-merges \"-m\".\n\n  * Added tests for \"git log -m --raw\" and \"git log -m\".\n\nSergey Organov (9):\n  t4013: test that \"-m\" alone has no effect in \"git log\"\n  t4013: test \"git log -m --raw\"\n  t4013: test \"git log -m --stat\"\n  t4013: test \"git diff-index -m\"\n  diff-merges: move specific diff-index \"-m\" handling to diff-index\n  git-svn: stop passing \"-m\" to \"git rev-list\"\n  stash list: stop passing \"-m\" to \"git log\"\n  diff-merges: rename \"combined_imply_patch\" to \"merges_imply_patch\"\n  diff-merges: let \"-m\" imply \"-p\"\n\n Documentation/diff-options.txt    |  8 ++--\n builtin/diff-index.c              |  9 +++++\n builtin/stash.c                   |  2 +-\n diff-merges.c                     | 36 +++++++++--------\n diff-merges.h                     |  2 +\n perl/Git/SVN.pm                   |  2 +-\n revision.h                        |  2 +-\n t/t3903-stash.sh                  |  2 +-\n t/t4013-diff-various.sh           | 23 +++++++++++\n t/t4013/diff.log_-m_--raw_master  | 61 ++++++++++++++++++++++++++++\n t/t4013/diff.log_-m_--stat_master | 66 +++++++++++++++++++++++++++++++\n 11 files changed, 188 insertions(+), 25 deletions(-)\n create mode 100644 t/t4013/diff.log_-m_--raw_master\n create mode 100644 t/t4013/diff.log_-m_--stat_master\n\nInterdiff against v1:\n-- \n2.25.1\n\n"},{"id":"424944","messageId":"20210519114552.4180-3-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210519114552.4180-1-sorganov@gmail.com","subject":"[PATCH v2 2/9] t4013: test \"git log -m --raw\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-19T11:45:45Z","receivedAt":"2021-05-19T11:48:39Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"This is to ensure we won't break different diff formats when we start\nto imply \"-p\" by \"-m\".\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n t/t4013-diff-various.sh          |  1 +\n t/t4013/diff.log_-m_--raw_master | 61 ++++++++++++++++++++++++++++++++\n 2 files changed, 62 insertions(+)\n create mode 100644 t/t4013/diff.log_-m_--raw_master\n\ndiff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh\nindex e9f67cd24351..1809355f9bb1 100755\n--- a/t/t4013-diff-various.sh\n+++ b/t/t4013-diff-various.sh\n@@ -337,6 +337,7 @@ log -m -p --first-parent master\n log -m -p master\n log --cc -m -p master\n log -c -m -p master\n+log -m --raw master\n log -SF master\n log -S F master\n log -SF -p master\ndiff --git a/t/t4013/diff.log_-m_--raw_master b/t/t4013/diff.log_-m_--raw_master\nnew file mode 100644\nindex 000000000000..cd2ecc462832\n--- /dev/null\n+++ b/t/t4013/diff.log_-m_--raw_master\n@@ -0,0 +1,61 @@\n+$ git log -m --raw master\n+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0)\n+Merge: 9a6d494 c7a2ab9\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:04:00 2006 +0000\n+\n+    Merge branch 'side'\n+\n+:100644 100644 cead32e... 992913c... M\tdir/sub\n+:100644 100644 b414108... 10a8a9f... M\tfile0\n+\n+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a)\n+Merge: 9a6d494 c7a2ab9\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:04:00 2006 +0000\n+\n+    Merge branch 'side'\n+\n+:100644 100644 7289e35... 992913c... M\tdir/sub\n+:100644 100644 f4615da... 10a8a9f... M\tfile0\n+:000000 100644 0000000... b1e6722... A\tfile1\n+:100644 000000 01e79c3... 0000000... D\tfile2\n+:100644 000000 7289e35... 0000000... D\tfile3\n+\n+commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:03:00 2006 +0000\n+\n+    Side\n+\n+:100644 100644 35d242b... 7289e35... M\tdir/sub\n+:100644 100644 01e79c3... f4615da... M\tfile0\n+:000000 100644 0000000... 7289e35... A\tfile3\n+\n+commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:02:00 2006 +0000\n+\n+    Third\n+\n+:100644 100644 8422d40... cead32e... M\tdir/sub\n+:000000 100644 0000000... b1e6722... A\tfile1\n+\n+commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:01:00 2006 +0000\n+\n+    Second\n+    \n+    This is the second commit.\n+\n+:100644 100644 35d242b... 8422d40... M\tdir/sub\n+:100644 100644 01e79c3... b414108... M\tfile0\n+:100644 000000 01e79c3... 0000000... D\tfile2\n+\n+commit 444ac553ac7612cc88969031b02b3767fb8a353a\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:00:00 2006 +0000\n+\n+    Initial\n+$\n-- \n2.25.1\n\n"},{"id":"424946","messageId":"20210519114552.4180-4-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210519114552.4180-1-sorganov@gmail.com","subject":"[PATCH v2 3/9] t4013: test \"git log -m --stat\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-19T11:45:46Z","receivedAt":"2021-05-19T11:48:41Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"This is to ensure we won't break different diff formats when we start\nto imply \"-p\" by \"-m\".\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n t/t4013-diff-various.sh           |  1 +\n t/t4013/diff.log_-m_--stat_master | 66 +++++++++++++++++++++++++++++++\n 2 files changed, 67 insertions(+)\n create mode 100644 t/t4013/diff.log_-m_--stat_master\n\ndiff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh\nindex 1809355f9bb1..e53ca7aa503f 100755\n--- a/t/t4013-diff-various.sh\n+++ b/t/t4013-diff-various.sh\n@@ -338,6 +338,7 @@ log -m -p master\n log --cc -m -p master\n log -c -m -p master\n log -m --raw master\n+log -m --stat master\n log -SF master\n log -S F master\n log -SF -p master\ndiff --git a/t/t4013/diff.log_-m_--stat_master b/t/t4013/diff.log_-m_--stat_master\nnew file mode 100644\nindex 000000000000..c7db084fd905\n--- /dev/null\n+++ b/t/t4013/diff.log_-m_--stat_master\n@@ -0,0 +1,66 @@\n+$ git log -m --stat master\n+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0)\n+Merge: 9a6d494 c7a2ab9\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:04:00 2006 +0000\n+\n+    Merge branch 'side'\n+\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ 2 files changed, 5 insertions(+)\n+\n+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a)\n+Merge: 9a6d494 c7a2ab9\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:04:00 2006 +0000\n+\n+    Merge branch 'side'\n+\n+ dir/sub | 4 ++++\n+ file0   | 3 +++\n+ file1   | 3 +++\n+ file2   | 3 ---\n+ file3   | 4 ----\n+ 5 files changed, 10 insertions(+), 7 deletions(-)\n+\n+commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:03:00 2006 +0000\n+\n+    Side\n+\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n+ 3 files changed, 9 insertions(+)\n+\n+commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:02:00 2006 +0000\n+\n+    Third\n+\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n+ 2 files changed, 5 insertions(+)\n+\n+commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:01:00 2006 +0000\n+\n+    Second\n+    \n+    This is the second commit.\n+\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n+ 3 files changed, 5 insertions(+), 3 deletions(-)\n+\n+commit 444ac553ac7612cc88969031b02b3767fb8a353a\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:00:00 2006 +0000\n+\n+    Initial\n+$\n-- \n2.25.1\n\n"},{"id":"424947","messageId":"20210519114552.4180-5-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210519114552.4180-1-sorganov@gmail.com","subject":"[PATCH v2 4/9] t4013: test \"git diff-index -m\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-19T11:45:47Z","receivedAt":"2021-05-19T11:48:42Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"-m in \"git diff-index\" means \"match missing\", that differs\nfrom its meaning in \"git diff\". Let's check it in diff-index.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n t/t4013-diff-various.sh | 13 +++++++++++++\n 1 file changed, 13 insertions(+)\n\ndiff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh\nindex e53ca7aa503f..c35cc73d08bd 100755\n--- a/t/t4013-diff-various.sh\n+++ b/t/t4013-diff-various.sh\n@@ -493,6 +493,19 @@ test_expect_success 'git config log.diffMerges first-parent vs -m' '\n \ttest_cmp expected actual\n '\n \n+# -m in \"git diff-index\" means \"match missing\", that differs\n+# from its meaning in \"git diff\". Let's check it in diff-index.\n+# The line in the output for removed file should disappear when\n+# we provide -m in diff-index.\n+test_expect_success 'git diff-index -m' '\n+\trm -f file1 &&\n+\tgit diff-index HEAD >without-m &&\n+\tlines_count=$(wc -l <without-m) &&\n+\tgit diff-index -m HEAD >with-m &&\n+\tgit restore file1 &&\n+\ttest_line_count = $((lines_count - 1)) with-m\n+'\n+\n test_expect_success 'log -S requires an argument' '\n \ttest_must_fail git log -S\n '\n-- \n2.25.1\n\n"},{"id":"424948","messageId":"20210519114552.4180-6-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210519114552.4180-1-sorganov@gmail.com","subject":"[PATCH v2 5/9] diff-merges: move specific diff-index \"-m\" handling to diff-index","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-19T11:45:48Z","receivedAt":"2021-05-19T11:48:43Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Move specific handling of \"-m\" for diff-index to diff-index.c, so\ndiff-merges is left to handle only diff for merges options.\n\nBeing a better design by itself, this is especially essential in\npreparation for letting -m imply -p, as \"diff-index -m\" obviously\nshould not imply -p, as it's entirely unrelated.\n\nTo handle this, in addition to moving specific diff-index \"-m\" code\nout of diff-merges, we introduce new\n\n  diff_merges_suppress_options_parsing()\n\nand call it before generic options processing in cmd_diff_index().\n\nThis new diff_merges_suppress_options_parsing() could then be reused\nand called before invocations of setup_revisions() for other commands\nthat don't need --diff-merges options, but that's outside of the scope\nof these patch series.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n builtin/diff-index.c |  9 +++++++++\n diff-merges.c        | 25 +++++++++++++------------\n diff-merges.h        |  2 ++\n 3 files changed, 24 insertions(+), 12 deletions(-)\n\ndiff --git a/builtin/diff-index.c b/builtin/diff-index.c\nindex 176fe7ff2b4e..cf09559e422d 100644\n--- a/builtin/diff-index.c\n+++ b/builtin/diff-index.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"diff.h\"\n+#include \"diff-merges.h\"\n #include \"commit.h\"\n #include \"revision.h\"\n #include \"builtin.h\"\n@@ -27,6 +28,12 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)\n \trev.abbrev = 0;\n \tprefix = precompose_argv_prefix(argc, argv, prefix);\n \n+\t/*\n+\t * We need no diff for merges options, and we need to avoid conflict\n+\t * with our own meaning of \"-m\".\n+\t */\n+\tdiff_merges_suppress_options_parsing();\n+\n \targc = setup_revisions(argc, argv, &rev, NULL);\n \tfor (i = 1; i < argc; i++) {\n \t\tconst char *arg = argv[i];\n@@ -35,6 +42,8 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)\n \t\t\toption |= DIFF_INDEX_CACHED;\n \t\telse if (!strcmp(arg, \"--merge-base\"))\n \t\t\toption |= DIFF_INDEX_MERGE_BASE;\n+\t\telse if (!strcmp(arg, \"-m\"))\n+\t\t\trev.match_missing = 1;\n \t\telse\n \t\t\tusage(diff_cache_usage);\n \t}\ndiff --git a/diff-merges.c b/diff-merges.c\nindex f3a9daed7e05..9ca00cdd0cc6 100644\n--- a/diff-merges.c\n+++ b/diff-merges.c\n@@ -6,6 +6,7 @@ typedef void (*diff_merges_setup_func_t)(struct rev_info *);\n static void set_separate(struct rev_info *revs);\n \n static diff_merges_setup_func_t set_to_default = set_separate;\n+static int suppress_parsing;\n \n static void suppress(struct rev_info *revs)\n {\n@@ -30,17 +31,6 @@ static void set_first_parent(struct rev_info *revs)\n \trevs->first_parent_merges = 1;\n }\n \n-static void set_m(struct rev_info *revs)\n-{\n-\t/*\n-\t * To \"diff-index\", \"-m\" means \"match missing\", and to the \"log\"\n-\t * family of commands, it means \"show default diff for merges\". Set\n-\t * both fields appropriately.\n-\t */\n-\tset_to_default(revs);\n-\trevs->match_missing = 1;\n-}\n-\n static void set_combined(struct rev_info *revs)\n {\n \tsuppress(revs);\n@@ -101,14 +91,22 @@ int diff_merges_config(const char *value)\n \treturn 0;\n }\n \n+void diff_merges_suppress_options_parsing(void)\n+{\n+\tsuppress_parsing = 1;\n+}\n+\n int diff_merges_parse_opts(struct rev_info *revs, const char **argv)\n {\n \tint argcount = 1;\n \tconst char *optarg;\n \tconst char *arg = argv[0];\n \n+\tif (suppress_parsing)\n+\t\treturn 0;\n+\n \tif (!strcmp(arg, \"-m\")) {\n-\t\tset_m(revs);\n+\t\tset_to_default(revs);\n \t} else if (!strcmp(arg, \"-c\")) {\n \t\tset_combined(revs);\n \t\trevs->combined_imply_patch = 1;\n@@ -155,6 +153,9 @@ void diff_merges_set_dense_combined_if_unset(struct rev_info *revs)\n \n void diff_merges_setup_revs(struct rev_info *revs)\n {\n+\tif (suppress_parsing)\n+\t\treturn;\n+\n \tif (revs->combine_merges == 0)\n \t\trevs->dense_combined_merges = 0;\n \tif (revs->separate_merges == 0)\ndiff --git a/diff-merges.h b/diff-merges.h\nindex 09d9a6c9a4fb..b5d57f6563e3 100644\n--- a/diff-merges.h\n+++ b/diff-merges.h\n@@ -11,6 +11,8 @@ struct rev_info;\n \n int diff_merges_config(const char *value);\n \n+void diff_merges_suppress_options_parsing(void);\n+\n int diff_merges_parse_opts(struct rev_info *revs, const char **argv);\n \n void diff_merges_suppress(struct rev_info *revs);\n-- \n2.25.1\n\n"},{"id":"424949","messageId":"20210519114552.4180-7-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210519114552.4180-1-sorganov@gmail.com","subject":"[PATCH v2 6/9] git-svn: stop passing \"-m\" to \"git rev-list\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-19T11:45:49Z","receivedAt":"2021-05-19T11:48:45Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"rev-list doesn't utilize -m. It happens to eat it silently, so this\nbug went unnoticed.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n perl/Git/SVN.pm | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm\nindex f6f1dc03c608..35ff5a68963d 100644\n--- a/perl/Git/SVN.pm\n+++ b/perl/Git/SVN.pm\n@@ -1636,7 +1636,7 @@ sub has_no_changes {\n \tmy $commit = shift;\n \n \tmy @revs = split / /, command_oneline(\n-\t\tqw(rev-list --parents -1 -m), $commit);\n+\t\tqw(rev-list --parents -1), $commit);\n \n \t# Commits with no parents, e.g. the start of a partial branch,\n \t# have changes by definition.\n-- \n2.25.1\n\n"},{"id":"424950","messageId":"20210519114552.4180-8-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210519114552.4180-1-sorganov@gmail.com","subject":"[PATCH v2 7/9] stash list: stop passing \"-m\" to \"git log\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-19T11:45:50Z","receivedAt":"2021-05-19T11:48:46Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Passing \"-m\" in \"git log --first-parent -m\" is not needed as\n--first-parent implies --diff-merges=first-parent anyway. OTOH, it\nwill stop being harmless once we let \"-m\" imply \"-p\".\n\nWhile we are at it, fix corresponding test description in t3903-stash\nto match what it actually tests.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n builtin/stash.c  | 2 +-\n t/t3903-stash.sh | 2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex d68ed784d2af..fe8e97428808 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -761,7 +761,7 @@ static int list_stash(int argc, const char **argv, const char *prefix)\n \n \tcp.git_cmd = 1;\n \tstrvec_pushl(&cp.args, \"log\", \"--format=%gd: %gs\", \"-g\",\n-\t\t     \"--first-parent\", \"-m\", NULL);\n+\t\t     \"--first-parent\", NULL);\n \tstrvec_pushv(&cp.args, argv);\n \tstrvec_push(&cp.args, ref_stash);\n \tstrvec_push(&cp.args, \"--\");\ndiff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\nindex 5f282ecf6175..873aa56e359d 100755\n--- a/t/t3903-stash.sh\n+++ b/t/t3903-stash.sh\n@@ -859,7 +859,7 @@ test_expect_success 'setup stash with index and worktree changes' '\n \tgit stash\n '\n \n-test_expect_success 'stash list implies --first-parent -m' '\n+test_expect_success 'stash list -p shows simple diff' '\n \tcat >expect <<-EOF &&\n \tstash@{0}\n \n-- \n2.25.1\n\n"},{"id":"424951","messageId":"20210519114552.4180-9-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210519114552.4180-1-sorganov@gmail.com","subject":"[PATCH v2 8/9] diff-merges: rename \"combined_imply_patch\" to \"merges_imply_patch\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-19T11:45:51Z","receivedAt":"2021-05-19T11:48:47Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"This is refactoring change in preparation for the next commit that\nwill let -m imply -p.\n\nThe old name doesn't match the intention to let not only -c/-cc imply\n-p, but also -m, that is not a \"combined\" format, so we rename the\nflag accordingly.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n diff-merges.c | 10 +++++-----\n revision.h    |  2 +-\n 2 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/diff-merges.c b/diff-merges.c\nindex 9ca00cdd0cc6..d897fd8a2933 100644\n--- a/diff-merges.c\n+++ b/diff-merges.c\n@@ -15,7 +15,7 @@ static void suppress(struct rev_info *revs)\n \trevs->combine_merges = 0;\n \trevs->dense_combined_merges = 0;\n \trevs->combined_all_paths = 0;\n-\trevs->combined_imply_patch = 0;\n+\trevs->merges_imply_patch = 0;\n \trevs->merges_need_diff = 0;\n }\n \n@@ -109,10 +109,10 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv)\n \t\tset_to_default(revs);\n \t} else if (!strcmp(arg, \"-c\")) {\n \t\tset_combined(revs);\n-\t\trevs->combined_imply_patch = 1;\n+\t\trevs->merges_imply_patch = 1;\n \t} else if (!strcmp(arg, \"--cc\")) {\n \t\tset_dense_combined(revs);\n-\t\trevs->combined_imply_patch = 1;\n+\t\trevs->merges_imply_patch = 1;\n \t} else if (!strcmp(arg, \"--no-diff-merges\")) {\n \t\tsuppress(revs);\n \t} else if (!strcmp(arg, \"--combined-all-paths\")) {\n@@ -162,9 +162,9 @@ void diff_merges_setup_revs(struct rev_info *revs)\n \t\trevs->first_parent_merges = 0;\n \tif (revs->combined_all_paths && !revs->combine_merges)\n \t\tdie(\"--combined-all-paths makes no sense without -c or --cc\");\n-\tif (revs->combined_imply_patch)\n+\tif (revs->merges_imply_patch)\n \t\trevs->diff = 1;\n-\tif (revs->combined_imply_patch || revs->merges_need_diff) {\n+\tif (revs->merges_imply_patch || revs->merges_need_diff) {\n \t\tif (!revs->diffopt.output_format)\n \t\t\trevs->diffopt.output_format = DIFF_FORMAT_PATCH;\n \t}\ndiff --git a/revision.h b/revision.h\nindex 93aa012f518e..17698cb51aca 100644\n--- a/revision.h\n+++ b/revision.h\n@@ -193,10 +193,10 @@ struct rev_info {\n \t\t\t/* Diff-merge flags */\n \t\t\texplicit_diff_merges: 1,\n \t\t\tmerges_need_diff: 1,\n+\t\t\tmerges_imply_patch:1,\n \t\t\tseparate_merges: 1,\n \t\t\tcombine_merges:1,\n \t\t\tcombined_all_paths:1,\n-\t\t\tcombined_imply_patch:1,\n \t\t\tdense_combined_merges:1,\n \t\t\tfirst_parent_merges:1;\n \n-- \n2.25.1\n\n"},{"id":"424952","messageId":"20210519114552.4180-10-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210519114552.4180-1-sorganov@gmail.com","subject":"[PATCH v2 9/9] diff-merges: let \"-m\" imply \"-p\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-19T11:45:52Z","receivedAt":"2021-05-19T11:48:49Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Fix long standing inconsistency between -c/--cc that do imply -p on\none side, and -m that did not imply -p on the other side.\n\nChange corresponding test accordingly, as \"log -m\" output should now\nmatch one from \"log -m -p\", rather than from just \"log\".\n\nChange documentation accordingly.\n\nNOTES:\n\nAfter this patch\n\n  git log -m\n\nproduces diffs without need to provide -p as well, that improves both\nconsistency and usability. It gets even more useful if one sets\n\"log.diffMerges\" configuration variable to \"first-parent\" to force -m\nproduce usual diff with respect to first parent only.\n\nThis patch, however, does not change behavior when specific diff\nformat is explicitly provided on the command-line, so that commands\nlike\n\n  git log -m --raw\n  git log -m --stat\n\nare not affected.\n\nExact historical semantics of -m is still provided by\n--diff-merges=separate.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n Documentation/diff-options.txt | 8 ++++----\n diff-merges.c                  | 1 +\n t/t4013-diff-various.sh        | 4 ++--\n 3 files changed, 7 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex 530d1159141f..32e6dee5ac3b 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -49,10 +49,9 @@ ifdef::git-log[]\n --diff-merges=m:::\n -m:::\n \tThis option makes diff output for merge commits to be shown in\n-\tthe default format. `-m` will produce the output only if `-p`\n-\tis given as well. The default format could be changed using\n+\tthe default format. The default format could be changed using\n \t`log.diffMerges` configuration parameter, which default value\n-\tis `separate`.\n+\tis `separate`. `-m` implies `-p`.\n +\n --diff-merges=first-parent:::\n --diff-merges=1:::\n@@ -62,7 +61,8 @@ ifdef::git-log[]\n --diff-merges=separate:::\n \tThis makes merge commits show the full diff with respect to\n \teach of the parents. Separate log entry and diff is generated\n-\tfor each parent.\n+\tfor each parent. This is the format that `-m` produced\n+\thistorically.\n +\n --diff-merges=combined:::\n --diff-merges=c:::\ndiff --git a/diff-merges.c b/diff-merges.c\nindex d897fd8a2933..0dfcaa1b11b0 100644\n--- a/diff-merges.c\n+++ b/diff-merges.c\n@@ -107,6 +107,7 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv)\n \n \tif (!strcmp(arg, \"-m\")) {\n \t\tset_to_default(revs);\n+\t\trevs->merges_imply_patch = 1;\n \t} else if (!strcmp(arg, \"-c\")) {\n \t\tset_combined(revs);\n \t\trevs->merges_imply_patch = 1;\ndiff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh\nindex c35cc73d08bd..15ca3c75bff7 100755\n--- a/t/t4013-diff-various.sh\n+++ b/t/t4013-diff-various.sh\n@@ -454,8 +454,8 @@ diff-tree --stat --compact-summary initial mode\n diff-tree -R --stat --compact-summary initial mode\n EOF\n \n-test_expect_success 'log -m matches pure log' '\n-\tgit log master >result &&\n+test_expect_success 'log -m matches log -m -p' '\n+\tgit log -m -p master >result &&\n \tprocess_diffs result >expected &&\n \tgit log -m >result &&\n \tprocess_diffs result >actual &&\n-- \n2.25.1\n\n"},{"id":"424991","messageId":"YKWG0jgYXAnKUJNR@google.com","threadId":"55579","inReplyTo":"CABPp-BEwp5bWWaBkv-G+OAJgd+pcsB=GoMCBd+gnhK5JAAnFgQ@mail.gmail.com","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2021-05-19T21:44:50Z","receivedAt":"2021-05-19T21:44:55Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nElijah Newren wrote:\n\n> Interesting.  I have a strong preference for --diff-merges=remerge\n> (yeah, I know it's not upstream, but it's been ready to submit for\n> months, but just backed up behind the other ort changes.  Sorry, I\n> can't push those through any faster).  I've had others using it for\n> about 9 months now.\n\nI agree.  The --diff-merges=remerge behavior has also been the default\nin Gerrit since time immemorial, and when I first started using Gerrit\nit was one of my favorite things about it.\n\nThat is because it shows the human content of the merge: it shows\nexactly what changes were made after the automated part was done.\n\nI don't have a strong opinion about what the default for -m should be.\n\n> I think --cc is a lot better than -m for helping you find what users\n> changed when they did the merge, but I agree the format is somewhat\n> difficult for many users to understand.\n\nMy experience in training new users has been that --cc is quite\ncounterintuitive for them.  Like you're hinting, I suspect it's\nfundamentally just meant to be a fast approximation to\n--diff-merges=remerge.\n\nThanks,\nJonathan\n"},{"id":"424992","messageId":"YKWHo9gZNp+i3fH9@google.com","threadId":"55579","inReplyTo":"20210510153451.15090-7-sorganov@gmail.com","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2021-05-19T21:48:19Z","receivedAt":"2021-05-19T21:48:29Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Sergey Organov wrote:\n\n> Fix long standing inconsistency between -c/--cc that do imply -p, on\n> one side, and -m that did not imply -p, on the other side.\n>\n> After this patch\n>\n>   git log -m\n>\n> will start to produce diffs without need to provide -p as well,\n\nPersonally I don't ever use -m without -p and --first-parent, so in\nthat sense this feels like a change in the right direction.\n\nDoes this also affect the plumbing command \"git diff-tree\"?  I'm\nguessing \"no\" because diff-tree already generates a diff by default,\nbut it seems worth spelling out in the commit message to prevent\nworries about the effect on scripts that expect stable plumbing\nbehavior.\n\nThanks,\nJonathan\n"},{"id":"424994","messageId":"877dju754o.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"YKWHo9gZNp+i3fH9@google.com","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-19T22:03:51Z","receivedAt":"2021-05-19T22:03:59Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> Sergey Organov wrote:\n>\n>> Fix long standing inconsistency between -c/--cc that do imply -p, on\n>> one side, and -m that did not imply -p, on the other side.\n>>\n>> After this patch\n>>\n>>   git log -m\n>>\n>> will start to produce diffs without need to provide -p as well,\n>\n> Personally I don't ever use -m without -p and --first-parent, so in\n> that sense this feels like a change in the right direction.\n>\n> Does this also affect the plumbing command \"git diff-tree\"?  I'm\n> guessing \"no\" because diff-tree already generates a diff by default,\n> but it seems worth spelling out in the commit message to prevent\n> worries about the effect on scripts that expect stable plumbing\n> behavior.\n\nWell, here are existing relevant tests:\n\ndiff-tree master\ndiff-tree -p master\ndiff-tree -p -m master\n\nthat all still pass after the patches, and I believe\n\ndiff-tree -m master\n\ndoes change the behavior, but provided it's useless before these\npatches, it should be OK to have this change.\n\nThanks,\n-- Sergey Organov\n"},{"id":"425002","messageId":"xmqqmtsqwb9g.fsf@gitster.g","threadId":"55579","inReplyTo":"YKWHo9gZNp+i3fH9@google.com","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-05-19T23:32:11Z","receivedAt":"2021-05-19T23:32:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> Sergey Organov wrote:\n>\n>> Fix long standing inconsistency between -c/--cc that do imply -p, on\n>> one side, and -m that did not imply -p, on the other side.\n>>\n>> After this patch\n>>\n>>   git log -m\n>>\n>> will start to produce diffs without need to provide -p as well,\n>\n> Personally I don't ever use -m without -p and --first-parent, so in\n> that sense this feels like a change in the right direction.\n>\n> Does this also affect the plumbing command \"git diff-tree\"?  I'm\n> guessing \"no\" because diff-tree already generates a diff by default,\n> but it seems worth spelling out in the commit message to prevent\n> worries about the effect on scripts that expect stable plumbing\n> behavior.\n\nThis is about \"log\" from the \"rev-list\" family, not \"diff\" to\ncompare two endpoints, so \"git diff\" won't be affected, and \"git\ndiff-tree\" is not affected, either.\n\n\n"},{"id":"425101","messageId":"87v97dfsyg.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"xmqqmtsqwb9g.fsf@gitster.g","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-20T13:14:15Z","receivedAt":"2021-05-20T13:14:28Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Jonathan Nieder <jrnieder@gmail.com> writes:\n>\n>> Sergey Organov wrote:\n>>\n>>> Fix long standing inconsistency between -c/--cc that do imply -p, on\n>>> one side, and -m that did not imply -p, on the other side.\n>>>\n>>> After this patch\n>>>\n>>>   git log -m\n>>>\n>>> will start to produce diffs without need to provide -p as well,\n>>\n>> Personally I don't ever use -m without -p and --first-parent, so in\n>> that sense this feels like a change in the right direction.\n>>\n>> Does this also affect the plumbing command \"git diff-tree\"?  I'm\n>> guessing \"no\" because diff-tree already generates a diff by default,\n>> but it seems worth spelling out in the commit message to prevent\n>> worries about the effect on scripts that expect stable plumbing\n>> behavior.\n>\n> This is about \"log\" from the \"rev-list\" family, not \"diff\" to\n> compare two endpoints, so \"git diff\" won't be affected, and \"git\n> diff-tree\" is not affected, either.\n\nYou are right. I've added a test for \"git diff-tree -m\", and the changes\ndon't break it.\n\nCan easily re-roll if you think the test worth it.\n\nThanks,\n-- Sergey Organov\n"},{"id":"425140","messageId":"YKaverOKIAJpJl3s@google.com","threadId":"55579","inReplyTo":"87v97dfsyg.fsf@osv.gnss.ru","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2021-05-20T18:50:34Z","receivedAt":"2021-05-20T18:50:40Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Sergey Organov wrote:\n> Junio C Hamano <gitster@pobox.com> writes:\n\n>> This is about \"log\" from the \"rev-list\" family, not \"diff\" to\n>> compare two endpoints, so \"git diff\" won't be affected, and \"git\n>> diff-tree\" is not affected, either.\n>\n> You are right. I've added a test for \"git diff-tree -m\", and the changes\n> don't break it.\n\nGood.\n\n> Can easily re-roll if you think the test worth it.\n\nI care more about the commit message than the test --- i.e. mentioning\nthat this doesn't affect commands like\n\n\tgit rev-list HEAD~5..HEAD | git diff-tree --stdin -m\n\nThanks,\nJonathan\n"},{"id":"425141","messageId":"871ra1b3gf.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"YKaverOKIAJpJl3s@google.com","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-20T19:38:40Z","receivedAt":"2021-05-20T19:38:45Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> Sergey Organov wrote:\n>> Junio C Hamano <gitster@pobox.com> writes:\n>\n>>> This is about \"log\" from the \"rev-list\" family, not \"diff\" to\n>>> compare two endpoints, so \"git diff\" won't be affected, and \"git\n>>> diff-tree\" is not affected, either.\n>>\n>> You are right. I've added a test for \"git diff-tree -m\", and the changes\n>> don't break it.\n>\n> Good.\n>\n>> Can easily re-roll if you think the test worth it.\n>\n> I care more about the commit message than the test --- i.e. mentioning\n> that this doesn't affect commands like\n>\n> \tgit rev-list HEAD~5..HEAD | git diff-tree --stdin -m\n\nOK, re-roll to follow...\n\nThanks,\n-- Sergey Organov\n"},{"id":"425142","messageId":"87sg2h9m2n.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"YKWG0jgYXAnKUJNR@google.com","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-20T20:39:28Z","receivedAt":"2021-05-20T20:39:35Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Hi,\n\nJonathan Nieder <jrnieder@gmail.com> writes:\n\n> Hi,\n>\n> Elijah Newren wrote:\n>\n>> Interesting.  I have a strong preference for --diff-merges=remerge\n>> (yeah, I know it's not upstream, but it's been ready to submit for\n>> months, but just backed up behind the other ort changes.  Sorry, I\n>> can't push those through any faster).  I've had others using it for\n>> about 9 months now.\n>\n> I agree.  The --diff-merges=remerge behavior has also been the default\n> in Gerrit since time immemorial, and when I first started using Gerrit\n> it was one of my favorite things about it.\n\nDue to previous set of diff-merges patches you now can set\nlog.diffMerges=remerge and have fun having it as the default for \"-m\" in\npure Git. I've introduced log.diffMerges exactly because I do realize\nthat different people and different workflows might have different\npreferences here.\n\n> That is because it shows the human content of the merge: it shows\n> exactly what changes were made after the automated part was done.\n\nNo, in fact it shows what additional changes were to be made if the\nmerge had been achieved using particular automated merge algorithm you\napply right now. Provided you utilize no external knowledge, you have no\nidea how merge has been in fact achieved, as core Git (fortunately)\nneither cares nor stores such information.\n\nContrary to your view, and I believe more inline with Git core\nphilosophy, I (usually) don't care *how* particular changes were\nachieved, I rather care *what* they are, so pure diff to the first\nparent is the best basic format for me. Only if I need to see *why* the\nchanges are this particular way, I'd use advanced tools and formats to\nget to the best *guess*, and that's where these advanced formats get\nhandy.\n\nIn other words, for me merge commit is mostly *commit*, and only then\nit's *merge*: \"here are the changes, and, by the way, here is where\nthese changes came from.\"\n\nThat said, please don't get me wrong: I'm all for advanced features such\nas --diff-merges=remerge, as I do understand how and when they are\nuseful, I just personally won't make them active by default.\n\n>\n> I don't have a strong opinion about what the default for -m should be.\n>\n>> I think --cc is a lot better than -m for helping you find what users\n>> changed when they did the merge, but I agree the format is somewhat\n>> difficult for many users to understand.\n\nI do have strong opinion. --diff-merges=1 is the only sensible\nfactory-default. Not only it has no implicit assumptions about how given\ncommit has been achieved, it's also the only format even entire Git\nnewbie might already be familiar with.\n\nThen, --cc and I suspect \"remerge\" too, give exactly empty output most\nof times, that'd cause even more surprises when one of them is the\ndefault: you enable diff for merges, but still get nothing. OTOH,\n--diff-merges=1 will give empty output if and only if given commit\nactually brings no changes to the branch, exactly as any commit out\nthere. No surprises at all.\n\nPrinciple of least surprise is still a good thing to follow.\n\nThanks,\n-- Sergey Organov\n"},{"id":"425149","messageId":"20210520214703.27323-1-sorganov@gmail.com","threadId":"55579","inReplyTo":"CAMMLpeR-W35Qq6a343ifrxJ=mwBc_VcXZtVrBYDpJTySNBroFw@mail.gmail.com","subject":"[PATCH v3 00/10] diff-merges: let -m imply -p","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-20T21:46:53Z","receivedAt":"2021-05-20T21:47:21Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Fix long standing inconsistency between -c/--cc that do imply -p, on\none side, and -m that did not imply -p, on the other side.\n\nOnly the last patch is the actual functional change. The rest of\npatches are additional tests and refactorings that are not expected to\nalter existing behaviors.\n\nAfter these patches\n\n  git log -m\n\nproduces diffs without need to provide -p as well, that improves both\nconsistency and usability. It gets even more useful if one sets\n\"log.diffMerges\" configuration variable to \"first-parent\" to force -m\nproduce usual diff with respect to first parent only.\n\nThese series, however, don't change behavior when specific diff format\nis explicitly provided on the command-line, so that commands like\n\n  git log -m --raw\n  git log -m --stat\n\nare not affected, nor do they change commands where specific diff\nformat is active by default, such as:\n\n  git diff-tree -m\n\nIt's also worth to be noticed that exact historical semantics of -m is\nstill provided by --diff-merges=separate.\n\nUpdates in v3:\n\n  * Add test for \"diff-tree -m\" and mention it in descriptions\n\n  * Fix one more typo in descriptions\n\nUpdates in v2:\n\n  * Fix style and typos in descriptions\n\nUpdates in v1:\n\n  * Stop parsing distinct diff-index options beforehand, as it could\n    cause unexpected behaviors. Implement different strategy to avoid\n    clash of diff-index \"-m\" and diff-merges \"-m\".\n\n  * Added tests for \"git log -m --raw\" and \"git log -m\".\n\nSergey Organov (10):\n  t4013: test that \"-m\" alone has no effect in \"git log\"\n  t4013: test \"git log -m --raw\"\n  t4013: test \"git log -m --stat\"\n  t4013: test \"git diff-tree -m\"\n  t4013: test \"git diff-index -m\"\n  diff-merges: move specific diff-index \"-m\" handling to diff-index\n  git-svn: stop passing \"-m\" to \"git rev-list\"\n  stash list: stop passing \"-m\" to \"git log\"\n  diff-merges: rename \"combined_imply_patch\" to \"merges_imply_patch\"\n  diff-merges: let \"-m\" imply \"-p\"\n\n Documentation/diff-options.txt    |  8 ++--\n builtin/diff-index.c              |  9 +++++\n builtin/stash.c                   |  2 +-\n diff-merges.c                     | 36 +++++++++--------\n diff-merges.h                     |  2 +\n perl/Git/SVN.pm                   |  2 +-\n revision.h                        |  2 +-\n t/t3903-stash.sh                  |  2 +-\n t/t4013-diff-various.sh           | 24 +++++++++++\n t/t4013/diff.diff-tree_-m_master  | 11 ++++++\n t/t4013/diff.log_-m_--raw_master  | 61 ++++++++++++++++++++++++++++\n t/t4013/diff.log_-m_--stat_master | 66 +++++++++++++++++++++++++++++++\n 12 files changed, 200 insertions(+), 25 deletions(-)\n create mode 100644 t/t4013/diff.diff-tree_-m_master\n create mode 100644 t/t4013/diff.log_-m_--raw_master\n create mode 100644 t/t4013/diff.log_-m_--stat_master\n\nInterdiff against v2:\ndiff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh\nindex 15ca3c75bff7..7fadc985cccd 100755\n--- a/t/t4013-diff-various.sh\n+++ b/t/t4013-diff-various.sh\n@@ -293,6 +293,7 @@ diff-tree --stat initial mode\n diff-tree --summary initial mode\n \n diff-tree master\n+diff-tree -m master\n diff-tree -p master\n diff-tree -p -m master\n diff-tree -c master\ndiff --git a/t/t4013/diff.diff-tree_-m_master b/t/t4013/diff.diff-tree_-m_master\nnew file mode 100644\nindex 000000000000..6d0a2207fb30\n--- /dev/null\n+++ b/t/t4013/diff.diff-tree_-m_master\n@@ -0,0 +1,11 @@\n+$ git diff-tree -m master\n+59d314ad6f356dd08601a4cd5e530381da3e3c64\n+:040000 040000 65f5c9dd60ce3b2b3324b618ac7accf8d912c113 0564e026437809817a64fff393079714b6dd4628 M\tdir\n+:100644 100644 b414108e81e5091fe0974a1858b4d0d22b107f70 10a8a9f3657f91a156b9f0184ed79a20adef9f7f M\tfile0\n+59d314ad6f356dd08601a4cd5e530381da3e3c64\n+:040000 040000 f977ed46ae6873c1c30ab878e15a4accedc3618b 0564e026437809817a64fff393079714b6dd4628 M\tdir\n+:100644 100644 f4615da674c09df322d6ba8d6b21ecfb1b1ba510 10a8a9f3657f91a156b9f0184ed79a20adef9f7f M\tfile0\n+:000000 100644 0000000000000000000000000000000000000000 b1e67221afe8461efd244b487afca22d46b95eb8 A\tfile1\n+:100644 000000 01e79c32a8c99c557f0757da7cb6d65b3414466d 0000000000000000000000000000000000000000 D\tfile2\n+:100644 000000 7289e35bff32727c08dda207511bec138fdb9ea5 0000000000000000000000000000000000000000 D\tfile3\n+$\n-- \n2.25.1\n\n"},{"id":"425150","messageId":"20210520214703.27323-3-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210520214703.27323-1-sorganov@gmail.com","subject":"[PATCH v3 02/10] t4013: test \"git log -m --raw\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-20T21:46:55Z","receivedAt":"2021-05-20T21:47:22Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"This is to ensure we won't break different diff formats when we start\nto imply \"-p\" by \"-m\".\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n t/t4013-diff-various.sh          |  1 +\n t/t4013/diff.log_-m_--raw_master | 61 ++++++++++++++++++++++++++++++++\n 2 files changed, 62 insertions(+)\n create mode 100644 t/t4013/diff.log_-m_--raw_master\n\ndiff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh\nindex e9f67cd24351..1809355f9bb1 100755\n--- a/t/t4013-diff-various.sh\n+++ b/t/t4013-diff-various.sh\n@@ -337,6 +337,7 @@ log -m -p --first-parent master\n log -m -p master\n log --cc -m -p master\n log -c -m -p master\n+log -m --raw master\n log -SF master\n log -S F master\n log -SF -p master\ndiff --git a/t/t4013/diff.log_-m_--raw_master b/t/t4013/diff.log_-m_--raw_master\nnew file mode 100644\nindex 000000000000..cd2ecc462832\n--- /dev/null\n+++ b/t/t4013/diff.log_-m_--raw_master\n@@ -0,0 +1,61 @@\n+$ git log -m --raw master\n+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0)\n+Merge: 9a6d494 c7a2ab9\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:04:00 2006 +0000\n+\n+    Merge branch 'side'\n+\n+:100644 100644 cead32e... 992913c... M\tdir/sub\n+:100644 100644 b414108... 10a8a9f... M\tfile0\n+\n+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a)\n+Merge: 9a6d494 c7a2ab9\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:04:00 2006 +0000\n+\n+    Merge branch 'side'\n+\n+:100644 100644 7289e35... 992913c... M\tdir/sub\n+:100644 100644 f4615da... 10a8a9f... M\tfile0\n+:000000 100644 0000000... b1e6722... A\tfile1\n+:100644 000000 01e79c3... 0000000... D\tfile2\n+:100644 000000 7289e35... 0000000... D\tfile3\n+\n+commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:03:00 2006 +0000\n+\n+    Side\n+\n+:100644 100644 35d242b... 7289e35... M\tdir/sub\n+:100644 100644 01e79c3... f4615da... M\tfile0\n+:000000 100644 0000000... 7289e35... A\tfile3\n+\n+commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:02:00 2006 +0000\n+\n+    Third\n+\n+:100644 100644 8422d40... cead32e... M\tdir/sub\n+:000000 100644 0000000... b1e6722... A\tfile1\n+\n+commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:01:00 2006 +0000\n+\n+    Second\n+    \n+    This is the second commit.\n+\n+:100644 100644 35d242b... 8422d40... M\tdir/sub\n+:100644 100644 01e79c3... b414108... M\tfile0\n+:100644 000000 01e79c3... 0000000... D\tfile2\n+\n+commit 444ac553ac7612cc88969031b02b3767fb8a353a\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:00:00 2006 +0000\n+\n+    Initial\n+$\n-- \n2.25.1\n\n"},{"id":"425151","messageId":"20210520214703.27323-2-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210520214703.27323-1-sorganov@gmail.com","subject":"[PATCH v3 01/10] t4013: test that \"-m\" alone has no effect in \"git log\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-20T21:46:54Z","receivedAt":"2021-05-20T21:47:22Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"This is to notice current behavior that we are going to change when we\nstart to imply \"-p\" by \"-m\".\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n t/t4013-diff-various.sh | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\ndiff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh\nindex 87def81699bf..e9f67cd24351 100755\n--- a/t/t4013-diff-various.sh\n+++ b/t/t4013-diff-various.sh\n@@ -452,6 +452,14 @@ diff-tree --stat --compact-summary initial mode\n diff-tree -R --stat --compact-summary initial mode\n EOF\n \n+test_expect_success 'log -m matches pure log' '\n+\tgit log master >result &&\n+\tprocess_diffs result >expected &&\n+\tgit log -m >result &&\n+\tprocess_diffs result >actual &&\n+\ttest_cmp expected actual\n+'\n+\n test_expect_success 'log --diff-merges=on matches --diff-merges=separate' '\n \tgit log -p --diff-merges=separate master >result &&\n \tprocess_diffs result >expected &&\n-- \n2.25.1\n\n"},{"id":"425152","messageId":"20210520214703.27323-4-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210520214703.27323-1-sorganov@gmail.com","subject":"[PATCH v3 03/10] t4013: test \"git log -m --stat\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-20T21:46:56Z","receivedAt":"2021-05-20T21:47:23Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"This is to ensure we won't break different diff formats when we start\nto imply \"-p\" by \"-m\".\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n t/t4013-diff-various.sh           |  1 +\n t/t4013/diff.log_-m_--stat_master | 66 +++++++++++++++++++++++++++++++\n 2 files changed, 67 insertions(+)\n create mode 100644 t/t4013/diff.log_-m_--stat_master\n\ndiff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh\nindex 1809355f9bb1..e53ca7aa503f 100755\n--- a/t/t4013-diff-various.sh\n+++ b/t/t4013-diff-various.sh\n@@ -338,6 +338,7 @@ log -m -p master\n log --cc -m -p master\n log -c -m -p master\n log -m --raw master\n+log -m --stat master\n log -SF master\n log -S F master\n log -SF -p master\ndiff --git a/t/t4013/diff.log_-m_--stat_master b/t/t4013/diff.log_-m_--stat_master\nnew file mode 100644\nindex 000000000000..c7db084fd905\n--- /dev/null\n+++ b/t/t4013/diff.log_-m_--stat_master\n@@ -0,0 +1,66 @@\n+$ git log -m --stat master\n+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0)\n+Merge: 9a6d494 c7a2ab9\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:04:00 2006 +0000\n+\n+    Merge branch 'side'\n+\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ 2 files changed, 5 insertions(+)\n+\n+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a)\n+Merge: 9a6d494 c7a2ab9\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:04:00 2006 +0000\n+\n+    Merge branch 'side'\n+\n+ dir/sub | 4 ++++\n+ file0   | 3 +++\n+ file1   | 3 +++\n+ file2   | 3 ---\n+ file3   | 4 ----\n+ 5 files changed, 10 insertions(+), 7 deletions(-)\n+\n+commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:03:00 2006 +0000\n+\n+    Side\n+\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n+ 3 files changed, 9 insertions(+)\n+\n+commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:02:00 2006 +0000\n+\n+    Third\n+\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n+ 2 files changed, 5 insertions(+)\n+\n+commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:01:00 2006 +0000\n+\n+    Second\n+    \n+    This is the second commit.\n+\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n+ 3 files changed, 5 insertions(+), 3 deletions(-)\n+\n+commit 444ac553ac7612cc88969031b02b3767fb8a353a\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:00:00 2006 +0000\n+\n+    Initial\n+$\n-- \n2.25.1\n\n"},{"id":"425153","messageId":"20210520214703.27323-5-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210520214703.27323-1-sorganov@gmail.com","subject":"[PATCH v3 04/10] t4013: test \"git diff-tree -m\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-20T21:46:57Z","receivedAt":"2021-05-20T21:47:25Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"We want to ensure we don't affect plumbing commands with our changes\nof \"-m\" semantics, so add corresponding test.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n t/t4013-diff-various.sh          |  1 +\n t/t4013/diff.diff-tree_-m_master | 11 +++++++++++\n 2 files changed, 12 insertions(+)\n create mode 100644 t/t4013/diff.diff-tree_-m_master\n\ndiff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh\nindex e53ca7aa503f..bdc23b1180b0 100755\n--- a/t/t4013-diff-various.sh\n+++ b/t/t4013-diff-various.sh\n@@ -293,6 +293,7 @@ diff-tree --stat initial mode\n diff-tree --summary initial mode\n \n diff-tree master\n+diff-tree -m master\n diff-tree -p master\n diff-tree -p -m master\n diff-tree -c master\ndiff --git a/t/t4013/diff.diff-tree_-m_master b/t/t4013/diff.diff-tree_-m_master\nnew file mode 100644\nindex 000000000000..6d0a2207fb30\n--- /dev/null\n+++ b/t/t4013/diff.diff-tree_-m_master\n@@ -0,0 +1,11 @@\n+$ git diff-tree -m master\n+59d314ad6f356dd08601a4cd5e530381da3e3c64\n+:040000 040000 65f5c9dd60ce3b2b3324b618ac7accf8d912c113 0564e026437809817a64fff393079714b6dd4628 M\tdir\n+:100644 100644 b414108e81e5091fe0974a1858b4d0d22b107f70 10a8a9f3657f91a156b9f0184ed79a20adef9f7f M\tfile0\n+59d314ad6f356dd08601a4cd5e530381da3e3c64\n+:040000 040000 f977ed46ae6873c1c30ab878e15a4accedc3618b 0564e026437809817a64fff393079714b6dd4628 M\tdir\n+:100644 100644 f4615da674c09df322d6ba8d6b21ecfb1b1ba510 10a8a9f3657f91a156b9f0184ed79a20adef9f7f M\tfile0\n+:000000 100644 0000000000000000000000000000000000000000 b1e67221afe8461efd244b487afca22d46b95eb8 A\tfile1\n+:100644 000000 01e79c32a8c99c557f0757da7cb6d65b3414466d 0000000000000000000000000000000000000000 D\tfile2\n+:100644 000000 7289e35bff32727c08dda207511bec138fdb9ea5 0000000000000000000000000000000000000000 D\tfile3\n+$\n-- \n2.25.1\n\n"},{"id":"425154","messageId":"20210520214703.27323-6-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210520214703.27323-1-sorganov@gmail.com","subject":"[PATCH v3 05/10] t4013: test \"git diff-index -m\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-20T21:46:58Z","receivedAt":"2021-05-20T21:47:26Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"-m in \"git diff-index\" means \"match missing\", that differs\nfrom its meaning in \"git diff\". Let's check it in diff-index.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n t/t4013-diff-various.sh | 13 +++++++++++++\n 1 file changed, 13 insertions(+)\n\ndiff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh\nindex bdc23b1180b0..e561a8e48521 100755\n--- a/t/t4013-diff-various.sh\n+++ b/t/t4013-diff-various.sh\n@@ -494,6 +494,19 @@ test_expect_success 'git config log.diffMerges first-parent vs -m' '\n \ttest_cmp expected actual\n '\n \n+# -m in \"git diff-index\" means \"match missing\", that differs\n+# from its meaning in \"git diff\". Let's check it in diff-index.\n+# The line in the output for removed file should disappear when\n+# we provide -m in diff-index.\n+test_expect_success 'git diff-index -m' '\n+\trm -f file1 &&\n+\tgit diff-index HEAD >without-m &&\n+\tlines_count=$(wc -l <without-m) &&\n+\tgit diff-index -m HEAD >with-m &&\n+\tgit restore file1 &&\n+\ttest_line_count = $((lines_count - 1)) with-m\n+'\n+\n test_expect_success 'log -S requires an argument' '\n \ttest_must_fail git log -S\n '\n-- \n2.25.1\n\n"},{"id":"425155","messageId":"20210520214703.27323-7-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210520214703.27323-1-sorganov@gmail.com","subject":"[PATCH v3 06/10] diff-merges: move specific diff-index \"-m\" handling to diff-index","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-20T21:46:59Z","receivedAt":"2021-05-20T21:47:27Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Move specific handling of \"-m\" for diff-index to diff-index.c, so\ndiff-merges is left to handle only diff for merges options.\n\nBeing a better design by itself, this is especially essential in\npreparation for letting -m imply -p, as \"diff-index -m\" obviously\nshould not imply -p, as it's entirely unrelated.\n\nTo handle this, in addition to moving specific diff-index \"-m\" code\nout of diff-merges, we introduce new\n\n  diff_merges_suppress_options_parsing()\n\nand call it before generic options processing in cmd_diff_index().\n\nThis new diff_merges_suppress_options_parsing() could then be reused\nand called before invocations of setup_revisions() for other commands\nthat don't need --diff-merges options, but that's outside of the scope\nof these patch series.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n builtin/diff-index.c |  9 +++++++++\n diff-merges.c        | 25 +++++++++++++------------\n diff-merges.h        |  2 ++\n 3 files changed, 24 insertions(+), 12 deletions(-)\n\ndiff --git a/builtin/diff-index.c b/builtin/diff-index.c\nindex 176fe7ff2b4e..cf09559e422d 100644\n--- a/builtin/diff-index.c\n+++ b/builtin/diff-index.c\n@@ -2,6 +2,7 @@\n #include \"cache.h\"\n #include \"config.h\"\n #include \"diff.h\"\n+#include \"diff-merges.h\"\n #include \"commit.h\"\n #include \"revision.h\"\n #include \"builtin.h\"\n@@ -27,6 +28,12 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)\n \trev.abbrev = 0;\n \tprefix = precompose_argv_prefix(argc, argv, prefix);\n \n+\t/*\n+\t * We need no diff for merges options, and we need to avoid conflict\n+\t * with our own meaning of \"-m\".\n+\t */\n+\tdiff_merges_suppress_options_parsing();\n+\n \targc = setup_revisions(argc, argv, &rev, NULL);\n \tfor (i = 1; i < argc; i++) {\n \t\tconst char *arg = argv[i];\n@@ -35,6 +42,8 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)\n \t\t\toption |= DIFF_INDEX_CACHED;\n \t\telse if (!strcmp(arg, \"--merge-base\"))\n \t\t\toption |= DIFF_INDEX_MERGE_BASE;\n+\t\telse if (!strcmp(arg, \"-m\"))\n+\t\t\trev.match_missing = 1;\n \t\telse\n \t\t\tusage(diff_cache_usage);\n \t}\ndiff --git a/diff-merges.c b/diff-merges.c\nindex f3a9daed7e05..9ca00cdd0cc6 100644\n--- a/diff-merges.c\n+++ b/diff-merges.c\n@@ -6,6 +6,7 @@ typedef void (*diff_merges_setup_func_t)(struct rev_info *);\n static void set_separate(struct rev_info *revs);\n \n static diff_merges_setup_func_t set_to_default = set_separate;\n+static int suppress_parsing;\n \n static void suppress(struct rev_info *revs)\n {\n@@ -30,17 +31,6 @@ static void set_first_parent(struct rev_info *revs)\n \trevs->first_parent_merges = 1;\n }\n \n-static void set_m(struct rev_info *revs)\n-{\n-\t/*\n-\t * To \"diff-index\", \"-m\" means \"match missing\", and to the \"log\"\n-\t * family of commands, it means \"show default diff for merges\". Set\n-\t * both fields appropriately.\n-\t */\n-\tset_to_default(revs);\n-\trevs->match_missing = 1;\n-}\n-\n static void set_combined(struct rev_info *revs)\n {\n \tsuppress(revs);\n@@ -101,14 +91,22 @@ int diff_merges_config(const char *value)\n \treturn 0;\n }\n \n+void diff_merges_suppress_options_parsing(void)\n+{\n+\tsuppress_parsing = 1;\n+}\n+\n int diff_merges_parse_opts(struct rev_info *revs, const char **argv)\n {\n \tint argcount = 1;\n \tconst char *optarg;\n \tconst char *arg = argv[0];\n \n+\tif (suppress_parsing)\n+\t\treturn 0;\n+\n \tif (!strcmp(arg, \"-m\")) {\n-\t\tset_m(revs);\n+\t\tset_to_default(revs);\n \t} else if (!strcmp(arg, \"-c\")) {\n \t\tset_combined(revs);\n \t\trevs->combined_imply_patch = 1;\n@@ -155,6 +153,9 @@ void diff_merges_set_dense_combined_if_unset(struct rev_info *revs)\n \n void diff_merges_setup_revs(struct rev_info *revs)\n {\n+\tif (suppress_parsing)\n+\t\treturn;\n+\n \tif (revs->combine_merges == 0)\n \t\trevs->dense_combined_merges = 0;\n \tif (revs->separate_merges == 0)\ndiff --git a/diff-merges.h b/diff-merges.h\nindex 09d9a6c9a4fb..b5d57f6563e3 100644\n--- a/diff-merges.h\n+++ b/diff-merges.h\n@@ -11,6 +11,8 @@ struct rev_info;\n \n int diff_merges_config(const char *value);\n \n+void diff_merges_suppress_options_parsing(void);\n+\n int diff_merges_parse_opts(struct rev_info *revs, const char **argv);\n \n void diff_merges_suppress(struct rev_info *revs);\n-- \n2.25.1\n\n"},{"id":"425156","messageId":"20210520214703.27323-8-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210520214703.27323-1-sorganov@gmail.com","subject":"[PATCH v3 07/10] git-svn: stop passing \"-m\" to \"git rev-list\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-20T21:47:00Z","receivedAt":"2021-05-20T21:47:27Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"rev-list doesn't utilize -m. It happens to eat it silently, so this\nbug went unnoticed.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n perl/Git/SVN.pm | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm\nindex f6f1dc03c608..35ff5a68963d 100644\n--- a/perl/Git/SVN.pm\n+++ b/perl/Git/SVN.pm\n@@ -1636,7 +1636,7 @@ sub has_no_changes {\n \tmy $commit = shift;\n \n \tmy @revs = split / /, command_oneline(\n-\t\tqw(rev-list --parents -1 -m), $commit);\n+\t\tqw(rev-list --parents -1), $commit);\n \n \t# Commits with no parents, e.g. the start of a partial branch,\n \t# have changes by definition.\n-- \n2.25.1\n\n"},{"id":"425157","messageId":"20210520214703.27323-9-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210520214703.27323-1-sorganov@gmail.com","subject":"[PATCH v3 08/10] stash list: stop passing \"-m\" to \"git log\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-20T21:47:01Z","receivedAt":"2021-05-20T21:47:28Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Passing \"-m\" in \"git log --first-parent -m\" is not needed as\n--first-parent implies --diff-merges=first-parent anyway. OTOH, it\nwill stop being harmless once we let \"-m\" imply \"-p\".\n\nWhile we are at it, fix corresponding test description in t3903-stash\nto match what it actually tests.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n builtin/stash.c  | 2 +-\n t/t3903-stash.sh | 2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex d68ed784d2af..fe8e97428808 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -761,7 +761,7 @@ static int list_stash(int argc, const char **argv, const char *prefix)\n \n \tcp.git_cmd = 1;\n \tstrvec_pushl(&cp.args, \"log\", \"--format=%gd: %gs\", \"-g\",\n-\t\t     \"--first-parent\", \"-m\", NULL);\n+\t\t     \"--first-parent\", NULL);\n \tstrvec_pushv(&cp.args, argv);\n \tstrvec_push(&cp.args, ref_stash);\n \tstrvec_push(&cp.args, \"--\");\ndiff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\nindex 5f282ecf6175..873aa56e359d 100755\n--- a/t/t3903-stash.sh\n+++ b/t/t3903-stash.sh\n@@ -859,7 +859,7 @@ test_expect_success 'setup stash with index and worktree changes' '\n \tgit stash\n '\n \n-test_expect_success 'stash list implies --first-parent -m' '\n+test_expect_success 'stash list -p shows simple diff' '\n \tcat >expect <<-EOF &&\n \tstash@{0}\n \n-- \n2.25.1\n\n"},{"id":"425158","messageId":"20210520214703.27323-10-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210520214703.27323-1-sorganov@gmail.com","subject":"[PATCH v3 09/10] diff-merges: rename \"combined_imply_patch\" to \"merges_imply_patch\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-20T21:47:02Z","receivedAt":"2021-05-20T21:47:29Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"This is refactoring change in preparation for the next commit that\nwill let -m imply -p.\n\nThe old name doesn't match the intention to let not only -c/-cc imply\n-p, but also -m, that is not a \"combined\" format, so we rename the\nflag accordingly.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n diff-merges.c | 10 +++++-----\n revision.h    |  2 +-\n 2 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/diff-merges.c b/diff-merges.c\nindex 9ca00cdd0cc6..d897fd8a2933 100644\n--- a/diff-merges.c\n+++ b/diff-merges.c\n@@ -15,7 +15,7 @@ static void suppress(struct rev_info *revs)\n \trevs->combine_merges = 0;\n \trevs->dense_combined_merges = 0;\n \trevs->combined_all_paths = 0;\n-\trevs->combined_imply_patch = 0;\n+\trevs->merges_imply_patch = 0;\n \trevs->merges_need_diff = 0;\n }\n \n@@ -109,10 +109,10 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv)\n \t\tset_to_default(revs);\n \t} else if (!strcmp(arg, \"-c\")) {\n \t\tset_combined(revs);\n-\t\trevs->combined_imply_patch = 1;\n+\t\trevs->merges_imply_patch = 1;\n \t} else if (!strcmp(arg, \"--cc\")) {\n \t\tset_dense_combined(revs);\n-\t\trevs->combined_imply_patch = 1;\n+\t\trevs->merges_imply_patch = 1;\n \t} else if (!strcmp(arg, \"--no-diff-merges\")) {\n \t\tsuppress(revs);\n \t} else if (!strcmp(arg, \"--combined-all-paths\")) {\n@@ -162,9 +162,9 @@ void diff_merges_setup_revs(struct rev_info *revs)\n \t\trevs->first_parent_merges = 0;\n \tif (revs->combined_all_paths && !revs->combine_merges)\n \t\tdie(\"--combined-all-paths makes no sense without -c or --cc\");\n-\tif (revs->combined_imply_patch)\n+\tif (revs->merges_imply_patch)\n \t\trevs->diff = 1;\n-\tif (revs->combined_imply_patch || revs->merges_need_diff) {\n+\tif (revs->merges_imply_patch || revs->merges_need_diff) {\n \t\tif (!revs->diffopt.output_format)\n \t\t\trevs->diffopt.output_format = DIFF_FORMAT_PATCH;\n \t}\ndiff --git a/revision.h b/revision.h\nindex 93aa012f518e..17698cb51aca 100644\n--- a/revision.h\n+++ b/revision.h\n@@ -193,10 +193,10 @@ struct rev_info {\n \t\t\t/* Diff-merge flags */\n \t\t\texplicit_diff_merges: 1,\n \t\t\tmerges_need_diff: 1,\n+\t\t\tmerges_imply_patch:1,\n \t\t\tseparate_merges: 1,\n \t\t\tcombine_merges:1,\n \t\t\tcombined_all_paths:1,\n-\t\t\tcombined_imply_patch:1,\n \t\t\tdense_combined_merges:1,\n \t\t\tfirst_parent_merges:1;\n \n-- \n2.25.1\n\n"},{"id":"425159","messageId":"20210520214703.27323-11-sorganov@gmail.com","threadId":"55579","inReplyTo":"20210520214703.27323-1-sorganov@gmail.com","subject":"[PATCH v3 10/10] diff-merges: let \"-m\" imply \"-p\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-05-20T21:47:03Z","receivedAt":"2021-05-20T21:47:31Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Fix long standing inconsistency between -c/--cc that do imply -p on\none side, and -m that did not imply -p on the other side.\n\nChange corresponding test accordingly, as \"log -m\" output should now\nmatch one from \"log -m -p\", rather than from just \"log\".\n\nChange documentation accordingly.\n\nNOTES:\n\nAfter this patch\n\n  git log -m\n\nproduces diffs without need to provide -p as well, that improves both\nconsistency and usability. It gets even more useful if one sets\n\"log.diffMerges\" configuration variable to \"first-parent\" to force -m\nproduce usual diff with respect to first parent only.\n\nThis patch, however, does not change behavior when specific diff\nformat is explicitly provided on the command-line, so that commands\nlike\n\n  git log -m --raw\n  git log -m --stat\n\nare not affected, nor does it change commands where specific diff\nformat is active by default, such as:\n\n  git diff-tree -m\n\nIt's also worth to be noticed that exact historical semantics of -m is\nstill provided by --diff-merges=separate.\n\nSigned-off-by: Sergey Organov <sorganov@gmail.com>\n---\n Documentation/diff-options.txt | 8 ++++----\n diff-merges.c                  | 1 +\n t/t4013-diff-various.sh        | 4 ++--\n 3 files changed, 7 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex 530d1159141f..32e6dee5ac3b 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -49,10 +49,9 @@ ifdef::git-log[]\n --diff-merges=m:::\n -m:::\n \tThis option makes diff output for merge commits to be shown in\n-\tthe default format. `-m` will produce the output only if `-p`\n-\tis given as well. The default format could be changed using\n+\tthe default format. The default format could be changed using\n \t`log.diffMerges` configuration parameter, which default value\n-\tis `separate`.\n+\tis `separate`. `-m` implies `-p`.\n +\n --diff-merges=first-parent:::\n --diff-merges=1:::\n@@ -62,7 +61,8 @@ ifdef::git-log[]\n --diff-merges=separate:::\n \tThis makes merge commits show the full diff with respect to\n \teach of the parents. Separate log entry and diff is generated\n-\tfor each parent.\n+\tfor each parent. This is the format that `-m` produced\n+\thistorically.\n +\n --diff-merges=combined:::\n --diff-merges=c:::\ndiff --git a/diff-merges.c b/diff-merges.c\nindex d897fd8a2933..0dfcaa1b11b0 100644\n--- a/diff-merges.c\n+++ b/diff-merges.c\n@@ -107,6 +107,7 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv)\n \n \tif (!strcmp(arg, \"-m\")) {\n \t\tset_to_default(revs);\n+\t\trevs->merges_imply_patch = 1;\n \t} else if (!strcmp(arg, \"-c\")) {\n \t\tset_combined(revs);\n \t\trevs->merges_imply_patch = 1;\ndiff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh\nindex e561a8e48521..7fadc985cccd 100755\n--- a/t/t4013-diff-various.sh\n+++ b/t/t4013-diff-various.sh\n@@ -455,8 +455,8 @@ diff-tree --stat --compact-summary initial mode\n diff-tree -R --stat --compact-summary initial mode\n EOF\n \n-test_expect_success 'log -m matches pure log' '\n-\tgit log master >result &&\n+test_expect_success 'log -m matches log -m -p' '\n+\tgit log -m -p master >result &&\n \tprocess_diffs result >expected &&\n \tgit log -m >result &&\n \tprocess_diffs result >actual &&\n-- \n2.25.1\n\n"},{"id":"425227","messageId":"60a7f88565aa8_5503920832@natae.notmuch","threadId":"55579","inReplyTo":"87sg2h9m2n.fsf@osv.gnss.ru","subject":"Re: [PATCH 6/6] diff-merges: let -m imply -p","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2021-05-21T18:14:29Z","receivedAt":"2021-05-21T18:14:39Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Sergey Organov wrote:\n> Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> > I don't have a strong opinion about what the default for -m should be.\n> >\n> >> I think --cc is a lot better than -m for helping you find what users\n> >> changed when they did the merge, but I agree the format is somewhat\n> >> difficult for many users to understand.\n> \n> I do have strong opinion. --diff-merges=1 is the only sensible\n> factory-default. Not only it has no implicit assumptions about how given\n> commit has been achieved, it's also the only format even entire Git\n> newbie might already be familiar with.\n\nI agree.\n\n> Principle of least surprise is still a good thing to follow.\n\nI could not agree more.\n\n-- \nFelipe Contreras\n"},{"id":"432048","messageId":"YQtYEftByY8cNMml@google.com","threadId":"55579","inReplyTo":"20210520214703.27323-11-sorganov@gmail.com","subject":"Re: [PATCH v3 10/10] diff-merges: let \"-m\" imply \"-p\"","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2021-08-05T03:16:33Z","receivedAt":"2021-08-05T03:16:40Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi Sergey,\n\nSergey Organov wrote:\n\n> Fix long standing inconsistency between -c/--cc that do imply -p on\n> one side, and -m that did not imply -p on the other side.\n\nAs I mentioned before, I quite like this change for interactive use.\n\nBut:\n\n[...]\n> It's also worth to be noticed that exact historical semantics of -m is\n> still provided by --diff-merges=separate.\n\nIs that true?  When I try it locally, -m shows no diff by default,\nwhereas --diff-merges=separate shows a diff for merges.\n\nAnyway, the reason I write is that this ended up tripping up some\nscripts, namely Rust's bootstrap.py\n(https://github.com/rust-lang/rust/commit/df004df3a79b70b4af2b8c267457a5be76bb0d85):\n\n\tgit log --author=bors --format=%H -n1 \\\n\t\t-m --first-parent \\\n\t\t-- src/llvm-project\n\nIt's not clear what that *meant* the -m to do --- perhaps they intended\nit as an abbreviation for --merges.  That was fixed in Rust by\nhttps://github.com/rust-lang/rust/pull/87513; in the current code at\nhttps://github.com/rust-lang/rust/blob/master/src/bootstrap/bootstrap.py\nRust now uses\n\n\tgit log --author=bors --format=%H -n1 \\\n\t\t--no-patch --first-parent \\\n\t\t-- [etc]\n\nThere's also an open pull request at\nhttps://github.com/rust-lang/rust/pull/87532 to simplify it further, to\n\n\tgit rev-list --author=bors@rust-lang.org -n1 \\\n\t\t--merges --first-parent HEAD \\\n\t\t-- [etc]\n\nIn any event, the code using -m was pretty clearly a typo, and people\ntrying to build current Rust won't be affected since it's fixed\nalready, so this might not be too worrisome.\n\nWhat happens if someone wants to build an older version of Rust?\nbootstrap.py is \"symlinked\" from x.py at the toplevel of a Rust\ndistribution; the README explains\n\n\t## Installing from Source\n\n\tThe Rust build system uses a Python script called `x.py` to build the compiler,\n\twhich manages the bootstrapping process. It lives in the root of the project.\n\n\tThe `x.py` command can be run directly on most systems in the following format:\n\n\t```sh\n\t./x.py <subcommand> [flags]\n\t```\n\nso this tool is fundamental to everything.  The relevant code using 'git\nlog -m' is used in the\n\n\tif self.downloading_llvm() and stage0:\n\ncase to find out how recently llvm changed, in order to check that we\nhave downloaded that recent of a version of llvm.  It has a\nnot-too-complicated workaround: if you build LLVM from source using\nthe src/llvm-project submodule then this logic does not get triggered.\n\nIn other words, I don't think this issue will be _too_ problematic for\npeople working with the Rust project.  Hudson or Taylor (cc-ed) may be\nable to correct me if that's wrong.\n\nStill, it does feel a bit like we've pulled the rug from underneath\nscript authors.  \"git log --format=%H\" is generally a pretty stable\ntool, and here we've changed it when passing -m from not printing\ndiffs to printing diffs.  What do you think we should do?\n\nSome possibilities:\n\n a. Revert 'diff-merges: let \"-m\" imply \"-p\"'.  This buys us time to\n    make a more targeted change, make the change more gradually in a\n    future release, or just stop encouraging use of \"-m\" in docs.\n\n b. Make \"-m\" imply \"-p\", except in some more 'script-ish'\n    circumstances (e.g. when using log --format with a format string)\n\n c. Go ahead with the change and advertise it in release notes.\n\nSearching for other examples using\nhttps://codesearch.debian.net/search?q=%5Cbgit%5Cb.*%5Cblog%5Cb.*-m%5Cb&literal=0,\nI find that almost all uses of \"git log -m\" also include \"-p\", so (c)\nis kind of tempting.  What do you think?\n\nThanks,\nJonathan\n"},{"id":"432150","messageId":"YQyUM2uZdFBX8G0r@google.com","threadId":"55579","inReplyTo":"YQtYEftByY8cNMml@google.com","subject":"[PATCH] Revert 'diff-merges: let \"-m\" imply \"-p\"'","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2021-08-06T01:45:23Z","receivedAt":"2021-08-06T01:45:29Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"This reverts commit f5bfcc823ba242a46e20fb6f71c9fbf7ebb222fe, which\nmade \"git log -m\" imply \"--patch\" by default.  The logic was that\n\"-m\", which makes diff generation for merges perform a diff against\neach parent, has no use unless I am viewing the diff, so we could save\nthe user some typing by turning on display of the resulting diff\nautomatically.  That wasn't expected to adversely affect scripts\nbecause scripts would either be using a command like \"git diff-tree\"\nthat already emits diffs by default or would be combining -m with a\ndiff generation option such as --name-status.  By saving typing for\ninteractive use without adversely affecting scripts in the wild, it\nwould be a pure improvement.\n\nThe problem is that although diff generation options are only relevant\nfor the displayed diff, a script author can imagine them affecting\npath limiting.  For example, I might run\n\n\tgit log -w --format=%H -- README\n\nhoping to list commits that edited README, excluding whitespace-only\nchanges.  In fact, a whitespace-only change is not TREESAME so the use\nof -w here has no effect (since we don't apply these diff generation\nflags to the diff_options struct rev_info::pruning used for this\npurpose), but the documentation suggests that it should work\n\n\tSuppose you specified foo as the <paths>. We shall call\n\tcommits that modify foo !TREESAME, and the rest TREESAME. (In\n\ta diff filtered for foo, they look different and equal,\n\trespectively.)\n\nand a script author who has not tested whitespace-only changes\nwouldn't notice.\n\nSimilarly, a script author could include\n\n\tgit log -m --first-parent --format=%H -- README\n\nto filter the first-parent history for commits that modified README.\nThe -m is a no-op but it reflects the script author's intent.  For\nexample, until 1e20a407fe2 (stash list: stop passing \"-m\" to \"git\nlog\", 2021-05-21), \"git stash list\" did this.\n\nAs a result, we can't safely change \"-m\" to imply \"-p\" without fear of\nbreaking such scripts.  Restore the previous behavior.\n\nNoticed because Rust's src/bootstrap/bootstrap.py made use of this\nsame construct: https://github.com/rust-lang/rust/pull/87513.  That\nscript has been updated to omit the unnecessary \"-m\" option, but we\ncan expect other scripts in the wild to have similar expectations.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nHi,\n\nJoshua Nelson wrote[1]:\n> Jonathan Nieder wrote:\n\n>> What happens if someone wants to build an older version of Rust?\n>\n> For what it's worth, almost no one builds old versions of rust from source\n> except for distros, and distros wouldn't ever set download-ci-llvm = true. So\n> this shouldn't affect anyone in practice now that we've removed `-m` on master.\n\nThanks.  With that out of the way, I started thinking more clearly\nabout the intent behind this use of `-m` and I'm starting to think it\nwasn't a typo after all.\n\nAs a result, in terms of\n\n>>  a. Revert 'diff-merges: let \"-m\" imply \"-p\"'.  This buys us time to\n>>     make a more targeted change, make the change more gradually in a\n>>     future release, or just stop encouraging use of \"-m\" in docs.\n>>\n>>  b. Make \"-m\" imply \"-p\", except in some more 'script-ish'\n>>     circumstances (e.g. when using log --format with a format string)\n>>\n>>  c. Go ahead with the change and advertise it in release notes.\n\nnow I lean toward (a).  How about this patch?\n\nThanks,\nJonathan\n\n[1] https://lore.kernel.org/git/CAJ+j++Vj1gY93QuKDhDODXOJGXTiFFEzy0Oew+LWD7a5e7iaTA@mail.gmail.com/\n\n Documentation/diff-options.txt | 8 ++++----\n diff-merges.c                  | 1 -\n t/t4013-diff-various.sh        | 4 ++--\n 3 files changed, 6 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex 0aebe832057..c89d530d3d1 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -49,9 +49,10 @@ ifdef::git-log[]\n --diff-merges=m:::\n -m:::\n \tThis option makes diff output for merge commits to be shown in\n-\tthe default format. The default format could be changed using\n+\tthe default format. `-m` will produce the output only if `-p`\n+\tis given as well. The default format could be changed using\n \t`log.diffMerges` configuration parameter, which default value\n-\tis `separate`. `-m` implies `-p`.\n+\tis `separate`.\n +\n --diff-merges=first-parent:::\n --diff-merges=1:::\n@@ -61,8 +62,7 @@ ifdef::git-log[]\n --diff-merges=separate:::\n \tThis makes merge commits show the full diff with respect to\n \teach of the parents. Separate log entry and diff is generated\n-\tfor each parent. This is the format that `-m` produced\n-\thistorically.\n+\tfor each parent.\n +\n --diff-merges=combined:::\n --diff-merges=c:::\ndiff --git a/diff-merges.c b/diff-merges.c\nindex 0dfcaa1b11b..d897fd8a293 100644\n--- a/diff-merges.c\n+++ b/diff-merges.c\n@@ -107,7 +107,6 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv)\n \n \tif (!strcmp(arg, \"-m\")) {\n \t\tset_to_default(revs);\n-\t\trevs->merges_imply_patch = 1;\n \t} else if (!strcmp(arg, \"-c\")) {\n \t\tset_combined(revs);\n \t\trevs->merges_imply_patch = 1;\ndiff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh\nindex 7fadc985ccc..e561a8e4852 100755\n--- a/t/t4013-diff-various.sh\n+++ b/t/t4013-diff-various.sh\n@@ -455,8 +455,8 @@ diff-tree --stat --compact-summary initial mode\n diff-tree -R --stat --compact-summary initial mode\n EOF\n \n-test_expect_success 'log -m matches log -m -p' '\n-\tgit log -m -p master >result &&\n+test_expect_success 'log -m matches pure log' '\n+\tgit log master >result &&\n \tprocess_diffs result >expected &&\n \tgit log -m >result &&\n \tprocess_diffs result >actual &&\n-- \n2.32.0.605.g8dce9f2422-goog\n\n"},{"id":"432188","messageId":"xmqqh7g2ij5q.fsf@gitster.g","threadId":"55579","inReplyTo":"YQyUM2uZdFBX8G0r@google.com","subject":"Re: [PATCH] Revert 'diff-merges: let \"-m\" imply \"-p\"'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-08-06T17:21:05Z","receivedAt":"2021-08-06T17:21:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> The problem is that although diff generation options are only relevant\n> for the displayed diff, a script author can imagine them affecting\n> path limiting.  For example, I might run\n\nI am somewhat puzzled.  What does \"can imagine\" exactly mean and\njustify this change?  A script author may imagine \"git cat-file\" can\nbe expected to meow, but the command actually does not meow and end\nup disappointing the author, but that wouldn't justify a rename of\n\"cat-file\" to something else.\n\n> \tgit log -w --format=%H -- README\n>\n> hoping to list commits that edited README, excluding whitespace-only\n> changes.  In fact, a whitespace-only change is not TREESAME so the use\n> of -w here has no effect (since we don't apply these diff generation\n> flags to the diff_options struct rev_info::pruning used for this\n> purpose), but the documentation suggests that it should work\n>\n> \tSuppose you specified foo as the <paths>. We shall call\n> \tcommits that modify foo !TREESAME, and the rest TREESAME. (In\n> \ta diff filtered for foo, they look different and equal,\n> \trespectively.)\n>\n> and a script author who has not tested whitespace-only changes\n> wouldn't notice.\n\nIt would need to be corrected by a bugfix of either TREESAME\ncomputation, or a documentation fix, I would think.  I fail to see\nthe similarity you perceive to the \"-m\" issue at hand, though.\n\n> Similarly, a script author could include\n>\n> \tgit log -m --first-parent --format=%H -- README\n>\n> to filter the first-parent history for commits that modified README.\n> The -m is a no-op but it reflects the script author's intent.\n\nSo the expectation is with \"-m\" we'd give single parent commits on\nthe fp chain, and merges from side branches that change README, in\naddition to merges from side branches that was forked way before the\nREADME was updated on the trunk (hence had ancient README but the\nmerge kept the version from the trunk)?\n\n> For\n> example, until 1e20a407fe2 (stash list: stop passing \"-m\" to \"git\n> log\", 2021-05-21), \"git stash list\" did this.\n\nThis is not a example that supports your conclusion, though.  The\nreason why 288c67ca (stash: default listing to working-tree diff,\n2014-08-06) added \"-m\" on the command line to make it:\n\n  git log --format=\"%gd: %gs\" -g --first-parent -m \"$@\" $ref_stash --\n\nis to prepare for the users who may pass \"-p\" as part of the \"$@\";\nthey wil get no patches out of these merge commits that represent\nstash entries otherwise, and they'd have to pass \"-m -p\" instead,\nwithout the change.\n\n> As a result, we can't safely change \"-m\" to imply \"-p\" without fear of\n> breaking such scripts.  Restore the previous behavior.\n\nSo the above is *not* an example of a script that would have been\nbroken with this change.\n"},{"id":"432191","messageId":"xmqqczqqihkk.fsf@gitster.g","threadId":"55579","inReplyTo":"xmqqh7g2ij5q.fsf@gitster.g","subject":"Re: [PATCH] Revert 'diff-merges: let \"-m\" imply \"-p\"'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-08-06T17:55:23Z","receivedAt":"2021-08-06T17:55:30Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n>> Similarly, a script author could include\n>>\n>> \tgit log -m --first-parent --format=%H -- README\n>>\n>> to filter the first-parent history for commits that modified README.\n>> The -m is a no-op but it reflects the script author's intent.\n>\n> So the expectation is with \"-m\" we'd give single parent commits on\n> the fp chain, and merges from side branches that change README, in\n> addition to merges from side branches that was forked way before the\n> README was updated on the trunk (hence had ancient README but the\n> merge kept the version from the trunk)?\n>\n>> For\n>> example, until 1e20a407fe2 (stash list: stop passing \"-m\" to \"git\n>> log\", 2021-05-21), \"git stash list\" did this.\n>\n> This is not a example that supports your conclusion, though.  The\n> reason why 288c67ca (stash: default listing to working-tree diff,\n> 2014-08-06) added \"-m\" on the command line to make it:\n>\n>   git log --format=\"%gd: %gs\" -g --first-parent -m \"$@\" $ref_stash --\n>\n> is to prepare for the users who may pass \"-p\" as part of the \"$@\";\n> they wil get no patches out of these merge commits that represent\n> stash entries otherwise, and they'd have to pass \"-m -p\" instead,\n> without the change.\n>\n>> As a result, we can't safely change \"-m\" to imply \"-p\" without fear of\n>> breaking such scripts.  Restore the previous behavior.\n>\n> So the above is *not* an example of a script that would have been\n> broken with this change.\n\nSorry, I have to take 70% of the above back.  While it is *not* an\nexample that shows an author's intent that changes from not just\ntrunk but all side branches to README are to be shown, the original\nleft after 288c67ca (stash: default listing to working-tree diff,\n2014-08-06) would have been broken by the change you are proposing\nto revert.  It used to be just \"if you give -p we'll show a patch\"\nbut if we make \"-m\" to mean \"-m -p\", it does get broken.\n\nWhich is BAD.\n\nI am inclined to take the revert, but I do not think reverting it\nalone will break more things than it fixes.\n\nFor example, 1e20a407 (stash list: stop passing \"-m\" to \"git log\",\n2021-05-21) that dropped \"-m\" must be reverted as well, no?\n\n"},{"id":"432202","messageId":"YQ2UFmCxRKNMOtrD@google.com","threadId":"55579","inReplyTo":"xmqqczqqihkk.fsf@gitster.g","subject":"Re: [PATCH] Revert 'diff-merges: let \"-m\" imply \"-p\"'","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2021-08-06T19:57:10Z","receivedAt":"2021-08-06T19:57:16Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Junio C Hamano wrote:\n\n> For example, 1e20a407 (stash list: stop passing \"-m\" to \"git log\",\n> 2021-05-21) that dropped \"-m\" must be reverted as well, no?\n\nNo, that change is fine.  The \"-m\" doesn't have an effect one way or\nanother after this revert.\n\nThanks,\nJonathan\n"},{"id":"432219","messageId":"YQ3n9Z2nH35429mC@google.com","threadId":"55579","inReplyTo":"xmqqh7g2ij5q.fsf@gitster.g","subject":"Re: [PATCH] Revert 'diff-merges: let \"-m\" imply \"-p\"'","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2021-08-07T01:55:01Z","receivedAt":"2021-08-07T01:56:03Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nJunio C Hamano wrote:\n\n> I am somewhat puzzled.  What does \"can imagine\" exactly mean and\n> justify this change?  A script author may imagine \"git cat-file\" can\n> be expected to meow, but the command actually does not meow and end\n> up disappointing the author, but that wouldn't justify a rename of\n> \"cat-file\" to something else.\n\nSorry for the lack of clarity.  I was describing what leads a script\nauthor to include \"-m\" in a place where it has no effect.\n\nYou might be inclined to wonder why it matters _why_ a script author\nwould do such a thing, if the script author is wrong.  To me, it\nmatters because it allows us to estimate how common it is for scripts\nto use \"-m\" in this way.\n\nThe motivating example (Rust) shows that there is at least one script\nthat _did_ use \"-m\" in this way.  Rust has mitigation, but the above\nlogic leads me to believe that they are not the only project that will\nbe affected.  And more generally, when a script author has a\nreasonable reason to believe something will work, they write scripts\nwhere it _does_ work, and then an update breaks their script, I think\nit's reasonable for them not to be happy.\n\nJonathan\n"},{"id":"432242","messageId":"035b4e99-e708-f31b-2f13-e255d99dea33@kdbg.org","threadId":"55579","inReplyTo":"YQ3n9Z2nH35429mC@google.com","subject":"Re: [PATCH] Revert 'diff-merges: let \"-m\" imply \"-p\"'","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2021-08-07T06:49:12Z","receivedAt":"2021-08-07T09:44:31Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 07.08.21 um 03:55 schrieb Jonathan Nieder:\n> The motivating example (Rust) shows that there is at least one script\n> that _did_ use \"-m\" in this way.  Rust has mitigation, but the above\n> logic leads me to believe that they are not the only project that will\n> be affected.  And more generally, when a script author has a\n> reasonable reason to believe something will work, they write scripts\n> where it _does_ work, and then an update breaks their script, I think\n> it's reasonable for them not to be happy.\n\nAs you know, we have \"plumbing\" commands with a stable interface and\n\"porcelain\" commands for which we reserve to change the behavior without\nadvance notice. By your reasoning we would not need to distinguish\nbetween the two categories and were forced to keep all behavior stable.\nThis undoing of a behavior change in a \"porcelain\" command with the\nargument that one script depended on the old behavior and that others\nmight do so as well would set an unwanted precedent.\n\nPerhaps we need to point script authors to \"plumbing\" commands more clearly?\n\n(BTW, I have no opinion on whether -m should or should not imply -p.)\n\n-- Hannes\n"},{"id":"432244","messageId":"YQ6P0OWPPksWG5Hf@google.com","threadId":"55579","inReplyTo":"035b4e99-e708-f31b-2f13-e255d99dea33@kdbg.org","subject":"Re: [PATCH] Revert 'diff-merges: let \"-m\" imply \"-p\"'","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2021-08-07T13:51:12Z","receivedAt":"2021-08-07T13:51:25Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi Hannes,\n\nJohannes Sixt wrote:\n> Am 07.08.21 um 03:55 schrieb Jonathan Nieder:\n\n>> The motivating example (Rust) shows that there is at least one script\n>> that _did_ use \"-m\" in this way.  Rust has mitigation, but the above\n>> logic leads me to believe that they are not the only project that will\n>> be affected.  And more generally, when a script author has a\n>> reasonable reason to believe something will work, they write scripts\n>> where it _does_ work, and then an update breaks their script, I think\n>> it's reasonable for them not to be happy.\n>\n> As you know, we have \"plumbing\" commands with a stable interface and\n> \"porcelain\" commands for which we reserve to change the behavior without\n> advance notice. By your reasoning we would not need to distinguish\n> between the two categories and were forced to keep all behavior stable.\n> This undoing of a behavior change in a \"porcelain\" command with the\n> argument that one script depended on the old behavior and that others\n> might do so as well would set an unwanted precedent.\n\nHm, this is worth elucidating a bit more, since I am definitely in\nfavor of continuing to change porcelain commands for the better where\nwe can.  If we decide that \"git log --format=<fmt>\" is no longer part\nof the stable scripting interface we provide, then that would be a\nhuge change for our callers (and it's probably too late), but I would\ncertainly be in favor of us going back in time and doing that. :)\n\nMore generally, we've been able to make changes to porcelain commands\nthat don't hurt our ability to act as a platform for scripts, and I\nwant us to continue to be able to do that.  \"Do not break any script\"\nis certainly not the standard I think we should apply, as illustrated\nby my thoughts upthread when I thought '-m' in this Rust example was a\ntypo.\n\nBut by now it's very clear to me that it was not a typo.\n\nIn other words:\n\n- this isn't only about one obscure script.  The point of the \"this\n  was not a typo\" logic is to illustrate that in addition to the\n  examples that we know about it is very likely that there are\n  examples that we don't know about, in teams' script collections\n  beyond the reach of search engines.\n\n- In fact, in addition to the motivating example that makes it\n  possible to build Rust, we had multiple in-tree scripts that would\n  also have broken by this, if they had not been adapted to work\n  around that in the same series!  I should have noticed that in\n  review, and I'm sorry that I didn't.\n\n> Perhaps we need to point script authors to \"plumbing\" commands more clearly?\n\nI think the existence of \"plumbing\" is fairly well known, but users\ndon't always have an easy time using it.  The \"porcelain\" is what ends\nup getting the most attention in improvements, and so while I\nencourage script authors to use 'git rev-list <revs> | git diff-tree\n-s --stdin --format=<fmt>' in place of 'git log --format=<fmt>\n<revs>', most do not listen, and I can't really blame them given how\nmuch more convenient the latter is and how many more options it\nsupports.\n\nI don't think that situation will change unless we\n\n a. Maintain a second, parallel implementation of each porcelain\n    command that only uses plumbing.  This would provide an example of\n    how to use plumbing and would ensure that the plumbing grows in\n    capability at the same time as the corresponding porcelain.  Or\n\n b. Expose a library interface, so that we can expose the actual\n    helpers that support the standard implementation of porcelain\n    commands.\n\nI tried a little of (a) years ago by updating contrib/examples/ to\npass tests: https://lore.kernel.org/git/20100817065147.GA18293@burratino/.\nIt was fun but I don't think it's really sustainable.\n\nIn the long term, I think (b) is going to be an important thing to do,\nand I think it will be helpful.  Some automated callers would\nappreciate the ability to pass structured input instead of having to\npretend to be shell scripts. :)  True shell scripts would also benefit\nbecause the plumbing commands can more directly map to such a library\nAPI.\n\n> (BTW, I have no opinion on whether -m should or should not imply -p.)\n\nNevertheless, thanks for weighing in.\n\nJonathan\n"},{"id":"432252","messageId":"xmqqv94hi3zw.fsf@gitster.g","threadId":"55579","inReplyTo":"YQ6P0OWPPksWG5Hf@google.com","subject":"Re: [PATCH] Revert 'diff-merges: let \"-m\" imply \"-p\"'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-08-07T17:00:51Z","receivedAt":"2021-08-07T17:01:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> More generally, we've been able to make changes to porcelain commands\n> that don't hurt our ability to act as a platform for scripts, and I\n> want us to continue to be able to do that.  \"Do not break any script\"\n> is certainly not the standard I think we should apply, as illustrated\n> by my thoughts upthread when I thought '-m' in this Rust example was a\n> typo.\n>\n> But by now it's very clear to me that it was not a typo.\n\nThis is a tangent that does not change the conclusion, because the\nuse of \"-m\" in \"stash list\" was not a typo but a deliberate attempt\nto allow \"-p\" from the end-users to do what they wanted to do, and\nit was clearly broken by this change (as you said, the need to hide\nthe breakage in the same series should have ringed a loud bell for\nus).\n\nBut I didn't see how you think your Rust thing is not a typo, and I\nstill don't.  Unless you think Rust folks expected \"-m\" to do what\n\"-m\" was not designed to do, that is, and I do not think that\n\"people thought it did something entirely differently, when it was a\nno-op, so we shouldn't suddenly make it not a no-op\" is a good\nrationale that affects how we choose the evolution path for our\ntools.\n\nTHanks.\n"},{"id":"432253","messageId":"YQ7MGoNswyZJHjkZ@google.com","threadId":"55579","inReplyTo":"xmqqv94hi3zw.fsf@gitster.g","subject":"Re: [PATCH] Revert 'diff-merges: let \"-m\" imply \"-p\"'","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2021-08-07T18:08:26Z","receivedAt":"2021-08-07T18:08:42Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nJunio C Hamano wrote:\n\n> But I didn't see how you think your Rust thing is not a typo, and I\n> still don't.  Unless you think Rust folks expected \"-m\" to do what\n> \"-m\" was not designed to do, that is, and I do not think that\n> \"people thought it did something entirely differently, when it was a\n> no-op, so we shouldn't suddenly make it not a no-op\" is a good\n> rationale that affects how we choose the evolution path for our\n> tools.\n\nPlease don't treat this as an attempt to be argumentative: as you've\nsaid, there's plenty of other reason for us to know in retrospect that\nmaking \"-m\" imply \"-p\" is problematic for scripts.  Since you asked, I\nthink it's still worth describing my logic about the Rust example.\n\nI believe the Rust folks expected \"-m\" to do something that it is\ndesigned to do.  They _also_ overlooked a different subtlety about the\ninteraction between diff generation and path limiting.  It's good that\nRust's bootstrap.py is fixed now to be more straightforward (by now\nit's even using the plumbing command); but it is very easy for another\nscript author to have had the same confusion, which I might add was a\nharmless confusion until this change.  If we changed the behavior to\nmatch their expectation _better_ then it would be a perfectly fine\ncompatibility break that would be expected to improve the behavior of\nmore scripts than it hurts.  This change was not in that category.\n\n1. When I add \"-m --first-parent\" to my \"git log -p\" invocation, it\n   changes what diff it generates.  Until 9ab89a24390 (log: enable\n   \"-m\" automatically with \"--first-parent\", 2020-07-29), the diff\n   shown for a merge with --first-parent was simply \"no diff\".  A\n   script written before mid-2020 that wants to operate on the\n   --first-parent diff is highly likely to pass -m.\n\n2. The -m only affects diff generation and does not affect path\n   limiting.  So when no diff is being generated it is in fact a\n   no-op.  This point is fairly subtle, though, and because it is not\n   documented, script authors _in practice_ would only discover it by\n   experimentation.\n\n3. A script using -m with the intent of affecting path limiting\n   doesn't get any feedback via experimentation that they've made a\n   mistake because path limiting with --first-parent already does what\n   the script author was hoping for.\n\nWhat's relevant is not whether the script author was in the wrong or\nin the right: it's whether we expect there to be a significant number\nof scripts negatively affected by the change.  Because of (1) to (3)\nabove, I do.\n\nJonathan\n"},{"id":"432263","messageId":"xmqqy29chim6.fsf@gitster.g","threadId":"55579","inReplyTo":"YQ7MGoNswyZJHjkZ@google.com","subject":"Re: [PATCH] Revert 'diff-merges: let \"-m\" imply \"-p\"'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-08-08T00:42:41Z","receivedAt":"2021-08-08T00:42:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> Please don't treat this as an attempt to be argumentative:...\n\nI won't.  I asked you what I didn't understand in what you said.\nAnswering the question is not being argumentative ;-)\n\n> What's relevant is not whether the script author was in the wrong or\n> in the right.\n\nI do not agree with this reasoning at all.  Only if vast majority of\nusers incorrectly used the command and the option, we may need to\nconsider such a move as an exception, but not as a general rule.\n\nBut \"stash list\" example shows that \"log --first-parent -m\" without\n\"-p\" in a script has a valid reason, and a change that hurts those\nwho correctly used a command and an option in a way they were\nintended to do _is_ problematic.\n\nThanks.\n"},{"id":"432272","messageId":"xmqqeeb3hlcq.fsf@gitster.g","threadId":"55579","inReplyTo":"YQ2UFmCxRKNMOtrD@google.com","subject":"Re: [PATCH] Revert 'diff-merges: let \"-m\" imply \"-p\"'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-08-08T17:55:49Z","receivedAt":"2021-08-08T17:57:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> Junio C Hamano wrote:\n>\n>> For example, 1e20a407 (stash list: stop passing \"-m\" to \"git log\",\n>> 2021-05-21) that dropped \"-m\" must be reverted as well, no?\n>\n> No, that change is fine.  The \"-m\" doesn't have an effect one way or\n> another after this revert.\n\nAh, we are saved by the fact that \"--first-parent\" was made to imply\n\"-m\", so a \"-p\" coming from the command line of \"git stash list\"\nwould do \"log --first-parent -p\" that shows the patch we want\nwithout the need for \"-m\"... nice.\n"},{"id":"432784","messageId":"87wnolah7t.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"YQtYEftByY8cNMml@google.com","subject":"Re: [PATCH v3 10/10] diff-merges: let \"-m\" imply \"-p\"","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-08-16T09:09:42Z","receivedAt":"2021-08-16T09:09:49Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> Hi Sergey,\n>\n> Sergey Organov wrote:\n>\n>> Fix long standing inconsistency between -c/--cc that do imply -p on\n>> one side, and -m that did not imply -p on the other side.\n>\n> As I mentioned before, I quite like this change for interactive use.\n>\n> But:\n>\n> [...]\n>> It's also worth to be noticed that exact historical semantics of -m is\n>> still provided by --diff-merges=separate.\n>\n> Is that true?  When I try it locally, -m shows no diff by default,\n> whereas --diff-merges=separate shows a diff for merges.\n\nYou are right, it's not true that --diff-merges=separate behaves exactly\nlike -m did before this commit.\n\nActually, I think this notice was meant to be referring to the\n\n\"It gets even more useful if one sets \"log.diffMerges\" configuration\n variable to \"first-parent\" to force -m produce usual diff with respect\n to first parent only.\"\n\npart of the message when I wrote it, but it ends up being confusing and\nthus wrong, sorry.\n\nThanks,\n-- Sergey Organov\n"},{"id":"432929","messageId":"87a6lgl9gq.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"xmqqeeb3hlcq.fsf@gitster.g","subject":"Re: [PATCH] Revert 'diff-merges: let \"-m\" imply \"-p\"'","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-08-17T09:13:57Z","receivedAt":"2021-08-17T09:14:04Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Jonathan Nieder <jrnieder@gmail.com> writes:\n>\n>> Junio C Hamano wrote:\n>>\n>>> For example, 1e20a407 (stash list: stop passing \"-m\" to \"git log\",\n>>> 2021-05-21) that dropped \"-m\" must be reverted as well, no?\n>>\n>> No, that change is fine.  The \"-m\" doesn't have an effect one way or\n>> another after this revert.\n>\n> Ah, we are saved by the fact that \"--first-parent\" was made to imply\n> \"-m\", so a \"-p\" coming from the command line of \"git stash list\"\n> would do \"log --first-parent -p\" that shows the patch we want\n> without the need for \"-m\"... nice.\n\nSo, do I get it right that there is actually no reason to use \"log\n--first-parent -m\" anymore, since the time the much older commit made\n--first-parent imply -m?\n\nIf so, I'd object against this particular patch as the pros of patch\nbeing reverted outweighs its cons, and the original patch never meant to\nbe entirely backward compatible in the first place, when it was\naccepted.\n\nThanks,\n-- Sergey Organov\n"},{"id":"432930","messageId":"875yw4l9ac.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"xmqqy29chim6.fsf@gitster.g","subject":"Re: [PATCH] Revert 'diff-merges: let \"-m\" imply \"-p\"'","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-08-17T09:17:47Z","receivedAt":"2021-08-17T09:18:34Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Jonathan Nieder <jrnieder@gmail.com> writes:\n>\n>> Please don't treat this as an attempt to be argumentative:...\n>\n> I won't.  I asked you what I didn't understand in what you said.\n> Answering the question is not being argumentative ;-)\n>\n>> What's relevant is not whether the script author was in the wrong or\n>> in the right.\n>\n> I do not agree with this reasoning at all.  Only if vast majority of\n> users incorrectly used the command and the option, we may need to\n> consider such a move as an exception, but not as a general rule.\n>\n> But \"stash list\" example shows that \"log --first-parent -m\" without\n> \"-p\" in a script has a valid reason, and a change that hurts those\n> who correctly used a command and an option in a way they were\n> intended to do _is_ problematic.\n\nThe patch never meant to be entirely backward compatible in the first\nplace, and, as far as I can see, \"log --first-parent -m\" doesn't make\nsense anymore, since --fist-parent implies -m, that has been settled\nalready.\n\nThanks,\nSergey Organov\n"},{"id":"433035","messageId":"xmqqczqb7mds.fsf@gitster.g","threadId":"55579","inReplyTo":"87a6lgl9gq.fsf@osv.gnss.ru","subject":"Re: [PATCH] Revert 'diff-merges: let \"-m\" imply \"-p\"'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-08-17T22:10:55Z","receivedAt":"2021-08-17T22:10:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sergey Organov <sorganov@gmail.com> writes:\n\n> So, do I get it right that there is actually no reason to use \"log\n> --first-parent -m\" anymore, since the time the much older commit made\n> --first-parent imply -m?\n\nIt was necessary for scripts to say\n\n    git log --first-parent -m \"$@\"\n\nif they wanted to optionally show a first-parent diff for a merge\nwhen the user of the script passes \"-p\" in \"$@\" (and not to show\npatch if the user does not pass \"-p\").  \n\nThat changed with 9ab89a24 (log: enable \"-m\" automatically with\n\"--first-parent\", 2020-07-29).\n\nAfter that commit, it no longer was needed, but it still was correct\nto expect that no patch will be shown with \"--first-parent -m\",\nunless you give \"-p\" at the same time.  The original change that the\npatch under discussion reverted broke that expectation.\n\nWe need to note that the \"-m\" implied by \"--first-parent\" is \"if we\nwere to show some comparison, do so also for merge commits\", not the\n\"if the user says '-m', it must mean that the user wants to see\ncomparison, period, so make it imply '-p'\".  The latter is what was\nreverted.\n\n> If so, I'd object against this particular patch as the pros of patch\n> being reverted outweighs its cons, and the original patch never meant to\n> be entirely backward compatible in the first place, when it was\n> accepted.\n\nI agree that we both (and if there were other reviewers, they too)\nmistakenly thought that the change in behaviour was innocuous enough\nwhen we queued the patch, but our mistakes were caught while the\ntopic was still cooking in 'next', and I have Jonathan to thank for\nbeing extra careful.\n\nThanks.\n\n"},{"id":"433049","messageId":"87fsv7f7wx.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"xmqqczqb7mds.fsf@gitster.g","subject":"Re: [PATCH] Revert 'diff-merges: let \"-m\" imply \"-p\"'","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-08-18T08:56:14Z","receivedAt":"2021-08-18T08:56:20Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Sergey Organov <sorganov@gmail.com> writes:\n>\n>> So, do I get it right that there is actually no reason to use \"log\n>> --first-parent -m\" anymore, since the time the much older commit made\n>> --first-parent imply -m?\n>\n> It was necessary for scripts to say\n>\n>     git log --first-parent -m \"$@\"\n>\n> if they wanted to optionally show a first-parent diff for a merge\n> when the user of the script passes \"-p\" in \"$@\" (and not to show\n> patch if the user does not pass \"-p\").  \n>\n> That changed with 9ab89a24 (log: enable \"-m\" automatically with\n> \"--first-parent\", 2020-07-29).\n\nYes, and since then it's no more needed to say \"--first-parent -m\" in\nthis case, as \"--fist-parent\" will do.\n\n>\n> After that commit, it no longer was needed, but it still was correct\n> to expect that no patch will be shown with \"--first-parent -m\",\n> unless you give \"-p\" at the same time.  The original change that the\n> patch under discussion reverted broke that expectation.\n\n>\n> We need to note that the \"-m\" implied by \"--first-parent\" is \"if we\n> were to show some comparison, do so also for merge commits\", not the\n> \"if the user says '-m', it must mean that the user wants to see\n> comparison, period, so make it imply '-p'\".  The latter is what was\n> reverted.\n\nYes, there is minor backward incompatibility indeed, and that was\nexpected. This could be seen from the patch in the same series that\nfixes \"git stash\" by removing unneeded -m.\n\nThe fix for the scripts is as simple as removing -m from \"--first-parent\n-m\". It's a one-time change.\n\n>\n>> If so, I'd object against this particular patch as the pros of patch\n>> being reverted outweighs its cons, and the original patch never meant to\n>> be entirely backward compatible in the first place, when it was\n>> accepted.\n>\n> I agree that we both (and if there were other reviewers, they too)\n> mistakenly thought that the change in behaviour was innocuous enough\n> when we queued the patch, but our mistakes were caught while the\n> topic was still cooking in 'next', and I have Jonathan to thank for\n> being extra careful.\n\nSo, what would be the procedure to get this change back, as this minor\nbackward incompatibility shouldn't be the show-stopper for the change\nthat otherwise is an improvement?\n\nThanks,\n-- Sergey Organov\n"},{"id":"433149","messageId":"xmqqim011d6m.fsf@gitster.g","threadId":"55579","inReplyTo":"87fsv7f7wx.fsf@osv.gnss.ru","subject":"Re: [PATCH] Revert 'diff-merges: let \"-m\" imply \"-p\"'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-08-19T18:50:41Z","receivedAt":"2021-08-19T18:50:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sergey Organov <sorganov@gmail.com> writes:\n\n>> We need to note that the \"-m\" implied by \"--first-parent\" is \"if we\n>> were to show some comparison, do so also for merge commits\", not the\n>> \"if the user says '-m', it must mean that the user wants to see\n>> comparison, period, so make it imply '-p'\".  The latter is what was\n>> reverted.\n>\n> Yes, there is minor backward incompatibility indeed, and that was\n> expected. This could be seen from the patch in the same series that\n> fixes \"git stash\" by removing unneeded -m.\n>\n> The fix for the scripts is as simple as removing -m from \"--first-parent\n> -m\". It's a one-time change.\n> ...\n>> I agree that we both (and if there were other reviewers, they too)\n>> mistakenly thought that the change in behaviour was innocuous enough\n>> when we queued the patch, but our mistakes were caught while the\n>> topic was still cooking in 'next', and I have Jonathan to thank for\n>> being extra careful.\n>\n> So, what would be the procedure to get this change back, as this minor\n> backward incompatibility shouldn't be the show-stopper for the change\n> that otherwise is an improvement?\n\nYour repeating \"minor\" does not make it minor.  Anything you force\nexisting users and scripts to change is \"fixing the scripts\", but\n\"working around the breakage you brought to them\", which is closer\nto being a show-stopper.  I understand that you like this feature a\nlot, but you'd need to be a bit more considerate to your users and\nother people.\n\nI think it is a design mistake to make a plain vanilla \"-m\" to imply\n\"-p\" (or any \"output of result of comparison\"), simply because the\nimplication goes in the other direction, so there will never be \"get\nthis change back\", period, but see below.\n\n\"git log\" when showing a commit and asked to \"output result of\ncomparison\" like patch, combined diff, raw diff, etc. would:\n\n - show the comparison for non-merge commits and when\n   \"--first-parent\" is specified (the latter is natural since it\n   makes us consistently pretend that the merges were squash\n   merges).\n\n - shows the comparison for merge commits when -m is given.\n\nbut because \"--cc\" and \"-c\" (which are used to specify how the\nresult of comparison is shown; they are not about specifying if\n\"normally we show only non-merges\" is disabled) do not make sense in\nthe context of non-merge commits (in other words, the user is better\noff giving \"-p\" if merges are not to be shown), they are made to\nimply \"-m\".  And that is a sensible design choice.  On the other\nhand, \"--raw\" (which is used to specify how the result of comparison\nis shown; it not about specifying if \"normally we show only\nnon-merges\" is disabled) does make sense in the context of non-merge\ncommits, so unlike \"--cc\"/\"-c\", it does not imply \"-m\".  And that\nalso is a sensible design choice.  \"-p\" falls into the same bucket\nas \"--raw\", so it should not imply \"-m\".\n\nBut some folks may not like \"log -p\" to be silent about comparison\nfor merge commits (like you are).  To accomodate them, it might make\nsense to have a configuration that says \"I like -m, so when -p or\n--raw or any 'how to show comparison result' option is given, please\nmake it imply '-m'\", but it should not be the default.\n\nThanks.\n\n"},{"id":"433150","messageId":"xmqqeeap1d5c.fsf@gitster.g","threadId":"55579","inReplyTo":"xmqqim011d6m.fsf@gitster.g","subject":"Re: [PATCH] Revert 'diff-merges: let \"-m\" imply \"-p\"'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-08-19T18:51:27Z","receivedAt":"2021-08-19T18:51:30Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Your repeating \"minor\" does not make it minor.  Anything you force\n> existing users and scripts to change is \"fixing the scripts\", but\n\n... is NOT \"fixing the scripts\", of course.\n"},{"id":"433213","messageId":"87y28wct1x.fsf@osv.gnss.ru","threadId":"55579","inReplyTo":"xmqqim011d6m.fsf@gitster.g","subject":"Re: [PATCH] Revert 'diff-merges: let \"-m\" imply \"-p\"'","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2021-08-20T10:24:42Z","receivedAt":"2021-08-20T10:24:48Z","isPatch":true,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Sergey Organov <sorganov@gmail.com> writes:\n>\n>>> We need to note that the \"-m\" implied by \"--first-parent\" is \"if we\n>>> were to show some comparison, do so also for merge commits\", not the\n>>> \"if the user says '-m', it must mean that the user wants to see\n>>> comparison, period, so make it imply '-p'\".  The latter is what was\n>>> reverted.\n>>\n>> Yes, there is minor backward incompatibility indeed, and that was\n>> expected. This could be seen from the patch in the same series that\n>> fixes \"git stash\" by removing unneeded -m.\n>>\n>> The fix for the scripts is as simple as removing -m from \"--first-parent\n>> -m\". It's a one-time change.\n>> ...\n>>> I agree that we both (and if there were other reviewers, they too)\n>>> mistakenly thought that the change in behaviour was innocuous enough\n>>> when we queued the patch, but our mistakes were caught while the\n>>> topic was still cooking in 'next', and I have Jonathan to thank for\n>>> being extra careful.\n>>\n>> So, what would be the procedure to get this change back, as this minor\n>> backward incompatibility shouldn't be the show-stopper for the change\n>> that otherwise is an improvement?\n>\n> Your repeating \"minor\" does not make it minor.  Anything you force\n> existing users and scripts to change is \"fixing the scripts\", but\n> \"working around the breakage you brought to them\", which is closer\n> to being a show-stopper.\n\nBackward compatibility is important, no questions, but later on you\nstart to say that this change is a *design* mistake, so discussing\nbackward compatibility issues gets rather useless.\n\nThat said, scripts that still have \"log --first-parent -m\" are remnants\nof former sub-optimal design that was improved by \"--first-parent imply\n-m\" change about a year ago, and with current Git these scripts are\nconfusing anyway, so fixing them by removing the work around they\nhistorically have would be a good idea no matter if the change in\nquestion is accepted or not.\n\nI mean your \"working around the breakage you brought to them\" is simply\nwrong. These changes to the scripts in question are not work-arounds\nthey are rather improvements. It's \"log --first-parent -m\" in the\nscripts that is a work-around, and getting rid of -m there is getting\nrid of work-around that is not needed anymore (for about a year\nalready.)\n\n> I understand that you like this feature a lot, but you'd need to be a\n> bit more considerate to your users and other people.\n\nFirst, I believe I *am* considerate, and second, I don't either \"like\"\nor \"dislike\" the feature, personally. It's a matter of consistency of\nUI, and the fact that such requests appear on the list (not from me)\nonly supports this view. There are other people here who do think this\nis an improvement.\n\n> I think it is a design mistake to make a plain vanilla \"-m\" to imply\n> \"-p\" (or any \"output of result of comparison\"), simply because the\n> implication goes in the other direction, so there will never be \"get\n> this change back\", period, but see below.\n\nWell, I thought we've already discussed this to death and agreed this is\nan improvement, before I even started to implement the patches, and now\nwhat? I'm confused.\n\nI still believe it's reasonable for \"git log -m\" to output diffs without\nneed to explicitly specify -p, and I still see no design mistake here,\nespecially if it were implemented this way from the beginning,\nespecially given that \"git log --cc\" and and \"git log -c\" already behave\nexactly this way.\n\n>\n> \"git log\" when showing a commit and asked to \"output result of\n> comparison\" like patch, combined diff, raw diff, etc. would:\n>\n>  - show the comparison for non-merge commits and when\n>    \"--first-parent\" is specified (the latter is natural since it\n>    makes us consistently pretend that the merges were squash\n>    merges).\n>\n>  - shows the comparison for merge commits when -m is given.\n>\n> but because \"--cc\" and \"-c\" (which are used to specify how the\n> result of comparison is shown; they are not about specifying if\n> \"normally we show only non-merges\" is disabled) do not make sense in\n> the context of non-merge commits (in other words, the user is better\n> off giving \"-p\" if merges are not to be shown), they are made to\n> imply \"-m\". And that is a sensible design choice.  \n\nNo, sorry, they are made to imply -p, not -m.\n\n> On the other\n> hand, \"--raw\" (which is used to specify how the result of comparison\n> is shown; it not about specifying if \"normally we show only\n> non-merges\" is disabled) does make sense in the context of non-merge\n> commits, so unlike \"--cc\"/\"-c\", it does not imply \"-m\".  And that\n> also is a sensible design choice.  \"-p\" falls into the same bucket\n> as \"--raw\", so it should not imply \"-m\".\n\nYes, but this has nothing to do with the patch in question, as -p still\ndoesn't imply -m with this patch. It's another way around: the patch\nmakes -m imply -p, the same way -c/--cc imply -p.\n\n>\n> But some folks may not like \"log -p\" to be silent about comparison\n> for merge commits (like you are).\n\nNo, not me, and I didn't see anybody who insisted on it yet. It's fine\nwith me it's silent by default.\n\n> To accomodate them, it might make sense to have a configuration that\n> says \"I like -m, so when -p or --raw or any 'how to show comparison\n> result' option is given, please make it imply '-m'\", but it should not\n> be the default.\n\nThis has nothing to do with the patch in question, and I actually don't\nlike the idea, sorry.\n\nOverall, my opinion is still that there is nothing wrong with \"-m\nimplies -p\", as implemented by the patch, as if user asks to output\ndiffs even for merge commits, it's likely they need diffs for *all* of\nthem. This is again consistent with how -c/--cc work.\n\nNow, only provided we *again* and *finally* agree that -m should better\nimply -p, we can get back to discussing backward incompatibility this\nchange does introduce, and how to get transition smoother if it needs to\nbe.\n\nThanks,\n-- Sergey Organov\n"}]}