IsGitRepo reports whether path is inside a git working tree. Returns true for the repo root as well as any subdirectory of it.
(path string)
| 20 | // IsGitRepo reports whether path is inside a git working tree. |
| 21 | // Returns true for the repo root as well as any subdirectory of it. |
| 22 | func IsGitRepo(path string) bool { |
| 23 | _, err := Run(context.Background(), path, "rev-parse", "--is-inside-work-tree") |
| 24 | return err == nil |
| 25 | } |
| 26 | |
| 27 | func Clone(ctx context.Context, path, remote, checkoutBranch string, singleBranch, shallow bool) error { |
| 28 | args := []string{"clone", remote, path} |