HasUncommittedChanges checks if there are any uncommitted changes in the repository
(repoPath string)
| 117 | |
| 118 | // HasUncommittedChanges checks if there are any uncommitted changes in the repository |
| 119 | func HasUncommittedChanges(repoPath string) (bool, error) { |
| 120 | stdout, stderr, err := runGitCommand(repoPath, "status", "--porcelain") |
| 121 | if err != nil { |
| 122 | return false, gitCommandError(err, stderr) |
| 123 | } |
| 124 | |
| 125 | // If output is not empty, there are uncommitted changes |
| 126 | return strings.TrimSpace(string(stdout)) != "", nil |
| 127 | } |
| 128 | |
| 129 | // ParseCommitRange parses a commit specification and returns the from/to commits. |
| 130 | // Supports formats: "abc...def", "abc..def", or single commit "abc" |