Hi, I noticed that Git 2.48 has support for migrating refs when there are reflogs and, as promised at Git Merge, I decided to try it out. Unfortunately, I got an error: ---- % git refs migrate --ref-format=reftable --dry-run error: reftable: transaction failure: corrupt reftable file ---- Here's a small reproduction case: ---- #!/bin/sh rm -fr test-repo git init -b dev test-repo cd test-repo # start first block touch foo.txt git add foo.txt git commit -m + head=$(git rev-parse HEAD) seq 5000 | sed -Ee "s!^(.*)\$!create refs/heads/ref-\1 $head!" | git update-ref --stdin # end first block # start second block echo abc >bar.txt git add bar.txt git commit -m + head=$(git rev-parse HEAD) seq 3000 | sed -Ee "s!^(.*)\$!update refs/heads/ref-\1 $head!" | git update-ref --stdin # end second block git refs migrate --ref-format=reftable ---- I can also reproduce this on the latest master. If you remove the second block, it does not appear to reproduce. Some investigation led me to the conclusion that the difference is when max_update_index is not 1, the header has the value 1 for it but the trailer has the correct value, and so we flag the header and trailer as mismatching and therefore it gets marked as corrupt. I believe the reason things work when removing the second block is because that value remains 1, and so it works. I haven't done anything else to investigate here, for which I apologize, but I just wanted to mention it while it was fresh on my mind. In case this is helpful, I did see this when attempting to migrate two work repositories with lots of reflogs and many refs (the smaller has 2983 and the larger, 44832). I obviously cannot send you these repositories or things in them, but I'm happy to test patches against them. Please let me know if I can provide more useful information. -- brian m. carlson (they/them or he/him) Toronto, Ontario, CA
Attachment:
signature.asc
Description: PGP signature