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>
This commit is contained in:

committed by
Junio C Hamano

parent
2e673356ae
commit
8ef9312464
@ -93,6 +93,14 @@ test_expect_success 'git diff HEAD with dirty submodule (untracked)' '
|
||||
) &&
|
||||
git diff HEAD >actual &&
|
||||
sed -e "1,/^@@/d" actual >actual.body &&
|
||||
expect_from_to >expect.body $subtip $subprev &&
|
||||
test_cmp expect.body actual.body
|
||||
'
|
||||
|
||||
test_expect_success 'git diff HEAD with dirty submodule (untracked) (none ignored)' '
|
||||
test_config diff.ignoreSubmodules none &&
|
||||
git diff HEAD >actual &&
|
||||
sed -e "1,/^@@/d" actual >actual.body &&
|
||||
expect_from_to >expect.body $subtip $subprev-dirty &&
|
||||
test_cmp expect.body actual.body
|
||||
'
|
||||
@ -168,13 +176,13 @@ test_expect_success 'git diff HEAD with dirty submodule (untracked, refs match)'
|
||||
git clean -qfdx &&
|
||||
>cruft
|
||||
) &&
|
||||
git diff HEAD >actual &&
|
||||
git diff --ignore-submodules=none HEAD >actual &&
|
||||
sed -e "1,/^@@/d" actual >actual.body &&
|
||||
expect_from_to >expect.body $subprev $subprev-dirty &&
|
||||
test_cmp expect.body actual.body &&
|
||||
git diff --ignore-submodules=all HEAD >actual2 &&
|
||||
test_must_be_empty actual2 &&
|
||||
git diff --ignore-submodules=untracked HEAD >actual3 &&
|
||||
git diff HEAD >actual3 &&
|
||||
test_must_be_empty actual3 &&
|
||||
git diff --ignore-submodules=dirty HEAD >actual4 &&
|
||||
test_must_be_empty actual4
|
||||
|
Reference in New Issue
Block a user