From 1c63131b7210babf4573e4722723dff9925dd9e6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 27 Apr 2026 03:04:15 +0000 Subject: [PATCH] Fix redundant condition and misleading comment in buildTree helper Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/2fffdd1f-2d67-4a28-b124-437c26794e25 Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com> --- kittens/dnd/drop_test.go | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/kittens/dnd/drop_test.go b/kittens/dnd/drop_test.go index d131ba14b..f27a9a283 100644 --- a/kittens/dnd/drop_test.go +++ b/kittens/dnd/drop_test.go @@ -21,28 +21,18 @@ func openDir(t *testing.T, path string) *os.File { } // buildTree creates a directory tree described by a map of relative path -> -// content. A nil content value creates a directory; a non-nil value (even -// empty string) creates a regular file. Symlink entries are expressed via the -// separate symlinks map: relative link name -> target string. +// content. Each entry creates a regular file with the given content (parent +// directories are created automatically). Symlink entries are expressed via +// the separate symlinks map: relative link name -> target string. func buildTree(t *testing.T, base string, files map[string]string, symlinks map[string]string) { t.Helper() for rel, content := range files { full := filepath.Join(base, rel) - if content == "" && files[rel] == "" { - // Create parent dirs in case they are missing. - if err := os.MkdirAll(filepath.Dir(full), 0755); err != nil { - t.Fatal(err) - } - if err := os.WriteFile(full, []byte(content), 0644); err != nil { - t.Fatal(err) - } - } else { - if err := os.MkdirAll(filepath.Dir(full), 0755); err != nil { - t.Fatal(err) - } - if err := os.WriteFile(full, []byte(content), 0644); err != nil { - t.Fatal(err) - } + if err := os.MkdirAll(filepath.Dir(full), 0755); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(full, []byte(content), 0644); err != nil { + t.Fatal(err) } } for name, target := range symlinks {