git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
anatoly techtonik <techtonik@gmail.com>
Date
Mar 2, 2021, 21:52 UTC
Message-ID
<CAPkN8xKM0zi-AB1xKRGp=whEQTZAbn78w0JjvUXfGfRDky0C=w@mail.gmail.com>
In-Reply-To
<xmqqblc2srq0.fsf@gitster.c.googlers.com>
On Mon, Mar 1, 2021 at 8:34 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 10 quoted lines
>
> It is just that the output stream of fast-export is designed to be
> "filtered" and the expected use case is to modify the stream somehow
> before feeding it to fast-import.  And because every object name and
> commit & tag signature depends on everything that they can reach,
> even a single bit change in an earlier part of the history will
> invalidate any and all signatures on objects that can reach it.  So
> instead of originally-signed objects whose signatures are now
> invalid, "fast-export | fast-import" pipeline would give you
> originally-signed objects whose signatures are stripped.

I need to merge two unrelated repos and I am using `reposurgeon` http://www.catb.org/~esr/reposurgeon/repository-editing.html to do this preserving timestamps and commit order. The model of operation is that it reads revisions into memory from git using fast-export, operates on them, and then rebuild the stream back into git repo with fast-import. The problem is that in the exported dump the information is already lost, and the resulting commits are "not mergeable". Basically all GitHub repositories where people edited `README.md` online are "not mergeable" after this point, because all GitHub edited commits are signed.

For my use case, where I just need to attach another branch in time without altering original commits in any way, `reposurgeon` can not be used.

> Admittedly, there is a narrow use case where such a signature
> invalidation is not an issue.  If you run fast-export and feed that
> straight into fast-import without doing any modification to the
> stream, then you are getting a bit-for-bit identical copy.
I did just that and signatures got stripped, altering history.

git -C protonfixes fast-export --all --reencode=no | (cd protoimported && git fast-import)

-- 
anatoly t.
Previous: Junio C HamanoNext: Johannes Sixt
Message 7 of 21 in “Round-tripping fast-export/import changes commit hashes”
  1. anatoly techtonikFeb 27, 2021
  2. Elijah NewrenFeb 27, 2021
  3. anatoly techtonikFeb 28, 2021
  4. Ævar Arnfjörð BjarmasonFeb 28, 2021
  5. anatoly techtonikMar 1, 2021
  6. Junio C HamanoMar 1, 2021
  7. anatoly techtonikMar 2, 2021
  8. Johannes SixtMar 3, 2021
  9. Junio C HamanoMar 4, 2021
  10. anatoly techtonikAug 9, 2021
  11. Elijah NewrenAug 9, 2021
  12. anatoly techtonikAug 10, 2021
  13. Elijah NewrenAug 10, 2021
  14. anatoly techtonikDec 11, 2022
  15. Elijah NewrenJan 13, 2023
  16. Elijah NewrenMar 1, 2021
  17. Ævar Arnfjörð BjarmasonMar 1, 2021
  18. Elijah NewrenMar 1, 2021
  19. anatoly techtonikMar 2, 2021
  20. Ævar Arnfjörð BjarmasonMar 1, 2021
  21. anatoly techtonikMar 2, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.