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)
| 130 | // Supports formats: "abc...def", "abc..def", or single commit "abc" |
| 131 | // Returns (from, to, isRange) |
| 132 | func 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. |
no outgoing calls