Skip to content

Commit ad7780b

Browse files
pks-tgitster
authored andcommitted
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 c3459ae (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 <[email protected]> Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a52a24e commit ad7780b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Documentation/git-pack-refs.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ Pack refs as needed depending on the current state of the ref database. The
6666
behavior depends on the ref format used by the repository and may change in the
6767
future.
6868
+
69-
- "files": No special handling for `--auto` has been implemented.
69+
- "files": Loose references are packed into the `packed-refs` file
70+
based on the ratio of loose references to the size of the
71+
`packed-refs` file. The bigger the `packed-refs` file, the more loose
72+
references need to exist before we repack.
7073
+
7174
- "reftable": Tables are compacted such that they form a geometric
7275
sequence. For two tables N and N+1, where N+1 is newer, this

0 commit comments

Comments
 (0)