diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-04-09 14:31:45 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-04-09 14:31:45 -0700 |
| commit | eacfd581d2b805b95b4c12beb1a63ceb2fd4ca69 (patch) | |
| tree | 4b4b47adb385102ab5ed8880e3c72c5561b037f3 /refs | |
| parent | Merge branch 'es/test-cron-safety' (diff) | |
| parent | builtin/gc: pack refs when using `git maintenance run --auto` (diff) | |
| download | git-eacfd581d2b805b95b4c12beb1a63ceb2fd4ca69.tar.gz git-eacfd581d2b805b95b4c12beb1a63ceb2fd4ca69.zip | |
Merge branch 'ps/pack-refs-auto'
"git pack-refs" learned the "--auto" option, which is a useful
addition to be triggered from "git gc --auto".
Acked-by: Karthik Nayak <karthik.188@gmail.com>
cf. <CAOLa=ZRAEA7rSUoYL0h-2qfEELdbPHbeGpgBJRqesyhHi9Q6WQ@mail.gmail.com>
* ps/pack-refs-auto:
builtin/gc: pack refs when using `git maintenance run --auto`
builtin/gc: forward git-gc(1)'s `--auto` flag when packing refs
t6500: extract objects with "17" prefix
builtin/gc: move `struct maintenance_run_opts`
builtin/pack-refs: introduce new "--auto" flag
builtin/pack-refs: release allocated memory
refs/reftable: expose auto compaction via new flag
refs: remove `PACK_REFS_ALL` flag
refs: move `struct pack_refs_opts` to where it's used
t/helper: drop pack-refs wrapper
refs/reftable: print errors on compaction failure
reftable/stack: gracefully handle failed auto-compaction due to locks
reftable/stack: use error codes when locking fails during compaction
reftable/error: discern locked/outdated errors
reftable/stack: fix error handling in `reftable_stack_init_addition()`
Diffstat (limited to 'refs')
| -rw-r--r-- | refs/reftable-backend.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c index e206d5a073..0bed6d2ab4 100644 --- a/refs/reftable-backend.c +++ b/refs/reftable-backend.c @@ -1203,9 +1203,16 @@ static int reftable_be_pack_refs(struct ref_store *ref_store, if (!stack) stack = refs->main_stack; - ret = reftable_stack_compact_all(stack, NULL); - if (ret) + if (opts->flags & PACK_REFS_AUTO) + ret = reftable_stack_auto_compact(stack); + else + ret = reftable_stack_compact_all(stack, NULL); + if (ret < 0) { + ret = error(_("unable to compact stack: %s"), + reftable_error_str(ret)); goto out; + } + ret = reftable_stack_clean(stack); if (ret) goto out; |
