fix(git): prevent app freeze on repos with large untracked directories#1361
Merged
jonathanlab merged 2 commits intoPostHog:mainfrom Mar 31, 2026
Merged
fix(git): prevent app freeze on repos with large untracked directories#1361jonathanlab merged 2 commits intoPostHog:mainfrom
jonathanlab merged 2 commits intoPostHog:mainfrom
Conversation
882677e to
3d5aff5
Compare
3d5aff5 to
ec50cb8
Compare
jonathanlab
approved these changes
Mar 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The app freezes (macOS beach ball) when selecting a repository that contains a large untracked directory (e.g.
.pnpm-store/not in.gitignore). The main process becomes unresponsive because multiple git queries rungit statuswhich enumerates every file inside untracked directories.Changes
simple-git's.status()hardcodes a-uflag, which is shorthand for--untracked-files=all. This makes git recursively list every file inside untracked directories, a.pnpm-store/can contain tens of thousands of files, all piped through stdout and parsed synchronously by simple-git.From simple-git's source (
src/lib/tasks/status.ts)[https://github.com/steveukx/git-js/blob/main/simple-git/src/lib/tasks/status.ts]:Custom args are appended after
-u, so passing--untracked-files=normalor--untracked-files=nooverrides it (last flag wins in git).What changed in
packages/git/src/queries.ts:All
git.status()calls now pass an explicit--untracked-filesmode:--untracked-files=normalfor functions that readnot_added— collapses untracked directories into a single entry instead of listing every file inside them (matches defaultgit statusCLI behavior)--untracked-files=noforgetAheadBehindandgetSyncStatuswhich only read branch/ahead/behind info and don't need untracked data at allgetChangedFilesDetailed: cappedcountFileLinesto the first 10,000 untracked files. This function sequentially reads every untracked file to count lines, which can cause a secondary bottleneck after the status enumeration.No behavior change:
--untracked-files=normalstill reports untracked content, just grouped by directory instead of expanded per-file.isClean(),not_added,modified,staged,deleted,ahead,behindall remain correct. Functions using--untracked-files=nonever accessed untracked fields to begin with.How did you test this?
Manually selected a repository containing a large untracked
.pnpm-store/directory via the folder picker. Before the fix, the app froze with a beach ball. After the fix, the repo loads without freezing.