- When a commit is a merge commit, adjust the revision so that it selects the correct parent. - Add relevant tests. - Extract the logic to initialize a Git repository for tests in a dedicated function. Fix #5941