{"thread":{"id":"22593","subject":"What should I do to display the diff of even a simple merge commit?","startedAt":"2010-02-09T23:45:44Z","lastAt":"2010-02-10T03:23:18Z","messageCount":9,"participants":["Christian MICHON","Petr Baudis","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"134093","messageId":"46d6db661002091545j74f625ffr74ca70a0474948fc@mail.gmail.com","threadId":"22593","inReplyTo":null,"subject":"What should I do to display the diff of even a simple merge commit?","fromName":"Christian MICHON","fromEmail":"christian.michon@gmail.com","sentAt":"2010-02-09T23:45:44Z","receivedAt":"2010-02-09T23:45:44Z","isPatch":false,"sender":{"key":"christian.michon@gmail.com","avatar":"https://gravatar.com/avatar/8a7c327b21187fbcab5c27640a49450eec72e0355dc292501197f27a5a744ec4?d=mp&s=160"},"body":"Hi list,\n\nI'm performing many merges between developpers branches these days,\nmost of them not yielding into conflicts. (understand: simple merges)\n\nAll is good, but sometimes, I would like to really like what has been changed.\n\nAs I do not systematically do this \"git merge --no-commit --stat\n<list_to_merge>\" and then fire \"git gui\" to inspect the diffs before\nthe real commit, I'm wondering: how could I do this using some\nplumbing ?\n\nRight now, I've tried the obvious git log -c -p, git show -u --cc, but\nsince the merge are simple merges, I cannot get any diff output. I\nbelieve this is by construction.\n\nAny hints ?\n\nThanks in advance.\n\n-- \nChristian\n--\nhttp://detaolb.sourceforge.net/, a linux distribution for Qemu with Git inside !\n"},{"id":"134094","messageId":"46d6db661002091546r1372836cs5dc47d54ae8eb19e@mail.gmail.com","threadId":"22593","inReplyTo":"46d6db661002091545j74f625ffr74ca70a0474948fc@mail.gmail.com","subject":"Re: What should I do to display the diff of even a simple merge commit?","fromName":"Christian MICHON","fromEmail":"christian.michon@gmail.com","sentAt":"2010-02-09T23:46:57Z","receivedAt":"2010-02-09T23:46:57Z","isPatch":false,"sender":{"key":"christian.michon@gmail.com","avatar":"https://gravatar.com/avatar/8a7c327b21187fbcab5c27640a49450eec72e0355dc292501197f27a5a744ec4?d=mp&s=160"},"body":"On Wed, Feb 10, 2010 at 12:45 AM, Christian MICHON\n<christian.michon@gmail.com> wrote:\n> Hi list,\n>\n> I'm performing many merges between developpers branches these days,\n> most of them not yielding into conflicts. (understand: simple merges)\n>\n> All is good, but sometimes, I would like to really like what has been changed.\n\nI meant << I would really like to see what has been changed. >>\n\n>\n> As I do not systematically do this \"git merge --no-commit --stat\n> <list_to_merge>\" and then fire \"git gui\" to inspect the diffs before\n> the real commit, I'm wondering: how could I do this using some\n> plumbing ?\n>\n> Right now, I've tried the obvious git log -c -p, git show -u --cc, but\n> since the merge are simple merges, I cannot get any diff output. I\n> believe this is by construction.\n>\n> Any hints ?\n>\n> Thanks in advance.\n>\n\n-- \nChristian\n--\nhttp://detaolb.sourceforge.net/, a linux distribution for Qemu with Git inside !\n"},{"id":"134096","messageId":"20100209235707.GQ9553@machine.or.cz","threadId":"22593","inReplyTo":"46d6db661002091545j74f625ffr74ca70a0474948fc@mail.gmail.com","subject":"Re: What should I do to display the diff of even a simple merge commit?","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2010-02-09T23:57:07Z","receivedAt":"2010-02-09T23:57:07Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"  Hi!\n\nOn Wed, Feb 10, 2010 at 12:45:44AM +0100, Christian MICHON wrote:\n> I'm performing many merges between developpers branches these days,\n> most of them not yielding into conflicts. (understand: simple merges)\n> \n> All is good, but sometimes, I would like to really like what has been changed.\n> \n> As I do not systematically do this \"git merge --no-commit --stat\n> <list_to_merge>\" and then fire \"git gui\" to inspect the diffs before\n> the real commit, I'm wondering: how could I do this using some\n> plumbing ?\n> \n> Right now, I've tried the obvious git log -c -p, git show -u --cc, but\n> since the merge are simple merges, I cannot get any diff output. I\n> believe this is by construction.\n> \n> Any hints ?\n\n  I'm not sure if there is any clever switch for this, but I usually\njust use one of\n\n\tgit diff mergecommit^1 mergecommit\n\tgit diff mergecommit^2 mergecommit\n\ndepending on which parent I want the diff against. If you always do your\nmerges as \"on mainline, merging in a topic\" without fast-forwarding,\ndiff against the first parent will be probably the right one and you can\nsimply use:\n\n\tgit diff mergecommit^ mergecommit\n\n  Kind regards,\n\n\t\t\t\tPetr \"Pasky\" Baudis\n"},{"id":"134097","messageId":"7v1vguuf8h.fsf@alter.siamese.dyndns.org","threadId":"22593","inReplyTo":"20100209235707.GQ9553@machine.or.cz","subject":"Re: What should I do to display the diff of even a simple merge commit?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-02-10T00:05:50Z","receivedAt":"2010-02-10T00:05:50Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Petr Baudis <pasky@suse.cz> writes:\n\n>   I'm not sure if there is any clever switch for this, but I usually\n> just use one of\n>\n> \tgit diff mergecommit^1 mergecommit\n> \tgit diff mergecommit^2 mergecommit\n>\n> depending on which parent I want the diff against. If you always do your\n> merges as \"on mainline, merging in a topic\" without fast-forwarding,\n> diff against the first parent will be probably the right one and you can\n> simply use:\n>\n> \tgit diff mergecommit^ mergecommit\n\nFrankly, we should make \"git log --first-parent -p\" DTRT, I think.\n\nThe attitude towards merges we maintain officially is \"all parents are\nequal\", but in practice, there often are cases where --first-parent\ntraversal makes a lot more sense when browsing the history (especially\n\"the official\" one).  The use of that option should be a clear enough sign\nthat diff between the first parent and the merge result is asked for.\n"},{"id":"134098","messageId":"46d6db661002091607ka7a9c9bncc996bd5d8a26a88@mail.gmail.com","threadId":"22593","inReplyTo":"20100209235707.GQ9553@machine.or.cz","subject":"Re: What should I do to display the diff of even a simple merge commit?","fromName":"Christian MICHON","fromEmail":"christian.michon@gmail.com","sentAt":"2010-02-10T00:07:01Z","receivedAt":"2010-02-10T00:07:01Z","isPatch":false,"sender":{"key":"christian.michon@gmail.com","avatar":"https://gravatar.com/avatar/8a7c327b21187fbcab5c27640a49450eec72e0355dc292501197f27a5a744ec4?d=mp&s=160"},"body":"On Wed, Feb 10, 2010 at 12:57 AM, Petr Baudis <pasky@suse.cz> wrote:\n>  Hi!\n>\n> On Wed, Feb 10, 2010 at 12:45:44AM +0100, Christian MICHON wrote:\n>> I'm performing many merges between developpers branches these days,\n>> most of them not yielding into conflicts. (understand: simple merges)\n>>\n>> All is good, but sometimes, I would like to really like what has been changed.\n>>\n>> As I do not systematically do this \"git merge --no-commit --stat\n>> <list_to_merge>\" and then fire \"git gui\" to inspect the diffs before\n>> the real commit, I'm wondering: how could I do this using some\n>> plumbing ?\n>>\n>> Right now, I've tried the obvious git log -c -p, git show -u --cc, but\n>> since the merge are simple merges, I cannot get any diff output. I\n>> believe this is by construction.\n>>\n>> Any hints ?\n>\n>  I'm not sure if there is any clever switch for this, but I usually\n> just use one of\n>\n>        git diff mergecommit^1 mergecommit\n>        git diff mergecommit^2 mergecommit\n>\n> depending on which parent I want the diff against. If you always do your\n> merges as \"on mainline, merging in a topic\" without fast-forwarding,\n> diff against the first parent will be probably the right one and you can\n> simply use:\n>\n>        git diff mergecommit^ mergecommit\n>\n\nHi Petr,\n\nunfortunately it does not ouput anything :-( the diff is empty, again...\n\nI'm fiddling now with \"git checkout -f <that-commit>\", and I'm faking\nan \"amend last commit\" using \"git gui\". With this dirty trick, I get\nthe same diff I would have gotten from git gui with a merge\n--no-commit.\n\nThanks for suggesting !\n\n-- \nChristian\n--\nhttp://detaolb.sourceforge.net/, a linux distribution for Qemu with Git inside !\n"},{"id":"134099","messageId":"20100210011149.GR9553@machine.or.cz","threadId":"22593","inReplyTo":"7v1vguuf8h.fsf@alter.siamese.dyndns.org","subject":"[PATCH] git log -p -m: Document, honor --first-parent","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2010-02-10T01:11:49Z","receivedAt":"2010-02-10T01:11:49Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"On Tue, Feb 09, 2010 at 04:05:50PM -0800, Junio C Hamano wrote:\n> Petr Baudis <pasky@suse.cz> writes:\n> \n> >   I'm not sure if there is any clever switch for this, but I usually\n> > just use one of\n> >\n> > \tgit diff mergecommit^1 mergecommit\n> > \tgit diff mergecommit^2 mergecommit\n> >\n> > depending on which parent I want the diff against. If you always do your\n> > merges as \"on mainline, merging in a topic\" without fast-forwarding,\n> > diff against the first parent will be probably the right one and you can\n> > simply use:\n> >\n> > \tgit diff mergecommit^ mergecommit\n> \n> Frankly, we should make \"git log --first-parent -p\" DTRT, I think.\n> \n> The attitude towards merges we maintain officially is \"all parents are\n> equal\", but in practice, there often are cases where --first-parent\n> traversal makes a lot more sense when browsing the history (especially\n> \"the official\" one).  The use of that option should be a clear enough sign\n> that diff between the first parent and the merge result is asked for.\n\nI have also discovered -m while digging into this, which seems to have\nthe effect of showing the merge TWICE, each time against a different\nparent; this is sort-of-almost what Christian also wanted.\n\nThis seems to be undocumented and does have this effect only in log,\nnot in show - I have absolutely no idea why from cursory code\nexamination.\n\nI think making just --first-parent alone imply this behavior is wrong,\nIMHO first-parent alone does not warrant avoiding combined-diff behavior.\nI'm not really sure though, so feel free to add another\n\n\tif (revs->diff && revs->follow_first_parent)\n\t\trevs->ignore_merges = 0;\n\ntest at the right place (whatever that is).  At any rate, -m explicitly\nstates the intent and the current behavior of not honoring\n--first-parent is IMHO a bug.\n\nI think --first-parent documentation is still accurate with the new\nbehavior, so I adjusted just -m documentation - also making the flag\nactually visible for non-diff-tree-stdin cases. Sorry that it's both\nconflated in a single patch, I'd rather avoid creating a patch queue\nout of this supposedly-5-minute hack.\n\n--8<--\n\ngit log -p -m has a special magic behavior of showin one merge entry per\nparent, with an appropriate diff; this can be frequently useful when\nexamining histories where full set of changes introduced by a merged\nbranch is interesting, not only the conflicts.\n\nThis patch properly documents the -m switch, which has so far been\nmentioned only as a fairly special diff-tree flag. It also makes the\ncode show full patch entry only for the first parent in case\n--first-parent is used. Thus,\n\n\tgit log -p -m --first-parent\n\nwill show the history from the \"main branch perspective\", while also\nincluding full diff of changes introduced by other merged in branches.\n\nSigned-off-by: Petr Baudis <pasky@suse.cz>\n\n---\n\ndiff --git a/Documentation/diff-generate-patch.txt b/Documentation/diff-generate-patch.txt\nindex 0f25ba7..8f9a241 100644\n--- a/Documentation/diff-generate-patch.txt\n+++ b/Documentation/diff-generate-patch.txt\n@@ -56,7 +56,8 @@ combined diff format\n \n \"git-diff-tree\", \"git-diff-files\" and \"git-diff\" can take '-c' or\n '--cc' option to produce 'combined diff'.  For showing a merge commit\n-with \"git log -p\", this is the default format.\n+with \"git log -p\", this is the default format; you can force showing\n+full diff with the '-m' option.\n A 'combined diff' format looks like this:\n \n ------------\ndiff --git a/Documentation/git-log.txt b/Documentation/git-log.txt\nindex 0e39bb6..a2a2d04 100644\n--- a/Documentation/git-log.txt\n+++ b/Documentation/git-log.txt\n@@ -118,6 +118,15 @@ git log master --not --remotes=*/master::\n \tShows all commits that are in local master but not in any remote\n \trepository master branches.\n \n+git log -p -m --first-parent::\n+\n+\tShows the history including change diffs, but only from the\n+\t\"main branch\" perspective, skipping commits that come only from\n+\tmerges, and showing full diffs of changes introduced by the merges.\n+\tThis makes sense only when following a strict policy of merging all\n+\ttopic branches when staying on a single integration branch and\n+\tmaking sure the merges are not fast-forwards.\n+\n Discussion\n ----------\n \ndiff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt\nindex 6e9baf8..d7d0dee 100644\n--- a/Documentation/rev-list-options.txt\n+++ b/Documentation/rev-list-options.txt\n@@ -108,8 +108,8 @@ options may be given. See linkgit:git-diff-files[1] for more options.\n \n -c::\n \n-\tThis flag changes the way a merge commit is displayed.  It shows\n-\tthe differences from each of the parents to the merge result\n+\tThis flag forces the default way a merge commit is displayed.  It\n+\tshows the differences from each of the parents to the merge result\n \tsimultaneously instead of showing pairwise diff between a parent\n \tand the result one at a time. Furthermore, it lists only files\n \twhich were modified from all parents.\n@@ -121,6 +121,15 @@ options may be given. See linkgit:git-diff-files[1] for more options.\n \tthe parents have only two variants and the merge result picks\n \tone of them without modification.\n \n+-m::\n+\n+\tThis flag makes the merge commits show the full diff like\n+\tregular commits; for each merge parent, a separate log entry\n+\tand diff is generated. (An exception is made if '--first-parent'\n+\toption has been also passed; in that case, only diff against\n+\tthe first parent is shown, representing the changes the merge\n+\tbrought _into_ the then-current branch.)\n+\n -r::\n \n \tShow recursive diffs.\ndiff --git a/log-tree.c b/log-tree.c\nindex 27afcf6..fb990a1 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -514,6 +514,14 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log\n \t\t\treturn 0;\n \t\telse if (opt->combine_merges)\n \t\t\treturn do_diff_combined(opt, commit);\n+\t\telse if (opt->first_parent_only) {\n+\t\t\t/* Generate merge log entry only for the first\n+\t\t\t * parent, showing summary diff of the others\n+\t\t\t * we merged _in_. */\n+\t\t\tdiff_tree_sha1(parents->item->object.sha1, sha1, \"\", &opt->diffopt);\n+\t\t\tlog_tree_diff_flush(opt);\n+\t\t\treturn !opt->loginfo;\n+\t\t}\n \n \t\t/* If we show individual diffs, show the parent info */\n \t\tlog->parent = parents->item;\n"},{"id":"134103","messageId":"7vpr4dop1m.fsf@alter.siamese.dyndns.org","threadId":"22593","inReplyTo":"20100210011149.GR9553@machine.or.cz","subject":"Re: [PATCH] git log -p -m: Document, honor --first-parent","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-02-10T01:30:29Z","receivedAt":"2010-02-10T01:30:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Petr Baudis <pasky@suse.cz> writes:\n\n> diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt\n> index 0e39bb6..a2a2d04 100644\n> --- a/Documentation/git-log.txt\n> +++ b/Documentation/git-log.txt\n> @@ -118,6 +118,15 @@ git log master --not --remotes=*/master::\n>  \tShows all commits that are in local master but not in any remote\n>  \trepository master branches.\n>  \n> +git log -p -m --first-parent::\n> +\n> +\tShows the history including change diffs, but only from the\n> +\t\"main branch\" perspective, skipping commits that come only from\n> +\tmerges, and showing full diffs of changes introduced by the merges.\n> +\tThis makes sense only when following a strict policy of merging all\n> +\ttopic branches when staying on a single integration branch and\n> +\tmaking sure the merges are not fast-forwards.\n\nI think the tone of the last three lines is too strong.\n\nWhy is it necessary to make a merge with a single commit side branch when\nfast-forward would do?  And if the side branch is actually two or more\ncommits, it will show the broken-down changes in more detail, but the fact\nthat it was made on the \"primary\" history would also have some\nsignificance (e.g. trivial and obvious fixes made directly on 'master',\nother branches merged from topic after cooking).\n\nIt is Ok to elaborate on the \"policy\" issues in the Discussion section,\nbut otherwise, I would rather see you spend the same number of lines to\nclarify \"showing full diffs of changes introduced by the merges\" a bit\nbetter (e.g. it is unclear if you are showing diff from each parents or\njust from the first parent).  Perhaps \"s/introduced /& to the first-parent\nancestry /\" may suffice.\n\n> diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt\n> index 6e9baf8..d7d0dee 100644\n> --- a/Documentation/rev-list-options.txt\n> +++ b/Documentation/rev-list-options.txt\n> @@ -108,8 +108,8 @@ options may be given. See linkgit:git-diff-files[1] for more options.\n>  \n>  -c::\n>  \n> -\tThis flag changes the way a merge commit is displayed.  It shows\n> -\tthe differences from each of the parents to the merge result\n> +\tThis flag forces the default way a merge commit is displayed.  It\n> +\tshows the differences from each of the parents to the merge result\n>  \tsimultaneously instead of showing pairwise diff between a parent\n\nSorry, I don't understand this change; \"forces the default?\"  Any option\n\"forces\" the command to behave differently.  At least the original is\nunderstandable \"Ah, without it it shows one way but with this it shows in\na different way\", even though that does not carry much useful information\n(i.e. what are the two ways?  ah, I need to read further down).\n\n> diff --git a/log-tree.c b/log-tree.c\n> index 27afcf6..fb990a1 100644\n> --- a/log-tree.c\n> +++ b/log-tree.c\n> @@ -514,6 +514,14 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log\n>  \t\t\treturn 0;\n>  \t\telse if (opt->combine_merges)\n>  \t\t\treturn do_diff_combined(opt, commit);\n> +\t\telse if (opt->first_parent_only) {\n> +\t\t\t/* Generate merge log entry only for the first\n> +\t\t\t * parent, showing summary diff of the others\n> +\t\t\t * we merged _in_. */\n\nStyle?\n\nDon't we use --cc as default for \"show\" (and possibly \"log\"---I don't\nremember the details)?\n\n> +\t\t\tdiff_tree_sha1(parents->item->object.sha1, sha1, \"\", &opt->diffopt);\n> +\t\t\tlog_tree_diff_flush(opt);\n> +\t\t\treturn !opt->loginfo;\n> +\t\t}\n\nThis needs some tests but I think it is a good first step in the right\ndirection.\n\nThanks.\n"},{"id":"134106","messageId":"20100210021148.GT9553@machine.or.cz","threadId":"22593","inReplyTo":"7vpr4dop1m.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] git log -p -m: Document, honor --first-parent","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2010-02-10T02:12:10Z","receivedAt":"2010-02-10T02:12:10Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"On Tue, Feb 09, 2010 at 05:30:29PM -0800, Junio C Hamano wrote:\n> Petr Baudis <pasky@suse.cz> writes:\n> \n> > diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt\n> > index 0e39bb6..a2a2d04 100644\n> > --- a/Documentation/git-log.txt\n> > +++ b/Documentation/git-log.txt\n> > @@ -118,6 +118,15 @@ git log master --not --remotes=*/master::\n> >  \tShows all commits that are in local master but not in any remote\n> >  \trepository master branches.\n> >  \n> > +git log -p -m --first-parent::\n> > +\n> > +\tShows the history including change diffs, but only from the\n> > +\t\"main branch\" perspective, skipping commits that come only from\n> > +\tmerges, and showing full diffs of changes introduced by the merges.\n> > +\tThis makes sense only when following a strict policy of merging all\n> > +\ttopic branches when staying on a single integration branch and\n> > +\tmaking sure the merges are not fast-forwards.\n> \n> I think the tone of the last three lines is too strong.\n> \n> Why is it necessary to make a merge with a single commit side branch when\n> fast-forward would do?  And if the side branch is actually two or more\n> commits, it will show the broken-down changes in more detail, but the fact\n> that it was made on the \"primary\" history would also have some\n> significance (e.g. trivial and obvious fixes made directly on 'master',\n> other branches merged from topic after cooking).\n\nOk, so what about \"...the merges are not fast-forwards if the branch\nhistories are non-trivial\"? Since there are two cases:\n\n* The branch was created on top of HEAD, the commits were made and now\nthe branch is merged back, that's an \"ok fastforward\".\n\n* The branch was created long ago, but has merged latest changes of the\ntop of HEAD in, and now the branch is merged back, that's a \"bad\nfastforward\" since that flips the perspective of main-vs-topic branch.\n\nI feel that it's important to point out this caveat.\n\n> It is Ok to elaborate on the \"policy\" issues in the Discussion section,\n> but otherwise, I would rather see you spend the same number of lines to\n> clarify \"showing full diffs of changes introduced by the merges\" a bit\n> better (e.g. it is unclear if you are showing diff from each parents or\n> just from the first parent).  Perhaps \"s/introduced /& to the first-parent\n> ancestry /\" may suffice.\n\nI really dislike the \"first-parent ancestry\" wording, I think it muds\ndown the whole issue.  It would seem to me that the basic idea is clear\nfrom the description (which might even now be excessively verbose) and\nif anyone is still confused, they can quickly peek at -m description or\nactually try the command out.\n\n> > diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt\n> > index 6e9baf8..d7d0dee 100644\n> > --- a/Documentation/rev-list-options.txt\n> > +++ b/Documentation/rev-list-options.txt\n> > @@ -108,8 +108,8 @@ options may be given. See linkgit:git-diff-files[1] for more options.\n> >  \n> >  -c::\n> >  \n> > -\tThis flag changes the way a merge commit is displayed.  It shows\n> > -\tthe differences from each of the parents to the merge result\n> > +\tThis flag forces the default way a merge commit is displayed.  It\n> > +\tshows the differences from each of the parents to the merge result\n> >  \tsimultaneously instead of showing pairwise diff between a parent\n> \n> Sorry, I don't understand this change; \"forces the default?\"  Any option\n> \"forces\" the command to behave differently.  At least the original is\n> understandable \"Ah, without it it shows one way but with this it shows in\n> a different way\", even though that does not carry much useful information\n> (i.e. what are the two ways?  ah, I need to read further down).\n\nAt some point when making this change, I was in the state of believing\nthat combined diffs are always the default. :-) That is not true, so\nI will drop this change again.\n\n> > diff --git a/log-tree.c b/log-tree.c\n> > index 27afcf6..fb990a1 100644\n> > --- a/log-tree.c\n> > +++ b/log-tree.c\n> > @@ -514,6 +514,14 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log\n> >  \t\t\treturn 0;\n> >  \t\telse if (opt->combine_merges)\n> >  \t\t\treturn do_diff_combined(opt, commit);\n> > +\t\telse if (opt->first_parent_only) {\n> > +\t\t\t/* Generate merge log entry only for the first\n> > +\t\t\t * parent, showing summary diff of the others\n> > +\t\t\t * we merged _in_. */\n> \n> Style?\n\nWhat's wrong? There should be an empty line at the comment beginning?\nI have a faint memory of getting some-such undocumented comment ugliness\nrequirement wrong before. ;-)\n\n> Don't we use --cc as default for \"show\" (and possibly \"log\"---I don't\n> remember the details)?\n\nAh, that must be it! Turning that off in -m code makes it work for show\nas well.\n\n> > +\t\t\tdiff_tree_sha1(parents->item->object.sha1, sha1, \"\", &opt->diffopt);\n> > +\t\t\tlog_tree_diff_flush(opt);\n> > +\t\t\treturn !opt->loginfo;\n> > +\t\t}\n> \n> This needs some tests but I think it is a good first step in the right\n> direction.\n\nThanks. Hrmh, testsuites... ;-)\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nIf you can't see the value in jet powered ants you should turn in\nyour nerd card. -- Dunbal (464142)\n"},{"id":"134110","messageId":"7vk4ullqop.fsf@alter.siamese.dyndns.org","threadId":"22593","inReplyTo":"20100210021148.GT9553@machine.or.cz","subject":"Re: [PATCH] git log -p -m: Document, honor --first-parent","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-02-10T03:23:18Z","receivedAt":"2010-02-10T03:23:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Petr Baudis <pasky@suse.cz> writes:\n\n> * The branch was created long ago, but has merged latest changes of the\n> top of HEAD in, and now the branch is merged back, that's a \"bad\n> fastforward\" since that flips the perspective of main-vs-topic branch.\n>\n> I feel that it's important to point out this caveat.\n\nAh, I thought you were contrasting between ff and non-ff, but instead you\nwere giving caveat about trusting \"fast-parent\", which I didn't realize.\n\nYeah, but in general, unless it is the final merge to consolidate the work\non the topic to mainline that was delegated by the mainline maintainer to\nthe topic person, merging _from_ mainline _to_ topic should rarely happen.\nAnd when it happens, relying on the first-parent ancestry obviously breaks\ndown.\n\n> I really dislike the \"first-parent ancestry\" wording, I think it muds\n> down the whole issue.\n\nI am not particularly fond of the wording, either, but any other word you\nwould use, you would need to explain the background information, i.e. how\nand why the concept embodied by that other word you choose to use relates\nto the \"--first-parent\" option.\n\nYou can for example say \"the changes introduced to the mainline by each\ncommit\" (and by \"commit\" we mean both single parent ones directly made\nwhile the mainline was the current branch, and merges made into that\nbranch); you need to define what you mean by \"the mainline\", and what your\nassumptions are about the workflow employed (e.g. \"rarely if ever merge\ngoes the wrong direction\").\n\n>> > +\t\telse if (opt->first_parent_only) {\n>> > +\t\t\t/* Generate merge log entry only for the first\n>> > +\t\t\t * parent, showing summary diff of the others\n>> > +\t\t\t * we merged _in_. */\n>> \n>> Style?\n>\n> What's wrong?\n\n\t/*\n         * We prefer to write multi-line comments\n         * like this.\n         */\n"}]}