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

Function GetShortCommitHash

vcs/git/git.go:105–116  ·  view source on GitHub ↗

GetShortCommitHash returns the short version of a given commit hash

(repoPath, commitID string)

Source from the content-addressed store, hash-verified

103
104// GetShortCommitHash returns the short version of a given commit hash
105func GetShortCommitHash(repoPath, commitID string) (string, error) {
106 if err := validateGitRef(commitID); err != nil {
107 return "", err
108 }
109
110 stdout, stderr, err := runGitCommand(repoPath, "rev-parse", "--short", commitID)
111 if err != nil {
112 return "", gitCommandError(err, stderr)
113 }
114
115 return strings.TrimSpace(string(stdout)), nil
116}
117
118// HasUncommittedChanges checks if there are any uncommitted changes in the repository
119func HasUncommittedChanges(repoPath string) (bool, error) {

Calls 3

validateGitRefFunction · 0.85
runGitCommandFunction · 0.85
gitCommandErrorFunction · 0.85