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

feat: add new issues.new-from-merge-base option #5362

Merged
merged 2 commits into from
Jan 31, 2025

Conversation

ldez
Copy link
Member

@ldez ldez commented Jan 31, 2025

Adds new issues.new-from-merge-base option.

git merge-base is a better approach than an explicit revision:

gitGraph:
commit id:"a"
commit id:"b" type:HIGHLIGHT
branch my_branch
checkout main
commit id:"c"
checkout my_branch
commit id:"d"
commit  id:"e"tag:"HEAD" type:HIGHLIGHT
checkout main
commit id:"f"
commit id:"g" type:HIGHLIGHT
Loading

When using issues.new-from-rev=main, the diff will be between e and g, which is wrong.

With issues.new-from-merge-base=main, the diff will be between e and b, which is right.

The new option uses git merge-base <ref> HEAD internally. (https://github.com/golangci/revgrep/blob/43995b04fc9795de8791e8a9d82206f95d8acaf1/patch.go#L182)

Reference: https://git-scm.com/docs/git-merge-base

Some real-life examples:

Fixes #460

@ldez ldez added the enhancement New feature or improvement label Jan 31, 2025
@ldez ldez added this to the next milestone Jan 31, 2025
@ldez ldez merged commit 192e98b into golangci:master Jan 31, 2025
18 checks passed
@ldez ldez deleted the feat/merge-base branch January 31, 2025 15:36
@ldez ldez modified the milestones: next, v1.64 Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Why HEAD~1 ?
2 participants