{"thread":{"id":"50489","subject":"How to get next commit that just after a specified commit","startedAt":"2019-02-13T09:14:10Z","lastAt":"2019-02-18T19:41:59Z","messageCount":6,"participants":["wuzhouhui","Ævar Arnfjörð Bjarmason","Junio C Hamano","Philip Oakley","Derrick Stolee"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"369212","messageId":"383c14cc.9289.168e61d39e8.Coremail.wuzhouhui14@mails.ucas.ac.cn","threadId":"50489","inReplyTo":null,"subject":"How to get next commit that just after a specified commit","fromName":"wuzhouhui","fromEmail":"wuzhouhui14@mails.ucas.ac.cn","sentAt":"2019-02-13T09:08:21Z","receivedAt":"2019-02-13T09:14:10Z","isPatch":false,"sender":{"key":"wuzhouhui14@mails.ucas.ac.cn","avatar":null},"body":"Hi,\n\nI have searched Internet for while but couldn't find the answer.\n\nSuppose I have commit\n  212146f0800e\nthen commit\n  73a4c5218414\nand finally commit\n  aadaa8061189\n\nSo I get following after 'git log':\n  aadaa8061189\n  73a4c5218414\n  212146f0800e\n\nAnd now, my question is how to retrieve the next commit (i.e. 73a4c5218414)\nthat just after 212146f0800e?\n\nPlease CC me.\n\nThanks."},{"id":"369213","messageId":"87mun0j9vv.fsf@evledraar.gmail.com","threadId":"50489","inReplyTo":"383c14cc.9289.168e61d39e8.Coremail.wuzhouhui14@mails.ucas.ac.cn","subject":"Re: How to get next commit that just after a specified commit","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2019-02-13T09:49:40Z","receivedAt":"2019-02-13T09:49:48Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"(Replying to\nhttps://public-inbox.org/git/383c14cc.9289.168e61d39e8.Coremail.wuzhouhui14@mails.ucas.ac.cn/\nwhich curiously I can see there, but not in my inbox (or spam))\n\nGit's data format doesn't make it easy to find \"C\" given \"B\" in a commit\nchain like A->B->C (also there could be any number of \"C\"\nsuccessors). We need to walk the graph. This shows how to do it:\n\nhttps://sqlite.org/whynotgit.html#git_makes_it_difficult_to_find_successors_descendents_of_a_check_in\n"},{"id":"369256","messageId":"xmqqimxnbdfq.fsf@gitster-ct.c.googlers.com","threadId":"50489","inReplyTo":"87mun0j9vv.fsf@evledraar.gmail.com","subject":"Re: How to get next commit that just after a specified commit","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-02-13T21:12:25Z","receivedAt":"2019-02-13T21:12:33Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n> (Replying to\n> https://public-inbox.org/git/383c14cc.9289.168e61d39e8.Coremail.wuzhouhui14@mails.ucas.ac.cn/\n> which curiously I can see there, but not in my inbox (or spam))\n>\n> Git's data format doesn't make it easy to find \"C\" given \"B\" in a commit\n> chain like A->B->C (also there could be any number of \"C\"\n> successors). We need to walk the graph. This shows how to do it:\n>\n> https://sqlite.org/whynotgit.html#git_makes_it_difficult_to_find_successors_descendents_of_a_check_in\n\nOf course, the history is not necessarily linear.  Even though you\n*MUST* know all your parents before having a commit (which means\nthat when you ask \"what came before this commit\", there is a\ndefinitive answer that everybody in the world would agree on), you\nby definition cannot know all the commits that are children of a\ncommit (simply because somebody else may be creating a new one), so\nthe question \"what's the next commit\" does not make any sense from\nthat point of view ;-)\n\n"},{"id":"369257","messageId":"87ef8bjrqv.fsf@evledraar.gmail.com","threadId":"50489","inReplyTo":"xmqqimxnbdfq.fsf@gitster-ct.c.googlers.com","subject":"Re: How to get next commit that just after a specified commit","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2019-02-13T21:36:08Z","receivedAt":"2019-02-13T21:36:14Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Wed, Feb 13 2019, Junio C Hamano wrote:\n\n> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n>\n>> (Replying to\n>> https://public-inbox.org/git/383c14cc.9289.168e61d39e8.Coremail.wuzhouhui14@mails.ucas.ac.cn/\n>> which curiously I can see there, but not in my inbox (or spam))\n>>\n>> Git's data format doesn't make it easy to find \"C\" given \"B\" in a commit\n>> chain like A->B->C (also there could be any number of \"C\"\n>> successors). We need to walk the graph. This shows how to do it:\n>>\n>> https://sqlite.org/whynotgit.html#git_makes_it_difficult_to_find_successors_descendents_of_a_check_in\n\nI didn't mean to link to that fossil page to start some fossil v.s. git\nargument. I just remembered having seen the one-liner there.\n\n> Of course, the history is not necessarily linear.  Even though you\n> *MUST* know all your parents before having a commit (which means\n> that when you ask \"what came before this commit\", there is a\n> definitive answer that everybody in the world would agree on), you\n> by definition cannot know all the commits that are children of a\n> commit (simply because somebody else may be creating a new one), so\n> the question \"what's the next commit\" does not make any sense from\n> that point of view ;-)\n\nThis is the case with fossil as well. You could create a new descendant\ncommit at any moment.\n\nTheir point in comparing it to git is that there's nothing intuitive in\nthe UI that exposes this information for the *current* graph, whereas in\nfossil this is a built-in command:\nhttps://fossil-scm.org/xfer/help/descendants\n\nPerhaps this information is cheaper to extract these days with the\ncommit graph and we could expose it somehow?\n"},{"id":"369379","messageId":"fbf09f23-6f9c-2353-2416-8c2a12f9cf48@iee.org","threadId":"50489","inReplyTo":"xmqqimxnbdfq.fsf@gitster-ct.c.googlers.com","subject":"Re: How to get next commit that just after a specified commit","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2019-02-15T10:58:31Z","receivedAt":"2019-02-15T10:58:37Z","isPatch":false,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"On 13/02/2019 21:12, Junio C Hamano wrote:\n> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n>\n>> (Replying to\n>> https://public-inbox.org/git/383c14cc.9289.168e61d39e8.Coremail.wuzhouhui14@mails.ucas.ac.cn/\n>> which curiously I can see there, but not in my inbox (or spam))\n>>\n>> Git's data format doesn't make it easy to find \"C\" given \"B\" in a commit\n>> chain like A->B->C (also there could be any number of \"C\"\n>> successors). We need to walk the graph. This shows how to do it:\n>>\n>> https://sqlite.org/whynotgit.html#git_makes_it_difficult_to_find_successors_descendents_of_a_check_in\n> Of course, the history is not necessarily linear.  Even though you\n> *MUST* know all your parents before having a commit (which means\n> that when you ask \"what came before this commit\", there is a\n> definitive answer that everybody in the world would agree on), you\n> by definition cannot know all the commits that are children of a\n> commit (simply because somebody else may be creating a new one), so\n> the question \"what's the next commit\" does not make any sense from\n> that point of view ;-)\n\nIt will also depend on which heads (branches) one wishes to trace back \nfrom, or even know about. I'd expect that the default would just be the \ncurrent branch (head) which would definitely limit the potential commit \nlist.\n\n--\n\nPhilip\n\n"},{"id":"369549","messageId":"8f4bc4cf-cfe4-ddf5-cee3-294ebc5fc88c@gmail.com","threadId":"50489","inReplyTo":"87ef8bjrqv.fsf@evledraar.gmail.com","subject":"Re: How to get next commit that just after a specified commit","fromName":"Derrick Stolee","fromEmail":"stolee@gmail.com","sentAt":"2019-02-18T19:41:55Z","receivedAt":"2019-02-18T19:41:59Z","isPatch":false,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 2/13/2019 4:36 PM, Ævar Arnfjörð Bjarmason wrote:\n> \n> On Wed, Feb 13 2019, Junio C Hamano wrote:\n> \n>> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n> \n> Their point in comparing it to git is that there's nothing intuitive in\n> the UI that exposes this information for the *current* graph, whereas in\n> fossil this is a built-in command:\n> https://fossil-scm.org/xfer/help/descendants\n> \n> Perhaps this information is cheaper to extract these days with the\n> commit graph and we could expose it somehow?\n\nI believe the recent changes (collected in commit-reach.c) that improve\n'git branch --contains' or 'git tag --contains' are important in helping\nthis descendants list. There is likely more work to be done to show this\nlist in a rev-list call.\n\nThanks,\n-Stolee \n"}]}