MCPcopy Create free account
hub / github.com/nikivdev/go / splitOwnerRepo

Function splitOwnerRepo

cli/flow/main.go:3025–3043  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

3023}
3024
3025func splitOwnerRepo(path string) (string, string, error) {
3026 trimmed := strings.Trim(path, "/")
3027 if trimmed == "" {
3028 return "", "", fmt.Errorf("invalid GitHub repository path: %q", path)
3029 }
3030 parts := strings.Split(trimmed, "/")
3031 if len(parts) < 2 {
3032 return "", "", fmt.Errorf("invalid GitHub repository path: %q", path)
3033 }
3034 if len(parts) > 2 {
3035 return "", "", fmt.Errorf("unexpected extra path components in %q", path)
3036 }
3037 owner := parts[0]
3038 repo := strings.TrimSuffix(parts[1], ".git")
3039 if owner == "" || repo == "" {
3040 return "", "", fmt.Errorf("invalid GitHub repository path: %q", path)
3041 }
3042 return owner, repo, nil
3043}
3044
3045func runPrivateForkRepo(ctx *snap.Context) error {
3046 return privateForkRepoFlow(ctx, "privateForkRepo", false)

Callers 2

parsePullRequestRefFunction · 0.70
parseGitHubCloneInfoFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected