Skip to content

"gix status --submodules all" falsely reports submodule as modified with empty dir #2490

@slhck

Description

@slhck

Current behavior 😯

gix status --submodules all reports a submodule as modified (M) when the submodule's working tree contains empty untracked directories. git status correctly reports clean.

Expected behavior 🤔

It should report those as clean.

This causes some false positives in tools that use gitoxide for status checks. Notably, Starship (which uses gitoxide) shows a [!] indicator in the prompt for repositories with such submodules containing empty untracked directories.

Git behavior

Reports them as clean. Git does not consider empty directories as untracked content because it tracks files, not directories. A directory containing no files (at any depth) has nothing to track and is not considered dirty.

Steps to reproduce 🕹

Using macOS and gix 0.52.0 (CLI) – also reproduced via Starship 1.24.2 which bundles gix.

mkdir /tmp/gix-bug && cd /tmp/gix-bug
git init sub-repo && cd sub-repo
echo "sub" > file.txt && git add file.txt && git commit -m "init"
cd .. && git init main-repo && cd main-repo
echo "main" > file.txt && git add file.txt && git commit -m "init"
git -c protocol.file.allow=always submodule add /tmp/gix-bug/sub-repo config
git commit -m "add submodule"
mkdir -p config/empty-dir/nested-empty

# git considers this clean
git status --short
git status --short --ignore-submodules=none

# gix reports the submodule as modified
gix status --submodules all
gix status --submodules ref-change
gix status --submodules modifications

# Inside the submodule, gix reports the empty dir as untracked
cd config
gix status
git status --short

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions