treeboot 0.6.0

Bootstrap Git worktrees from one repo-local setup file.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
use std::ffi::{OsStr, OsString};
use std::path::Path;

use predicates::prelude::*;

mod common;

use common::{display_path, git_repo, git_worktree, treeboot, write_file};

#[cfg(unix)]
use common::write_executable_script;

const COMPLETION_SHELLS: [&str; 5] = ["bash", "zsh", "fish", "powershell", "elvish"];

fn complete_source_candidates<I, S>(
    shell: &str,
    args: I,
    current_dir: &Path,
) -> assert_cmd::assert::Assert
where
    I: IntoIterator<Item = S>,
    S: AsRef<OsStr>,
{
    let args = args
        .into_iter()
        .map(|arg| arg.as_ref().to_os_string())
        .collect::<Vec<OsString>>();
    let index = args.len().saturating_sub(1).to_string();
    let mut command = treeboot();

    command
        .env("COMPLETE", shell)
        .env("_CLAP_COMPLETE_INDEX", index)
        .env("_CLAP_IFS", "\n")
        .arg("--")
        .args(args)
        .current_dir(current_dir);

    command.assert()
}

#[test]
fn manual_commands_should_require_sources() {
    for command in ["copy", "symlink", "sync"] {
        treeboot()
            .arg(command)
            .assert()
            .code(2)
            .stderr(predicate::str::contains("required"));
    }
}

#[test]
fn copy_should_create_files_and_directories_from_root() {
    let repo = git_worktree();
    write_file(&repo.root_path().join(".env"), "TOKEN=1\n");
    std::fs::create_dir_all(repo.root_path().join("shared/nested"))
        .expect("source directory should be created");
    write_file(&repo.root_path().join("shared/nested/config"), "value\n");

    treeboot()
        .args(["copy", ".env", "shared"])
        .current_dir(repo.worktree_path())
        .assert()
        .success()
        .stdout(predicate::str::contains("treeboot: copy .env -> .env"))
        .stdout(predicate::str::contains("treeboot: copy shared -> shared"));

    assert_eq!(
        std::fs::read_to_string(repo.worktree_path().join(".env"))
            .expect("copied file should be readable"),
        "TOKEN=1\n"
    );
    assert_eq!(
        std::fs::read_to_string(repo.worktree_path().join("shared/nested/config"))
            .expect("copied nested file should be readable"),
        "value\n"
    );
}

#[test]
fn copy_should_place_multiple_sources_under_target_prefix() {
    let repo = git_worktree();
    write_file(&repo.root_path().join("a"), "a\n");
    write_file(&repo.root_path().join("c"), "c\n");

    treeboot()
        .args(["copy", "a", "c", "--target", "local"])
        .current_dir(repo.worktree_path())
        .assert()
        .success()
        .stdout(predicate::str::contains(format!(
            "treeboot: copy a -> {}",
            display_path("local/a")
        )))
        .stdout(predicate::str::contains(format!(
            "treeboot: copy c -> {}",
            display_path("local/c")
        )));

    assert_eq!(
        std::fs::read_to_string(repo.worktree_path().join("local/a"))
            .expect("first target should be readable"),
        "a\n"
    );
    assert_eq!(
        std::fs::read_to_string(repo.worktree_path().join("local/c"))
            .expect("second target should be readable"),
        "c\n"
    );
}

#[cfg(unix)]
#[test]
fn symlink_should_create_relative_link() {
    let repo = git_worktree();
    write_file(&repo.root_path().join(".tool-versions"), "rust latest\n");

    treeboot()
        .args([
            "symlink",
            ".tool-versions",
            "--target",
            "config/tool-versions",
        ])
        .current_dir(repo.worktree_path())
        .assert()
        .success()
        .stdout(predicate::str::contains(
            "treeboot: symlink .tool-versions -> config/tool-versions",
        ));

    let link = repo.worktree_path().join("config/tool-versions");
    let target = std::fs::read_link(&link).expect("target should be a symlink");
    assert!(target.is_relative());
    assert_eq!(
        std::fs::canonicalize(link).expect("link should resolve"),
        std::fs::canonicalize(repo.root_path().join(".tool-versions"))
            .expect("source should canonicalize")
    );
}

