git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fetch: pass --no-write-fetch-head to subprocesses
@ 2023-03-08 10:04 Eric Wong
  2023-03-08 17:41 ` Junio C Hamano
  2023-03-09  3:09 ` [PATCH] " Jeff King
  0 siblings, 2 replies; 8+ messages in thread
From: Eric Wong @ 2023-03-08 10:04 UTC (permalink / raw)
  To: git

It seems a user would expect this option would work regardless
of whether it's fetching from a single remote or many.

Signed-off-by: Eric Wong <e@80x24.org>
---
 I haven't checked if there's other suitable options which could
 go into add_options_to_argv(); hopefully someone else can check :>

 builtin/fetch.c           | 2 ++
 t/t5514-fetch-multiple.sh | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/builtin/fetch.c b/builtin/fetch.c
index a09606b472..78513f1708 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -1880,6 +1880,8 @@ static void add_options_to_argv(struct strvec *argv)
 		strvec_push(argv, "--ipv4");
 	else if (family == TRANSPORT_FAMILY_IPV6)
 		strvec_push(argv, "--ipv6");
+	if (!write_fetch_head)
+		strvec_push(argv, "--no-write-fetch-head");
 }
 
 /* Fetch multiple remotes in parallel */
diff --git a/t/t5514-fetch-multiple.sh b/t/t5514-fetch-multiple.sh
index 54f422ced3..98f034aa77 100755
--- a/t/t5514-fetch-multiple.sh
+++ b/t/t5514-fetch-multiple.sh
@@ -58,6 +58,13 @@ test_expect_success 'git fetch --all' '
 	 test_cmp expect output)
 '
 
+test_expect_success 'git fetch --all --no-write-fetch-head' '
+	(cd test &&
+	rm -f .git/FETCH_HEAD &&
+	git fetch --all --no-write-fetch-head &&
+	test_path_is_missing .git/FETCH_HEAD)
+'
+
 test_expect_success 'git fetch --all should continue if a remote has errors' '
 	(git clone one test2 &&
 	 cd test2 &&

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-03-09 21:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-08 10:04 [PATCH] fetch: pass --no-write-fetch-head to subprocesses Eric Wong
2023-03-08 17:41 ` Junio C Hamano
2023-03-08 22:22   ` [PATCH v2] " Eric Wong
2023-03-08 23:13     ` Junio C Hamano
2023-03-08 23:40       ` Junio C Hamano
2023-03-08 23:48         ` Eric Wong
2023-03-09 21:32           ` Junio C Hamano
2023-03-09  3:09 ` [PATCH] " Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).