t7508-status.sh: Add tests for status -s
The new short status has been completely untested so far. Introduce tests by duplicating all tests which are present for the long format. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
482a6c1061
commit
14ed05ddd6
@ -68,6 +68,24 @@ test_expect_success 'status (2)' '
|
|||||||
|
|
||||||
'
|
'
|
||||||
|
|
||||||
|
cat > expect << \EOF
|
||||||
|
M dir1/modified
|
||||||
|
A dir2/added
|
||||||
|
?? dir1/untracked
|
||||||
|
?? dir2/modified
|
||||||
|
?? dir2/untracked
|
||||||
|
?? expect
|
||||||
|
?? output
|
||||||
|
?? untracked
|
||||||
|
EOF
|
||||||
|
|
||||||
|
test_expect_success 'status -s (2)' '
|
||||||
|
|
||||||
|
git status -s > output &&
|
||||||
|
test_cmp expect output
|
||||||
|
|
||||||
|
'
|
||||||
|
|
||||||
cat >expect <<EOF
|
cat >expect <<EOF
|
||||||
# On branch master
|
# On branch master
|
||||||
# Changes to be committed:
|
# Changes to be committed:
|
||||||
@ -97,6 +115,22 @@ test_expect_success 'status (status.showUntrackedFiles no)' '
|
|||||||
test_cmp expect output
|
test_cmp expect output
|
||||||
'
|
'
|
||||||
|
|
||||||
|
cat >expect << EOF
|
||||||
|
M dir1/modified
|
||||||
|
A dir2/added
|
||||||
|
EOF
|
||||||
|
test_expect_success 'status -s -uno' '
|
||||||
|
git config --unset status.showuntrackedfiles
|
||||||
|
git status -s -uno >output &&
|
||||||
|
test_cmp expect output
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'status -s (status.showUntrackedFiles no)' '
|
||||||
|
git config status.showuntrackedfiles no
|
||||||
|
git status -s >output &&
|
||||||
|
test_cmp expect output
|
||||||
|
'
|
||||||
|
|
||||||
cat >expect <<EOF
|
cat >expect <<EOF
|
||||||
# On branch master
|
# On branch master
|
||||||
# Changes to be committed:
|
# Changes to be committed:
|
||||||
@ -132,6 +166,29 @@ test_expect_success 'status (status.showUntrackedFiles normal)' '
|
|||||||
test_cmp expect output
|
test_cmp expect output
|
||||||
'
|
'
|
||||||
|
|
||||||
|
cat >expect <<EOF
|
||||||
|
M dir1/modified
|
||||||
|
A dir2/added
|
||||||
|
?? dir1/untracked
|
||||||
|
?? dir2/modified
|
||||||
|
?? dir2/untracked
|
||||||
|
?? dir3/
|
||||||
|
?? expect
|
||||||
|
?? output
|
||||||
|
?? untracked
|
||||||
|
EOF
|
||||||
|
test_expect_success 'status -s -unormal' '
|
||||||
|
git config --unset status.showuntrackedfiles
|
||||||
|
git status -s -unormal >output &&
|
||||||
|
test_cmp expect output
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'status -s (status.showUntrackedFiles normal)' '
|
||||||
|
git config status.showuntrackedfiles normal
|
||||||
|
git status -s >output &&
|
||||||
|
test_cmp expect output
|
||||||
|
'
|
||||||
|
|
||||||
cat >expect <<EOF
|
cat >expect <<EOF
|
||||||
# On branch master
|
# On branch master
|
||||||
# Changes to be committed:
|
# Changes to be committed:
|
||||||
@ -169,6 +226,29 @@ test_expect_success 'status (status.showUntrackedFiles all)' '
|
|||||||
test_cmp expect output
|
test_cmp expect output
|
||||||
'
|
'
|
||||||
|
|
||||||
|
cat >expect <<EOF
|
||||||
|
M dir1/modified
|
||||||
|
A dir2/added
|
||||||
|
?? dir1/untracked
|
||||||
|
?? dir2/modified
|
||||||
|
?? dir2/untracked
|
||||||
|
?? expect
|
||||||
|
?? output
|
||||||
|
?? untracked
|
||||||
|
EOF
|
||||||
|
test_expect_success 'status -s -uall' '
|
||||||
|
git config --unset status.showuntrackedfiles
|
||||||
|
git status -s -uall >output &&
|
||||||
|
test_cmp expect output
|
||||||
|
'
|
||||||
|
test_expect_success 'status -s (status.showUntrackedFiles all)' '
|
||||||
|
git config status.showuntrackedfiles all
|
||||||
|
git status -s >output &&
|
||||||
|
rm -rf dir3 &&
|
||||||
|
git config --unset status.showuntrackedfiles &&
|
||||||
|
test_cmp expect output
|
||||||
|
'
|
||||||
|
|
||||||
cat > expect << \EOF
|
cat > expect << \EOF
|
||||||
# On branch master
|
# On branch master
|
||||||
# Changes to be committed:
|
# Changes to be committed:
|
||||||
@ -200,6 +280,23 @@ test_expect_success 'status with relative paths' '
|
|||||||
|
|
||||||
'
|
'
|
||||||
|
|
||||||
|
cat > expect << \EOF
|
||||||
|
M modified
|
||||||
|
A ../dir2/added
|
||||||
|
?? untracked
|
||||||
|
?? ../dir2/modified
|
||||||
|
?? ../dir2/untracked
|
||||||
|
?? ../expect
|
||||||
|
?? ../output
|
||||||
|
?? ../untracked
|
||||||
|
EOF
|
||||||
|
test_expect_success 'status -s with relative paths' '
|
||||||
|
|
||||||
|
(cd dir1 && git status -s) > output &&
|
||||||
|
test_cmp expect output
|
||||||
|
|
||||||
|
'
|
||||||
|
|
||||||
cat > expect << \EOF
|
cat > expect << \EOF
|
||||||
# On branch master
|
# On branch master
|
||||||
# Changes to be committed:
|
# Changes to be committed:
|
||||||
@ -232,6 +329,24 @@ test_expect_success 'status without relative paths' '
|
|||||||
|
|
||||||
'
|
'
|
||||||
|
|
||||||
|
cat > expect << \EOF
|
||||||
|
M dir1/modified
|
||||||
|
A dir2/added
|
||||||
|
?? dir1/untracked
|
||||||
|
?? dir2/modified
|
||||||
|
?? dir2/untracked
|
||||||
|
?? expect
|
||||||
|
?? output
|
||||||
|
?? untracked
|
||||||
|
EOF
|
||||||
|
|
||||||
|
test_expect_success 'status -s without relative paths' '
|
||||||
|
|
||||||
|
(cd dir1 && git status -s) > output &&
|
||||||
|
test_cmp expect output
|
||||||
|
|
||||||
|
'
|
||||||
|
|
||||||
cat <<EOF >expect
|
cat <<EOF >expect
|
||||||
# On branch master
|
# On branch master
|
||||||
# Changes to be committed:
|
# Changes to be committed:
|
||||||
@ -298,6 +413,28 @@ test_expect_success 'status --untracked-files=all does not show submodule' '
|
|||||||
test_cmp expect output
|
test_cmp expect output
|
||||||
'
|
'
|
||||||
|
|
||||||
|
cat >expect <<EOF
|
||||||
|
M dir1/modified
|
||||||
|
A dir2/added
|
||||||
|
A sm
|
||||||
|
?? dir1/untracked
|
||||||
|
?? dir2/modified
|
||||||
|
?? dir2/untracked
|
||||||
|
?? expect
|
||||||
|
?? output
|
||||||
|
?? untracked
|
||||||
|
EOF
|
||||||
|
test_expect_success 'status -s submodule summary is disabled by default' '
|
||||||
|
git status -s >output &&
|
||||||
|
test_cmp expect output
|
||||||
|
'
|
||||||
|
|
||||||
|
# we expect the same as the previous test
|
||||||
|
test_expect_success 'status -s --untracked-files=all does not show submodule' '
|
||||||
|
git status -s --untracked-files=all >output &&
|
||||||
|
test_cmp expect output
|
||||||
|
'
|
||||||
|
|
||||||
head=$(cd sm && git rev-parse --short=7 --verify HEAD)
|
head=$(cd sm && git rev-parse --short=7 --verify HEAD)
|
||||||
|
|
||||||
cat >expect <<EOF
|
cat >expect <<EOF
|
||||||
@ -335,6 +472,21 @@ test_expect_success 'status submodule summary' '
|
|||||||
test_cmp expect output
|
test_cmp expect output
|
||||||
'
|
'
|
||||||
|
|
||||||
|
cat >expect <<EOF
|
||||||
|
M dir1/modified
|
||||||
|
A dir2/added
|
||||||
|
A sm
|
||||||
|
?? dir1/untracked
|
||||||
|
?? dir2/modified
|
||||||
|
?? dir2/untracked
|
||||||
|
?? expect
|
||||||
|
?? output
|
||||||
|
?? untracked
|
||||||
|
EOF
|
||||||
|
test_expect_success 'status -s submodule summary' '
|
||||||
|
git status -s >output &&
|
||||||
|
test_cmp expect output
|
||||||
|
'
|
||||||
|
|
||||||
cat >expect <<EOF
|
cat >expect <<EOF
|
||||||
# On branch master
|
# On branch master
|
||||||
@ -364,6 +516,20 @@ test_expect_success 'status submodule summary (clean submodule)' '
|
|||||||
test_cmp expect output
|
test_cmp expect output
|
||||||
'
|
'
|
||||||
|
|
||||||
|
cat >expect <<EOF
|
||||||
|
M dir1/modified
|
||||||
|
?? dir1/untracked
|
||||||
|
?? dir2/modified
|
||||||
|
?? dir2/untracked
|
||||||
|
?? expect
|
||||||
|
?? output
|
||||||
|
?? untracked
|
||||||
|
EOF
|
||||||
|
test_expect_success 'status -s submodule summary (clean submodule)' '
|
||||||
|
git status -s >output &&
|
||||||
|
test_cmp expect output
|
||||||
|
'
|
||||||
|
|
||||||
cat >expect <<EOF
|
cat >expect <<EOF
|
||||||
# On branch master
|
# On branch master
|
||||||
# Changes to be committed:
|
# Changes to be committed:
|
||||||
|
Loading…
Reference in New Issue
Block a user