Skip to content

Commit

Permalink
Fix missing related PRs when cherry-picking (#33261)
Browse files Browse the repository at this point in the history
The `airflow-github` tooling had a check if PR has been already
merged, but the PR did not work well when there was already a PR
cherry-picked that referred the PR in question in their log message.

The check was done via `git log --grep=#PR` essentially and so
it happenes that `--grep` matches not only the first line of
the message but the whole log message. So if the log message
contained reference to the cherry-picked PR it was seen as merged.

This change adds ( ) around and $ to the regexp to match not
only the PR number but also parentheses around.

(cherry picked from commit eb07618)
  • Loading branch information
potiuk authored and ephraimbuddy committed Aug 9, 2023
1 parent 6378943 commit a57cc8b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dev/airflow-github
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def get_commit_in_main_associated_with_pr(repo: git.Repo, issue: Issue) -> str |

def is_cherrypicked(repo: git.Repo, issue: Issue, previous_version: str | None = None) -> bool:
"""Check if a given issue is cherry-picked in the current branch or not"""
log_args = ["--format=%H", f"--grep=#{issue.number}"]
log_args = ["--format=%H", f"--grep=(#{issue.number})$"]
if previous_version:
log_args.append(previous_version + "..")
log = repo.git.log(*log_args)
Expand Down

0 comments on commit a57cc8b

Please sign in to comment.