Skip to content

fix: narrow diff to only include changes from the source branch #423

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

Merged
merged 11 commits into from
Jun 12, 2025

Conversation

yagni92
Copy link
Contributor

@yagni92 yagni92 commented Jun 10, 2025

Change the logic to show diffs introduced in the source branch, rather than all diffs between the source branch and target. This provides a more focused and accurate analysis of kubechecks proposed changes on PRs.
Additionally, this PR includes minor syntax fixes to the contributing.md document.

The Problem:
Previously, the comparison logic used git diff origin/main..HEAD, which would show all accumulated differences between the two branches. This could lead to confusing or irrelevant results, especially if main had moved forward since the feature branch was created.

The Solution
this PR updates the git diff command to use the triple-dot notation (git diff origin/main...HEAD). The result is a diff that only includes the changes made in the pull request.

this resolves #406

Key Changes:

  • Modified the GetListOfChangedFiles function to use git diff ... for more precise change detection.
  • Corrected minor issues in contributing.md.

NOTE: Please be aware that this change will have no effect if KUBECHECKS_REPO_SHALLOW_CLONE is set to true. This is because the comparison logic won't be able to find the common base commit, which will result in a full diff being generated

@djeebus
Copy link
Collaborator

djeebus commented Jun 12, 2025

Tested, found a couple unrelated bugs related to github auth. Looks great to me, thanks!

@djeebus djeebus merged commit 50e6b47 into zapier:main Jun 12, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unnecessary Full Branch Diff Checks
2 participants