GetShortCommitHash returns the short version of a given commit hash
(repoPath, commitID string)
| 103 | |
| 104 | // GetShortCommitHash returns the short version of a given commit hash |
| 105 | func 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 |
| 119 | func HasUncommittedChanges(repoPath string) (bool, error) { |