summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-04-20 04:11:29 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-04-20 04:11:29 (GMT)
commit3642617ee7359eed5e108fea48981841591142bf (patch)
tree79cc1c5fab5efa38ddd4a1fdfbb9e02f16d4ed78 /t
parentd52301630f05c95a9bd0205bc36289ce8bab9211 (diff)
parente5e4a7f23d7df0ec04b6423a90c9b858082a74af (diff)
downloadgit-3642617ee7359eed5e108fea48981841591142bf.zip
git-3642617ee7359eed5e108fea48981841591142bf.tar.gz
git-3642617ee7359eed5e108fea48981841591142bf.tar.bz2
Merge branch 'py/submodule'
* py/submodule: builtin-status: Add tests for submodule summary builtin-status: submodule summary support git-submodule summary: --for-status option
Diffstat (limited to 't')
-rwxr-xr-xt/t7401-submodule-summary.sh13
-rwxr-xr-xt/t7502-status.sh134
2 files changed, 147 insertions, 0 deletions
diff --git a/t/t7401-submodule-summary.sh b/t/t7401-submodule-summary.sh
index b9a2219..bf12dbd 100755
--- a/t/t7401-submodule-summary.sh
+++ b/t/t7401-submodule-summary.sh
@@ -192,4 +192,17 @@ test_expect_success 'given commit' "
EOF
"
+test_expect_success '--for-status' "
+ git submodule summary --for-status HEAD^ >actual &&
+ test_cmp actual - <<EOF
+# Modified submodules:
+#
+# * sm1 $head6...0000000:
+#
+# * sm2 0000000...$head7 (2):
+# > Add foo9
+#
+EOF
+"
+
test_done
diff --git a/t/t7502-status.sh b/t/t7502-status.sh
index cd08516..e4bfcae 100755
--- a/t/t7502-status.sh
+++ b/t/t7502-status.sh
@@ -149,4 +149,138 @@ 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 <<EOF
+# On branch master
+# Changes to be committed:
+# (use "git reset HEAD <file>..." to unstage)
+#
+# new file: dir2/added
+# new file: sm
+#
+# Changed but not updated:
+# (use "git add <file>..." to update what will be committed)
+#
+# modified: dir1/modified
+#
+# Untracked files:
+# (use "git add <file>..." 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
+'
+
+head=$(cd sm && git rev-parse --short=7 --verify HEAD)
+
+cat >expect <<EOF
+# On branch master
+# Changes to be committed:
+# (use "git reset HEAD <file>..." to unstage)
+#
+# new file: dir2/added
+# new file: sm
+#
+# Changed but not updated:
+# (use "git add <file>..." to update what will be committed)
+#
+# modified: dir1/modified
+#
+# Modified submodules:
+#
+# * sm 0000000...$head (1):
+# > Add foo
+#
+# Untracked files:
+# (use "git add <file>..." 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 <<EOF
+# On branch master
+# Changed but not updated:
+# (use "git add <file>..." to update what will be committed)
+#
+# modified: dir1/modified
+#
+# Untracked files:
+# (use "git add <file>..." 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 <<EOF
+# On branch master
+# Changes to be committed:
+# (use "git reset HEAD^1 <file>..." to unstage)
+#
+# new file: dir2/added
+# new file: sm
+#
+# Changed but not updated:
+# (use "git add <file>..." to update what will be committed)
+#
+# modified: dir1/modified
+#
+# Modified submodules:
+#
+# * sm 0000000...$head (1):
+# > Add foo
+#
+# Untracked files:
+# (use "git add <file>..." 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