MCPcopy
hub / github.com/go-git/go-git / TestWorktreeFilesystemMkdirAllRootIsNoop

Function TestWorktreeFilesystemMkdirAllRootIsNoop

worktree_test.go:3254–3272  ·  view source on GitHub ↗

TestWorktreeFilesystemMkdirAllRootIsNoop locks in the contract that MkdirAll on a root-equivalent path is a silent no-op against the wrapper. validPath itself still rejects "", ".", and "/" (see TestValidPath), but MkdirAll specifically tolerates them because "ensure the root exists" is always trivi

(t *testing.T)

Source from the content-addressed store, hash-verified

3252// TestValidPath), but MkdirAll specifically tolerates them because
3253// "ensure the root exists" is always trivially satisfied.
3254func TestWorktreeFilesystemMkdirAllRootIsNoop(t *testing.T) {
3255 t.Parallel()
3256
3257 rootPaths := []string{"", ".", "/"}
3258 for _, p := range rootPaths {
3259 t.Run(p, func(t *testing.T) {
3260 t.Parallel()
3261
3262 mfs := memfs.New()
3263 fs := newWorktreeFilesystem(mfs, true, true)
3264
3265 require.NoError(t, fs.MkdirAll(p, 0o755))
3266
3267 entries, err := mfs.ReadDir("/")
3268 require.NoError(t, err)
3269 assert.Empty(t, entries, "MkdirAll(%q) must not materialise a directory entry", p)
3270 })
3271 }
3272}
3273
3274var statusCodeNames = map[StatusCode]string{
3275 Unmodified: "Unmodified",

Callers

nothing calls this directly

Calls 4

newWorktreeFilesystemFunction · 0.85
EmptyMethod · 0.80
MkdirAllMethod · 0.45
ReadDirMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…