git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: anatoly techtonik <techtonik@gmail.com>
To: Elijah Newren <newren@gmail.com>
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Johannes Sixt" <j6t@kdbg.org>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Git Mailing List" <git@vger.kernel.org>
Subject: Re: Round-tripping fast-export/import changes commit hashes
Date: Sun, 11 Dec 2022 21:30:08 +0300	[thread overview]
Message-ID: <CAPkN8xJ_B_t7L6bErsFB+rp6fzy7PO55myWqyJWPNbTgiQ69ow@mail.gmail.com> (raw)
In-Reply-To: <CABPp-BEqvmSaqVrK=nQsk-8PNXq6Pzq4Y-=RopYwTDjtyitAuw@mail.gmail.com>

On Tue, Aug 10, 2021 at 8:58 PM Elijah Newren <newren@gmail.com> wrote:
>
> On Tue, Aug 10, 2021 at 8:51 AM anatoly techtonik <techtonik@gmail.com> wrote:
> >
> > On Mon, Aug 9, 2021 at 9:15 PM Elijah Newren <newren@gmail.com> wrote:
> > >
>
> [2] https://lore.kernel.org/git/CABPp-BH4dcsW52immJpTjgY5LjaVfKrY9MaUOnKT3byi2tBPpg@mail.gmail.com/
>
> 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.

  reply	other threads:[~2022-12-11 18:32 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-27 12:31 Round-tripping fast-export/import changes commit hashes anatoly techtonik
2021-02-27 17:48 ` Elijah Newren
2021-02-28 10:00   ` anatoly techtonik
2021-02-28 10:34     ` Ævar Arnfjörð Bjarmason
2021-03-01  7:44       ` anatoly techtonik
2021-03-01 17:34         ` Junio C Hamano
2021-03-02 21:52           ` anatoly techtonik
2021-03-03  7:13             ` Johannes Sixt
2021-03-04  0:55               ` Junio C Hamano
2021-08-09 15:45                 ` anatoly techtonik
2021-08-09 18:15                   ` Elijah Newren
2021-08-10 15:51                     ` anatoly techtonik
2021-08-10 17:57                       ` Elijah Newren
2022-12-11 18:30                         ` anatoly techtonik [this message]
2023-01-13  7:21                           ` Elijah Newren
2021-03-01 18:06         ` Elijah Newren
2021-03-01 20:04           ` Ævar Arnfjörð Bjarmason
2021-03-01 20:17             ` Elijah Newren
2021-03-02 22:12           ` anatoly techtonik
2021-03-01 20:02         ` Ævar Arnfjörð Bjarmason
2021-03-02 22:23           ` anatoly techtonik

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPkN8xJ_B_t7L6bErsFB+rp6fzy7PO55myWqyJWPNbTgiQ69ow@mail.gmail.com \
    --to=techtonik@gmail.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=newren@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).