Merge branch 'js/submodule-in-excluded'
authorJunio C Hamano <gitster@pobox.com>
Mon, 6 Nov 2017 04:11:26 +0000 (13:11 +0900)
committerJunio C Hamano <gitster@pobox.com>
Mon, 6 Nov 2017 04:11:26 +0000 (13:11 +0900)
"git status --ignored -u" did not stop at a working tree of a
separate project that is embedded in an ignored directory and
listed files in that other project, instead of just showing the
directory itself as ignored.

* js/submodule-in-excluded:
status: do not get confused by submodules in excluded directories

dir.c
t/t7061-wtstatus-ignore.sh
diff --git a/dir.c b/dir.c
index 1d17b800cf374d179d7cef3c6bbb180a5a1b4aba..9987011da57bcf171ba645788b8ccd2151561e5c 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -1392,7 +1392,7 @@ static enum path_treatment treat_directory(struct dir_struct *dir,
                if (!(dir->flags & DIR_NO_GITLINKS)) {
                        unsigned char sha1[20];
                        if (resolve_gitlink_ref(dirname, "HEAD", sha1) == 0)
-                               return path_untracked;
+                               return exclude ? path_excluded : path_untracked;
                }
                return path_recurse;
        }
index fc6013ba3c83aa7243f15595bc7b6ddd8b8f46dc..0c394cf995cbcf17b1ebd8f38e73a0740e3e00b7 100755 (executable)
@@ -272,4 +272,15 @@ test_expect_success 'status ignored tracked directory with uncommitted file in t
        test_cmp expected actual
 '
 
+cat >expected <<\EOF
+!! tracked/submodule/
+EOF
+
+test_expect_success 'status ignores submodule in excluded directory' '
+       git init tracked/submodule &&
+       test_commit -C tracked/submodule initial &&
+       git status --porcelain --ignored -u tracked/submodule >actual &&
+       test_cmp expected actual
+'
+
 test_done