IsGitRepo returns true if the directory is inside a git repository.
(dir string)
| 44 | |
| 45 | // IsGitRepo returns true if the directory is inside a git repository. |
| 46 | func IsGitRepo(dir string) bool { |
| 47 | cmd := exec.Command("git", "rev-parse", "--git-dir") |
| 48 | cmd.Dir = dir |
| 49 | return cmd.Run() == nil |
| 50 | } |
| 51 | |
| 52 | // CommitCount returns the number of commits on branch that are not on the default branch. |
| 53 | // Returns 0 if the count cannot be determined. |
no test coverage detected