mirror of
https://github.com/git/git.git
synced 2026-01-25 18:12:44 +00:00
status: do not get confused by submodules in excluded directories
We meticulously pass the `exclude` flag to the `treat_directory()` function so that we can indicate that files in it are excluded rather than untracked when recursing. But we did not yet treat submodules the same way. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
2
dir.c
2
dir.c
@@ -1362,7 +1362,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;
|
||||
}
|
||||
|
||||
@@ -271,4 +271,18 @@ 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 &&
|
||||
(
|
||||
cd tracked/submodule &&
|
||||
test_commit initial
|
||||
) &&
|
||||
git status --porcelain --ignored -u tracked/submodule >actual &&
|
||||
test_cmp expected actual
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
Reference in New Issue
Block a user