Skip to content

Commit 9ccdace

Browse files
OneDeuxTriSeiGogitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ed6db0e commit 9ccdace

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

t/t2400-worktree-add.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,13 @@ test_expect_success 'add --quiet' '
334334
test_must_be_empty actual
335335
'
336336

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+
337344
test_expect_success 'local clone from linked checkout' '
338345
git clone --local here here-clone &&
339346
( cd here-clone && git fsck )
@@ -532,6 +539,35 @@ test_expect_success 'git worktree add --guess-remote sets up tracking' '
532539
test_cmp_rev refs/remotes/repo_a/foo refs/heads/foo
533540
)
534541
'
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+
'
535571

536572
test_expect_success 'git worktree add with worktree.guessRemote sets up tracking' '
537573
test_when_finished rm -rf repo_a repo_b foo &&

0 commit comments

Comments
 (0)