MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / getCurrentBranch

Function getCurrentBranch

cmd/pad/cmd_github.go:89–95  ·  view source on GitHub ↗

getCurrentBranch returns the current git branch name.

()

Source from the content-addressed store, hash-verified

87
88// getCurrentBranch returns the current git branch name.
89func getCurrentBranch() (string, error) {
90 out, err := exec.Command("git", "rev-parse", "--abbrev-ref", "HEAD").Output()
91 if err != nil {
92 return "", fmt.Errorf("not in a git repository or git not available")
93 }
94 return strings.TrimSpace(string(out)), nil
95}
96
97// extractItemRefFromBranch attempts to find a Pad item reference (e.g. TASK-5, BUG-3) in a branch name.
98//

Callers 1

githubLinkCmdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected