X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft7502-status.sh;h=38a48b57c70a888838cfa114be843e1d4aea00d8;hb=0f639abb68b29f6d4cd9b89ecfb66e41136dcfa3;hp=cd08516e6de6b5c4b39ffee14302d76c99229825;hpb=53b22a9e45161004ff3260782abc4ee2a5b3e730;p=git.git diff --git a/t/t7502-status.sh b/t/t7502-status.sh index cd08516e6..93f875f50 100755 --- a/t/t7502-status.sh +++ b/t/t7502-status.sh @@ -3,7 +3,7 @@ # Copyright (c) 2007 Johannes E. Schindelin # -test_description='git-status' +test_description='git status' . ./test-lib.sh @@ -46,6 +46,7 @@ cat > expect << \EOF # # Changed but not updated: # (use "git add ..." to update what will be committed) +# (use "git checkout -- ..." to discard changes in working directory) # # modified: dir1/modified # @@ -63,8 +64,109 @@ EOF test_expect_success 'status (2)' ' git status > output && - git diff expect output + test_cmp expect output + +' + +cat >expect <..." to unstage) +# +# new file: dir2/added +# +# Changed but not updated: +# (use "git add ..." to update what will be committed) +# (use "git checkout -- ..." to discard changes in working directory) +# +# modified: dir1/modified +# +# Untracked files not listed (use -u option to show untracked files) +EOF +test_expect_success 'status -uno' ' + mkdir dir3 && + : > dir3/untracked1 && + : > dir3/untracked2 && + git status -uno >output && + test_cmp expect output +' + +test_expect_success 'status (status.showUntrackedFiles no)' ' + git config status.showuntrackedfiles no + git status >output && + test_cmp expect output +' + +cat >expect <..." to unstage) +# +# new file: dir2/added +# +# Changed but not updated: +# (use "git add ..." to update what will be committed) +# (use "git checkout -- ..." to discard changes in working directory) +# +# modified: dir1/modified +# +# Untracked files: +# (use "git add ..." to include in what will be committed) +# +# dir1/untracked +# dir2/modified +# dir2/untracked +# dir3/ +# expect +# output +# untracked +EOF +test_expect_success 'status -unormal' ' + git status -unormal >output && + test_cmp expect output +' +test_expect_success 'status (status.showUntrackedFiles normal)' ' + git config status.showuntrackedfiles normal + git status >output && + test_cmp expect output +' + +cat >expect <..." to unstage) +# +# new file: dir2/added +# +# Changed but not updated: +# (use "git add ..." to update what will be committed) +# (use "git checkout -- ..." to discard changes in working directory) +# +# modified: dir1/modified +# +# Untracked files: +# (use "git add ..." to include in what will be committed) +# +# dir1/untracked +# dir2/modified +# dir2/untracked +# dir3/untracked1 +# dir3/untracked2 +# expect +# output +# untracked +EOF +test_expect_success 'status -uall' ' + git status -uall >output && + test_cmp expect output +' +test_expect_success 'status (status.showUntrackedFiles all)' ' + git config status.showuntrackedfiles all + git status >output && + rm -rf dir3 && + git config --unset status.showuntrackedfiles && + test_cmp expect output ' cat > expect << \EOF @@ -76,6 +178,7 @@ cat > expect << \EOF # # Changed but not updated: # (use "git add ..." to update what will be committed) +# (use "git checkout -- ..." to discard changes in working directory) # # modified: modified # @@ -93,7 +196,7 @@ EOF test_expect_success 'status with relative paths' ' (cd dir1 && git status) > output && - git diff expect output + test_cmp expect output ' @@ -106,6 +209,7 @@ cat > expect << \EOF # # Changed but not updated: # (use "git add ..." to update what will be committed) +# (use "git checkout -- ..." to discard changes in working directory) # # modified: dir1/modified # @@ -124,7 +228,7 @@ test_expect_success 'status without relative paths' ' git config status.relativePaths false (cd dir1 && git status) > output && - git diff expect output + test_cmp expect output ' @@ -149,4 +253,148 @@ test_expect_success 'status of partial commit excluding new file in index' ' test_cmp expect output ' +test_expect_success 'setup status submodule summary' ' + test_create_repo sm && ( + cd sm && + >foo && + git add foo && + git commit -m "Add foo" + ) && + git add sm +' + +cat >expect <..." to unstage) +# +# new file: dir2/added +# new file: sm +# +# Changed but not updated: +# (use "git add ..." to update what will be committed) +# (use "git checkout -- ..." to discard changes in working directory) +# +# modified: dir1/modified +# +# Untracked files: +# (use "git add ..." to include in what will be committed) +# +# dir1/untracked +# dir2/modified +# dir2/untracked +# expect +# output +# untracked +EOF +test_expect_success 'status submodule summary is disabled by default' ' + git status >output && + test_cmp expect output +' + +# we expect the same as the previous test +test_expect_success 'status --untracked-files=all does not show submodule' ' + git status --untracked-files=all >output && + test_cmp expect output +' + +head=$(cd sm && git rev-parse --short=7 --verify HEAD) + +cat >expect <..." to unstage) +# +# new file: dir2/added +# new file: sm +# +# Changed but not updated: +# (use "git add ..." to update what will be committed) +# (use "git checkout -- ..." to discard changes in working directory) +# +# modified: dir1/modified +# +# Modified submodules: +# +# * sm 0000000...$head (1): +# > Add foo +# +# Untracked files: +# (use "git add ..." to include in what will be committed) +# +# dir1/untracked +# dir2/modified +# dir2/untracked +# expect +# output +# untracked +EOF +test_expect_success 'status submodule summary' ' + git config status.submodulesummary 10 && + git status >output && + test_cmp expect output +' + + +cat >expect <..." to update what will be committed) +# (use "git checkout -- ..." to discard changes in working directory) +# +# modified: dir1/modified +# +# Untracked files: +# (use "git add ..." to include in what will be committed) +# +# dir1/untracked +# dir2/modified +# dir2/untracked +# expect +# output +# untracked +no changes added to commit (use "git add" and/or "git commit -a") +EOF +test_expect_success 'status submodule summary (clean submodule)' ' + git commit -m "commit submodule" && + git config status.submodulesummary 10 && + test_must_fail git status >output && + test_cmp expect output +' + +cat >expect <..." to unstage) +# +# new file: dir2/added +# new file: sm +# +# Changed but not updated: +# (use "git add ..." to update what will be committed) +# (use "git checkout -- ..." to discard changes in working directory) +# +# modified: dir1/modified +# +# Modified submodules: +# +# * sm 0000000...$head (1): +# > Add foo +# +# Untracked files: +# (use "git add ..." to include in what will be committed) +# +# dir1/untracked +# dir2/modified +# dir2/untracked +# expect +# output +# untracked +EOF +test_expect_success 'status submodule summary (--amend)' ' + git config status.submodulesummary 10 && + git status --amend >output && + test_cmp expect output +' + test_done