Re: How to get next commit that just after a specified commit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 13/02/2019 21:12, Junio C Hamano wrote:
Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> writes:

(Replying to
https://public-inbox.org/git/383c14cc.9289.168e61d39e8.Coremail.wuzhouhui14@xxxxxxxxxxxxxxxx/
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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux