]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'ps/maintenance-daemonize-lockfix' into next
authorJunio C Hamano <gitster@pobox.com>
Thu, 21 May 2026 06:51:33 +0000 (15:51 +0900)
committerJunio C Hamano <gitster@pobox.com>
Thu, 21 May 2026 06:51:33 +0000 (15:51 +0900)
"git maintenance" that goes background did not use the lockfile to
prevent multiple maintenance processes from running at the same
time, which has been corrected..

* ps/maintenance-daemonize-lockfix:
  run-command: honor "gc.auto" for auto-maintenance
  builtin/maintenance: fix locking with "--detach"

1  2 
setup.c
setup.h
t/t7900-maintenance.sh

diff --cc setup.c
Simple merge
diff --cc setup.h
index 9409326fe47c7098c8d4ca2d3b3d717b6432bc31,b5bc5f280c34f09e107727ca4c146c25e34ffec8..7878c9d2673d2f121c4ab865e5d82251282393b6
+++ b/setup.h
@@@ -134,22 -134,36 +134,37 @@@ enum 
   * links.  User relative paths are also returned as they are given,
   * except DWIM suffixing.
   */
 -const char *enter_repo(const char *path, unsigned flags);
 +const char *enter_repo(struct repository *repo, const char *path, unsigned flags);
  
 -const char *setup_git_directory_gently(int *);
 -const char *setup_git_directory(void);
 -char *prefix_path(const char *prefix, int len, const char *path);
 -char *prefix_path_gently(const char *prefix, int len, int *remaining, const char *path);
 +const char *setup_git_directory_gently(struct repository *repo, int *);
 +const char *setup_git_directory(struct repository *repo);
 +char *prefix_path(struct repository *repo, const char *prefix, int len, const char *path);
 +char *prefix_path_gently(struct repository *repo, const char *prefix, int len, int *remaining, const char *path);
  
  int check_filename(const char *prefix, const char *name);
 -void verify_filename(const char *prefix,
 +void verify_filename(struct repository *repo,
 +                   const char *prefix,
                     const char *name,
                     int diagnose_misspelt_rev);
 -void verify_non_filename(const char *prefix, const char *name);
 -int path_inside_repo(const char *prefix, const char *path);
 +void verify_non_filename(struct repository *repo, const char *prefix, const char *name);
 +int path_inside_repo(struct repository *repo, const char *prefix, const char *path);
  
  void sanitize_stdfds(void);
+ /*
+  * Daemonize the current process by forking and then exiting the parent
+  * process. Returns 0 when successful, in which case the parent process will
+  * have exited and it's the child process that continues to run the code.
+  * Otherwise, a negative error code is returned and the parent process will
+  * continue execution.
+  *
+  * Note that this function will also perform the following changes:
+  *
+  *   - Standard file descriptors in the child process are closed.
+  *   - The child process is made a session leader via setsid(3p).
+  *   - All tempfiles owned by the parent process are reassigned to the
+  *     daemonized child process.
+  */
  int daemonize(void);
  
  /*
Simple merge