Skip to content

Resolve CODEOWNERS source paths relative to the repository root #17

Description

@ho991217

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:

/docs/ @docs

From the repository's a/ subdirectory, run:

pullup sync

Actual generated rule:

/a/docs/ @docs

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.

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions