MCPcopy Index your code
hub / github.com/dagger/dagger / WorkTree

Method WorkTree

util/gitutil/cli_helpers.go:16–30  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

14}
15
16func (cli *GitCLI) WorkTree(ctx context.Context) (string, error) {
17 if cli.workTree != "" {
18 return cli.workTree, nil
19 }
20 out, err := cli.Run(ctx, "rev-parse", "--is-inside-work-tree", "--show-toplevel")
21 out = bytes.TrimSpace(out)
22 if err != nil {
23 if string(out) == "false" {
24 return "", nil
25 }
26 return "", err
27 }
28 lines := slices.Collect(bytes.Lines(out))
29 return string(lines[len(lines)-1]), nil
30}
31
32func (cli *GitCLI) GitDir(ctx context.Context) (string, error) {
33 if cli.gitDir != "" {

Callers 2

CleanedMethod · 0.95
doGitCheckoutFunction · 0.45

Calls 1

RunMethod · 0.95

Tested by

no test coverage detected