]> git.ipfire.org Git - thirdparty/git.git/blob - t/t2202-add-addremove.sh
Merge branch 'jc/advice-sans-trailing-whitespace'
[thirdparty/git.git] / t / t2202-add-addremove.sh
1 #!/bin/sh
2
3 test_description='git add --all'
4
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7
8 test_expect_success setup '
9 (
10 echo .gitignore &&
11 echo will-remove
12 ) >expect &&
13 (
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
25 '
26
27 test_expect_success 'git add --all' '
28 (
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
44 '
45
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
53 '
54
55 test_done