#[test]
fn sync_should_update_changed_files() {
    let repo = git_worktree();
    std::fs::create_dir_all(repo.root_path().join("shared"))
        .expect("source directory should be created");
    std::fs::create_dir_all(repo.worktree_path().join("shared"))
        .expect("target directory should be created");
    write_file(&repo.root_path().join("shared/config"), "new\n");
    write_file(&repo.worktree_path().join("shared/config"), "old\n");

    treeboot()
        .args(["sync", "shared", "--compare", "checksum"])
        .current_dir(repo.worktree_path())
        .assert()
        .success()
        .stdout(predicate::str::contains(
            "treeboot: sync shared -> shared (1 changed)",
        ));

    assert_eq!(
        std::fs::read_to_string(repo.worktree_path().join("shared/config"))
            .expect("synced file should be readable"),
        "new\n"
    );
}

#[cfg(unix)]
#[test]
fn sync_should_honor_ignore_metadata_permissions() {
    use std::os::unix::fs::PermissionsExt;

    let repo = git_worktree();
    let source = repo.root_path().join("config");
    let target = repo.worktree_path().join("config");
    write_file(&source, "value\n");
    write_file(&target, "value\n");
    let modified = std::fs::metadata(&source)
        .expect("source metadata should be readable")
        .modified()
        .expect("source mtime should be readable");
    std::fs::File::options()
        .write(true)
        .open(&target)
        .and_then(|file| file.set_times(std::fs::FileTimes::new().set_modified(modified)))
        .expect("target mtime should match source");
    let mut source_permissions = std::fs::metadata(&source)
        .expect("source metadata should be readable")
        .permissions();
    source_permissions.set_mode(0o600);
    std::fs::set_permissions(&source, source_permissions).expect("source mode should be set");
    let mut target_permissions = std::fs::metadata(&target)
        .expect("target metadata should be readable")
        .permissions();
    target_permissions.set_mode(0o644);
    std::fs::set_permissions(&target, target_permissions).expect("target mode should be set");

    treeboot()
        .args(["sync", "config", "--ignore-metadata", "permissions"])
        .current_dir(repo.worktree_path())
        .assert()
        .success()
        .stdout(predicate::str::is_empty());

    let mode = std::fs::metadata(&target)
        .expect("target metadata should be readable")
        .permissions()
        .mode()
        & 0o777;
    assert_eq!(mode, 0o644);
}

#[test]
fn sync_verbose_should_report_concrete_file_actions() {
    let repo = git_worktree();
    std::fs::create_dir_all(repo.root_path().join("shared"))
        .expect("source directory should be created");
    write_file(&repo.root_path().join("shared/config"), "new\n");

    treeboot()
        .args(["sync", "shared", "--verbose"])
        .current_dir(repo.worktree_path())
        .assert()
        .success()
        .stdout(predicate::str::contains(format!(
            "treeboot: sync {} -> {}",
            display_path("shared/config"),
            display_path("shared/config")
        )));
}

#[test]
fn sync_delete_should_remove_target_only_files() {
    let repo = git_worktree();
    std::fs::create_dir_all(repo.root_path().join("shared"))
        .expect("source directory should be created");
    std::fs::create_dir_all(repo.worktree_path().join("shared"))
        .expect("target directory should be created");
    write_file(&repo.root_path().join("shared/config"), "value\n");
    write_file(&repo.worktree_path().join("shared/extra"), "remove\n");

    treeboot()
        .args(["sync", "shared", "--delete"])
        .current_dir(repo.worktree_path())
        .assert()
        .success()
        .stdout(predicate::str::contains(
            "treeboot: sync shared -> shared (1 changed, 1 deleted)",
        ));

    assert!(!repo.worktree_path().join("shared/extra").exists());
}

#[test]
fn sync_no_delete_should_preserve_target_only_files() {
    let repo = git_worktree();
    std::fs::create_dir_all(repo.root_path().join("shared"))
        .expect("source directory should be created");
    std::fs::create_dir_all(repo.worktree_path().join("shared"))
        .expect("target directory should be created");
    write_file(&repo.root_path().join("shared/config"), "value\n");
    write_file(&repo.worktree_path().join("shared/extra"), "keep\n");

    treeboot()
        .args(["sync", "shared", "--no-delete"])
        .current_dir(repo.worktree_path())
        .assert()
        .success();

    assert_eq!(
        std::fs::read_to_string(repo.worktree_path().join("shared/extra"))
            .expect("extra file should remain"),
        "keep\n"
    );
}

#[test]
fn dry_run_should_report_without_mutation() {
    let repo = git_worktree();
    write_file(&repo.root_path().join(".env"), "TOKEN=1\n");

    treeboot()
        .args(["copy", ".env", "--dry-run"])
        .current_dir(repo.worktree_path())
        .assert()
        .success()
        .stdout(predicate::str::contains(
            "treeboot: would copy .env -> .env",
        ));

    assert!(!repo.worktree_path().join(".env").exists());
}

