MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / normalizeRemoteBranchReference

Function normalizeRemoteBranchReference

internal/store/gitstore.go:731–740  ·  view source on GitHub ↗
(name plumbing.ReferenceName)

Source from the content-addressed store, hash-verified

729}
730
731func normalizeRemoteBranchReference(name plumbing.ReferenceName) (plumbing.ReferenceName, bool) {
732 switch {
733 case strings.HasPrefix(name.String(), "refs/heads/"):
734 return name, true
735 case strings.HasPrefix(name.String(), "refs/remotes/origin/"):
736 return plumbing.NewBranchReferenceName(strings.TrimPrefix(name.String(), "refs/remotes/origin/")), true
737 default:
738 return "", false
739 }
740}
741
742func shouldFallbackToCurrentBranch(repo *git.Repository, err error) bool {
743 if !errors.Is(err, transport.ErrAuthenticationRequired) && !errors.Is(err, transport.ErrEmptyRemoteRepository) {

Callers 2

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected