summaryrefslogtreecommitdiff
path: root/t/t4027-diff-submodule.sh
diff options
context:
space:
mode:
authorJens Lehmann <Jens.Lehmann@web.de>2010-06-08 16:31:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-06-11 20:33:17 (GMT)
commitdd44d419d30afa52b863efa07aeec738c4531ea9 (patch)
tree4268bacc206a612a8d43e57da79ca5dd45dd3c73 /t/t4027-diff-submodule.sh
parentcf6aef803df93343e628e0c273a5d8f0d2f0fddb (diff)
downloadgit-dd44d419d30afa52b863efa07aeec738c4531ea9.zip
git-dd44d419d30afa52b863efa07aeec738c4531ea9.tar.gz
git-dd44d419d30afa52b863efa07aeec738c4531ea9.tar.bz2
Add optional parameters to the diff option "--ignore-submodules"
In some use cases it is not desirable that the diff family considers submodules that only contain untracked content as dirty. This may happen e.g. when the submodule is not under the developers control and not all build generated files have been added to .gitignore by the upstream developers. Using the "untracked" parameter for the "--ignore-submodules" option disables checking for untracked content and lets git diff report them as changed only when they have new commits or modified content. Sometimes it is not wanted to have submodules show up as changed when they just contain changes to their work tree. An example for that are scripts which just want to check for submodule commits while ignoring any changes to the work tree. Also users having large submodules known not to change might want to use this option, as the - sometimes substantial - time it takes to scan the submodule work tree(s) is saved. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4027-diff-submodule.sh')
-rwxr-xr-xt/t4027-diff-submodule.sh20
1 files changed, 17 insertions, 3 deletions
diff --git a/t/t4027-diff-submodule.sh b/t/t4027-diff-submodule.sh
index 83c1914..559b41e 100755
--- a/t/t4027-diff-submodule.sh
+++ b/t/t4027-diff-submodule.sh
@@ -103,9 +103,17 @@ test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match)'
git diff HEAD >actual &&
sed -e "1,/^@@/d" actual >actual.body &&
expect_from_to >expect.body $subprev $subprev-dirty &&
- test_cmp expect.body actual.body
+ test_cmp expect.body actual.body &&
+ git diff --ignore-submodules HEAD >actual2 &&
+ echo -n "" | test_cmp - actual2 &&
+ git diff --ignore-submodules=untracked HEAD >actual3 &&
+ sed -e "1,/^@@/d" actual3 >actual3.body &&
+ expect_from_to >expect.body $subprev $subprev-dirty &&
+ test_cmp expect.body actual3.body &&
+ git diff --ignore-submodules=dirty HEAD >actual4 &&
+ echo -n "" | test_cmp - actual4
'
-
+test_done
test_expect_success 'git diff HEAD with dirty submodule (index, refs match)' '
(
cd sub &&
@@ -129,7 +137,13 @@ test_expect_success 'git diff HEAD with dirty submodule (untracked, refs match)'
git diff HEAD >actual &&
sed -e "1,/^@@/d" actual >actual.body &&
expect_from_to >expect.body $subprev $subprev-dirty &&
- test_cmp expect.body actual.body
+ test_cmp expect.body actual.body &&
+ git diff --ignore-submodules=all HEAD >actual2 &&
+ echo -n "" | test_cmp - actual2 &&
+ git diff --ignore-submodules=untracked HEAD >actual3 &&
+ echo -n "" | test_cmp - actual3 &&
+ git diff --ignore-submodules=dirty HEAD >actual4 &&
+ echo -n "" | test_cmp - actual4
'
test_expect_success 'git diff (empty submodule dir)' '