#[test]
fn force_should_replace_supported_targets() {
    let repo = git_worktree();
    write_file(&repo.root_path().join(".env"), "new\n");
    write_file(&repo.worktree_path().join(".env"), "old\n");

    treeboot()
        .args(["copy", ".env", "--force"])
        .current_dir(repo.worktree_path())
        .assert()
        .success();

    assert_eq!(
        std::fs::read_to_string(repo.worktree_path().join(".env"))
            .expect("target should be readable"),
        "new\n"
    );
}

#[test]
fn root_checkout_should_skip_manual_file_operations() {
    let repo = git_repo();
    write_file(&repo.path().join(".env"), "TOKEN=1\n");

    treeboot()
        .args(["copy", ".env"])
        .current_dir(repo.path())
        .assert()
        .success()
        .stdout(predicate::str::contains(
            "treeboot: This is not a work tree",
        ))
        .stdout(predicate::str::contains("treeboot: copy").not());
}

#[test]
fn root_checkout_should_skip_manual_config_parsing() {
    let repo = git_repo();
    write_file(&repo.path().join(".env"), "TOKEN=1\n");
    write_file(&repo.path().join(".treeboot.toml"), "invalid = [\n");

    treeboot()
        .args(["copy", ".env"])
        .current_dir(repo.path())
        .assert()
        .success()
        .stdout(predicate::str::contains(
            "treeboot: This is not a work tree",
        ))
        .stderr(predicate::str::contains("invalid config").not());
}

#[test]
fn strict_root_checkout_should_fail_manual_file_operations() {
    let repo = git_repo();

    treeboot()
        .args(["copy", ".env", "--strict"])
        .current_dir(repo.path())
        .assert()
        .code(1)
        .stdout(predicate::str::contains(
            "treeboot: This is not a work tree",
        ))
        .stderr(predicate::str::contains(
            "treeboot: This is not a work tree",
        ));
}

#[test]
fn invalid_operation_specific_flags_should_be_usage_errors() {
    treeboot()
        .args(["copy", ".env", "--compare", "checksum"])
        .assert()
        .code(2)
        .stderr(predicate::str::contains("unexpected argument"));

    treeboot()
        .args(["symlink", ".env", "--symlinks", "preserve"])
        .assert()
        .code(2)
        .stderr(predicate::str::contains("unexpected argument"));

    treeboot()
        .args(["symlink", ".env", "--ignore-metadata", "permissions"])
        .assert()
        .code(2)
        .stderr(predicate::str::contains("unexpected argument"));
}

#[test]
fn required_missing_source_should_fail_without_config_locations() {
    let repo = git_worktree();

    treeboot()
        .args(["copy", "missing", "--required"])
        .current_dir(repo.worktree_path())
        .assert()
        .code(1)
        .stderr(predicate::str::contains("invalid copy file operation"))
        .stderr(predicate::str::contains("required source does not exist"))
        .stderr(predicate::str::contains("invalid config").not())
        .stderr(predicate::str::contains("line").not());
}

#[test]
fn duplicate_manual_targets_should_fail_before_side_effects() {
    let repo = git_worktree();
    write_file(&repo.root_path().join("a"), "value\n");

    treeboot()
        .args(["copy", "a", "./a"])
        .current_dir(repo.worktree_path())
        .assert()
        .code(1)
        .stderr(predicate::str::contains("invalid copy file operation"))
        .stderr(predicate::str::contains("duplicate target"));

    assert!(!repo.worktree_path().join("a").exists());
}

#[test]
fn overlapping_manual_sync_delete_targets_should_fail_before_side_effects() {
    let repo = git_worktree();
    std::fs::create_dir_all(repo.root_path().join("shared/nested"))
        .expect("nested source should be created");
    write_file(&repo.root_path().join("shared/nested/config"), "value\n");

    treeboot()
        .args(["sync", "--delete", "shared", "shared/nested"])
        .current_dir(repo.worktree_path())
        .assert()
        .code(1)
        .stderr(predicate::str::contains("invalid sync file operation"))
        .stderr(predicate::str::contains("overlapping targets"));

    assert!(!repo.worktree_path().join("shared").exists());
}

