From: Thomas Glanzmann <sithglan@stud.uni-erlangen.de>
To: Junio C Hamano <junkio@cox.net>
Cc: Linus Torvalds <torvalds@osdl.org>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: More gitweb queries..
Date: Mon, 30 May 2005 10:36:53 +0200 [thread overview]
Message-ID: <20050530083653.GL12290@cip.informatik.uni-erlangen.de> (raw)
In-Reply-To: <7vmzqd4041.fsf@assigned-by-dhcp.cox.net>
Hello,
[ => Skip till next ']' if you want because my approach doesn't work out
for all cases in the optimal way.
> "An empty tree (no HEAD)"? Is your definition of "an empty
> tree" the same as "empty" directory after you do "mkdir empty &&
> cd empty && git-init-db", followed by bunch of git-*-pull to get
> the objects and commits from other reposititories being involved
> in the merge but without touching .git/HEAD?
Yep. In practice it isn't anything else than just using the first
'remote' HEAD as 'local' HEAD if there is no 'local' HEAD. But for merge
this doesn't really matter.
> If so, why cannot I do the git-*-pull from multiple repositories and
> merge them together? Why "there is only one head in this array that
> is remote_head"? Oh, I guess I am missing your definition of
> "remote_head". Puzzled...
My intention by writing this note was to clear things up. That it also
works for cases where you do the 'initial clone' for one and multiple
remotes.
> Anyhow I presume that if your ${GIT-.git}/HEAD exists, you
> include it as the first element of MERGE_HEADS.
Affirmative.
> TG> I have a function merge which gets a sorted array of heads. Heads can be
> TG> unlimited at the time because some of the heads can be included into
> TG> other heads (they're a subset) and so they don't show up in the commit
> TG> object. I call this array MERGE_HEADS.
Here is a typo: MERGE_HEADS is *not* sorted. But it is 'ordered'.
> Sorry I am not very good at this "thinking" thing, and I need to
> draw pictures. Please bear with me.
Of course, I do.
> (line of dev C)-------------C We are here, trying to merge
> (line of dev B)---(merge)---B these three lines of devs:
> (line of dev A)---A/ A, B and C
> MERGE_HEADS = (A B C)
> A is actually a "subset" of B
> Is this what you mean by "subset"? Are these "subset" HEAD the
> only thing that causes fast forwards?
Exactly, but it has not to be a merge it also can be a linear
development. What matters that A is referenced in any way in the history
of B.
In this case where A is referenced in the history of B, we just discard
HEAD A, because it is already merged. So A will never show up in
git-commit-tree in one of its "-p" options. But I mention it in the
commit-text as 'there was nothing todo'.
If we take now your example and switch the order A and B we have
MERGE_HEADS = (B A C) and A is still in the history of B:
We do exactly the same here only that in the above scenario we have to
kick out the previous COMMIT_HEAD when processing B while we drop the
current COMMIT_HEAD when processing A in this scenario. So to clear
things up:
The HEAD we are working on is surrouned by '*'s.
MERGE_HEADS = (*B* A C) => COMMIT_HEADS = (B)
MERGE_HEADS = (B *A* C) => COMMIT_HEADS = (B) /* note: A never did it in COMMIT_HEADS because it was referenced in history of B */
MERGE_HEADS = (B A *C*) => COMMIT_HEADS = (B C)
while in the above example with your initial order it is:
MERGE_HEADS = (*A* B C) => COMMIT_HEADS = (A)
MERGE_HEADS = (A *B* C) => COMMIT_HEADS = (B) /* note: A is kicked out of COMMIT_HEADS ... see above */
MERGE_HEADS = (A B *C*) => COMMIT_HEADS = (B C)
]
> My gut feeling without thinking much is that it might be easier
> to first cull such fast forward heads by using N-way rev-tree
> before you do anything else. If only one head survives after
> that, then that head would be your new head and you do not have
> to go through any merges. Otherwise you merge those independent
> heads without worrying about fast forwards. How does that
> sound?
You're right. Because this would work out bad (unneccessary
automatic/threeway/manual merge) if we twist MERGE_HEADS again:
MERGE_HEADS = (*C* A B) => COMMIT_HEADS (C)
MERGE_HEADS = (C *A* B) => COMMIT_HEADS (C A) /* A stays in because it is not in the history of C; -> unneccessary merge */
MERGE_HEADS = (C A *B*) => COMMIT_HEADS (C A B)
Okay, so I have to elminate all fast forward conditions in the first
place? How do I do this:
foreach CURRENT_HEAD (@MERGE_HEADS) {
foreach COMPARE_HEAD (@MERGE_HEADS) {
if (COMPARE_HEAD != CURRENT_HEAD
&& COMPARE_HEAD is_included_into_history_of CURRENT_HEAD) {
@WIPE_HEADS += COMPARE_HEAD;
}
}
}
foreach (@WIPE_HEADS) {
grep -v @WIPE_HEADS @MERGE_HEADS;
}
Thomas
next prev parent reply other threads:[~2005-05-30 8:34 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-27 19:24 More gitweb queries Linus Torvalds
2005-05-27 19:29 ` Thomas Glanzmann
2005-05-27 19:52 ` Junio C Hamano
2005-05-27 19:55 ` Thomas Glanzmann
2005-05-27 20:13 ` Junio C Hamano
2005-05-27 20:32 ` Thomas Glanzmann
2005-05-27 20:40 ` Junio C Hamano
2005-05-27 22:00 ` Linus Torvalds
2005-05-27 22:04 ` Thomas Glanzmann
2005-05-28 2:26 ` Junio C Hamano
2005-05-29 23:02 ` Thomas Glanzmann
2005-05-29 23:10 ` Thomas Glanzmann
2005-05-29 23:16 ` Thomas Glanzmann
2005-05-29 23:46 ` Thomas Glanzmann
2005-05-29 23:56 ` Thomas Glanzmann
2005-05-30 0:50 ` Junio C Hamano
2005-05-30 0:57 ` Junio C Hamano
2005-05-30 1:33 ` Thomas Glanzmann
2005-05-30 1:30 ` Thomas Glanzmann
2005-05-30 7:57 ` Junio C Hamano
2005-05-30 8:36 ` Thomas Glanzmann [this message]
2005-05-30 9:21 ` Thomas Glanzmann
2005-05-30 10:20 ` Junio C Hamano
2005-05-30 12:11 ` Thomas Glanzmann
2005-05-30 17:54 ` Junio C Hamano
2005-05-27 20:17 ` Linus Torvalds
2005-05-27 19:54 ` Junio C Hamano
2005-05-27 19:58 ` Thomas Glanzmann
2005-05-27 20:03 ` Linus Torvalds
2005-05-27 20:24 ` Junio C Hamano
2005-05-27 19:31 ` Thomas Glanzmann
2005-05-27 19:32 ` Junio C Hamano
2005-05-27 19:48 ` Linus Torvalds
2005-05-27 23:12 ` Benjamin Herrenschmidt
2005-05-27 23:59 ` Kay Sievers
2005-05-28 1:03 ` Daniel Serpell
2005-05-28 2:51 ` David Lang
2005-05-28 10:56 ` Kay Sievers
2005-05-28 8:42 ` Kay Sievers
2005-05-28 22:43 ` Benjamin Herrenschmidt
2005-05-30 23:03 ` Paul Mackerras
2005-05-31 2:27 ` Jeff Epler
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=20050530083653.GL12290@cip.informatik.uni-erlangen.de \
--to=sithglan@stud.uni-erlangen.de \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=torvalds@osdl.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).