]> git.ipfire.org Git - thirdparty/git.git/commit
builtin/pack-refs: introduce new "--auto" flag
authorPatrick Steinhardt <ps@pks.im>
Mon, 25 Mar 2024 10:03:20 +0000 (11:03 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 25 Mar 2024 16:54:07 +0000 (09:54 -0700)
commit6dcffc68f4cea97d4b4af8a9add0daae54a5c292
treea9687964dd5ca66787a4d0a05054ea221d2dde12
parenta75dc71f3772cee10dfb93861610d8ee413ad207
builtin/pack-refs: introduce new "--auto" flag

Calling git-pack-refs(1) will unconditionally cause it to pack all
requested refs regardless of the current state of the ref database. For
example:

  - With the "files" backend we will end up rewriting the complete
    "packed-refs" file even if only a single ref would require
    compaction.

  - With the "reftable" backend we will end up always compacting all
    tables into a single table.

This behaviour can be completely unnecessary depending on the backend
and is thus wasteful.

With the introduction of the `PACK_REFS_AUTO` flag in the preceding
commit we can improve this and let the backends decide for themselves
whether to pack refs in the first place. Expose this functionality via a
new "--auto" flag in git-pack-refs(1), which mirrors the same flag in
both git-gc(1) and git-maintenance(1).

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-pack-refs.txt
builtin/pack-refs.c
t/t0601-reffiles-pack-refs.sh
t/t0610-reftable-basics.sh