Skip to content

Commit

Permalink
Fix exception when there are no commits to merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry Mercer committed Mar 24, 2022
1 parent 4b465cb commit b8f3a37
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/update-release-branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit b8f3a37

Please sign in to comment.