Re: git filter-branch should run git gc --auto
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:44:07
Mike Hommey [off-list ref] writes:
I wonder if it wouldn't be possible to have filter-branch use fast-import, so that it would create a pack instead of a lot of loose objects.
I do not think it will help. The objects in packs fast-import creates cannot be accessed from outside fast-import. Not even the rest of the core routines running inside that fast-import process cannot access them via the usual read_sha1_file() interface, as described in detail in a recent thread [*1*]. The only way to make it available while you are still feeding new data to fast-import is to explicitly tell it to finalize the current pack by issuing a 'mark' command (and fast-import will start writing to a new pack). And filters need to be able to read the objects previous steps produced to do their work. Which means that instead of having to deal with many loose objects, you will now face many little packs, each contains data changed perhaps at most one commit's worth. You would need to "repack -a -d" to consolidate these little packs every once in a while, and I suspect more often than you would need to repack loose objects, as handling many packs is much more expensive than handling many loose objects. [Reference] *1* http://thread.gmane.org/gmane.comp.version-control.git/70964/focus=71076