From b8f3a377bfeac2fc198940d26a1610d7abb64cb2 Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Tue, 22 Mar 2022 15:33:54 +0000 Subject: [PATCH] Fix exception when there are no commits to merge --- .github/update-release-branch.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/update-release-branch.py b/.github/update-release-branch.py index 42479624a..c41d3f8b3 100644 --- a/.github/update-release-branch.py +++ b/.github/update-release-branch.py @@ -98,7 +98,9 @@ def open_pr(repo, all_commits, short_main_sha, new_branch_name, source_branch, t # This will not include any commits that exist on the release branch # that aren't on main. def get_commit_difference(repo, source_branch, target_branch): - commits = run_git('log', '--pretty=format:%H', ORIGIN + '/' + target_branch + '..' + ORIGIN + '/' + source_branch).strip().split('\n') + # Passing split nothing means that the empty string splits to nothing: compare `''.split() == []` + # to `''.split('\n') == ['']`. + commits = run_git('log', '--pretty=format:%H', ORIGIN + '/' + target_branch + '..' + ORIGIN + '/' + source_branch).strip().split() # Convert to full-fledged commit objects commits = [repo.get_commit(c) for c in commits]