[PATCH v6 1/3] t5510: cover upstream info update on fetch failure
flat view
HOTtoday
From: Karthik Nayak <hidden>
Date: 2026-10-29 12:45:52
Subsystem:
the rest · Maintainer:
Linus Torvalds
git-fetch(1) performs reference updates in a single batched transaction, so individual updates can be rejected while the rest succeed. Even in that partial-failure case the command still performs the remainder of its work, such as writing the upstream tracking configuration and backfilling tags. We have no test asserting that the upstream tracking information is written when one of the reference updates is rejected. Add one. Signed-off-by: Karthik Nayak <redacted> --- t/t5510-fetch.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index 300bd5396d..30871617f9 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh@@ -2005,6 +2005,31 @@ test_expect_success REFFILES "upstream tracking info is added even with conflict ) ' +test_expect_success REFFILES "upstream tracking info is added with conflicts and backfilled tags" ' + test_when_finished rm -rf base repo && + + git init --initial-branch=main base && + test_commit -C base one && + test_commit -C base two && + git -C base branch foo && + # Backfilling only takes place for tags which are not pointing at tips. + git -C base tag -a annotated -m annotated HEAD~1 && + + git init --bare --initial-branch=main repo && + ( + cd repo && + git remote add origin ../base && + mkdir -p refs/remotes/origin && + >refs/remotes/origin/foo.lock && + test_must_fail git fetch origin --set-upstream main \ + "+refs/heads/*:refs/remotes/origin/*" && + git config get branch.main.remote >actual && + echo "origin" >expect && + test_cmp expect actual && + git rev-parse --verify refs/tags/annotated + ) +' + test_expect_success REFFILES "HEAD is updated even with conflicts" ' test_when_finished rm -rf base repo &&
--
2.56.GIT