Skip to content

Updated submodules are ignored unless committed #16424

Description

@nightduck

Describe the bug

submodules that are checked out to a different commit don't register as "dirty" to nix, and get ignored in favor of whatever commit revision is recorded in the parent repo for that submodule

Steps To Reproduce

Have a clean repo with a submodule. Record its hash

user@machine $ nix eval --raw ".?submodules=1#workspace"
/nix/store/qnxr2a3hkhf83swqx7nxva9c267hngkq-workspace

Change the submodule, so workspace is dirty, but submodule is clean. Nix hash doesn't change

user@machine $ cd sub_repo
user@machine $ git checkout HEAD~1
Previous HEAD position was d572775 Random commit message
HEAD is now at b1352aa Another commit message
user@machine $ cd ..
user@machine $ git add sub_repo   # This line has no effect. You get the same result whether it's staged or not
user@machine $ nix eval --raw ".?submodules=1#workspace"
/nix/store/qnxr2a3hkhf83swqx7nxva9c267hngkq-workspace

Additionally, if you add tracked changes to the submodule, THEN it'll register as dirty and the evaluated hash will change

Expected behavior

If git says the tree is dirty, nix should treat it as dirty, including out-of-tree submodules.

Metadata

nix-env (Determinate Nix 3.21.5) 2.34.8

Additional context

None

Checklist


Add 👍 to issues you find important.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions