MCPcopy Create free account
hub / github.com/cli/cli / isSameRef

Function isSameRef

pkg/cmd/pr/create/create.go:178–183  ·  view source on GitHub ↗

isSameRef checks if the head and base refs point to the same ref in the same repository. For cross-repository PRs (e.g., from a fork), the qualified head ref will contain an owner prefix (owner:branch), so even if branch names match, they refer to different repos.

(refs creationRefs)

Source from the content-addressed store, hash-verified

176// For cross-repository PRs (e.g., from a fork), the qualified head ref will contain
177// an owner prefix (owner:branch), so even if branch names match, they refer to different repos.
178func isSameRef(refs creationRefs) bool {
179 if strings.Contains(refs.QualifiedHeadRef(), ":") {
180 return false
181 }
182 return refs.UnqualifiedHeadRef() == refs.BaseRef()
183}
184
185// CreateContext stores contextual data about the creation process and is for building up enough
186// data to create a pull request.

Callers 2

Test_isSameRefFunction · 0.85
createRunFunction · 0.85

Calls 4

ContainsMethod · 0.80
QualifiedHeadRefMethod · 0.65
UnqualifiedHeadRefMethod · 0.65
BaseRefMethod · 0.65

Tested by 1

Test_isSameRefFunction · 0.68