Re: Round-tripping fast-export/import changes commit hashes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 10, 2021 at 8:58 PM Elijah Newren <newren@xxxxxxxxx> wrote:
>
> On Tue, Aug 10, 2021 at 8:51 AM anatoly techtonik <techtonik@xxxxxxxxx> wrote:
> >
> > On Mon, Aug 9, 2021 at 9:15 PM Elijah Newren <newren@xxxxxxxxx> wrote:
> > >
>
> [2] https://lore.kernel.org/git/CABPp-BH4dcsW52immJpTjgY5LjaVfKrY9MaUOnKT3byi2tBPpg@xxxxxxxxxxxxxx/
>
> Signed commits is just one issue, and you'll have to add special code
> to handle a bunch of other special cases if you go down this route.
> I'd rephrase the problem.  You want to know when _your tool_ (e.g.
> reposurgeon since you refer to it multiple times; I'm guessing you're
> contributing to it?) has not modified a commit or any of its
> ancestors, and when it hasn't, then _your tool_ should remove that
> commit from the fast-export stream and replace any references to it by
> the original commit's object id.  I outlined how to do this in [2],
> referenced above, making use of the --show-original-ids flag to
> fast-export.  If you do that, then for any commits which you haven't
> modified (including not modifying any of its ancestors), then you'll
> keep the same commits as-is with no stripping of gpg-signatures or
> canonicalization of objects, so that you'll have the exact same commit
> IDs.  Further, you can do this today, without any changes to git
> fast-export or git fast-import.

Took me a while to process the reply. Let's recap.

I want to make a roundtrip export/import of
https://github.com/simons-public/protonfixes which should get exactly
the same repository.

# --- fast-export to exported.txt
git clone https://github.com/simons-public/protonfixes
git -C protonfixes fast-export --all > exported.txt
# --- check revision of the repo
git -C protonfixes rev-parse HEAD
# 681411ba8ceb5d2d790e674eb7a5b98951d426e6

# --- fast-import into new repo
git init newrepo
git -C newrepo fast-import < exported.txt
# --- checking revision of the new repo
git -C newrepo rev-parse HEAD
# 9888762d7857d9721f0c354e7fc187a199754a4b

Hashes don't match. The roundtrip fails.


Let's see if --reference-excluded-parents helps.

# --- export below produces the same export stream as above
git -C protonfixes fast-export --reference-excluded-parents --all >
exported_parents.txt


Because fast-import/fast-export don't work, you propose to keep the old
repo around until it is clear which commits I am going to modify. Then
make a new fast-export starting from the first commit I am going to
modify with --reference-excluded-parents flag. Is that correct so far?

Then given this partial export and old repo, how to init the new repo
that fast-import can apply its tail there?

What if I have multiple commits that I modify, but I don't know which
of their parents was first? And when I touch commits from different
branches, how to recreate their parent history intact in one repo?

-- 
anatoly t.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux