Git panel shows empty diffs and Discard fails when the project is a subfolder of a repository
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 64/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- git, typescript
Research direction
Start in src/main/panels/git.ts and trace how diff, discard, ownPath, and countLines handle paths from git status --porcelain. Check the existing tests and add coverage for a project in a repository subfolder, including tracked and untracked files. Done means diffs, discard, line counts, and commit scope work correctly for that project without including sibling-package files.
Written by the indexing model from the issue text.
Description
Found in the 2026-10-07 code review and confirmed with git in a scratch repository.
Problem
git status --porcelain paths are relative to the repository root. src/main/panels/git.ts (diff, discard, ownPath, countLines) treats them as relative to the project folder. isRepo() accepts an enclosing repository, and #132 supports projects inside another repo on purpose. In repo/pkg, status lists pkg/f.txt. git diff HEAD -- :(literal)pkg/f.txt prints nothing, and git checkout HEAD -- :(literal)pkg/f.txt fails with "pathspec did not match".
Impact
In a monorepo package:
- Selecting a file shows "No textual changes".
- Discard fails for tracked files, and silently does nothing for untracked ones (it resolves
pkg/pkg/new.txt). - Discard All aborts partway through.
- Untracked files get no line counts.
- Files from sibling packages are listed, and Commit includes them.
Fix
Run path operations with -C <toplevel> and :(top,literal) pathspecs, mapping paths through git rev-parse --show-prefix. Or limit status to the project (git status -- .). Add tests that use a project in a subfolder of a repo.
- Dominant language
- TypeScript
- Stars
- 2
- Forks
- 2
- Avg merge
- 5h 28m
- Merged PRs (30d)
- 24
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PierrunoYT/patch
-
enhancement platform: windows priority: low severity: low
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
PierrunoYT/patch#198 ·
Maintainers usually reply within 1 day
-
priority: medium security severity: low
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
PierrunoYT/patch#66 ·
Maintainers usually reply within 1 day
-
bug platform: macos priority: low severity: low tests
Difficulty 3/5 1-2 days Newbie friendliness 56/100
PierrunoYT/patch#218 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement priority: low security severity: low
Difficulty 4/5 3-5 days Newbie friendliness 55/100
PierrunoYT/patch#211 · 2 comments ·
Maintainers usually reply within 1 day
-
enhancement platform: windows priority: low security severity: low
Difficulty 4/5 3-5 days Newbie friendliness 55/100
PierrunoYT/patch#207 ·
Maintainers usually reply within 1 day
All issues in PierrunoYT/patch
Similar issues
-
Flaky: mongodb-memory-server 'Port already in use' when another process starts a mongod concurrentlyOpenarea:testing bug effort:S priority:P2
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
lens:agent lens:process process
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
thebristolsound/birdbrain#1772 ·
Maintainers usually reply within 1 day
-
bug priority:low ready-for-dev
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Automattic/data-liberation-agent#685 ·
Maintainers usually reply within 1 day
-
Business
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day