git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Langhoff <martin.langhoff@gmail.com>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: Re: Fake linear history in a deterministic manner.
Date: Mon, 13 Feb 2006 18:58:40 +1300	[thread overview]
Message-ID: <46a038f90602122158n51fc94a8h2ff2631c16cd28b5@mail.gmail.com> (raw)
In-Reply-To: <7vk6bz3k7e.fsf@assigned-by-dhcp.cox.net>

On 2/13/06, Junio C Hamano <junkio@cox.net> wrote:

Yep, I had roughly this exact scenario in my mind, thanks for the
graphs -- help make sense of what's happening.

> When somebody pushes a ref to your existing commit ancestry
> graph, you can easily identify which commits are the new ones
> you see for the first time.
>
>                 A
>            o---o
>           /
>      o---o---o---o---o B
>
> Suppose you started from two branch repo A and B.  Your sqlite
> database knows about all of these commits, and say you earlier
> have decided to treat A as a side branch, B as trunk.

Well, from the point of view of B being a head we know about, either A
is another head, and we don't care about it, or A is someone's repo
and we haven't seen it and thus cannot care about it either.

A bit of background... git-cvsserver at the moment has the following
semantics: what cvs considers a top-level "module" we use to identify
the head. So

    cvs -d :ext:me@server:/var/frob.git checkout  master

will get you frob.git#master. I thought long and hard about this, and
it is horribly hard to mimic CVS's idea of branches. So clients see a
strictly linear history. Any user in this scenario wanting to do
branching and merging is kindly invited to use real tools. There';s
only so much magic Perl can do ;-)

> Then somebody pushed a new B, making the ancestry graph like
> this:
>
>                 A
>            o---o-------*---*---* B-new
>           /           /
>      o---o---o---o---o B-old
>
> When the update-hook runs, as you read in receive-pack.c,
> your refs have not been updated yet, so you can identify the
> commits marked with * with:
>
>         git rev-list B-new $(git rev-parse --not --all)

That's a nifty trick, though I'm not sure I'll be able to use it.

Right now I'm doing something stupid-er just using `git-log
--parents`, skipping commits that don't move the ball forward on the
linear head I know about, and then processing those "other tracks"
when I see a merge commit. I'll probably find the merge base and see
what commits were brought in from the other side.

The problem is that the situation running from post update hook is
very different from the scenario of running the very same script on a
repo where you see all the history.

In any case, I'm undecided whether to use --topo-order or
--merge-order. Does it really matter?

(...)
> With CVS you cannot express a merge very well, so you now face a
> choice.  Which parent to drop from the leftmost * commit in the
> above picture?

Well, we've already lied about having B to clients that won't know
what to do if we tell them about parallel histories, so our pick is B.

(...)
> One approach would be to see the world with eyes of the person
> who did such a merge.  Both git and cogito place the current
> branch as the first parent,

Yes, I thought about that, but that order is ambiguous in the two most
interesting cases:

 - project maintainer pulls from mature feature branches from other
developers - her side is first, show the "pulled" stuff as merges
(flattened with a merge summary in the commit msg). Still, you can
argue the feature development is more interesting.

 - team-shared-git-repo user does cg-update and merges updates from
origin - her side is first, we don't know which side is the
interesting one. At all. Hmmm.

> But the thing is, there is no
> inherent trunk or branch in the distributed world, so the cvs
> clients of your server needs to live with it.

That's the mantra so far, and we'll talk to cvs clients about
perfectly linearized history. Anything else won't be useful as far as
I can tell -- or in any case,until this is going well for basic usage.
If someone's crazy enough to try I won't get in the way.

cheers.


martin

  reply	other threads:[~2006-02-13  5:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-13  1:46 Fake linear history in a deterministic manner Martin Langhoff
2006-02-13  5:24 ` Junio C Hamano
2006-02-13  5:58   ` Martin Langhoff [this message]
2006-02-13 16:34     ` Linus Torvalds
2006-02-16 22:29 ` Eric Wong
2006-02-16 23:29   ` Martin Langhoff
2006-02-16 23:54 ` 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=46a038f90602122158n51fc94a8h2ff2631c16cd28b5@mail.gmail.com \
    --to=martin.langhoff@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /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).