From 8ef93124645f89c45c9ec3edd3b268b38154061a Mon Sep 17 00:00:00 2001 From: Sangeeta Jain Date: Tue, 10 Nov 2020 14:09:00 +0530 Subject: 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 Signed-off-by: Junio C Hamano --- submodule.c | 1 + 1 file changed, 1 insertion(+) (limited to 'submodule.c') diff --git a/submodule.c b/submodule.c index b3bb59f066..8f6227c993 100644 --- a/submodule.c +++ b/submodule.c @@ -420,6 +420,7 @@ const char *submodule_strategy_to_string(const struct submodule_update_strategy void handle_ignore_submodules_arg(struct diff_options *diffopt, const char *arg) { + diffopt->flags.ignore_submodule_set = 1; diffopt->flags.ignore_submodules = 0; diffopt->flags.ignore_untracked_in_submodules = 0; diffopt->flags.ignore_dirty_submodules = 0; -- cgit v1.2.3