#[cfg(unix)]
#[test]
fn unsafe_source_symlink_should_fail_before_side_effects() {
    let repo = git_worktree();
    let outside = repo
        .root_path()
        .parent()
        .expect("root should have parent")
        .join("outside-secret");
    write_file(&outside, "secret\n");
    std::fs::create_dir_all(repo.root_path().join("unsafe"))
        .expect("source directory should be created");
    std::os::unix::fs::symlink(&outside, repo.root_path().join("unsafe/link"))
        .expect("unsafe symlink should be created");

    treeboot()
        .args(["copy", "unsafe"])
        .current_dir(repo.worktree_path())
        .assert()
        .code(1)
        .stderr(predicate::str::contains("invalid copy file operation"))
        .stderr(predicate::str::contains("unsafe symlink"));

    assert!(!repo.worktree_path().join("unsafe").exists());
}

#[test]
fn manual_commands_should_fail_on_invalid_config_before_side_effects() {
    let repo = git_worktree();
    write_file(&repo.root_path().join(".env"), "TOKEN=1\n");
    write_file(
        &repo.worktree_path().join(".treeboot.toml"),
        "invalid = [\n",
    );

    treeboot()
        .args(["copy", ".env"])
        .current_dir(repo.worktree_path())
        .assert()
        .code(1)
        .stderr(predicate::str::contains("invalid config"));

    assert!(!repo.worktree_path().join(".env").exists());
}

#[test]
fn manual_commands_should_use_config_runtime_policy() {
    let repo = git_worktree();
    let outside = repo
        .root_path()
        .parent()
        .expect("root should have parent")
        .join("outside.env");
    write_file(&outside, "TOKEN=1\n");
    write_file(
        &repo.worktree_path().join(".treeboot.toml"),
        "dangerously_allow_sources_outside_root = true\n",
    );

    treeboot()
        .args(["copy", "--target", "copied.env", "../outside.env"])
        .current_dir(repo.worktree_path())
        .assert()
        .success()
        .stdout(predicate::str::contains(
            "treeboot: copy ../outside.env -> copied.env",
        ));

    assert_eq!(
        std::fs::read_to_string(repo.worktree_path().join("copied.env"))
            .expect("outside source should be copied"),
        "TOKEN=1\n"
    );
}

#[test]
fn manual_commands_should_reject_targets_outside_worktree_by_default() {
    let repo = git_worktree();
    let outside = repo
        .worktree_path()
        .parent()
        .expect("worktree should have parent")
        .join("outside-target.env");
    write_file(&repo.root_path().join(".env"), "TOKEN=1\n");

    treeboot()
        .args([
            OsStr::new("copy"),
            OsStr::new("--target"),
            outside.as_os_str(),
            OsStr::new(".env"),
        ])
        .current_dir(repo.worktree_path())
        .assert()
        .code(1)
        .stderr(predicate::str::contains("invalid copy file operation"))
        .stderr(predicate::str::contains("target resolves outside worktree"));

    assert!(!outside.exists());
}

#[test]
fn manual_commands_should_allow_configured_targets_outside_worktree() {
    let repo = git_worktree();
    let outside = repo
        .worktree_path()
        .parent()
        .expect("worktree should have parent")
        .join("outside-target.env");
    write_file(&repo.root_path().join(".env"), "TOKEN=1\n");
    write_file(
        &repo.worktree_path().join(".treeboot.toml"),
        "dangerously_allow_targets_outside_worktree = true\n",
    );

    treeboot()
        .args([
            OsStr::new("copy"),
            OsStr::new("--target"),
            outside.as_os_str(),
            OsStr::new(".env"),
        ])
        .current_dir(repo.worktree_path())
        .assert()
        .success()
        .stdout(predicate::str::contains("treeboot: copy .env ->"));

    assert_eq!(
        std::fs::read_to_string(&outside).expect("outside target should be copied"),
        "TOKEN=1\n"
    );
}

#[test]
fn manual_config_strict_should_reject_sync_before_side_effects() {
    let repo = git_worktree();
    std::fs::create_dir_all(repo.root_path().join("shared"))
        .expect("source directory should be created");
    write_file(&repo.root_path().join("shared/config"), "value\n");
    write_file(
        &repo.worktree_path().join(".treeboot.toml"),
        "strict = true\n",
    );

    treeboot()
        .args(["sync", "shared"])
        .current_dir(repo.worktree_path())
        .assert()
        .code(1)
        .stderr(predicate::str::contains("invalid sync file operation"))
        .stderr(predicate::str::contains("cannot be used with sync"));

    assert!(!repo.worktree_path().join("shared").exists());
}

