{"thread":{"id":"60207","subject":"Please explain avoiding history simplifications when diffing merges","startedAt":"2023-09-08T09:09:27Z","lastAt":"2023-09-25T16:11:38Z","messageCount":4,"participants":["Magnus Holmgren","Bagas Sanjaya"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"481547","messageId":"3337579.YDm8p7mPUg@utklippan","threadId":"60207","inReplyTo":null,"subject":"Please explain avoiding history simplifications when diffing merges","fromName":"Magnus Holmgren","fromEmail":"magnus.holmgren@milientsoftware.com","sentAt":"2023-09-08T09:09:20Z","receivedAt":"2023-09-08T09:09:27Z","isPatch":false,"sender":{"key":"magnus.holmgren@milientsoftware.com","avatar":null},"body":"Hi (and thanks for a great free tool).\n\nQGit was bitten by \nhttps://github.com/git/git/commit/0dec322d31db3920872f43bdd2a7ddd282a5be67\n\nIt looks like passing --simplify-merges to override the default solves the \nproblem, but I still want to ask here because I'm not sure I fully understand \nthe reasoning:\n\n> the default history simplification would remove merge commits from \n> consideration if the file \"path\" matched the second parent.\n\nI guess that means that even if there was a difference relative to the first \nparent, which you wanted to see, the merge commit would be omitted if there's \nno diff relative to the second parent? That's fine, and history simplification \nisn't trivial, but now every merge commit ever is included in the commit log \nof an individual file, even if that file was only added somewhere in the \nmiddle and never changed since. Is that really desirable? Shouldn't it be \npossible to include only merge commits that are not TREESAME to *all* parents?\n\nThanks,\n-- \nMagnus Holmgren\n./¯\\_/¯\\. Milient\n(also holmgren@debian.org)\n\n\n"},{"id":"481874","messageId":"2250343.okVFLFBGsW@utklippan","threadId":"60207","inReplyTo":"3337579.YDm8p7mPUg@utklippan","subject":"Re: Please explain avoiding history simplifications when diffing merges","fromName":"Magnus Holmgren","fromEmail":"magnus.holmgren@milientsoftware.com","sentAt":"2023-09-15T15:10:28Z","receivedAt":"2023-09-15T15:11:31Z","isPatch":false,"sender":{"key":"magnus.holmgren@milientsoftware.com","avatar":null},"body":"Friday, 8 September 2023 11:09:20 CEST, I wrote\n> QGit was bitten by\n> https://github.com/git/git/commit/0dec322d31db3920872f43bdd2a7ddd282a5be67\n\nMaybe I should link to the QGit issue:\nhttps://github.com/tibirna/qgit/issues/129\n\n> It looks like passing --simplify-merges to override the default solves the\n> problem, but I still want to ask here because I'm not sure I fully\n> understand\n> the reasoning:\n> > the default history simplification would remove merge commits from\n> > consideration if the file \"path\" matched the second parent.\n\nAs I wrote at the above URL, I realized that the old git log output without --\nsimplify-merges and the output with --simplify-merges aren't quite the same. \nThe old output indeed omits some interesting merge commits, which may explain \nwhy the change was made, but git log --simplify-merges does include them, so \nit seems a reasonable default to me.\n\nHowever, QGit has a problem: git log --diff-merges=separate includes a \nseparate diff for each parent, but only for each parent with differences \ncompared to the merge commit, *and* there's no custom format placeholder for \nthe current parent, only for the list of parents (%P/%p). How should one go \nabout adding that? I figure the format_commit_context struct in pretty.c needs \nanother field.\n\n-- \nMagnus Holmgren\n./¯\\_/¯\\. Milient\n\n\n\n"},{"id":"481939","messageId":"ZQbNtgd82iARQ39D@debian.me","threadId":"60207","inReplyTo":"2250343.okVFLFBGsW@utklippan","subject":"Re: Please explain avoiding history simplifications when diffing merges","fromName":"Bagas Sanjaya","fromEmail":"bagasdotme@gmail.com","sentAt":"2023-09-17T09:58:14Z","receivedAt":"2023-09-17T09:59:15Z","isPatch":false,"sender":{"key":"bagasdotme@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40219486?v=4"},"body":"On Fri, Sep 15, 2023 at 05:10:28PM +0200, Magnus Holmgren wrote:\n> Friday, 8 September 2023 11:09:20 CEST, I wrote\n> > QGit was bitten by\n> > https://github.com/git/git/commit/0dec322d31db3920872f43bdd2a7ddd282a5be67\n> \n> Maybe I should link to the QGit issue:\n> https://github.com/tibirna/qgit/issues/129\n> \n> > It looks like passing --simplify-merges to override the default solves the\n> > problem, but I still want to ask here because I'm not sure I fully\n> > understand\n> > the reasoning:\n> > > the default history simplification would remove merge commits from\n> > > consideration if the file \"path\" matched the second parent.\n> \n> As I wrote at the above URL, I realized that the old git log output without --\n> simplify-merges and the output with --simplify-merges aren't quite the same. \n> The old output indeed omits some interesting merge commits, which may explain \n> why the change was made, but git log --simplify-merges does include them, so \n> it seems a reasonable default to me.\n\nCan you provide examples?\n\n> \n> However, QGit has a problem: git log --diff-merges=separate includes a \n> separate diff for each parent, but only for each parent with differences \n> compared to the merge commit, *and* there's no custom format placeholder for \n> the current parent, only for the list of parents (%P/%p). How should one go \n> about adding that? I figure the format_commit_context struct in pretty.c needs \n> another field.\n\nWhat are you trying to accomplish with your proposed formatting verbs?\n\nConfused...\n\n-- \nAn old man doll... just what I always wanted! - Clara\n"},{"id":"482285","messageId":"6191124.FXmgHNBoPt@utklippan","threadId":"60207","inReplyTo":"ZQbNtgd82iARQ39D@debian.me","subject":"Re: Please explain avoiding history simplifications when diffing merges","fromName":"Magnus Holmgren","fromEmail":"magnus.holmgren@milientsoftware.com","sentAt":"2023-09-25T16:11:26Z","receivedAt":"2023-09-25T16:11:38Z","isPatch":false,"sender":{"key":"magnus.holmgren@milientsoftware.com","avatar":null},"body":"söndag 17 september 2023 11:58:14 CEST skrev  Bagas Sanjaya:\n> On Fri, Sep 15, 2023 at 05:10:28PM +0200, Magnus Holmgren wrote:\n> > Friday, 8 September 2023 11:09:20 CEST, I wrote\n> > \n> > > QGit was bitten by\n> > > https://github.com/git/git/commit/0dec322d31db3920872f43bdd2a7ddd282a5be\n> > > 67\n> > \n> > Maybe I should link to the QGit issue:\n> > https://github.com/tibirna/qgit/issues/129\n> > \n> > > It looks like passing --simplify-merges to override the default solves\n> > > the\n> > > problem, but I still want to ask here because I'm not sure I fully\n> > > understand\n> > > \n> > > the reasoning:\n> > > > the default history simplification would remove merge commits from\n> > > > consideration if the file \"path\" matched the second parent.\n> > \n> > As I wrote at the above URL, I realized that the old git log output\n> > without -- simplify-merges and the output with --simplify-merges aren't\n> > quite the same. The old output indeed omits some interesting merge\n> > commits, which may explain why the change was made, but git log\n> > --simplify-merges does include them, so it seems a reasonable default to\n> > me.\n> \n> Can you provide examples?\n\ngit init git-test; cd git-test\necho foo > test; git add test; git commit -m Initial\ngit branch testbranch\ngit branch irrelevantbranch\necho foobar > test; git commit -am Change\ngit switch testbranch\necho barfoo > test; git commit -am Diverge\ngit switch irrelevantbranch\necho whatever > otherfile; git add otherfile\ngit commit -m \"Add other file\"\ngit switch master\ngit merge -m \"Merge branch 'testbranch'\" -s ours testbranch\ngit merge -m \"Merge branch 'irrelevantbranch' irrelevantbranch\ngit log test  # old git doesn't show either merge commit, new git shows both\ngit log --simplify-merges test  # both versions show the first merge commit\ngit log --diff-merges=separate -p --simplify-merges test # only in new git\n# note that only one diff is generated because the other would be empty,\n# although the man page says \"Separate log entry and diff is generated for\n# each parent.\"\n\n> > However, QGit has a problem: git log --diff-merges=separate includes a\n> > separate diff for each parent, but only for each parent with differences\n> > compared to the merge commit, *and* there's no custom format placeholder\n> > for the current parent, only for the list of parents (%P/%p). How should\n> > one go about adding that? I figure the format_commit_context struct in\n> > pretty.c needs another field.\n> \n> What are you trying to accomplish with your proposed formatting verbs?\n\nQGit builds annotated file histories by parsing git log output. To accomplish \nthat, it needs to use a custom, more machine-readable format, and to handle \nmerge commits correctly, it either needs one diff per parent in the order the \nparents are listed, or it needs to know which parent each diff is relative to.\n\nBecause old git log (without --simplify-merges) only included merge commits \nwhere the file in question is different to all parents, it didn't get confused \nby missing diffs - it was all or nothing - but some merge commits were missing \nin the file history view.\n\nQGit should be rewritten to use libgit2, but regardless, I think all the \ninformation you can get with a standard format should be available to custom \nformats as well.\n\n-- \nMagnus Holmgren\n./¯\\_/¯\\. Milient\n\n\n\n"}]}