Repository navigation
perf(server): skip the full untracked scan when Git status shows none #36870
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -630,6 +630,11 @@ export function isNonRepositoryGitStderr(stderr: string): boolean { | |
| const normalized = stderr.toLowerCase(); | ||
| return NON_REPOSITORY_STDERR_PHRASES.some((phrase) => normalized.includes(phrase)); | ||
| } | ||
| // Unknown spellings count as hidden so their untracked files are still found by a full scan. | ||
| const UNTRACKED_FILES_SHOWN_CONFIG_VALUES = new Set(["normal", "all", "true", "yes", "on", "1"]); | ||
| function untrackedFilesHiddenByConfig(value: string | null): boolean { | ||
| return value !== null && !UNTRACKED_FILES_SHOWN_CONFIG_VALUES.has(value.toLowerCase()); | ||
| } | ||
| function isUnbornHeadStderr(stderr: string): boolean { | ||
| const normalized = stderr.toLowerCase(); | ||
| return ( | ||
|
|
@@ -3738,8 +3743,16 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* | |
| detail: remembered.detail, | ||
| }); | ||
| } | ||
| // Empty status can mean untracked files are hidden; retain the full scan. | ||
| const untracked = yield* prepareUntrackedReviewIndexOrReason(cwd, pathspecs, undefined, false); | ||
| // Empty status means no untracked files unless config hides them; then scan the whole tree. | ||
| const untracked = | ||
| roots.length === 0 && | ||
| !untrackedFilesHiddenByConfig( | ||
| yield* readConfigValue(cwd, "status.showUntrackedFiles").pipe( | ||
| Effect.orElseSucceed(() => "no"), | ||
| ), | ||
|
Comment on lines
+3750
to
+3752
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Treat a failed
An unset key and a failed read both produce
|
||
| ) | ||
| ? { env: undefined, omitted: false } | ||
| : yield* prepareUntrackedReviewIndexOrReason(cwd, pathspecs, undefined, false); | ||
| if ("unavailable" in untracked) { | ||
| const count = remembered?.roots === rootsKey ? remembered.count + 1 : 1; | ||
| untrackedTotalsFailures.delete(cwd); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Distinguish an empty configuration value from an unset key.
With
status.showUntrackedFiles="", Git 2.56.1 hides untracked files. Its parser treats the empty string as false. (raw.githubusercontent.com)However,
readConfigValueconverts that value tonull. This branch then skips preparation, sodiff-indexomits the untracked files from branch totals. Read this setting without collapsing an empty value into absence. Extend the existing scenario table with an empty-value case.