From: Patrick Steinhardt Date: Tue, 8 Jul 2025 11:23:56 +0000 (+0200) Subject: docs/git-pack-refs: document heuristic used for packing loose refs X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ad7780b38fae2fb915404a59b0c904da8ed154a6;p=thirdparty%2Fgit.git docs/git-pack-refs: document heuristic used for packing loose refs The `git pack-refs --auto` flag asks the ref backend to decide for itself whether or not references need to be repacked. This is done to ensure that we don't repack in cases where the backend is already in a good-enough state, which is typically the case for the "reftable" backend that performs auto-compaction on writes. As such, we initially only had heuristics in place for the "reftable" backend. The "files" backend didn't have any heuristics, so we'd repack loose references every time `git pack-refs --auto` was executed. This caused excessive repacking with that backend though, which is why we eventually implemented a heuristic via c3459ae9ef2 (refs/files: use heuristic to decide whether to repack with `--auto`, 2024-09-04). The documentation for the `--auto` flag hasn't been updated accordingly and still claims that we don't have any metrics for the "files" backend. Update it to reflect the new reality. Reported-by: Karthik Nayak Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- diff --git a/Documentation/git-pack-refs.txt b/Documentation/git-pack-refs.txt index 2dcabaf74c..a6cd43c9be 100644 --- a/Documentation/git-pack-refs.txt +++ b/Documentation/git-pack-refs.txt @@ -66,7 +66,10 @@ Pack refs as needed depending on the current state of the ref database. The behavior depends on the ref format used by the repository and may change in the future. + - - "files": No special handling for `--auto` has been implemented. + - "files": Loose references are packed into the `packed-refs` file + based on the ratio of loose references to the size of the + `packed-refs` file. The bigger the `packed-refs` file, the more loose + references need to exist before we repack. + - "reftable": Tables are compacted such that they form a geometric sequence. For two tables N and N+1, where N+1 is newer, this