Skip to content

let git decide when to run gc #4495

Open
@matthiaskrgr

Description

fe5a5c7 added some logic to look into .git and run git gc if needed.

However git already has this implemented, there is a git gc --auto.
tl;dr: it checks some threshold and if it's exceeded, runs the gc, otherwise not.
Docs:

git gc --auto
With this option, git gc checks whether any housekeeping is required; if not, it exits without performing any work.
Some git commands run git gc --auto after performing operations that could create many loose objects.

Housekeeping is required if there are too many loose objects or too many packs in the repository. 
If the number of loose objects exceeds the value of the gc.auto configuration variable,
then all loose objects are combined into a single pack using git repack -d -l.
Setting the value of gc.auto to 0 disables automatic packing of loose objects.

If the number of packs exceeds the value of gc.autoPackLimit, 
then existing packs (except those marked with a .keep file) are consolidated into a single pack by using the -A option of git repack. 
Setting gc.autoPackLimit to 0 disables automatic consolidation of packs.

https://git-scm.com/docs/git-gc#git-gc---auto

I can have a look at making it use git gc --auto instead.

As for compatibility I don't think there will be any issues since gc --auto was added in 2007:
git/git@2c3c439

Metadata

Assignees

No one assigned

    Labels

    A-gitArea: anything dealing with gitC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions