From: Patrick Steinhardt Date: Tue, 12 May 2026 08:30:29 GMT Subject: [PATCH v2 0/2] builtin/maintenance: fix locking and respect "gc.auto" Message-ID: <20260512-pks-maintenance-fix-lock-with-detach-v2-0-dc6f2d284b6d@pks.im> In-Reply-To: <20260511-pks-maintenance-fix-lock-with-detach-v1-0-ccd7d62c9a40@pks.im> Hi, this patch series addresses the issues reported in [1]. The series is built on top of Git 2.54.0. Changes in v2: - Clarify comment when dropping ownership of the lock in the parent process. - Properly treat "gc.auto" as an integer, not a boolean. - Link to v1: https://patch.msgid.link/20260511-pks-maintenance-fix-lock-with-detach-v1-0-ccd7d62c9a40@pks.im Thanks! Patrick [1]: --- Patrick Steinhardt (2): builtin/maintenance: fix locking with "--detach" run-command: honor "gc.auto" for auto-maintenance builtin/gc.c | 27 ++++++++++++++-- lockfile.c | 9 ++++++ lockfile.h | 10 ++++++ run-command.c | 10 ++++-- setup.c | 31 +++++++++++++------ setup.h | 1 + t/t7900-maintenance.sh | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 157 insertions(+), 14 deletions(-) Range-diff versus v1: 1: d0609c03b4 ! 1: 8dda16ec8d builtin/maintenance: fix locking with "--detach" @@ builtin/gc.c: static int maintenance_run_tasks(struct maintenance_run_opts *opts + lock_file_reassign_owner(&lk, getpid()); + } else if (child_pid > 0) { + /* -+ * We're in the parent process, so we assign ownership -+ * of the lockfile to the child and then exit immediately. ++ * We're in the parent process, so we drop ownership of ++ * the lockfile to prevent us from removing it upon ++ * exit. + */ + lock_file_reassign_owner(&lk, child_pid); + exit(0); 2: 959ce46f7d < -: ---------- run-command: honor "gc.auto" for auto-maintenance -: ---------- > 2: d5507b5dd2 run-command: honor "gc.auto" for auto-maintenance --- base-commit: 13ef77ce6e222bef3ab145642e6ef1486075211c change-id: 20260511-pks-maintenance-fix-lock-with-detach-a608e9b6adeb