From: Pete Wyckoff <pw@padd.com>
To: Vitor Antunes <vitor.hda@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/3] git-p4: Search for parent commit on branch creation
Date: Tue, 17 Jan 2012 17:18:30 -0500 [thread overview]
Message-ID: <20120117221830.GA366@padd.com> (raw)
In-Reply-To: <CAOpHH-XUj7tF4O_kXfxq2e9Y4VmybNLCqGku_-9H1X+c7v=xwQ@mail.gmail.com>
vitor.hda@gmail.com wrote on Tue, 17 Jan 2012 00:10 +0000:
> On Mon, Jan 16, 2012 at 11:41 PM, Vitor Antunes <vitor.hda@gmail.com> wrote:
> > On Mon, Jan 16, 2012 at 6:57 PM, Pete Wyckoff <pw@padd.com> wrote:
> >> 1. Move the tempBranch commit outside of the "for blob" loop.
> >> It can have no parent, and the diff-tree will still tell you
> >> if you found the same contents. Instead of a ref for
> >> each blob inspected for each change, you'll just have one ref
> >> per change. Only one checkpoint() after the tempBranch
> >> commit should be needed.
> >
> > You're right. Completely oversaw that. Will improve the code
> > accordingly.
>
> Apparently I did not oversee it. Assume you have added a new file to
> HEAD of parent branch, but you branched from a previous commit. When the
> new branch is committed over HEAD the new file will, incorrectly, be
> part of it and diff-tree will not work as expected.
I don't get it. This algorithm works on the fact that a "branch"
in p4 creates a new change that looks exactly like a previous
change.
The git-p4 sync step, when it detects a branch, starts by saving
the change in a commit with parent = null, so it is its own new
branch, an orphan, with no parents.
Now the task is to find some commit that has an identical tree to
this temporary one. You walk back all known p4 commits to try to
find one that is the same. It doesn't matter if any of those p4
commits have other commits on top of them.
At each step in the backward walk, the comparison is against the
unchanged orphan commit.
An ascii-art picture might help me. Or even a test case.
> I should avoid taking 6 months to submit a patch to avoid forgetting why
> I did what I did :)
Yeah, and now you have to explain it all over to me again too. :)
-- Pete
next prev parent reply other threads:[~2012-01-17 22:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-16 0:39 [PATCH 0/3] git-p4: Search for parent commit on branch creation Vitor Antunes
2012-01-16 0:39 ` [PATCH 1/3] git-p4: Add checkpoint() task Vitor Antunes
2012-01-16 0:39 ` [PATCH 2/3] git-p4: Search for parent commit on branch creation Vitor Antunes
2012-01-16 18:57 ` Pete Wyckoff
2012-01-16 23:41 ` Vitor Antunes
2012-01-17 0:10 ` Vitor Antunes
2012-01-17 22:18 ` Pete Wyckoff [this message]
2012-01-17 23:43 ` Vitor Antunes
2012-01-16 0:39 ` [PATCH 3/3] git-p4: Add test case for complex branch import Vitor Antunes
2012-01-16 19:12 ` Pete Wyckoff
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=20120117221830.GA366@padd.com \
--to=pw@padd.com \
--cc=git@vger.kernel.org \
--cc=vitor.hda@gmail.com \
/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).