From: "George Spelvin" <linux@horizon.com>
To: drew.northup@maine.edu, linux@horizon.com
Cc: anthonyvdgent@gmail.com, david@lang.hm, git@vger.kernel.org,
nico@fluxnic.net, torvalds@linux-foundation.org
Subject: Re: Git commit generation numbers
Date: 21 Jul 2011 13:36:33 -0400 [thread overview]
Message-ID: <20110721173633.21195.qmail@science.horizon.com> (raw)
In-Reply-To: <1311263869.9745.72.camel@drew-northup.unet.maine.edu>
Drew Northup wrote:
> On Thu, 2011-07-21 at 08:55 -0400, George Spelvin wrote:
>> I have not read yet one discussion about how generation numbers [baked
>> into a commit] deal with rebasing, for instance. Do we assign one more
>> than the revision prior to the base of the rebase operation or do we
>> start with the revision one after the highest of those original commits
>> included in the rebase? Depending on how that is done
>> _drastically_different_ numbers can come out of different repository
>> instances for the same _final_ DAG. This is one major reason why, as I
>> see it, local storage is good for generation numbers and putting them in
>> the commit is bad.
>
> Er, no. Whenever a new commit object is generated (as the result
> of a rebase or not), its commit number is computed based on its
> parent commits. It is NEVER copied.
> I don't see the word "copy" in my original.
Indeed, you didn't use it; it was my simplified mental model of your
suggestion that the rebased commits would have generation numbers that
somehow depended on the generation numbers before rebasing.
Althouugh you suggested something different, the mistake is the same:
the rebased commits' generation numbers have simply no relationship to
those of the original pre-rebase commits. The generation numbers depend
only on the commits explicitly listed as parents in the commit objects.
That's why I went on to explain that the equivalence of the commits
produced by a rebase operation is a higher-level concept; the core git
object database just knows that they aren't identical, and therefore
are different.
Thus, they would retain the same relative order as before the rebase
(unless you permuted them with rebase -i), but start with the generation
number of the rebase target.
> B-O1-O2-O3-O4-O5-O6
> \
> R1----R2-------R3
> What's the correct generation number for R3? I would say gen(B)+3. My
> reading of the posts made by some others was that they thought gen(O6)
> was the correct answer. Still others seemed to indicate gen(O6)+1 was
> the correct answer. I don't think everybody MEANT to be saying such
> different things--that's just how they appeared on this end.
According to the canonical algorithm, it's gen(B)+3 = gen(R2)+1.
However, any non-decreasing series is equally permissible for
optimizing history walking, so you could add jumps to (for example)
make the numbers unique if that simplified anything.
I don't think it does simplify anything, so the issue hasn't been
discussed much.
For the purpose of the optimization enabled by the generation
numbers, however, it doesn't actually matter.
What matters is that if I am listing commits down multiple branches,
once I have walked back on each branch to commits of generation N or
less, I know that I have found all possible descendants of all commits
of generation N or more.
This lets me display the recent part of the commit DAG (back to generation
N) without exploring the entire commit treem or worrying that I'll have to
"back up" to insert a commit in its proper order. Without precomputed
generation numbers, the only way to be sure of this is to explore back
to generation 0 (parentless commits) or to use date-based heuristics.
> Now, did you mean something different by "commit number?"
No, just a bran fart I didn't catch before posting.
I meant "generation number".
next prev parent reply other threads:[~2011-07-21 17:36 UTC|newest]
Thread overview: 89+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-17 18:27 Git commit generation numbers George Spelvin
2011-07-17 19:00 ` Long, Martin
2011-07-17 19:30 ` Linus Torvalds
2011-07-17 23:39 ` George Spelvin
2011-07-17 23:58 ` Linus Torvalds
2011-07-18 5:13 ` George Spelvin
2011-07-18 10:28 ` Anthony Van de Gejuchte
2011-07-18 11:48 ` George Spelvin
2011-07-20 20:51 ` Nicolas Pitre
2011-07-20 22:16 ` George Spelvin
2011-07-20 23:26 ` david
2011-07-20 23:36 ` Nicolas Pitre
2011-07-21 0:08 ` Phil Hord
2011-07-21 0:18 ` david
2011-07-21 0:37 ` Shawn Pearce
2011-07-21 0:47 ` Phil Hord
2011-07-21 4:26 ` david
2011-07-21 12:43 ` George Spelvin
2011-07-21 19:19 ` Jakub Narebski
2011-07-21 20:27 ` George Spelvin
2011-07-21 20:33 ` Shawn Pearce
2011-07-22 12:18 ` Jakub Narebski
2011-07-22 13:09 ` Nicolas Pitre
2011-07-22 18:02 ` david
2011-07-22 18:34 ` Jakub Narebski
2011-07-22 19:06 ` Linus Torvalds
2011-07-22 22:02 ` Jeff King
2011-07-28 15:00 ` Felipe Contreras
2011-09-06 10:02 ` Ramkumar Ramachandra
2011-07-22 19:08 ` david
2011-07-22 19:40 ` Nicolas Pitre
2011-07-22 18:02 ` david
2011-07-21 0:39 ` Phil Hord
2011-07-21 0:58 ` Nicolas Pitre
2011-07-21 1:09 ` Phil Hord
2011-07-21 12:03 ` Drew Northup
2011-07-21 12:55 ` George Spelvin
2011-07-21 15:57 ` Drew Northup
2011-07-21 16:24 ` Phil Hord
2011-07-21 22:40 ` Pēteris Kļaviņš
2011-07-22 9:30 ` Christian Couder
2011-07-21 17:36 ` George Spelvin [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-07-14 18:24 Linus Torvalds
2011-07-14 18:37 ` Jeff King
2011-07-14 18:47 ` Linus Torvalds
2011-07-14 18:55 ` Linus Torvalds
2011-07-14 19:12 ` Jeff King
2011-07-14 19:46 ` Ted Ts'o
2011-07-14 19:51 ` Linus Torvalds
2011-07-14 20:07 ` Jeff King
2011-07-14 20:08 ` Ted Ts'o
2011-07-14 19:08 ` Jeff King
2011-07-14 19:23 ` Linus Torvalds
2011-07-14 20:01 ` Jeff King
2011-07-14 20:19 ` Linus Torvalds
2011-07-14 20:31 ` Jeff King
2011-07-15 1:19 ` Linus Torvalds
2011-07-15 2:41 ` Geert Bosch
2011-07-15 7:46 ` Jeff King
2011-07-15 16:10 ` Linus Torvalds
2011-07-15 16:18 ` Shawn Pearce
2011-07-15 16:44 ` Linus Torvalds
2011-07-15 18:42 ` Ted Ts'o
2011-07-15 19:00 ` Linus Torvalds
2011-07-16 9:16 ` Christian Couder
2011-07-18 3:41 ` Jeff King
2011-07-19 4:14 ` Christian Couder
2011-07-19 20:00 ` Jeff King
2011-07-21 6:29 ` Christian Couder
2011-07-15 18:46 ` Tony Luck
2011-07-15 18:58 ` Linus Torvalds
2011-07-15 19:48 ` Jeff King
2011-07-15 20:07 ` Jeff King
2011-07-15 21:17 ` Linus Torvalds
2011-07-15 21:54 ` Jeff King
2011-07-15 23:10 ` Linus Torvalds
2011-07-15 23:16 ` Linus Torvalds
2011-07-15 23:36 ` Linus Torvalds
2011-07-16 0:42 ` Jeff King
2011-07-16 0:40 ` Jeff King
2011-07-15 9:12 ` Jakub Narebski
2011-07-15 9:17 ` Long, Martin
2011-07-15 15:33 ` Long, Martin
2011-07-15 16:15 ` Drew Northup
2011-07-14 18:52 ` Linus Torvalds
2011-07-14 19:08 ` Jakub Narebski
2011-07-14 20:26 ` Junio C Hamano
2011-07-14 20:41 ` Jeff King
2011-07-14 21:30 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110721173633.21195.qmail@science.horizon.com \
--to=linux@horizon.com \
--cc=anthonyvdgent@gmail.com \
--cc=david@lang.hm \
--cc=drew.northup@maine.edu \
--cc=git@vger.kernel.org \
--cc=nico@fluxnic.net \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).