Thread (48 messages) 48 messages, 3 authors, 2021-07-06

[RFC PATCH 14/35] update: reverse the order of parents

flat view
STALE1919d

From: Felipe Contreras <hidden>
Date: 2021-07-05 12:32:40
Subsystem: the rest · Maintainer: Linus Torvalds

The order of the parents in git pull is wrong, many big threads [1] [2]
have been started because of that.

There's no need for git update to repeat that mistake.

[1] https://lore.kernel.org/git/20130522115042.GA20649@inner.h.apk.li/ (local)
[2] https://lore.kernel.org/git/4ay6w9i74cygt6ii1b0db7wg.1398433713382@email.android.com/ (local)

Signed-off-by: Felipe Contreras <redacted>
---
 builtin/update.c  | 2 +-
 t/t5563-update.sh | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/builtin/update.c b/builtin/update.c
index 5946b383f5..94e83532a8 100644
--- a/builtin/update.c
+++ b/builtin/update.c
@@ -59,7 +59,7 @@ static int run_merge(void)
 	int ret;
 	struct strvec args = STRVEC_INIT;
 
-	strvec_pushl(&args, "merge", "FETCH_HEAD", NULL);
+	strvec_pushl(&args, "merge", "--reverse-parents", "FETCH_HEAD", NULL);
 
 	ret = run_command_v_opt(args.v, RUN_GIT_CMD);
 	strvec_clear(&args);
diff --git a/t/t5563-update.sh b/t/t5563-update.sh
index 833a5285da..72d6a357a1 100755
--- a/t/t5563-update.sh
+++ b/t/t5563-update.sh
@@ -53,7 +53,9 @@ test_expect_success 'git update non-fast-forward with merge' '
 	git commit -m new &&
 	git checkout -b test -t other &&
 	git reset --hard master &&
-	git update --merge
+	git update --merge &&
+	test_cmp_rev @^2 master &&
+	test_cmp_rev @^1 other
 	)
 '
 
-- 
2.32.0.36.g70aac2b1aa
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help