GetCurrentCommitHash returns the current commit hash (HEAD)
(repoPath string)
| 93 | |
| 94 | // GetCurrentCommitHash returns the current commit hash (HEAD) |
| 95 | func GetCurrentCommitHash(repoPath string) (string, error) { |
| 96 | stdout, stderr, err := runGitCommand(repoPath, "rev-parse", "--short", "HEAD") |
| 97 | if err != nil { |
| 98 | return "", gitCommandError(err, stderr) |
| 99 | } |
| 100 | |
| 101 | return strings.TrimSpace(string(stdout)), nil |
| 102 | } |
| 103 | |
| 104 | // GetShortCommitHash returns the short version of a given commit hash |
| 105 | func GetShortCommitHash(repoPath, commitID string) (string, error) { |