codecov / codecov/vscode

[BUG] Extension does not handle git worktrees correctly

Open
#65 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
13
Forks
6
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
When getting the .git/config, it assumes that it's in the work directory:
https://github.com/codecov/vscode/blob/f708fe89afd86c740e6c192996fdc9438cfe5613/src/coverage/coverage.ts#L140

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at src/coverage/coverage.ts around line 140 and reproduce the problem with the listed git worktree steps before opening the linked VS Code workspace. Done means the extension resolves the repository and reads its Git configuration successfully for both linked worktrees and main worktrees.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, typescript
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.