t2400: add tests to verify --quiet
Add tests to verify that the command performs operations the same with `--quiet` as without it. Additionally verifies that all non-fatal output is suppressed. Signed-off-by: Jacob Abel <jacobabel@nullpo.dev> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jacob Abel committed
May 17, 2023 at 21:48 UTC
9ccdace1e83d22f0f618926e97b659e503b5fd94
1 file changed
+36
t/t2400-worktree-add.sh
+36
@@ -334,6 +334,13 @@ test_expect_success 'add --quiet' '
334
test_must_be_empty actual
335
'
336
337
+test_expect_success 'add --quiet -b' '
338
+ test_when_finished "git branch -D quietnewbranch" &&
339
+ test_when_finished "git worktree remove -f -f another-worktree" &&
340
+ git worktree add --quiet -b quietnewbranch another-worktree 2>actual &&
341
+ test_must_be_empty actual
342
+'
343
+
344
test_expect_success 'local clone from linked checkout' '
345
git clone --local here here-clone &&
346
( cd here-clone && git fsck )
@@ -532,6 +539,35 @@ test_expect_success 'git worktree add --guess-remote sets up tracking' '
539
test_cmp_rev refs/remotes/repo_a/foo refs/heads/foo
540
)
541
'
542
+test_expect_success 'git worktree add --guess-remote sets up tracking (quiet)' '
543
+ test_when_finished rm -rf repo_a repo_b foo &&
544
+ setup_remote_repo repo_a repo_b &&
545
+ (
546
+ cd repo_b &&
547
+ git worktree add --quiet --guess-remote ../foo 2>actual &&
548
+ test_must_be_empty actual
549
+ ) &&
550
+ (
551
+ cd foo &&
552
+ test_branch_upstream foo repo_a foo &&
553
+ test_cmp_rev refs/remotes/repo_a/foo refs/heads/foo
554
+ )
555
+'
556
+
557
+test_expect_success 'git worktree --no-guess-remote (quiet)' '
558
+ test_when_finished rm -rf repo_a repo_b foo &&
559
+ setup_remote_repo repo_a repo_b &&
560
+ (
561
+ cd repo_b &&
562
+ git worktree add --quiet --no-guess-remote ../foo
563
+ ) &&
564
+ (
565
+ cd foo &&
566
+ test_must_fail git config "branch.foo.remote" &&
567
+ test_must_fail git config "branch.foo.merge" &&
568
+ test_cmp_rev ! refs/remotes/repo_a/foo refs/heads/foo
569
+ )
570
+'
571
572
test_expect_success 'git worktree add with worktree.guessRemote sets up tracking' '
573
test_when_finished rm -rf repo_a repo_b foo &&