-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
feat: compare all branch authors when deciding if a branch is modified #21558
Merged
Merged
Changes from 20 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
1f9eae1
fix: isBranchModified now compares commit authors to defaultBranch
Keysox b932f56
Switch to using baseBranch instead of defaultBranch
Keysox 98964bb
Update unit tests with isBranchModified's first parameter
Keysox 1786954
Update types for baseBranch/defaultBranch to be always defined so we …
Keysox bddb6c0
Revert "Update types for baseBranch/defaultBranch to be always define…
Keysox 18f2597
Simplify branchIsModified logic
Keysox df774b5
Merge branch 'main' into 19994
Keysox adb0698
Refactor to for-of loop
Keysox f679af9
Use old isBranchModified logic if baseBranch is unknown
Keysox a4c5dc7
Update types and improve debug message
Keysox 4f32999
Don't use baseBranch for cleanUpBranches since it's only called once,…
Keysox 75ddd0b
Commit suggested changes
Keysox 62905b0
Merge branch 'main' into 19994
Keysox 11bf388
Merge branch 'main' into 19994
Keysox ab74915
Fixes #21504, see https://git-scm.com/docs/git-log\#_description for …
Keysox 64e8c96
Revert test since '..' relies on branches being pushed, which isn't w…
Keysox 6a513b2
ignore coverage for if block since .. relies on a git push
Keysox 2a03f7d
Merge branch 'main' into 19994
Keysox 0ae4756
Merge branch 'main' into 19994
rarkins 5794b9e
Add test per @rarkins and @viceice
Keysox 362caee
Apply suggestions from code review
Keysox 6db9a13
pnpm run prettier-fix
Keysox 7c28a2e
Log git authors
Keysox f124927
Merge branch 'main' into 19994
rarkins ddc85d6
Merge branch 'main' into 19994
rarkins 3d486eb
newlineRegex per @viceice
Keysox 3524e70
Merge branch 'main' into 19994
rarkins File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The syntax here is the wrong way.
This check means "all from baseBranch except those on branchName".
So basically this would return all commits that are on the base but NOT on the renovate-bot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what would be the right command?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@viceice Either switch the operands
Or use the explicit
Both should show all commits on the branchName (e.g. renovate/dep-abc), but without any commits on the baseBranch (e.g. main).
So if we were to have the following git tree (I hope the mermaid rendering is supported in all browsers):
Then baseBranch would be
main
and branchName would berenovate/x
We'd probably only want to look at the commit
X
, but the way this MR was written would return the D and EThen the result would be:
main..renovate/x
X
renovate/x..main
D, E
renovate/x ^main
X
main ^renovate/x
D, E
Of course, if there were some rebasing done in between, it would be a bit different.
Let's say we rebased C, D, E on the main branch (if for whatever reason you were to rebase on main).
Or well, pretty much anything that rewrites history, like someone else force-pushing over someone else's changes.
Then the result would be:
main..renovate/x
C, X
renovate/x..main
C - rebased, D - rebased, E - rebased
renovate/x ^main
C, X
main ^renovate/x
C - rebased, D - rebased, E - rebased
I don't know what the expected behaviour should be in the case the main was force-pushed, but you can at least use these tables as reference if you wanted this feature again 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rebase would be an issue now too. I'm not too worried about that. it shouldn't be a normal workflow with renovate. can we detect that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe I'll try to create this PR again with proper tests