Merge branch 'ml/doc-merge-updates' into maint-2.43
[alt-git.git] / t / t2202-add-addremove.sh
blob24c60bfd7905ba136ad59f090b40fe23a37d0a1e
1 #!/bin/sh
3 test_description='git add --all'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success setup '
10 echo .gitignore &&
11 echo will-remove
12 ) >expect &&
14 echo actual &&
15 echo expect &&
16 echo ignored
17 ) >.gitignore &&
18 git --literal-pathspecs add --all &&
19 >will-remove &&
20 git add --all &&
21 test_tick &&
22 git commit -m initial &&
23 git ls-files >actual &&
24 test_cmp expect actual
27 test_expect_success 'git add --all' '
29 echo .gitignore &&
30 echo not-ignored &&
31 echo "M .gitignore" &&
32 echo "A not-ignored" &&
33 echo "D will-remove"
34 ) >expect &&
35 >ignored &&
36 >not-ignored &&
37 echo modification >>.gitignore &&
38 rm -f will-remove &&
39 git add --all &&
40 git update-index --refresh &&
41 git ls-files >actual &&
42 git diff-index --name-status --cached HEAD >>actual &&
43 test_cmp expect actual
46 test_expect_success 'Just "git add" is a no-op' '
47 git reset --hard &&
48 echo >will-remove &&
49 >will-not-be-added &&
50 git add &&
51 git diff-index --name-status --cached HEAD >actual &&
52 test_must_be_empty actual
55 test_done