#[test]
fn manual_env_false_should_override_config_strict() {
    let repo = git_worktree();
    std::fs::create_dir_all(repo.root_path().join("shared"))
        .expect("source directory should be created");
    write_file(&repo.root_path().join("shared/config"), "value\n");
    write_file(
        &repo.worktree_path().join(".treeboot.toml"),
        "strict = true\n",
    );

    treeboot()
        .args(["sync", "shared"])
        .env("TREEBOOT_STRICT", "false")
        .current_dir(repo.worktree_path())
        .assert()
        .success()
        .stderr(predicate::str::contains("invalid sync file operation").not());

    assert_eq!(
        std::fs::read_to_string(repo.worktree_path().join("shared/config"))
            .expect("synced file should be readable"),
        "value\n"
    );
}

#[test]
fn manual_cli_strict_should_override_env_and_config_false() {
    let repo = git_worktree();
    std::fs::create_dir_all(repo.root_path().join("shared"))
        .expect("source directory should be created");
    write_file(&repo.root_path().join("shared/config"), "value\n");
    write_file(
        &repo.worktree_path().join(".treeboot.toml"),
        "strict = false\n",
    );

    treeboot()
        .args(["sync", "--strict", "shared"])
        .env("TREEBOOT_STRICT", "false")
        .current_dir(repo.worktree_path())
        .assert()
        .code(1)
        .stderr(predicate::str::contains("invalid sync file operation"))
        .stderr(predicate::str::contains("cannot be used with sync"));

    assert!(!repo.worktree_path().join("shared").exists());
}

#[cfg(unix)]
#[test]
fn manual_commands_should_ignore_executable_init_script() {
    let repo = git_worktree();
    let marker = repo.worktree_path().join("script.out");
    write_file(&repo.root_path().join(".env"), "TOKEN=1\n");
    write_executable_script(
        &repo.worktree_path().join(".treeboot.sh"),
        &format!("#!/bin/sh\nprintf 'ran\\n' > {}\n", marker.display()),
    );

    treeboot()
        .args(["copy", ".env"])
        .current_dir(repo.worktree_path())
        .assert()
        .success()
        .stdout(predicate::str::contains("treeboot: run").not());

    assert!(!marker.exists());
    assert!(repo.worktree_path().join(".env").is_file());
}

#[test]
fn dynamic_completion_should_list_root_relative_sources() {
    let repo = git_worktree();
    write_file(&repo.root_path().join(".env"), "TOKEN=1\n");
    write_file(
        &repo.worktree_path().join(".treeboot.toml"),
        "invalid = [\n",
    );
    std::fs::create_dir_all(repo.root_path().join("shared"))
        .expect("source directory should be created");

    for shell in COMPLETION_SHELLS {
        complete_source_candidates(shell, ["treeboot", "copy", ""], repo.worktree_path())
            .success()
            .stdout(predicate::str::contains(".env"))
            .stdout(predicate::str::contains("shared"));
    }
}

#[test]
fn dynamic_completion_should_use_root_option_for_sources() {
    let repo = git_worktree();
    let root = tempfile::TempDir::new().expect("override root should be created");
    write_file(&root.path().join("override.env"), "TOKEN=1\n");
    write_file(&repo.root_path().join("default.env"), "TOKEN=1\n");

    for shell in COMPLETION_SHELLS {
        complete_source_candidates(
            shell,
            [
                OsStr::new("treeboot"),
                OsStr::new("copy"),
                OsStr::new("--root"),
                root.path().as_os_str(),
                OsStr::new(""),
            ],
            repo.worktree_path(),
        )
        .success()
        .stdout(predicate::str::contains("override.env"))
        .stdout(predicate::str::contains("default.env").not());
    }
}

#[test]
fn dynamic_completion_should_use_root_equals_option_for_sources() {
    let repo = git_worktree();
    let root = tempfile::TempDir::new().expect("override root should be created");
    write_file(&root.path().join("override.env"), "TOKEN=1\n");
    write_file(&repo.root_path().join("default.env"), "TOKEN=1\n");

    for shell in COMPLETION_SHELLS {
        complete_source_candidates(
            shell,
            [
                OsString::from("treeboot"),
                OsString::from("copy"),
                OsString::from(format!("--root={}", root.path().display())),
                OsString::new(),
            ],
            repo.worktree_path(),
        )
        .success()
        .stdout(predicate::str::contains("override.env"))
        .stdout(predicate::str::contains("default.env").not());
    }
}