Re: Converting repo from HG, `git filter-branch --prune-empty -- --all` is extremely slow and errors out.
- From
Felipe Contreras <felipe.contreras@gmail.com>
- Date
- Sep 13, 2013, 00:47 UTC
- Message-ID
- <CAMP44s1cmcfSuB-TnFL+-57i5W=EA8v322rVDoUELCPF948jPw@mail.gmail.com>
- In-Reply-To
- <D4C9DBA5F955904683C89B4A96DA7759EA78D60FDF@synapsemail>
On Thu, Sep 12, 2013 at 5:01 PM, John Gietzen <jgietzen@woot.com> wrote:
Show 8 quoted lines
> Background:
> Windows, git version 1.8.3.msysgit.0
> bare repo, 54k commits after migration from HG
> git filter-branch --prune-empty -- --all
>
> I'm trying to clean up our repository after migrating it from HG. I'm running the filter-branch command listed above in an effort to clean up all of garbage commits that HG required ("closing branch" commits and their ilk).
>
> From my past experience, "git filter-branch" is extremely quick when using simple filters, like env-filter, since it doesn't have to touch the working dir. However, in our case each revision is taking 1-3 seconds; our entire repo will take 30 hours to clean up at this rate. Normally, this wouldn't be a problem, except that we are getting "sh.exe couldn't start" errors after anywhere between the 5000th and 6000th rewritten commit. Filter-branch doesn't have support for picking up where it left off, so we are entirely unable to clean up our repo.Indeed, I remember writing my own simplified version of 'git filter-branch' that was much faster. If I recall correctly, the trick was avoiding 'git write-tree' which can be done if you are not using any tree filter, but 'git filter-branch' is not that smart.
If all you want to do is prune empty commits, it should be easy to write a script that simply does 'git commit-tree'. I might decide to do that based on my script if I have time today.
-- Felipe Contreras