@@ -37,6 +37,39 @@ teardown() {
3737 [ -f " $TEST_WORKTREES_DIR /copy-target/config.json" ]
3838}
3939
40+ @test " cmd_copy copies configured includeDirs" {
41+ mkdir -p " $TEST_REPO /.zed"
42+ echo " settings" > " $TEST_REPO /.zed/settings.json"
43+ git config --add gtr.copy.includeDirs " .zed"
44+
45+ run cmd_copy copy-target
46+ [ " $status " -eq 0 ]
47+ [ -f " $TEST_WORKTREES_DIR /copy-target/.zed/settings.json" ]
48+ }
49+
50+ @test " cmd_copy dry-run does not copy configured includeDirs" {
51+ mkdir -p " $TEST_REPO /.zed"
52+ echo " settings" > " $TEST_REPO /.zed/settings.json"
53+ git config --add gtr.copy.includeDirs " .zed"
54+
55+ run cmd_copy copy-target --dry-run
56+ [ " $status " -eq 0 ]
57+ [ ! -d " $TEST_WORKTREES_DIR /copy-target/.zed" ]
58+ }
59+
60+ @test " cmd_copy applies configured excludeDirs" {
61+ mkdir -p " $TEST_REPO /.zed/cache"
62+ echo " settings" > " $TEST_REPO /.zed/settings.json"
63+ echo " token" > " $TEST_REPO /.zed/cache/token"
64+ git config --add gtr.copy.includeDirs " .zed"
65+ git config --add gtr.copy.excludeDirs " .zed/cache"
66+
67+ run cmd_copy copy-target
68+ [ " $status " -eq 0 ]
69+ [ -f " $TEST_WORKTREES_DIR /copy-target/.zed/settings.json" ]
70+ [ ! -e " $TEST_WORKTREES_DIR /copy-target/.zed/cache/token" ]
71+ }
72+
4073# ── --all flag ───────────────────────────────────────────────────────────────
4174
4275@test " cmd_copy --all copies to all worktrees" {
@@ -47,6 +80,29 @@ teardown() {
4780 [ -f " $TEST_WORKTREES_DIR /copy-target-2/.env" ]
4881}
4982
83+ @test " cmd_copy --all copies configured includeDirs to all worktrees" {
84+ create_test_worktree " copy-target-2"
85+ mkdir -p " $TEST_REPO /.zed"
86+ echo " settings" > " $TEST_REPO /.zed/settings.json"
87+ git config --add gtr.copy.includeDirs " .zed"
88+
89+ run cmd_copy --all
90+ [ " $status " -eq 0 ]
91+ [ -f " $TEST_WORKTREES_DIR /copy-target/.zed/settings.json" ]
92+ [ -f " $TEST_WORKTREES_DIR /copy-target-2/.zed/settings.json" ]
93+ }
94+
95+ @test " cmd_copy --from copies configured includeDirs from source worktree" {
96+ create_test_worktree " copy-source"
97+ mkdir -p " $TEST_WORKTREES_DIR /copy-source/.idea"
98+ echo " workspace" > " $TEST_WORKTREES_DIR /copy-source/.idea/workspace.xml"
99+ git config --add gtr.copy.includeDirs " .idea"
100+
101+ run cmd_copy copy-target --from copy-source
102+ [ " $status " -eq 0 ]
103+ [ -f " $TEST_WORKTREES_DIR /copy-target/.idea/workspace.xml" ]
104+ }
105+
50106# ── Error cases ──────────────────────────────────────────────────────────────
51107
52108@test " cmd_copy fails with no arguments" {
0 commit comments