Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Swagger BreakingChange] Unreliable calculation of "git diff" for PR #33039

Open
mikeharder opened this issue Mar 6, 2025 · 0 comments
Open
Assignees

Comments

@mikeharder
Copy link
Member

mikeharder commented Mar 6, 2025

PR: #33021

Incorrect calculation of "git diff" on first commit to PR: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4620973&view=logs&j=98f87804-8e1f-5655-af02-e80aefa7aa97&t=65457206-7ab6-5966-2a2f-9ae3efa14a03&l=24

Correct calculation of "git diff'" after pushing second commit to PR: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4621391&view=logs&j=98f87804-8e1f-5655-af02-e80aefa7aa97&t=65457206-7ab6-5966-2a2f-9ae3efa14a03&l=24

Commit to main that triggered race condition bug: 1175ddb

Root cause, the check code diffs the PR branch against the base branch, not the base SHA. Meaning, if a commit is merged to the base branch after the check has started, the diff will be incorrect, since it includes commits in main but not yet in the merge SHA.

The code should be changed to use the canonical version for this logic, which is currently here:

export async function getChangedFiles(
core,
baseCommitish = "HEAD^",
headCommitish = "HEAD",
diffFilter = "d",
) {
const result = await execRoot(
`git -c core.quotepath=off diff --name-only --diff-filter=${diffFilter} ${baseCommitish} ${headCommitish}`,
core,
);

@mikeharder mikeharder self-assigned this Mar 6, 2025
@mikeharder mikeharder moved this from 🤔 Triage to 🐝 Dev in Azure SDK EngSys 🤖🧠 Mar 6, 2025
@mikeharder mikeharder moved this from 🐝 Dev to 📋 Backlog in Azure SDK EngSys 🤖🧠 Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant