Skip to content

Commit

Permalink
Force PR tests to use a merge commit for testing with --no-ff
Browse files Browse the repository at this point in the history
Never perform a fast-forward merge (--no-ff) for merges used for PR testing.
This follows the convention used by GitHub Actions to never allow fast-forward merges
and allow consistent output of a merge commit sha1 in TriBITS configure output.
  • Loading branch information
achauphan committed Jan 9, 2024
1 parent 7b22ec3 commit 8cfda97
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/framework/pr_tools/PullRequestLinuxDriverMerge.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ def merge_branch(source_url, target_branch, sourceSHA):

if sha_exists_as_branch_on_remote:
print_wrapper("REMARK: Detected ref as a remote branch, will merge as such")
check_call_wrapper(['git', 'merge', '--no-edit', "source_remote/" + sourceSHA])
check_call_wrapper(['git', 'merge', '--no-ff', '--no-edit', "source_remote/" + sourceSHA])
else:
check_call_wrapper(['git', 'merge', '--no-edit', sourceSHA])
check_call_wrapper(['git', 'merge', '--no-ff', '--no-edit', sourceSHA])

return 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def test_mergeBranch_without_source_remote(self):
mock.call(['git', 'fetch', 'origin', 'fake_develop']),
mock.call(['git', 'reset', '--hard', 'HEAD']),
mock.call(['git', 'checkout', '-B', 'fake_develop', 'origin/fake_develop']),
mock.call(['git', 'merge', '--no-edit', 'df324ae']),
mock.call(['git', 'merge', '--no-ff', '--no-edit', 'df324ae']),
])
return

Expand Down Expand Up @@ -199,7 +199,7 @@ def test_mergeBranch_with_source_remote(self, m_check_call):
mock.call(['git', 'fetch', 'origin', 'fake_develop']),
mock.call(['git', 'reset', '--hard', 'HEAD']),
mock.call(['git', 'checkout', '-B', 'fake_develop', 'origin/fake_develop']),
mock.call(['git', 'merge', '--no-edit', 'df324ae']),
mock.call(['git', 'merge', '--no-ff', '--no-edit', 'df324ae']),
])
self.assertIn("git remote exists, removing it", m_stdout.getvalue())
return
Expand Down Expand Up @@ -229,7 +229,7 @@ def test_mergeBranch_ref_is_remote_branch(self, m_check_call):
mock.call(['git', 'fetch', 'origin', 'fake_develop']),
mock.call(['git', 'reset', '--hard', 'HEAD']),
mock.call(['git', 'checkout', '-B', 'fake_develop', 'origin/fake_develop']),
mock.call(['git', 'merge', '--no-edit', 'source_remote/some_ref']),
mock.call(['git', 'merge', '--no-ff', '--no-edit', 'source_remote/some_ref']),
])
self.assertIn("git remote exists, removing it", m_stdout.getvalue())
return
Expand Down

0 comments on commit 8cfda97

Please sign in to comment.