MCPcopy Index your code
hub / github.com/docker/docker-agent / WithRoot

Function WithRoot

pkg/worktree/worktree.go:108–114  ·  view source on GitHub ↗

WithRoot places the worktree under dir instead of the default data directory. The worktree is created at /worktrees/ . An empty dir is ignored, keeping the default. This decouples the package from the process-global data directory, letting tests and embedders pick an isolated location.

(dir string)

Source from the content-addressed store, hash-verified

106// process-global data directory, letting tests and embedders pick an isolated
107// location.
108func WithRoot(dir string) CreateOption {
109 return func(c *createConfig) {
110 if dir != "" {
111 c.root = dir
112 }
113 }
114}
115
116// Create creates a new git worktree for the repository containing dir and
117// returns it. The worktree lives under the data directory and checks out a

Calls

no outgoing calls