Sitelet https://web.archive.org/web/20201221222254/https://github.com/TimHeinrich/GitRewrite/issues/8
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when multiple pack-files contain the same object #8

Open
TimHeinrich opened this issue Sep 11, 2020 · 1 comment
Open

Crash when multiple pack-files contain the same object #8

TimHeinrich opened this issue Sep 11, 2020 · 1 comment

Comments

@TimHeinrich
Copy link
Owner

@TimHeinrich TimHeinrich commented Sep 11, 2020 •

Apparently multiple pack files can contain the same object hash. This error message will be shown:
Unhandled Exception: System.ArgumentException: An item with the same key has already been added. Key: 0b1bac8acae82a0d91133244c61400a3e409ce56 at System.Collections.Generic.Dictionary\2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) at GitRewrite.IO.PackReader.BuildPackFileDictionary(IEnumerable1 packFiles) in C:\VCS\GitRewrite\GitRewrite\IO\PackReader.cs:line 87 at GitRewrite.Program.Main(String[] args) in C:\VCS\GitRewrite\GitRewrite\Program.cs:line 24

It is most likely not fixed by just ignoring already this error (not adding the file to the dictionary), as I think the diff restoring algorithm always operates on only one packfile at a time.

The workaround for this is running a git repack with the -a switch before running GitRewrite. Please see the documentation of git repack: https://git-scm.com/docs/git-repack

@hackf5
Copy link

@hackf5 hackf5 commented Sep 30, 2020

Do you know how to reproduce this? (i.e. how to create such a repo)

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.