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

Function ParseCommitRange

vcs/git/git.go:132–145  ·  view source on GitHub ↗

ParseCommitRange parses a commit specification and returns the from/to commits. Supports formats: "abc...def", "abc..def", or single commit "abc" Returns (from, to, isRange)

(commitSpec string)

Source from the content-addressed store, hash-verified

130// Supports formats: "abc...def", "abc..def", or single commit "abc"
131// Returns (from, to, isRange)
132func ParseCommitRange(commitSpec string) (string, string, bool) {
133 // Check for three-dot syntax first (more specific)
134 if strings.Contains(commitSpec, "...") {
135 parts := strings.SplitN(commitSpec, "...", 2)
136 return parts[0], parts[1], true
137 }
138 // Check for two-dot syntax
139 if strings.Contains(commitSpec, "..") {
140 parts := strings.SplitN(commitSpec, "..", 2)
141 return parts[0], parts[1], true
142 }
143 // Single commit
144 return "", commitSpec, false
145}
146
147// isAncestor checks if possibleAncestor is an ancestor of possibleDescendant.
148// Returns true if possibleAncestor is older than (or equal to) possibleDescendant.

Calls

no outgoing calls