Skip to content

[BUG] Extension does not handle git worktrees correctly #65

@RasmusRendal

Description

@RasmusRendal

Describe the bug
When getting the .git/config, it assumes that it's in the work directory:

const gitConfig = Uri.file(`${pathToWorkspace}/.git/config`);

If somebody like me is a fan of worktrees, they won't have a .git folder in their workspace. Instead, .git will be a text file containing something like this:

gitdir: /home/rasmus/Projects/repo/main/.git/worktrees/branch

When running the codecov extension in a linked worktree, that has such a .git file in lieu of a directory, that will result in the following error:

 Error: ENOTDIR: not a directory, open '/home/rasmus/Projects/repo/branch/.git/config'

To Reproduce
Steps to reproduce the behavior:

  1. Clone a repository
  2. Run git worktree add -B branch ../branch
  3. Open ../branch in vscode with the codecov extension enabled

Expected behavior
The codecov extension should correctly resolve the git repository, and work as well in linked worktrees as in main worktrees.

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