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

packed-refs are ignored when listing remote branches #32

Closed
scholzb-hb opened this issue Jul 19, 2019 · 3 comments
Closed

packed-refs are ignored when listing remote branches #32

scholzb-hb opened this issue Jul 19, 2019 · 3 comments

Comments

@scholzb-hb
Copy link

The function remote-branches has a bug which may lead to missing branches and/or subtrees in the monorepo.

The file-based approach for listing all branches for a given remote does not consider packed-refs. The Git GC (garbage collector) may occasionally pack individual ref files into a single file named .git/packed-refs and remove them from the refs directory. Those refs will be ignored by tomono.

Further information:

For now we cannot provide any steps to reproduce, but it seems that the issue is related to the number and size of the repositories to process. In our case, we migrated ~100 single repositories with a total of ~125000 commits and ~1400 remote branches into a monorepo, when we detected that the content of a certain single repository was missing.

@scholzb-hb
Copy link
Author

The same problem may occur when creating the namespaced tags. The tags within .git/packed-refs are ignored in this case.

@pcentgraf
Copy link

The easiest way to work around this is to disable gc-auto right after creating the new repository, like so:

git init --bare .git

# we don't want pack-refs to run and break our flow
git config gc.auto 0

Then at the end of the main function, re-enable gc.auto. I also recommend running a full GC to optimize the resulting monorepo.

# optimize the git storage files
git config --unset gc.auto
git gc --aggressive

@hraban
Copy link
Owner

hraban commented Jun 22, 2022

This was fixed for branches but is still an issue for tags.

@hraban hraban closed this as completed in 8927ab1 Jun 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants