Skip to content

Commit

Permalink
status: do not get confused by submodules in excluded directories
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
dscho authored and Git for Windows Build Agent committed Oct 21, 2017
1 parent 6733a65 commit c682f96
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1393,7 +1393,7 @@ static enum path_treatment treat_directory(struct dir_struct *dir,
if (!(dir->flags & DIR_NO_GITLINKS)) {
struct object_id oid;
if (resolve_gitlink_ref(dirname, "HEAD", &oid) == 0)
return path_untracked;
return exclude ? path_excluded : path_untracked;
}
return path_recurse;
}
Expand Down
14 changes: 14 additions & 0 deletions t/t7061-wtstatus-ignore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -272,4 +272,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

0 comments on commit c682f96

Please sign in to comment.