Skip to content

Commit 340ce9e

Browse files
committed
git-add --all: tests
And here is a small test script that makes sure that: - both modified and new files are included, - removed file is noticed, and - no ignored file is included. Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 3ba1f11 commit 340ce9e

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

t/t2202-add-addremove.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/sh
2+
3+
test_description='git add --all'
4+
5+
. ./test-lib.sh
6+
7+
test_expect_success setup '
8+
(
9+
echo .gitignore
10+
echo will-remove
11+
) >expect &&
12+
(
13+
echo actual
14+
echo expect
15+
echo ignored
16+
) >.gitignore &&
17+
>will-remove &&
18+
git add --all &&
19+
test_tick &&
20+
git commit -m initial &&
21+
git ls-files >actual &&
22+
test_cmp expect actual
23+
'
24+
25+
test_expect_success 'git add --all' '
26+
(
27+
echo .gitignore
28+
echo not-ignored
29+
echo "M .gitignore"
30+
echo "A not-ignored"
31+
echo "D will-remove"
32+
) >expect &&
33+
>ignored &&
34+
>not-ignored &&
35+
echo modification >>.gitignore &&
36+
rm -f will-remove &&
37+
git add --all &&
38+
git update-index --refresh &&
39+
git ls-files >actual &&
40+
git diff-index --name-status --cached HEAD >>actual &&
41+
test_cmp expect actual
42+
'
43+
44+
test_done

0 commit comments

Comments
 (0)