{"thread":{"id":"3173","subject":"Possible git-rev-list bug","startedAt":"2006-01-29T09:41:51Z","lastAt":"2006-01-31T15:55:53Z","messageCount":4,"participants":["Marco Costalba","Junio C Hamano","Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"15191","messageId":"43DC8DDF.6080904@yahoo.it","threadId":"3173","inReplyTo":null,"subject":"Possible git-rev-list bug","fromName":"Marco Costalba","fromEmail":"mcostalba@yahoo.it","sentAt":"2006-01-29T09:41:51Z","receivedAt":"2006-01-29T09:41:51Z","isPatch":false,"sender":{"key":"mcostalba@gmail.com","avatar":null},"body":"In today git archive:\n\n$ git-rev-list --max-count=1 --parents addafaf92eeb86033da91323d0d3ad7a496dae83 -- rev-list.c\naddafaf92eeb86033da91323d0d3ad7a496dae83 d8f6b342ae200b2eb72e2f81afea7fe0d41aec0b 93b74bca86f59b8df410b6fd4803b88ee0f304bf d8f6b342ae200b2eb72e2f81afea7fe0d41aec0b \nd8f6b342ae200b2eb72e2f81afea7fe0d41aec0b 3815f423ae39bf774de3c268c6d3e3b72128a4e5\n\nWe have the same parent (d8f6b342ae200b2eb72e2f81afea7fe0d41aec0b) multiple times.\n\nThis behaviour causes a wrong graph in qgit and brakes gitk (try 'qgit rev-list.c'  or\n'gitk rev-list.c' and click on first merge commit).\n\n\nPlease confirm if it's a rev-list bug or it's a 'feature' ;-) in the latter case I will fix qgit.\n\n\nMarco\n\n\t\n\n\t\n\t\t\n___________________________________ \nYahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB \nhttp://mail.yahoo.it\n"},{"id":"15219","messageId":"7vmzhekcz3.fsf@assigned-by-dhcp.cox.net","threadId":"3173","inReplyTo":"43DC8DDF.6080904@yahoo.it","subject":"Re: Possible git-rev-list bug","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-01-29T20:15:12Z","receivedAt":"2006-01-29T20:15:12Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marco Costalba <mcostalba@yahoo.it> writes:\n\n> $ git-rev-list --max-count=1 --parents addafaf92eeb86033da91323d0d3ad7a496dae83 -- rev-list.c\n> addafaf92eeb86033da91323d0d3ad7a496dae83\n> d8f6b342ae200b2eb72e2f81afea7fe0d41aec0b\n> 93b74bca86f59b8df410b6fd4803b88ee0f304bf\n> d8f6b342ae200b2eb72e2f81afea7fe0d41aec0b\n> d8f6b342ae200b2eb72e2f81afea7fe0d41aec0b\n> 3815f423ae39bf774de3c268c6d3e3b72128a4e5\n>\n> We have the same parent (d8f6b342ae200b2eb72e2f81afea7fe0d41aec0b) multiple times.\n\nI think it probably is a bug.  The commit really has five\nparents that bundle five independent tracks of development.  Two\nof them touch the specified path since they forked.  The rest do\nnot, and for them, the last commit that touched the specified\npath is behind where they forked:\n\n                  .---o---.\n                 /         \\\n                .---*---o---.\n               /   93b74bc   \\\n  ---*---o---o-----o---o------o addafaf\n     d8f6b34   \\             /\n                .---o---o---.\n                 \\         /\n                  .---*---.\n                      3815f42\n\nThe \"rev-list.c\" path limiter is meant to omit \"uninteresting\"\ncommit, so in this case showing only the three parents after\nfiltering dups would be the right thing to do, I think.\n\nLet me wait for a while to hear Linus contradicts me, though...\n"},{"id":"15230","messageId":"7vmzhehath.fsf_-_@assigned-by-dhcp.cox.net","threadId":"3173","inReplyTo":"7vmzhekcz3.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] rev-list: omit duplicated parents.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-01-29T23:30:02Z","receivedAt":"2006-01-29T23:30:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Showing the same parent more than once for a commit does not\nmake much sense downstream, so stop it.\n\nThis can happen with an incorrectly made merge commit that\nmerges the same parent twice, but can happen in an otherwise\nsane development history while squishing the history by taking\ninto account only commits that touch specified paths.\n\nFor example,\n\n\t$ git rev-list --max-count=1 --parents addafaf -- rev-list.c\n\nwould have to show this commit ancestry graph:\n\n                  .---o---.\n                 /         \\\n                .---*---o---.\n               /    93b74bc  \\\n   ---*---o---o-----o---o-----o addafaf\n      d8f6b34  \\             /\n                .---o---o---.\n                 \\         /\n                  .---*---.\n                      3815f42\n\nwhere 5 independent development tracks, only two of which have\nchanges in the specified paths since they forked.  The last\nchange for the other three development tracks was done by the\nsame commit before they forked, and we were showing that three\ntimes.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n\n---\n\n    Junio C Hamano <junkio@cox.net> writes:\n\n    > I think it probably is a bug...\n    > ...\n    > Let me wait for a while to hear Linus contradicts me, though...\n\n    I've considered doing this only when path is specified, but\n    instead decided to do so for all commits.  I recall there\n    are commits in the kernel archive created somehow with the\n    same parent listed twice, and the downstream tools would\n    have the same trouble if we didn't.\n\n rev-list.c |   15 ++++++++++++++-\n 1 files changed, 14 insertions(+), 1 deletions(-)\n\nd6d9f494403a4e77d17244ece43005eec51200d3\ndiff --git a/rev-list.c b/rev-list.c\nindex 0b142c1..93ea41b 100644\n--- a/rev-list.c\n+++ b/rev-list.c\n@@ -12,6 +12,7 @@\n #define COUNTED\t\t(1u << 2)\n #define SHOWN\t\t(1u << 3)\n #define TREECHANGE\t(1u << 4)\n+#define TMP_MARK\t(1u << 5) /* for isolated cases; clean after use */\n \n static const char rev_list_usage[] =\n \"git-rev-list [OPTION] <commit-id>... [ -- paths... ]\\n\"\n@@ -72,9 +73,21 @@ static void show_commit(struct commit *c\n \tif (show_parents) {\n \t\tstruct commit_list *parents = commit->parents;\n \t\twhile (parents) {\n-\t\t\tprintf(\" %s\", sha1_to_hex(parents->item->object.sha1));\n+\t\t\tstruct object *o = &(parents->item->object);\n \t\t\tparents = parents->next;\n+\t\t\tif (o->flags & TMP_MARK)\n+\t\t\t\tcontinue;\n+\t\t\tprintf(\" %s\", sha1_to_hex(o->sha1));\n+\t\t\to->flags |= TMP_MARK;\n \t\t}\n+\t\t/* TMP_MARK is a general purpose flag that can\n+\t\t * be used locally, but the user should clean\n+\t\t * things up after it is done with them.\n+\t\t */\n+\t\tfor (parents = commit->parents;\n+\t\t     parents;\n+\t\t     parents = parents->next)\n+\t\t\tparents->item->object.flags &= ~TMP_MARK;\n \t}\n \tif (commit_format == CMIT_FMT_ONELINE)\n \t\tputchar(' ');\n-- \n1.1.5.g9843f\n"},{"id":"15302","messageId":"Pine.LNX.4.64.0601310745270.7301@g5.osdl.org","threadId":"3173","inReplyTo":"7vmzhekcz3.fsf@assigned-by-dhcp.cox.net","subject":"Re: Possible git-rev-list bug","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-01-31T15:55:53Z","receivedAt":"2006-01-31T15:55:53Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sun, 29 Jan 2006, Junio C Hamano wrote:\n\n> Marco Costalba <mcostalba@yahoo.it> writes:\n> \n> > $ git-rev-list --max-count=1 --parents addafaf92eeb86033da91323d0d3ad7a496dae83 -- rev-list.c\n> > addaf.. d8f6b.. 93b74.. d8f6b.. d8f6b.. 3815f..\n> >\n> > We have the same parent (d8f6b..) multiple times.\n> \n> I think it probably is a bug.\n\nWell, it's not strictly a bug, and multiple of the same parents _can_ \nhappen in real life due to buggy commits, so a tool that depends on some \nkind of parent uniqueness are a bit fragile. There is nothing fundamental \nin the git data structures that says that you couldn't have the same \nparent twice.\n\nIn this case, it didn't start out with the same parent - we had five \nunique parents, but by the time the tree had been simplified, some of them \nhad become common.\n\nSo I don't know if it's a \"bug\", and the bad reaction by gitk and qgit are \narguably the _real_ bugs. \n\nBut Junio's patch is simple, and perhaps the right thing to do. \n\n\t\t\tLinus\n"}]}