MCPcopy
hub / github.com/cli/cli / localRepoType

Function localRepoType

pkg/cmd/repo/create/create.go:782–802  ·  view source on GitHub ↗
(gitClient *git.Client)

Source from the content-addressed store, hash-verified

780)
781
782func 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
805func localInit(gitClient *git.Client, remoteURL, path string) error {

Callers 1

createFromLocalFunction · 0.85

Calls 2

ExitCodeMethod · 0.95
GitDirMethod · 0.80

Tested by

no test coverage detected