Skip to content

validate-family.py (family root): gitmodules-path-unnamed reads only the work tree's .gitmodules, so where that file is gone, a section the index still holds passes the gate and is committed #1036

Closed

Description

@brettheap

(lane openRepoShape-4, 2026-10-20T05:13:21Z)

gitmodules-path-unnamed reads its sections from the work tree's .gitmodules alone, so where that file is gone, a section the index still holds is never named. A hand mount's printed lines then all exit 0 and the gate passes, but the next commit records the section, and a clone of that commit fails the gate.

This is RV1025's SHOULD 1 in its review of #1025 (#936), issuecomment-6280865402. I measured it again on #1025's round-1 work, now pushed as 4c0c52d0. It is not a regression from #1025: in this state main printed git rm -- members/IRQS, which exits 1.

The state

The holder is the family fixture from tests/test_family.py, with members IRRS and IRSS and the spare IRQS. Git is 2.43.0.

  1. git submodule add <IRSS's remote> members/IRQS, not committed. The index now holds the gitlink, and the index's .gitmodules holds [submodule "members/IRQS"] with its path and url.
  2. The work tree's .gitmodules is deleted. The deletion is not staged.

What happens

  • The gate prints one finding in every mode, member-gitlink-unnamed for members/IRQS. Its lines are the switch line, git rm --cached -f -- members/IRQS and family.py add. Its text says "HEAD records nothing there, so nothing of it is left to commit".
  • Typed in order, with the checkout at members/IRQS deleted by hand as the text says: every line exits 0, and the gate exits 0 in all three modes (no flag, --pins, --no-members).
  • But something is left. git status --porcelain is MD .gitmodules: the index's file still holds [submodule "members/IRQS"], which the git submodule add staged. The next commit records it.
  • With the index's file back on disk (git checkout -- .gitmodules, which is what a clone of that commit has), the gate finds gitmodules-path-unnamed for members/IRQS in all three modes, exit 1.

Why

In templates/family-root/scripts/validate-family.py, at #1025's head 4c0c52d0:

  • _gitmodules_listed returns nothing where the work tree's file is gone (:1883-1884).
  • _check_members reads its sections through it (:4039, sections = _gitmodules_sections(root)), and gitmodules-path-unnamed is checked from those sections.

So no section is seen, and nothing prints the --unset-all lines or a put-back that would take members/IRQS's section out of the index's file.

What it should do

Where the work tree's .gitmodules is gone, gitmodules-path-unnamed should read the sections from the file git reads in its place: the index's, then HEAD's. _given_as_git_reads has done that for _check_gitlinks_elsewhere and the hand mount's put-back since rv882's SHOULD 2 on #882. Then either:

  • the section's finding prints its lines against that file put back first, through _file_put_back; or
  • the hand mount's text puts the file back before its git rm --cached.

Either way, nothing of the section is left to commit.

Verify: in the state above, type every printed git line in order, delete the checkout at members/IRQS as the text says, and commit what is staged. Then git show HEAD:.gitmodules gives no members/IRQS, and the gate passes in all three modes, both as left and after git checkout -- .gitmodules. Also, a row typing this state passes on the fix and fails on #1025's head.

Lane: openreposhape-4 (openRepoShape-4)

Activity

  1. brettheap commented on Oct 20, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-4, session 11c6c0ef-495a-4a05-94cf-811b7b0a1012@Eagle, 2026-10-20T10:37:05Z, for #1036

    Logged in lanes/log/openRepoShape-4.md at e3e5783741ee38f7bc61f422f7f122c00f57bf90.

    The three reads (lane-collision-protocol Rule 1):

    1. existing `CLAIMED —` comments on opensoft/openRepoShape#1036:
       none
    2. `gh pr list --repo opensoft/openRepoShape --state all --search "#1036"`, kept where the row or its body names `#1036`:
    1025	validate-family.py: a hand mount's `git rm` line works typed: `git rm --cached` where a plain one refuses a staged gitlink, dies on a clone no section names or refuses what is no checkout, with what it leaves said, and a `.gitmodules` gone from the work tree put back before the `git rm` that takes a section out (#936)	fix/936-hand-mount-git-rm-lines	OPEN
    3. `git ls-remote --heads git@github.com:opensoft/openRepoShape` branches naming `1036` as a whole token:
       none
    
  2. added this to the v1.2.0 milestone on Oct 20, 2026
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions