Skip to content

pr-2243/thomasbachem/t5520-reflog-expire-v3

tagged this 01 Oct 08:24
From: Thomas Bachem <mail@thomasbachem.com>

"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 <gitster@pobox.com>
Helped-by: D. Ben Knoble <ben.knoble@gmail.com>
Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Assisted-by: Claude Fable 5.1
Signed-off-by: Thomas Bachem <mail@thomasbachem.com>

Submitted-As: https://lore.kernel.org/git/pull.2243.v3.git.1790843056949.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.2243.git.1790606282769.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.2243.v2.git.1790701691022.gitgitgadget@gmail.com
Assets 2
Loading