mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 16:47:34 +00:00
Await Git checks while discovering and importing nested projects (#26790)
* Keep repository detection off the main IPC thread Share repository discovery decisions across synchronous compatibility callers and the existing asynchronous Git runner. Await discovery in project registration, nested imports, and folder upgrades, and recheck folder ownership after discovery completes. * Make repository detection fixtures work on native Windows * Await asynchronous Git checks in folder upgrade fixtures * Prevent duplicate project registration after async discovery * Check authoritative registration identity before renderer convergence * Narrow repository responsiveness to detection and registration * Keep one local project identity after concurrent registration * Run registration SSH coverage in the existing Docker lane * Await Git discovery when scanning and importing nested projects * test(git): cover classifier failure stages and literal path identity * test(git): use the current process host package * test(repos): use current process host in registration fixture
This commit is contained in:
@@ -7,7 +7,7 @@ import type { ProjectGroupImportResult } from '../../../shared/project-group-typ
|
||||
import { DEFAULT_REPO_BADGE_COLOR } from '../../../shared/constants'
|
||||
import { normalizeRuntimePathForComparison } from '../../../shared/cross-platform-path'
|
||||
import { awaitWindowsHostGitEnvironmentReady } from '../../git/runner'
|
||||
import { isGitRepo, getRepoName } from '../../git/repo'
|
||||
import { isGitRepoAsync, getRepoName } from '../../git/repo'
|
||||
import {
|
||||
createNestedProjectGroupResolver,
|
||||
resolveNestedRepoSelection
|
||||
@@ -83,7 +83,7 @@ export function registerNestedRepoImportHandler(mainWindow: BrowserWindow, store
|
||||
importRepoPath = await importTargetResolver.resolveSsh(repoPath, gitProvider)
|
||||
} else {
|
||||
await awaitWindowsHostGitEnvironmentReady({ cwd: repoPath })
|
||||
if (!isGitRepo(repoPath)) {
|
||||
if (!(await isGitRepoAsync(repoPath))) {
|
||||
results.push({
|
||||
path: repoPath,
|
||||
status: 'failed',
|
||||
@@ -152,7 +152,7 @@ export function registerNestedRepoImportHandler(mainWindow: BrowserWindow, store
|
||||
}
|
||||
importedProjectIdsByRepoPath.set(normalizedImportRepoPath, repo.id)
|
||||
results.push({ path: repoPath, projectId: repo.id, status: 'imported' })
|
||||
// Why: reaches here only after the isGitRepo guard above confirmed a git repo, so always true.
|
||||
// Why: reaches here only after the isGitRepoAsync guard above confirmed a git repo, so always true.
|
||||
emitRepoAdded('folder_picker', false, true)
|
||||
} catch (error) {
|
||||
results.push({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { readFile, readdir, stat } from 'node:fs/promises'
|
||||
import { basename, join } from 'node:path'
|
||||
import type { NestedRepoCandidate, NestedRepoScanResult } from '../../shared/project-group-types'
|
||||
import { isGitRepo } from '../git/repo'
|
||||
import { isGitRepoAsync } from '../git/repo'
|
||||
import {
|
||||
isIgnoredNestedRepoDirectory,
|
||||
normalizeNestedRepoScanOptions,
|
||||
@@ -58,7 +58,8 @@ export async function scanNestedRepos(args: {
|
||||
joinPath: join,
|
||||
basename,
|
||||
hasGitMarker,
|
||||
isSelectedPathGitRepo: async (path: string) => isGitRepo(path) || (await hasGitMarker(path))
|
||||
isSelectedPathGitRepo: async (path: string) =>
|
||||
(await isGitRepoAsync(path)) || (await hasGitMarker(path))
|
||||
}
|
||||
const buildResult = (selectedPathKind: NestedRepoScanResult['selectedPathKind']) => ({
|
||||
selectedPath: args.path,
|
||||
|
||||
@@ -9,7 +9,7 @@ import type {
|
||||
} from '../../shared/project-group-types'
|
||||
import type { Repo } from '../../shared/repo-types'
|
||||
import { awaitWindowsHostGitEnvironmentReady } from '../git/runner'
|
||||
import { getRepoName, isGitRepo } from '../git/repo'
|
||||
import { getRepoName, isGitRepoAsync } from '../git/repo'
|
||||
import { scanNestedRepos } from '../project-groups/nested-repo-discovery'
|
||||
import {
|
||||
createNestedProjectGroupResolver,
|
||||
@@ -77,7 +77,7 @@ export class RuntimeNestedRepoImport {
|
||||
for (const [projectGroupOrder, repoPath] of selection.selectedPaths.entries()) {
|
||||
try {
|
||||
await awaitWindowsHostGitEnvironmentReady({ cwd: repoPath })
|
||||
if (!isGitRepo(repoPath)) {
|
||||
if (!(await isGitRepoAsync(repoPath))) {
|
||||
results.push({ path: repoPath, status: 'failed', error: 'Not a valid git repository' })
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user