Skip to content

Commit 0f4b9b0

Browse files
committed
refactor: address review comments
Signed-off-by: majiayu000 <1835304752@qq.com>
1 parent c4fd102 commit 0f4b9b0

1 file changed

Lines changed: 0 additions & 4 deletions

File tree

pkg/cmd/pr/create/create.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,9 @@ func (r forkableRefs) UnqualifiedHeadRef() string {
170170
// For cross-repository PRs (e.g., from a fork), the qualified head ref will contain
171171
// an owner prefix (owner:branch), so even if branch names match, they refer to different repos.
172172
func isSameRef(refs creationRefs) bool {
173-
// If the qualified head ref contains ":", it's a cross-repo PR (e.g., from a fork)
174-
// and we should allow it even if branch names are the same
175173
if strings.Contains(refs.QualifiedHeadRef(), ":") {
176174
return false
177175
}
178-
// Same repository: check if branch names are identical
179176
return refs.UnqualifiedHeadRef() == refs.BaseRef()
180177
}
181178

@@ -380,7 +377,6 @@ func createRun(opts *CreateOptions) error {
380377
return err
381378
}
382379

383-
// Check if head and base refs point to the same ref in the same repository
384380
if isSameRef(ctx.PRRefs) {
385381
return fmt.Errorf("head branch %q is the same as base branch %q, cannot create a pull request", ctx.PRRefs.UnqualifiedHeadRef(), ctx.PRRefs.BaseRef())
386382
}

0 commit comments

Comments
 (0)