Problem
The job receives repository-relative source paths, but calculates each source directory with path.relative(rootDir, path.dirname(inputFile.path)). Node resolves the relative second argument against the process working directory. Running the CLI from a subdirectory therefore adds that subdirectory to generated patterns.
Reproduction
Create a repository with a .git directory, a pullup.config.ts using codeownersJob(), and a root CODEOWNERS file containing:
From the repository's a/ subdirectory, run:
Actual generated rule:
Expected behavior
The generated rule is /docs/ @docs regardless of the directory from which pullup is invoked.
Acceptance criteria
- Resolve each source path against the repository root before calculating its relative directory.
- Verify the output when invoked from the root and from a subdirectory.
- Cover an explicit
--root whose value differs from the process working directory.
Problem
The job receives repository-relative source paths, but calculates each source directory with
path.relative(rootDir, path.dirname(inputFile.path)). Node resolves the relative second argument against the process working directory. Running the CLI from a subdirectory therefore adds that subdirectory to generated patterns.Reproduction
Create a repository with a
.gitdirectory, apullup.config.tsusingcodeownersJob(), and a rootCODEOWNERSfile containing:From the repository's
a/subdirectory, run:Actual generated rule:
Expected behavior
The generated rule is
/docs/ @docsregardless of the directory from whichpullupis invoked.Acceptance criteria
--rootwhose value differs from the process working directory.