Skip to content

bug: scoped scans fail inside Git hooks #1501

Description

@dergachoff

Problem

react-doctor webapp --scope changed can fail inside a Git hook:

ENOENT: no such file or directory, open '<repo>/webapp/ops/maintenance/index.html'

Git hooks export GIT_DIR. React Doctor passes it to nested Git commands, which then ignore the scoped cwd and return repository-root paths.

Expected

A scan scoped to webapp/ returns paths relative to webapp/ and ignores files outside it.

Fix

Clear GIT_DIR for nested Git commands while preserving GIT_INDEX_FILE and the rest of the environment.

I have a tested patch with a linked-worktree regression case.

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