diff options
author | Sangeeta Jain <sangunb09@gmail.com> | 2020-11-10 14:09:00 +0530 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-12-08 14:27:35 -0800 |
commit | 8ef93124645f89c45c9ec3edd3b268b38154061a (patch) | |
tree | 6b5f8460317e3fa87f4b3ddd68541ff8f1ef656b /t/t4060-diff-submodule-option-diff-format.sh | |
parent | Sync with Git 2.29.1 (diff) | |
download | tgif-8ef93124645f89c45c9ec3edd3b268b38154061a.tar.xz |
diff: do not show submodule with untracked files as "-dirty"
Git diff reports a submodule directory as -dirty even when there are
only untracked files in the submodule directory. This is inconsistent
with what `git describe --dirty` says when run in the submodule
directory in that state.
Make `--ignore-submodules=untracked` the default for `git diff` when
there is no configuration variable or command line option, so that the
command would not give '-dirty' suffix to a submodule whose working
tree has untracked files, to make it consistent with `git
describe --dirty` that is run in the submodule working tree.
And also make `--ignore-submodules=none` the default for `git status`
so that the user doesn't end up deleting a submodule that has
uncommitted (untracked) files.
Signed-off-by: Sangeeta Jain <sangunb09@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4060-diff-submodule-option-diff-format.sh')
-rwxr-xr-x | t/t4060-diff-submodule-option-diff-format.sh | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/t/t4060-diff-submodule-option-diff-format.sh b/t/t4060-diff-submodule-option-diff-format.sh index fc8229c726..dc7b242697 100755 --- a/t/t4060-diff-submodule-option-diff-format.sh +++ b/t/t4060-diff-submodule-option-diff-format.sh @@ -409,7 +409,7 @@ test_expect_success 'submodule is up to date' ' test_expect_success 'submodule contains untracked content' ' echo new > sm1/new-file && - git diff-index -p --submodule=diff HEAD >actual && + git diff-index -p --ignore-submodules=none --submodule=diff HEAD >actual && cat >expected <<-EOF && Submodule sm1 contains untracked content EOF @@ -417,7 +417,7 @@ test_expect_success 'submodule contains untracked content' ' ' test_expect_success 'submodule contains untracked content (untracked ignored)' ' - git diff-index -p --ignore-submodules=untracked --submodule=diff HEAD >actual && + git diff-index -p --submodule=diff HEAD >actual && test_must_be_empty actual ' @@ -433,7 +433,7 @@ test_expect_success 'submodule contains untracked content (all ignored)' ' test_expect_success 'submodule contains untracked and modified content' ' echo new > sm1/foo6 && - git diff-index -p --submodule=diff HEAD >actual && + git diff-index -p --ignore-submodules=none --submodule=diff HEAD >actual && cat >expected <<-EOF && Submodule sm1 contains untracked content Submodule sm1 contains modified content @@ -451,7 +451,7 @@ test_expect_success 'submodule contains untracked and modified content' ' # NOT OK test_expect_success 'submodule contains untracked and modified content (untracked ignored)' ' echo new > sm1/foo6 && - git diff-index -p --ignore-submodules=untracked --submodule=diff HEAD >actual && + git diff-index -p --submodule=diff HEAD >actual && cat >expected <<-EOF && Submodule sm1 contains modified content diff --git a/sm1/foo6 b/sm1/foo6 @@ -512,7 +512,7 @@ test_expect_success 'submodule is modified' ' test_expect_success 'modified submodule contains untracked content' ' echo new > sm1/new-file && - git diff-index -p --submodule=diff HEAD >actual && + git diff-index -p --ignore-submodules=none --submodule=diff HEAD >actual && cat >expected <<-EOF && Submodule sm1 contains untracked content Submodule sm1 $head7..$head8: @@ -528,7 +528,7 @@ test_expect_success 'modified submodule contains untracked content' ' ' test_expect_success 'modified submodule contains untracked content (untracked ignored)' ' - git diff-index -p --ignore-submodules=untracked --submodule=diff HEAD >actual && + git diff-index -p --submodule=diff HEAD >actual && cat >expected <<-EOF && Submodule sm1 $head7..$head8: diff --git a/sm1/foo6 b/sm1/foo6 @@ -564,7 +564,7 @@ test_expect_success 'modified submodule contains untracked content (all ignored) test_expect_success 'modified submodule contains untracked and modified content' ' echo modification >> sm1/foo6 && - git diff-index -p --submodule=diff HEAD >actual && + git diff-index -p --ignore-submodules=none --submodule=diff HEAD >actual && cat >expected <<-EOF && Submodule sm1 contains untracked content Submodule sm1 contains modified content @@ -583,7 +583,7 @@ test_expect_success 'modified submodule contains untracked and modified content' test_expect_success 'modified submodule contains untracked and modified content (untracked ignored)' ' echo modification >> sm1/foo6 && - git diff-index -p --ignore-submodules=untracked --submodule=diff HEAD >actual && + git diff-index -p --submodule=diff HEAD >actual && cat >expected <<-EOF && Submodule sm1 contains modified content Submodule sm1 $head7..$head8: |