From be6c3f21c53dbada7745ed40d47939d76c7adb85 Mon Sep 17 00:00:00 2001 From: Thomas Bachem Date: Mon, 28 Sep 2026 16:22:23 +0200 Subject: [PATCH] t5520: don't expire reflogs where it matters "git merge" saves any uncommitted changes with "git stash" before it tries a merge strategy. When the strategy does not handle the merge, it restores them with "git stash apply --index". If some of the changes are staged, that runs "git reset", which writes an entry to the reflog of HEAD. The tests that pull with autostash disabled run eight such merges, each with a new file staged. An upcoming change makes "git stash apply --index" merge the index in-core, so it no longer runs "git reset" and those entries go away. Another makes the default "merge" backend of "git rebase" run auto maintenance when it finishes. Together, they change when auto maintenance expires the reflogs. This means that unfortunately the reflogs are expired at the end of "git pull --rebase" in the "--rebase with rebased upstream" test. The "git pull --rebase -f" in the next test looks for the fork point in the reflog of refs/remotes/me/copy, but as the test suite dates every reflog entry to 2005, the expiry has emptied that reflog. Pull then finds no fork point, so the rebase also replays copy-orig, the commit "copy" was rewound from, and it conflicts. Disable reflog expiration in this script, as ea7d894f44 (t34xx: don't expire reflogs where it matters, 2026-02-24) did for the rebase tests, so that the test no longer depends on where the expiry falls. Reported-by: Junio C Hamano Helped-by: D. Ben Knoble Helped-by: Phillip Wood Assisted-by: Claude Fable 5.1 Signed-off-by: Thomas Bachem --- t/t5520-pull.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 27f38ab3c83c85..bc818605a56a62 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -35,6 +35,12 @@ test_pull_autostash_fail () { } test_expect_success setup ' + # Commit dates are hardcoded to 2005, and the reflog entries will have + # a matching timestamp. Maintenance may thus immediately expire + # reflogs if it was running. + git config set gc.reflogExpire never && + git config set gc.reflogExpireUnreachable never && + echo file >file && git add file && git commit -a -m original