(gitClient *git.Client)
| 780 | ) |
| 781 | |
| 782 | func localRepoType(gitClient *git.Client) (repoType, error) { |
| 783 | projectDir, projectDirErr := gitClient.GitDir(context.Background()) |
| 784 | if projectDirErr != nil { |
| 785 | var execError errWithExitCode |
| 786 | if errors.As(projectDirErr, &execError) { |
| 787 | if exitCode := int(execError.ExitCode()); exitCode == 128 { |
| 788 | return unknown, nil |
| 789 | } |
| 790 | return unknown, projectDirErr |
| 791 | } |
| 792 | } |
| 793 | |
| 794 | switch projectDir { |
| 795 | case ".": |
| 796 | return bare, nil |
| 797 | case ".git": |
| 798 | return working, nil |
| 799 | default: |
| 800 | return unknown, nil |
| 801 | } |
| 802 | } |
| 803 | |
| 804 | // clone the checkout branch to specified path |
| 805 | func localInit(gitClient *git.Client, remoteURL, path string) error { |
no test coverage detected