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

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

From
Elijah Newren <newren@gmail.com>
Date
Feb 27, 2021, 17:48 UTC
Message-ID
<CABPp-BGDB6jj+Et44D6D22KXprB89dNpyS_AAu3E8vOCtVaW1A@mail.gmail.com>
In-Reply-To
<CAPkN8xK7JnhatkdurEb16bC0wb+=Khd=xJ51YQUXmf2H23YCGw@mail.gmail.com>
Hi,
On Sat, Feb 27, 2021 at 4:37 AM anatoly techtonik <techtonik@gmail.com> wrote:
Show 7 quoted lines
>
> Hi.
>
> I can't get the same commit hashes after fast-export and then fast-import of
> this repository without any edits https://github.com/simons-public/protonfixes
> I have no idea what causes this, and how to prevent it from happening. Are
> there any workarounds?

Your second commit is signed. Fast-export strips any extended headers on commits, such as GPG signatures, because there's no way to keep them in general. In the special case that you aren't making *any* changes to the repository and will import it as-is, you could theoretically keep the signatures, but you don't need fast-export in such a case so no one ever bothered to implement commit signature handling in fast-export and fast-import. If you make any changes whatsoever to the commits before the signature (including importing them to a different system), then the signature would be invalid.

You probably don't want to hear this, but there are no workarounds.

There are also other things that will prevent a simple fast-export | fast-import pipeline from preserving your history as-is besides signed commits (most of these are noted in the "Inherited Limitations" section over at https://htmlpreview.github.io/?https://github.com/newren/git-filter-repo/blob/docs/html/git-filter-repo.html):

  * any other form of extended header; fast-export only looks for the
headers it knows and exports those
  * grafts and replace objects will just get rewritten (and if they
cause any cycles, those cycles and anything depending on them are
dropped)
  * commits without an author will be given one matching the committer
(hopefully you don't have these, but if you do...)
  * tags that are missing a tagger are also a problem (hopefully you
don't have these, but if you do...)
  * annotated or signed tags outside the refs/tags/ namespace will get
renamed weirdly
  * commits by default are re-encoded into UTF-8, though I notice you
did pass --reencode=no to handle this

Hope that at least explains things for you, even if it doesn't give you a workaround or a solution.

Previous: anatoly techtonikNext: anatoly techtonik
Message 2 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.