Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2021-09-09 12:47:06 +0300
committerJunio C Hamano <gitster@pobox.com>2021-09-09 22:56:11 +0300
commit28d04e1ec19777bf6382d016b6e624d0ff4336cd (patch)
treec29b6dd43eb66f3d74920ab29f7e4b7818dd2b3f /run-command.h
parent3322a9d87f3b2121d2c62096f9261c8934c74056 (diff)
run-command: offer to close the object store before running
Especially on Windows, where files cannot be deleted if _any_ process holds an open file handle to them, it is important to close the object store (releasing all handles to all `.pack` files) before running a command that might spawn a garbage collection. This scenario is so common that we frequently see the pattern of closing the object store before running auto maintenance or another Git command. Let's make this much more convenient by teaching the `run_command()` machinery a new flag to release the object store before spawning the process. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'run-command.h')
-rw-r--r--run-command.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/run-command.h b/run-command.h
index 3893193f32..ad207daced 100644
--- a/run-command.h
+++ b/run-command.h
@@ -134,6 +134,14 @@ struct child_process {
*/
unsigned use_shell:1;
+ /**
+ * Release any open file handles to the object store before running
+ * the command; This is necessary e.g. when the spawned process may
+ * want to repack because that would delete `.pack` files (and on
+ * Windows, you cannot delete files that are still in use).
+ */
+ unsigned close_object_store:1;
+
unsigned stdout_to_stderr:1;
unsigned clean_on_exit:1;
unsigned wait_after_clean:1;
@@ -240,6 +248,7 @@ int run_auto_maintenance(int quiet);
#define RUN_USING_SHELL (1<<4)
#define RUN_CLEAN_ON_EXIT (1<<5)
#define RUN_WAIT_AFTER_CLEAN (1<<6)
+#define RUN_CLOSE_OBJECT_STORE (1<<7)
/**
* Convenience functions that encapsulate a sequence of