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 --- wt-status.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'wt-status.c') diff --git a/wt-status.c b/wt-status.c index 7074bbdd53..c361d1d1e1 100644 --- a/wt-status.c +++ b/wt-status.c @@ -606,7 +606,9 @@ static void wt_status_collect_changes_worktree(struct wt_status *s) if (s->ignore_submodule_arg) { rev.diffopt.flags.override_submodule_config = 1; handle_ignore_submodules_arg(&rev.diffopt, s->ignore_submodule_arg); - } + } else if (!rev.diffopt.flags.ignore_submodule_set && + s->show_untracked_files != SHOW_NO_UNTRACKED_FILES) + handle_ignore_submodules_arg(&rev.diffopt, "none"); rev.diffopt.format_callback = wt_status_collect_changed_cb; rev.diffopt.format_callback_data = s; rev.diffopt.detect_rename = s->detect_rename >= 0 ? s->detect_rename : rev.diffopt.detect_rename; -- cgit v1.2.1