{"thread":{"id":"8913","subject":"Possible BUG in 'git log --parents'","startedAt":"2007-07-07T09:49:50Z","lastAt":"2007-07-08T10:33:08Z","messageCount":7,"participants":["Marco Costalba","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"46679","messageId":"e5bfff550707070249i6f3f7288uce1f922686f6e14d@mail.gmail.com","threadId":"8913","inReplyTo":null,"subject":"Possible BUG in 'git log --parents'","fromName":"Marco Costalba","fromEmail":"mcostalba@gmail.com","sentAt":"2007-07-07T09:49:50Z","receivedAt":"2007-07-07T09:49:50Z","isPatch":false,"sender":{"key":"mcostalba@gmail.com","avatar":null},"body":"git-rev-list shows parents correctly, git-log no, in particulary there\nis parent 913419f that is shown 3 times instead of 1. Testing on git\nrepository.\n\n$ git --version\ngit version 1.5.3.rc0.11.ge2b1a\n\n$ git-rev-list --parents --header addafaf92e -n1 -- diff.h\naddafaf92eeb86033da91323d0d3ad7a496dae83\n913419fcc648dd43d7f7afdd94fa25aee4f9798a\nea726d02e9677a66586d7ffebe97f112ab6dab33\n46a6c2620ba421397eec627b8eb18eb530e694fc\ntree e3be15f54f01e3aa1f8ec830ac87da5f85a23480\nparent 6b94f1e404afc552e5139c4357331843f5be61ad\nparent 93b74bca86f59b8df410b6fd4803b88ee0f304bf\nparent ea726d02e9677a66586d7ffebe97f112ab6dab33\nparent b33aba518456bee97bde1fef4fe17ab6bf401bbe\nparent 6b1ddbdd6e02719ae2be55dc141a176187e5027e\nauthor Junio C Hamano <junkio@cox.net> 1138436169 -0800\ncommitter Junio C Hamano <junkio@cox.net> 1138436169 -0800\n\n    Merge lt/revlist,jc/diff,jc/revparse,jc/abbrev\n\n\n$ git-log --parents --pretty=raw addafaf92e -n1 -- diff.h\ncommit addafaf92eeb86033da91323d0d3ad7a496dae83\n913419fcc648dd43d7f7afdd94fa25aee4f9798a 913419fcc648dd43d7f7a\nfdd94fa25aee4f9798a ea726d02e9677a66586d7ffebe97f112ab6dab33\n913419fcc648dd43d7f7afdd94fa25aee4f9798a 46a6c262\n0ba421397eec627b8eb18eb530e694fc\ntree e3be15f54f01e3aa1f8ec830ac87da5f85a23480\nparent 6b94f1e404afc552e5139c4357331843f5be61ad\nparent 93b74bca86f59b8df410b6fd4803b88ee0f304bf\nparent ea726d02e9677a66586d7ffebe97f112ab6dab33\nparent b33aba518456bee97bde1fef4fe17ab6bf401bbe\nparent 6b1ddbdd6e02719ae2be55dc141a176187e5027e\nauthor Junio C Hamano <junkio@cox.net> 1138436169 -0800\ncommitter Junio C Hamano <junkio@cox.net> 1138436169 -0800\n\n    Merge lt/revlist,jc/diff,jc/revparse,jc/abbrev\n"},{"id":"46680","messageId":"7vps348qzi.fsf@assigned-by-dhcp.cox.net","threadId":"8913","inReplyTo":"e5bfff550707070249i6f3f7288uce1f922686f6e14d@mail.gmail.com","subject":"Re: Possible BUG in 'git log --parents'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-07-07T10:09:37Z","receivedAt":"2007-07-07T10:09:37Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Marco Costalba\" <mcostalba@gmail.com> writes:\n\n> git-rev-list shows parents correctly, git-log no, in particulary there\n> is parent 913419f that is shown 3 times instead of 1. Testing on git\n> repository.\n>\n> $ git-log --parents --pretty=raw addafaf92e -n1 -- diff.h\n> commit addafaf92eeb86033da91323d0d3ad7a496dae83\n> 913419fcc648dd43d7f7afdd94fa25aee4f9798a 913419fcc648dd43d7f7a\n> fdd94fa25aee4f9798a ea726d02e9677a66586d7ffebe97f112ab6dab33\n> 913419fcc648dd43d7f7afdd94fa25aee4f9798a 46a6c262\n> 0ba421397eec627b8eb18eb530e694fc\n> tree e3be15f54f01e3aa1f8ec830ac87da5f85a23480\n> parent 6b94f1e404afc552e5139c4357331843f5be61ad\n> parent 93b74bca86f59b8df410b6fd4803b88ee0f304bf\n> parent ea726d02e9677a66586d7ffebe97f112ab6dab33\n> parent b33aba518456bee97bde1fef4fe17ab6bf401bbe\n> parent 6b1ddbdd6e02719ae2be55dc141a176187e5027e\n> author Junio C Hamano <junkio@cox.net> 1138436169 -0800\n> committer Junio C Hamano <junkio@cox.net> 1138436169 -0800\n\nLine wrapping in the middle of a single object name makes it\nhard to read doesn't it?\n\nThe commit does have 5 parents, among which, three of them merge\nbranches that do not touch the named paths (in this case it\nhappens to be a single \"diff.h\") and parent simplification leads\nto the same ancestor.\n\nI recall we added an extra logic in rev-list side to squash the\nparent commits that artificially becomes duplicate due to this\nhistory simplification logic, which we might want to port to\ngit-log.  However, I have a slight suspicion that we earlier\ndecided not to do so on purpose with git-log and for a good\nreason.  I do not have much energy left tonight to dig into this\nright now, but mailing list log and commit log messages for\nrev-list.c, builtin-log.c and builtin-rev-list.c might tell you\nmore.\n"},{"id":"46683","messageId":"e5bfff550707070314q3b78ac65p9a8ff3130a7bfaef@mail.gmail.com","threadId":"8913","inReplyTo":"7vps348qzi.fsf@assigned-by-dhcp.cox.net","subject":"Re: Possible BUG in 'git log --parents'","fromName":"Marco Costalba","fromEmail":"mcostalba@gmail.com","sentAt":"2007-07-07T10:14:30Z","receivedAt":"2007-07-07T10:14:30Z","isPatch":false,"sender":{"key":"mcostalba@gmail.com","avatar":null},"body":"On 7/7/07, Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Line wrapping in the middle of a single object name makes it\n> hard to read doesn't it?\n>\n\nSorry!\n\n> I recall we added an extra logic in rev-list side to squash the\n> parent commits that artificially becomes duplicate due to this\n> history simplification logic, which we might want to port to\n> git-log.  However, I have a slight suspicion that we earlier\n> decided not to do so on purpose with git-log and for a good\n> reason.  I do not have much energy left tonight to dig into this\n> right now, but mailing list log and commit log messages for\n> rev-list.c, builtin-log.c and builtin-rev-list.c might tell you\n> more.\n>\n\nI will take a look hoping to *not* find anything important, now that\nqgit rely on git log instead of git-rev-list to show the graph, I\nwould really hope that it is possible to patch git-log in the same way\nthen git-rev-list.\n\nThanks\nMarco\n"},{"id":"46719","messageId":"e5bfff550707071517o776db380v9f3a68c3e46d9d3c@mail.gmail.com","threadId":"8913","inReplyTo":"e5bfff550707070314q3b78ac65p9a8ff3130a7bfaef@mail.gmail.com","subject":"Re: Possible BUG in 'git log --parents'","fromName":"Marco Costalba","fromEmail":"mcostalba@gmail.com","sentAt":"2007-07-07T22:17:57Z","receivedAt":"2007-07-07T22:17:57Z","isPatch":false,"sender":{"key":"mcostalba@gmail.com","avatar":null},"body":"On 7/7/07, Marco Costalba <mcostalba@gmail.com> wrote:\n> On 7/7/07, Junio C Hamano <gitster@pobox.com> wrote:\n>\n>\n> > git-log.  However, I have a slight suspicion that we earlier\n> > decided not to do so on purpose with git-log and for a good\n> > reason.  I do not have much energy left tonight to dig into this\n> > right now, but mailing list log and commit log messages for\n> > rev-list.c, builtin-log.c and builtin-rev-list.c might tell you\n> > more.\n> >\n>\n> I will take a look ...\n>\n\nThe commit with the patch for git-rev-list is 884944239f2\n\nI have found also the following commits, more or less related:\n884944239f2          3381c790        2a0925be3\n\nBut I haven't found messages with downsides of using the same approach\nalso for git log.\n\nSo could you please apply the patch also for git-log if possible.\n\nThanks\nMarco\n"},{"id":"46739","messageId":"7vodin2unr.fsf@assigned-by-dhcp.cox.net","threadId":"8913","inReplyTo":"e5bfff550707071517o776db380v9f3a68c3e46d9d3c@mail.gmail.com","subject":"Re: Possible BUG in 'git log --parents'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-07-08T07:59:04Z","receivedAt":"2007-07-08T07:59:04Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Marco Costalba\" <mcostalba@gmail.com> writes:\n\n> On 7/7/07, Marco Costalba <mcostalba@gmail.com> wrote:\n>> On 7/7/07, Junio C Hamano <gitster@pobox.com> wrote:\n>>\n>>\n>> > git-log.  However, I have a slight suspicion that we earlier\n>> > decided not to do so on purpose with git-log and for a good\n>> > reason.  I do not have much energy left tonight to dig into this\n>> > right now, but mailing list log and commit log messages for\n>> > rev-list.c, builtin-log.c and builtin-rev-list.c might tell you\n>> > more.\n>> >\n>>\n>> I will take a look ...\n>>\n>\n> The commit with the patch for git-rev-list is 884944239f2\n\nThat's correct.  And I do not think of a reason for log and\nrev-list to behave differently in this case now, so let's change\nthe behaviour of log.\n\nThere still is one thing I am a bit worried about, though.  You\ncan get the list of true, immediate parents in the raw format\n(\"parent\" lines) while getting the list of simplified parents on\nthe commit line (the topic of this thread).  Aren't there cases\nwhere Porcelains would want to match up which immediate parent\nlead to which simplified parent?  Using the illustration from\nthe commit log mesage of 88494423:\n\n    \n                      .---A---.\n                     /         \\\n                    .---*---B---.\n                   /    93b74bc  \\\n       ---*---o---o-----o---C-----o addafaf\n          d8f6b34  \\             /\n                    .---o---D---.\n                     \\         /\n                      .---E---.\n                          3815f42\n    \nIf we always show the five simplified parents as the response to\nthe --parent request, you would get:\n\n  commit addafaf... d8f6b34... 93b74bc... d8f6b34... d8f6b34... 3815f42...\n  tree e3be15f54f01e3aa1f8ec830ac87da5f85a23480\n  parent 6b94f1e404afc552e5139c4357331843f5be61ad\n  parent 93b74bca86f59b8df410b6fd4803b88ee0f304bf\n  parent ea726d02e9677a66586d7ffebe97f112ab6dab33\n  parent b33aba518456bee97bde1fef4fe17ab6bf401bbe\n  parent 6b1ddbdd6e02719ae2be55dc141a176187e5027e\n\nand you can tell 6b94f1e4 (the first immediate parent)\ncorresponds to d8f6b34, the first simplified parent, while\n93b74bc (the second immediate parent) corresponds to 93b74bc\n(the second simplified parent).  If we do the duplicate\nomission, as we do for rev-list (and not for log as you found\nout), you would not be able to tell which branch you can find by\nreading the immediate parent list corresponds to what simplified\nparent you can find from the --parent output.\n\nBut this worry applies to both rev-list and log, and it is no\nreason to leave their behaviours different.\n\n-- >8 --\nMatch \"log --parent\" output to \"rev-list --parent\" output.\n\nWe updated \"rev-list --parent\" output to omit duplicated parents\nfrom the output long time ago, but this change was not side-ported\nto \"git-log\".  There is no reason to leave them inconsistent.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n\ndiff --git a/log-tree.c b/log-tree.c\nindex 8624d5a..24aea6b 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -6,13 +6,32 @@\n \n struct decoration name_decoration = { \"object names\" };\n \n+static void clear_tmp_mark(struct commit_list *p)\n+{\n+\twhile (p) {\n+\t\tstruct commit *c = p->item;\n+\t\tc->object.flags &= ~TMP_MARK;\n+\t\tp = p->next;\n+\t}\n+}\n+\n static void show_parents(struct commit *commit, int abbrev)\n {\n \tstruct commit_list *p;\n+\n+\t/* TMP_MARK is a general purpose flag that can\n+\t * be used locally, but the user should clean\n+\t * things up after it is done with them.\n+\t */\n+\tclear_tmp_mark(commit->parents);\n \tfor (p = commit->parents; p ; p = p->next) {\n \t\tstruct commit *parent = p->item;\n+\t\tif (parent->object.flags & TMP_MARK)\n+\t\t\tcontinue;\n \t\tprintf(\" %s\", diff_unique_abbrev(parent->object.sha1, abbrev));\n+\t\tparent->object.flags |= TMP_MARK;\n \t}\n+\tclear_tmp_mark(commit->parents);\n }\n \n static void show_decorations(struct commit *commit)\n"},{"id":"46743","messageId":"e5bfff550707080232q3e27581t45c0e4c5a1ea3b0f@mail.gmail.com","threadId":"8913","inReplyTo":"7vodin2unr.fsf@assigned-by-dhcp.cox.net","subject":"Re: Possible BUG in 'git log --parents'","fromName":"Marco Costalba","fromEmail":"mcostalba@gmail.com","sentAt":"2007-07-08T09:32:01Z","receivedAt":"2007-07-08T09:32:01Z","isPatch":false,"sender":{"key":"mcostalba@gmail.com","avatar":null},"body":"On 7/8/07, Junio C Hamano <gitster@pobox.com> wrote:\n> Match \"log --parent\" output to \"rev-list --parent\" output.\n>\n\nThanks. It works for me.\n"},{"id":"46744","messageId":"e5bfff550707080333k6a225c6p74a7b0042e5739c8@mail.gmail.com","threadId":"8913","inReplyTo":"e5bfff550707080232q3e27581t45c0e4c5a1ea3b0f@mail.gmail.com","subject":"Re: Possible BUG in 'git log --parents'","fromName":"Marco Costalba","fromEmail":"mcostalba@gmail.com","sentAt":"2007-07-08T10:33:08Z","receivedAt":"2007-07-08T10:33:08Z","isPatch":false,"sender":{"key":"mcostalba@gmail.com","avatar":null},"body":"On 7/8/07, Marco Costalba <mcostalba@gmail.com> wrote:\n> On 7/8/07, Junio C Hamano <gitster@pobox.com> wrote:\n> > Match \"log --parent\" output to \"rev-list --parent\" output.\n> >\n>\n> Thanks. It works for me.\n>\n\nSorry, I have to correct, it does *not* work for me.\n\nPlease apply your patch and give a look at:\n\ngit log --parents -n1 addafaf92e -r -m -- diff.h\n\nWhat seems to happen is that duplicated entries are not removed by\ndiff machinery.\n\nAlthough duplicated parents are correctly removed from parent list as\nin git-rev-list, probably we should consider that git-log has also the\ndiff machinery attached.\n\nMarco\n\nP.S: Hope this little issue does not make you revert the patch ;-)\n"}]}