Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions packages/git/src/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export async function getStatus(
return manager.executeRead(
baseDir,
async (git) => {
const status = await git.status();
const status = await git.status(["--untracked-files=normal"]);
return {
isClean: status.isClean(),
staged: status.staged,
Expand All @@ -164,7 +164,7 @@ export async function hasChanges(
return manager.executeRead(
baseDir,
async (git) => {
const status = await git.status();
const status = await git.status(["--untracked-files=normal"]);
return !status.isClean();
},
{ signal: options?.abortSignal },
Expand All @@ -189,7 +189,7 @@ export async function getAheadBehind(
return null;
}

const status = await git.status();
const status = await git.status(["--untracked-files=no"]);
return {
aheadOfRemote: status.ahead,
behind: status.behind,
Expand Down Expand Up @@ -339,7 +339,7 @@ export async function getChangedFiles(
} catch {}
}

const status = await git.status();
const status = await git.status(["--untracked-files=normal"]);
for (const file of [
...status.modified,
...status.created,
Expand Down Expand Up @@ -430,7 +430,7 @@ export async function getChangedFilesDetailed(
try {
const [diffSummary, status] = await Promise.all([
git.diffSummary(["-M", "HEAD"]),
git.status(),
git.status(["--untracked-files=normal"]),
]);

const seenPaths = new Set<string>();
Expand Down Expand Up @@ -468,7 +468,10 @@ export async function getChangedFilesDetailed(
if (hasFrom) seenPaths.add(file.from as string);
}

const MAX_UNTRACKED_FILES = 10_000;
let untrackedProcessed = 0;
for (const file of status.not_added) {
if (untrackedProcessed >= MAX_UNTRACKED_FILES) break;
if (!seenPaths.has(file)) {
if (
excludePatterns &&
Expand All @@ -483,6 +486,7 @@ export async function getChangedFilesDetailed(
linesAdded: lineCount,
linesRemoved: 0,
});
untrackedProcessed++;
}
}

Expand Down Expand Up @@ -664,7 +668,7 @@ export async function getSyncStatus(
baseDir,
async (git) => {
try {
const status = await git.status();
const status = await git.status(["--untracked-files=no"]);
const isDetached = status.detached || status.current === "HEAD";
const currentBranch = isDetached ? null : status.current || null;

Expand Down
Loading