Skip to content
Snippets Groups Projects
Commit 4cb65470 authored by Patrick Steinhardt's avatar Patrick Steinhardt
Browse files

housekeeping: Skip prune if there are no old objects

The `OptimizeRepository()` RPC heuristically executes git-prune(1). The
heuristic we currently use counts the number of loose objects which
exist after having repacked the repository, and, if they exceed a given
threshold, we'll try to remove them. This also causes us to try and
prune objects though in case there are unreachable, but recent objects.
But because unreachable objects don't get packed, and because we only
prune objects older than two weeks, this will in many cases cause us to
execute git-prune(1) without any need.

Improve the heuristic to only prune objects in case there are loose
objects which have an mtime older than two weeks. This should in the
general case avoid useless prunes, but still detect the case where there
is work to be done.

Changelog: performance
parent dca63428
No related merge requests found
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment