MCPcopy Create free account
hub / github.com/cli/cli / revParseFacts

Function revParseFacts

pkg/cmd/pr/shared/worktree.go:100–114  ·  view source on GitHub ↗
(client *git.Client, dir string, flags ...string)

Source from the content-addressed store, hash-verified

98}
99
100func revParseFacts(client *git.Client, dir string, flags ...string) (fields []string, ok bool) {
101 args := append([]string{"rev-parse", "--path-format=absolute"}, flags...)
102 if dir != "" {
103 args = append([]string{"-C", dir}, args...)
104 }
105 cmd, err := client.Command(context.Background(), args...)
106 if err != nil {
107 return nil, false
108 }
109 out, err := cmd.Output()
110 if err != nil {
111 return nil, false
112 }
113 return strings.Split(strings.TrimRight(string(out), "\n"), "\n"), true
114}
115
116func ensureWorktreePathSafe(path string) error {
117 fi, err := os.Lstat(path)

Callers 1

resolveWorktreeTargetFunction · 0.85

Calls 2

CommandMethod · 0.80
OutputMethod · 0.65

Tested by

no test coverage detected