git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] fetch: avoid locking issues between fetch.jobs/fetch.writeCommitGraph

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Nov 3, 2019, 00:21 UTC
Message-ID
<f8157985dc5d59331a80d3c6034644bc3f6d8881.1572740518.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.443.git.1572740518.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>

When both `fetch.jobs` and `fetch.writeCommitGraph` is set, we currently try to write the commit graph in each of the concurrent fetch jobs, which frequently leads to error messages like this one:

fatal: Unable to create '.../.git/objects/info/commit-graphs/commit-graph-chain.lock': File exists.

Let's avoid this by holding off from writing the commit graph until all fetch jobs are done.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 builtin/fetch.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/builtin/fetch.c b/builtin/fetch.c
index ba2a81c392..dc7dc303b1 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -1602,7 +1602,8 @@ static int fetch_multiple(struct string_list *list, int max_children)
 			return errcode;
 	}
 
-	argv_array_pushl(&argv, "fetch", "--append", "--no-auto-gc", NULL);
+	argv_array_pushl(&argv, "fetch", "--append", "--no-auto-gc",
+			"--no-write-commit-graph", NULL);
 	add_options_to_argv(&argv);
 
 	if (max_children != 1 && list->nr != 1) {
-- 
gitgitgadget
Previous: Johannes Schindelin via GitGitGadgetNext: Jeff King
Message 3 of 6 in “Fix locking issues with git fetch --multiple --jobs=<n> and fetch.writeCommitGraph”
  1. 0/2 Fix locking issues with git fetch --multiple --jobs=<n> and fetch.writeCommitGraphJohannes Schindelin via GitGitGadget, Nov 3, 2019
  2. 1/2 fetch: add the command-line option `--write-commit-graph`Johannes Schindelin via GitGitGadget, Nov 3, 2019
  3. 2/2 fetch: avoid locking issues between fetch.jobs/fetch.writeCommitGraphJohannes Schindelin via GitGitGadget, Nov 3, 2019
  4. Jeff KingNov 4, 2019
  5. Junio C HamanoNov 6, 2019
  6. Johannes SchindelinNov 6, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.