Re: git filter-branch should run git gc --auto
- From
Sam Vilain <sam@vilain.net>
- Date
- Jan 23, 2008, 05:07 UTC
- Message-ID
- <4796CB78.2070607@vilain.net>
- In-Reply-To
- <60D6C8F5-EF88-48F0-92CA-8E49838C0CB9@sb.org>
Kevin Ballard wrote:
Show 9 quoted lines
> I'm actually considering what the cost would be of switching macports > to git (not that it will ever happen - too many anonymous people pull > from svn trunk). Right now the svn trunk contains a subfolder for the > source code and another subfolder for all ~4400+ Portfiles. In such a > theoretical move, I'd want to split that up, probably into two > unrelated branches. Doing so would mean running git-filter-branch over > a linear commit history that's 31580 objects long, with a tree filter > to prune the dports directory away and a msg filter to remove the svn- > id stuff that git-svn left behind.
You could have used git-svn --no-metadata :)
Using a commit filter to implement the pruning will be much faster; you'll need to make a temporary index, use git-read-tree, git-rm, then git-commit. This way you avoid the expense of checking out the files just to delete them in your rewrite hook.
> I'd also have to > figure out some way to remove the commit objects entirely that only > reference the dports directory.
This can be done with a parent filter.
Show 5 quoted lines
> I'd suggest a patch to run git gc --auto, but it looks like you just > did in a subsequent email. As for your comments about the reflogs, > can't I disable recording those, at least temporarily? I'd rather > clean up after myself as I work rather than balloon the repository and > collapse it in a single operation at the end.
Honestly, the optimisation I mention above will save you much more time. Note that you can run git-repack -d every half hour out of cron, it is safe and will let it clean as you go.
Sam.