Skip to content

Keep an Inherited GIT_DIR From Rerooting the Prose Gate's Subdirectory Git Reads #3821

Closed

Description

@ptr727

Defect: several of .github/actions/prose-gate/prose_lint.py's git reads run git -C <dir> with the inherited environment. These are tracked_paths, untracked_paths, shallow_checkout, and git_bytes. In a linked worktree, git hands a hook GIT_DIR. Under GIT_DIR with no GIT_WORK_TREE, git takes the directory a command starts in as the top level of the work tree.

Failure: take a run naming a subdirectory, for example prose_lint.py scripts --diff HEAD, from a hook in a linked worktree. Its git -C scripts ls-files and git -C scripts diff answer as though scripts/ were the repository root. Discovery and the diff keys then disagree with what the tree holds. A hook passing . or file paths does not reach it, because those reads then start at the top level.

Reproduce, constructed:

git init -q r && cd r && mkdir sub && printf 'x\n' > sub/a.md && git add -A
GIT_DIR="$PWD/.git" git -C sub rev-parse --show-toplevel   # prints .../r/sub, not .../r

The burndown/1657-staged-prose-hook change fixes the same class in repo_root(). It drops the GIT_LOCATION variables through a git_env() helper. Whether the other reads should drop them too needs thought about GIT_INDEX_FILE, which a hook sets for git commit <paths> and -a.

Found by the local review pass on that change.

Activity

  1. added
    pre-existing
    on Nov 2, 2026
  2. ptr727 commented on Nov 2, 2026

    @ptr727
    OwnerAuthor

    Released (2026-11-02): PR #3831 merged to develop and its branch is deleted, so this claim holds no files. The issue closes on promotion.

    Backlog burndown claim (away run 2026-11-02, round 3, group R3G1). Branch: burndown/3821-prose-gate-git-env. Issues: #3821.

    Predicted file set:

    • .github/actions/prose-gate/prose_lint.py
    • tests/test_prose_lint.py
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

    pre-existing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions