]> git.ipfire.org Git - thirdparty/git.git/blame - t/t2202-add-addremove.sh
Merge branch 'en/fetch-negotiation-default-fix'
[thirdparty/git.git] / t / t2202-add-addremove.sh
CommitLineData
340ce9e2
JH
1#!/bin/sh
2
3test_description='git add --all'
4
aecb85bd 5TEST_PASSES_SANITIZE_LEAK=true
340ce9e2
JH
6. ./test-lib.sh
7
8test_expect_success setup '
9 (
2c2d0f9f 10 echo .gitignore &&
340ce9e2
JH
11 echo will-remove
12 ) >expect &&
13 (
2c2d0f9f
ES
14 echo actual &&
15 echo expect &&
340ce9e2
JH
16 echo ignored
17 ) >.gitignore &&
29abb339 18 git --literal-pathspecs add --all &&
340ce9e2
JH
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
27test_expect_success 'git add --all' '
28 (
2c2d0f9f
ES
29 echo .gitignore &&
30 echo not-ignored &&
31 echo "M .gitignore" &&
32 echo "A not-ignored" &&
340ce9e2
JH
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
76b62358
JH
46test_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 &&
d3c6751b 52 test_must_be_empty actual
76b62358
JH
53'
54
340ce9e2 55test_done