From 3bfc45047654c7dd38b32033321228e97fc8f60e Mon Sep 17 00:00:00 2001 From: Jens Lehmann Date: Sat, 13 Mar 2010 23:00:27 +0100 Subject: git status: ignoring untracked files must apply to submodules too Since 1.7.0 submodules are considered dirty when they contain untracked files. But when git status is called with the "-uno" option, the user asked to ignore untracked files, so they must be ignored in submodules too. To achieve this, the new flag DIFF_OPT_IGNORE_UNTRACKED_IN_SUBMODULES is introduced. Signed-off-by: Jens Lehmann Signed-off-by: Junio C Hamano --- submodule.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'submodule.c') diff --git a/submodule.c b/submodule.c index 714ca976b..b3b8bc147 100644 --- a/submodule.c +++ b/submodule.c @@ -130,7 +130,7 @@ void show_submodule_summary(FILE *f, const char *path, strbuf_release(&sb); } -unsigned is_submodule_modified(const char *path) +unsigned is_submodule_modified(const char *path, int ignore_untracked) { int i; ssize_t len; @@ -139,6 +139,7 @@ unsigned is_submodule_modified(const char *path) "status", "--porcelain", NULL, + NULL, }; const char *env[LOCAL_REPO_ENV_SIZE + 3]; struct strbuf buf = STRBUF_INIT; @@ -163,6 +164,9 @@ unsigned is_submodule_modified(const char *path) env[i++] = strbuf_detach(&buf, NULL); env[i] = NULL; + if (ignore_untracked) + argv[2] = "-uno"; + memset(&cp, 0, sizeof(cp)); cp.argv = argv; cp.env = env; @@ -181,7 +185,8 @@ unsigned is_submodule_modified(const char *path) break; } else { dirty_submodule |= DIRTY_SUBMODULE_MODIFIED; - if (dirty_submodule & DIRTY_SUBMODULE_UNTRACKED) + if (ignore_untracked || + (dirty_submodule & DIRTY_SUBMODULE_UNTRACKED)) break; } next_line = strchr(line, '\n'); -- cgit v1.2.1