MCPcopy Create free account
hub / github.com/LegacyCodeHQ/clarity-cli / GetCurrentCommitHash

Function GetCurrentCommitHash

vcs/git/git.go:95–102  ·  view source on GitHub ↗

GetCurrentCommitHash returns the current commit hash (HEAD)

(repoPath string)

Source from the content-addressed store, hash-verified

93
94// GetCurrentCommitHash returns the current commit hash (HEAD)
95func GetCurrentCommitHash(repoPath string) (string, error) {
96 stdout, stderr, err := runGitCommand(repoPath, "rev-parse", "--short", "HEAD")
97 if err != nil {
98 return "", gitCommandError(err, stderr)
99 }
100
101 return strings.TrimSpace(string(stdout)), nil
102}
103
104// GetShortCommitHash returns the short version of a given commit hash
105func GetShortCommitHash(repoPath, commitID string) (string, error) {

Calls 2

runGitCommandFunction · 0.85
gitCommandErrorFunction · 0.85