git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* How to get next commit that just after a specified commit
@ 2019-02-13  9:08 wuzhouhui
  2019-02-13  9:49 ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 6+ messages in thread
From: wuzhouhui @ 2019-02-13  9:08 UTC (permalink / raw)
  To: git; +Cc: wuzhouhui14

Hi,

I have searched Internet for while but couldn't find the answer.

Suppose I have commit
  212146f0800e
then commit
  73a4c5218414
and finally commit
  aadaa8061189

So I get following after 'git log':
  aadaa8061189
  73a4c5218414
  212146f0800e

And now, my question is how to retrieve the next commit (i.e. 73a4c5218414)
that just after 212146f0800e?

Please CC me.

Thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to get next commit that just after a specified commit
  2019-02-13  9:08 How to get next commit that just after a specified commit wuzhouhui
@ 2019-02-13  9:49 ` Ævar Arnfjörð Bjarmason
  2019-02-13 21:12   ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2019-02-13  9:49 UTC (permalink / raw)
  To: wuzhouhui; +Cc: git

(Replying to
https://public-inbox.org/git/383c14cc.9289.168e61d39e8.Coremail.wuzhouhui14@mails.ucas.ac.cn/
which curiously I can see there, but not in my inbox (or spam))

Git's data format doesn't make it easy to find "C" given "B" in a commit
chain like A->B->C (also there could be any number of "C"
successors). We need to walk the graph. This shows how to do it:

https://sqlite.org/whynotgit.html#git_makes_it_difficult_to_find_successors_descendents_of_a_check_in

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to get next commit that just after a specified commit
  2019-02-13  9:49 ` Ævar Arnfjörð Bjarmason
@ 2019-02-13 21:12   ` Junio C Hamano
  2019-02-13 21:36     ` Ævar Arnfjörð Bjarmason
  2019-02-15 10:58     ` Philip Oakley
  0 siblings, 2 replies; 6+ messages in thread
From: Junio C Hamano @ 2019-02-13 21:12 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason; +Cc: wuzhouhui, git

Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:

> (Replying to
> https://public-inbox.org/git/383c14cc.9289.168e61d39e8.Coremail.wuzhouhui14@mails.ucas.ac.cn/
> which curiously I can see there, but not in my inbox (or spam))
>
> Git's data format doesn't make it easy to find "C" given "B" in a commit
> chain like A->B->C (also there could be any number of "C"
> successors). We need to walk the graph. This shows how to do it:
>
> https://sqlite.org/whynotgit.html#git_makes_it_difficult_to_find_successors_descendents_of_a_check_in

Of course, the history is not necessarily linear.  Even though you
*MUST* know all your parents before having a commit (which means
that when you ask "what came before this commit", there is a
definitive answer that everybody in the world would agree on), you
by definition cannot know all the commits that are children of a
commit (simply because somebody else may be creating a new one), so
the question "what's the next commit" does not make any sense from
that point of view ;-)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to get next commit that just after a specified commit
  2019-02-13 21:12   ` Junio C Hamano
@ 2019-02-13 21:36     ` Ævar Arnfjörð Bjarmason
  2019-02-18 19:41       ` Derrick Stolee
  2019-02-15 10:58     ` Philip Oakley
  1 sibling, 1 reply; 6+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2019-02-13 21:36 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: wuzhouhui, git, Derrick Stolee


On Wed, Feb 13 2019, Junio C Hamano wrote:

> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
>> (Replying to
>> https://public-inbox.org/git/383c14cc.9289.168e61d39e8.Coremail.wuzhouhui14@mails.ucas.ac.cn/
>> which curiously I can see there, but not in my inbox (or spam))
>>
>> Git's data format doesn't make it easy to find "C" given "B" in a commit
>> chain like A->B->C (also there could be any number of "C"
>> successors). We need to walk the graph. This shows how to do it:
>>
>> https://sqlite.org/whynotgit.html#git_makes_it_difficult_to_find_successors_descendents_of_a_check_in

I didn't mean to link to that fossil page to start some fossil v.s. git
argument. I just remembered having seen the one-liner there.

> Of course, the history is not necessarily linear.  Even though you
> *MUST* know all your parents before having a commit (which means
> that when you ask "what came before this commit", there is a
> definitive answer that everybody in the world would agree on), you
> by definition cannot know all the commits that are children of a
> commit (simply because somebody else may be creating a new one), so
> the question "what's the next commit" does not make any sense from
> that point of view ;-)

This is the case with fossil as well. You could create a new descendant
commit at any moment.

Their point in comparing it to git is that there's nothing intuitive in
the UI that exposes this information for the *current* graph, whereas in
fossil this is a built-in command:
https://fossil-scm.org/xfer/help/descendants

Perhaps this information is cheaper to extract these days with the
commit graph and we could expose it somehow?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to get next commit that just after a specified commit
  2019-02-13 21:12   ` Junio C Hamano
  2019-02-13 21:36     ` Ævar Arnfjörð Bjarmason
@ 2019-02-15 10:58     ` Philip Oakley
  1 sibling, 0 replies; 6+ messages in thread
From: Philip Oakley @ 2019-02-15 10:58 UTC (permalink / raw)
  To: Junio C Hamano, Ævar Arnfjörð Bjarmason; +Cc: wuzhouhui, git

On 13/02/2019 21:12, Junio C Hamano wrote:
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
>> (Replying to
>> https://public-inbox.org/git/383c14cc.9289.168e61d39e8.Coremail.wuzhouhui14@mails.ucas.ac.cn/
>> which curiously I can see there, but not in my inbox (or spam))
>>
>> Git's data format doesn't make it easy to find "C" given "B" in a commit
>> chain like A->B->C (also there could be any number of "C"
>> successors). We need to walk the graph. This shows how to do it:
>>
>> https://sqlite.org/whynotgit.html#git_makes_it_difficult_to_find_successors_descendents_of_a_check_in
> Of course, the history is not necessarily linear.  Even though you
> *MUST* know all your parents before having a commit (which means
> that when you ask "what came before this commit", there is a
> definitive answer that everybody in the world would agree on), you
> by definition cannot know all the commits that are children of a
> commit (simply because somebody else may be creating a new one), so
> the question "what's the next commit" does not make any sense from
> that point of view ;-)

It will also depend on which heads (branches) one wishes to trace back 
from, or even know about. I'd expect that the default would just be the 
current branch (head) which would definitely limit the potential commit 
list.

--

Philip


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to get next commit that just after a specified commit
  2019-02-13 21:36     ` Ævar Arnfjörð Bjarmason
@ 2019-02-18 19:41       ` Derrick Stolee
  0 siblings, 0 replies; 6+ messages in thread
From: Derrick Stolee @ 2019-02-18 19:41 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason, Junio C Hamano; +Cc: wuzhouhui, git

On 2/13/2019 4:36 PM, Ævar Arnfjörð Bjarmason wrote:
> 
> On Wed, Feb 13 2019, Junio C Hamano wrote:
> 
>> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> 
> Their point in comparing it to git is that there's nothing intuitive in
> the UI that exposes this information for the *current* graph, whereas in
> fossil this is a built-in command:
> https://fossil-scm.org/xfer/help/descendants
> 
> Perhaps this information is cheaper to extract these days with the
> commit graph and we could expose it somehow?

I believe the recent changes (collected in commit-reach.c) that improve
'git branch --contains' or 'git tag --contains' are important in helping
this descendants list. There is likely more work to be done to show this
list in a rev-list call.

Thanks,
-Stolee 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-02-18 19:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-13  9:08 How to get next commit that just after a specified commit wuzhouhui
2019-02-13  9:49 ` Ævar Arnfjörð Bjarmason
2019-02-13 21:12   ` Junio C Hamano
2019-02-13 21:36     ` Ævar Arnfjörð Bjarmason
2019-02-18 19:41       ` Derrick Stolee
2019-02-15 10:58     ` Philip Oakley

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).