From: Junio C Hamano Date: Tue, 28 Jul 2026 19:15:03 +0000 (-0700) Subject: Merge branch 'ps/odb-pluggable-housekeeping' into next X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1e622f0e29fddfc7ca11d69b291f38a280dd539e;p=thirdparty%2Fgit.git Merge branch 'ps/odb-pluggable-housekeeping' into next Object database housekeeping in 'git gc' and 'git maintenance' has been refactored to be pluggable. The files-backend-specific logic, including incremental and geometric repacking as well as object pruning, has been moved out of the command implementation and into the files object database source, enabling future alternative object database backends to implement their own housekeeping services. * ps/odb-pluggable-housekeeping: odb: make optimizations pluggable builtin/gc: fix signedness issues in ODB-related functionality builtin/gc: refactor ODB optimizations to operate on "files" source builtin/gc: introduce `odb_optimize_required()` builtin/gc: move geometric repacking into `odb_optimize()` builtin/gc: introduce object database optimization options builtin/gc: inline config values specific to the "files" backend builtin/gc: make repack arguments self-contained builtin/gc: extract object database optimizations into separate function builtin/gc: move worktree and rerere tasks before object optimizations odb: run "pre-auto-gc" hook for all maintenance tasks t7900: simplify how we check for maintenance tasks --- 1e622f0e29fddfc7ca11d69b291f38a280dd539e diff --cc builtin/gc.c index 49c8474fad,ac1a21e912..de2f9e7fed --- a/builtin/gc.c +++ b/builtin/gc.c @@@ -1789,8 -1412,9 +1412,9 @@@ static int maintenance_run_tasks(struc struct lock_file lk; struct repository *r = the_repository; char *lock_path = xstrfmt("%s/maintenance", r->objects->sources->path); + enum auto_gc_hook_result auto_gc_hook_result = AUTO_GC_HOOK_UNDECIDED; - if (hold_lock_file_for_update(&lk, lock_path, LOCK_NO_DEREF) < 0) { + if (repo_hold_lock_file_for_update(r, &lk, lock_path, LOCK_NO_DEREF) < 0) { /* * Another maintenance command is running. * diff --cc odb/source.h index fc04dd5cda,88a48ba3c3..d69f8e2d1c --- a/odb/source.h +++ b/odb/source.h @@@ -478,10 -485,30 +493,31 @@@ static inline int odb_source_write_alte * Returns 0 on success, a negative error code otherwise. */ static inline int odb_source_begin_transaction(struct odb_source *source, - struct odb_transaction **out) + struct odb_transaction **out, + enum odb_transaction_flags flags) { - return source->begin_transaction(source, out); + return source->begin_transaction(source, out, flags); } + /* + * Optimize the object database source. Returns 0 on success, a negative error + * code otherwise. + */ + static inline int odb_source_optimize(struct odb_source *source, + const struct odb_optimize_options *opts) + { + return source->optimize(source, opts); + } + + /* + * Check whether optimization of the object database source is required given + * the provided options. Returns true if optimization should be performed, + * false otherwise. + */ + static inline bool odb_source_optimize_required(struct odb_source *source, + const struct odb_optimize_options *opts) + { + return source->optimize_required(source, opts); + } + #endif