Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Git panel shows empty diffs and Discard fails when the project is a subfolder of a repository

Closed
#174 0 comments 0 reactions 0 assignees View on GitHub

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
Domain
desktop, devtools

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

bug priority: medium severity: medium

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

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.

More from PierrunoYT/patch

All issues in PierrunoYT/patch

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.