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

Function GetRepositoryStateSignature

vcs/git/git_state.go:12–24  ·  view source on GitHub ↗

GetRepositoryStateSignature returns a compact signature of repository state. It includes HEAD and porcelain status so callers can detect commit/index/worktree transitions.

(repoPath string)

Source from the content-addressed store, hash-verified

10// GetRepositoryStateSignature returns a compact signature of repository state.
11// It includes HEAD and porcelain status so callers can detect commit/index/worktree transitions.
12func GetRepositoryStateSignature(repoPath string) (string, error) {
13 head, err := getHEADSignature(repoPath)
14 if err != nil {
15 return "", err
16 }
17
18 status, stderr, err := runGitCommand(repoPath, "status", "--porcelain", "--untracked-files=all")
19 if err != nil {
20 return "", gitCommandError(err, stderr)
21 }
22
23 return fmt.Sprintf("%s\n%s", head, strings.TrimSpace(string(status))), nil
24}
25
26func getHEADSignature(repoPath string) (string, error) {
27 head, stderr, err := runGitCommand(repoPath, "rev-parse", "--verify", "HEAD")

Calls 3

getHEADSignatureFunction · 0.85
runGitCommandFunction · 0.85
gitCommandErrorFunction · 0.85