From: Linus Torvalds <torvalds@osdl.org>
To: Nix <nix@esperi.org.uk>
Cc: git@vger.kernel.org
Subject: Re: What's the meaning of `parenthood' in git commits?
Date: Tue, 7 Nov 2006 16:58:43 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.64.0611071644430.3667@g5.osdl.org> (raw)
In-Reply-To: <878ximbwm3.fsf@hades.wkstn.nix>
On Wed, 8 Nov 2006, Nix wrote:
>
> [ Nix explains what he's doing now with SCCS ]: you may be
> sick now.
Wow. You've got some strange setup there, Nix.
> After all that setup, my question's simple. Does a `parent' in git
> terminology simply mean `this commit was derived in some way from the
> commit listed here'?
Well, strictly speaking, git doesn't itself assign much any real meaning
to "parent" at all. It has the obvious meanings:
- the parent pointers act as reachability graph edges (so fsck cares
about it a lot, of course)
- listing the "log" of a commit will show everything reachable from that
commit and it's parents, of course (with the commit date-stamp being
used as a "ordering" when having multiple choices of commits to show)
- it has the obvious meanings for the "revision arithmetic", ie revision
name parsing (ie "commit~3^2")
- parenthood will be used to show the diff ("git show", "git log -p" and
friends)
- the "merge-base" algorithms obviously use it to find the most recent
common ancestor, and that in turn impacts the normal merge strategies,
of course.
so parenthood does obviously have a number of very specific technical
meanings for different programs, but at the same time, no, git doesn't
really "care". You can happily generate your own parenthood if you want
to, and git will just continue to follow the above rules.
> If so, I suppose I can list heads/some-change-foo as one parent on these
> merge commits, even though the `merging' mechanism is so odd that I
> expect to be pelted with rotten vegetables as soon as I post this.
Yeah, git won't care. If you screw up parenthood, you have a few problems:
- the diffs may look really strange. In particular, if you list multiple
parents, the git "diff" functions will all just assume that it's a
merge, and a "git show" will start showing the combined diff (which is
usually empty).
So if you end up having multiple parents, not because it was "really" a
merge, but because you use the other parent pointer to point to some
"source" for the patch, things like "git log -p" won't give nice output
any more. You need to manually ask for the diff with something like
# show diff from second parent
git diff commit^2..commit
instead.
- listing too _few_ parents is potentially more serious, if you have
reachability issues (ie you wanted to keep the other source around, but
since you didn't list it as a parent, git won't know that it had
anything to do with your commit, so it may be pruned away unless you
have some other way to reach it)
but if you just have a really strange merge algorithm, and the _data_
associated with the parents is "surprising" from the standpoint of the
default merge, git really won't care at all.
Your usage does sound a bit strange.
next prev parent reply other threads:[~2006-11-08 0:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-08 0:39 What's the meaning of `parenthood' in git commits? Nix
2006-11-08 0:52 ` Jakub Narebski
2006-11-08 0:58 ` Linus Torvalds [this message]
2006-11-08 1:28 ` Nix
2006-11-08 3:04 ` Nix
2006-11-08 1:13 ` Junio C Hamano
2006-11-08 1:36 ` Nix
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=Pine.LNX.4.64.0611071644430.3667@g5.osdl.org \
--to=torvalds@osdl.org \
--cc=git@vger.kernel.org \
--cc=nix@esperi.org.uk \
/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).