MCPcopy Create free account
hub / github.com/belak/gitdir / Path

Method Path

repo.go:54–71  ·  view source on GitHub ↗

Path returns the full path to this repository on disk. This is relative to the gitdir root.

()

Source from the content-addressed store, hash-verified

52// Path returns the full path to this repository on disk. This is relative to
53// the gitdir root.
54func (repo RepoLookup) Path() string {
55 switch repo.Type {
56 case RepoTypeAdmin:
57 return "admin/admin"
58 case RepoTypeOrgConfig:
59 return path.Join("admin", "org-"+repo.PathParts[0])
60 case RepoTypeOrg:
61 return path.Join("orgs", repo.PathParts[0], repo.PathParts[1])
62 case RepoTypeUserConfig:
63 return path.Join("admin", "user-"+repo.PathParts[0])
64 case RepoTypeUser:
65 return path.Join("users", repo.PathParts[0], repo.PathParts[1])
66 case RepoTypeTopLevel:
67 return path.Join("top-level", repo.PathParts[0])
68 }
69
70 return "/dev/null"
71}
72
73// ErrInvalidRepoFormat is returned when a repo is looked up which cannot
74// exist based on the parsed format.

Callers 2

TestRepoLookupFunction · 0.95
cmdRepoActionMethod · 0.80

Calls

no outgoing calls

Tested by 1

TestRepoLookupFunction · 0.76