MCPcopy Index your code
hub / github.com/devspace-sh/devspace / GetBranch

Function GetBranch

pkg/util/git/helper.go:21–33  ·  view source on GitHub ↗

GetBranch retrieves the current HEADs name

(localPath string)

Source from the content-addressed store, hash-verified

19
20// GetBranch retrieves the current HEADs name
21func GetBranch(localPath string) (string, error) {
22 repo, err := git.PlainOpen(localPath)
23 if err != nil {
24 return "", errors.Wrap(err, "git open")
25 }
26
27 head, err := repo.Head()
28 if err != nil {
29 return "", errors.Wrap(err, "get head")
30 }
31
32 return head.Name().Short(), nil
33}
34
35// GetHash retrieves the current HEADs hash
36func GetHash(ctx context.Context, localPath string) (string, error) {

Callers 1

Calls 1

NameMethod · 0.65

Tested by

no test coverage detected