12
12
import ReduxResult from ' $components/ReduxResult.svelte' ;
13
13
import { OnboardingEvent , POSTHOG_WRAPPER } from ' $lib/analytics/posthog' ;
14
14
import { BACKEND } from ' $lib/backend' ;
15
- import { getUserErrorCode , Code } from ' $lib/backend/ipc' ;
16
15
import { BASE_BRANCH_SERVICE } from ' $lib/baseBranch/baseBranchService.svelte' ;
17
16
import { BRANCH_SERVICE } from ' $lib/branches/branchService.svelte' ;
18
17
import { SETTINGS_SERVICE } from ' $lib/config/appSettingsV2' ;
@@ -23,7 +22,7 @@ import { getUserErrorCode, Code } from '$lib/backend/ipc';
23
22
import { GITLAB_STATE } from ' $lib/forge/gitlab/gitlabState.svelte' ;
24
23
import { GIT_SERVICE } from ' $lib/git/gitService' ;
25
24
import { MODE_SERVICE } from ' $lib/mode/modeService' ;
26
- import { showError , showInfo , showWarning , showToast } from ' $lib/notifications/toasts' ;
25
+ import { showError , showInfo , showWarning } from ' $lib/notifications/toasts' ;
27
26
import { PROJECTS_SERVICE } from ' $lib/project/projectsService' ;
28
27
import { FILE_SELECTION_MANAGER } from ' $lib/selection/fileSelectionManager.svelte' ;
29
28
import { UNCOMMITTED_SERVICE } from ' $lib/selection/uncommittedService.svelte' ;
@@ -321,44 +320,7 @@ import { getUserErrorCode, Code } from '$lib/backend/ipc';
321
320
}
322
321
} catch (error : unknown ) {
323
322
posthog .captureOnboarding (OnboardingEvent .SetProjectActiveFailed );
324
-
325
- // Check if this is a non-git repository error
326
- const errorCode = getUserErrorCode (error );
327
- if (errorCode === Code .NonGitRepository ) {
328
- // Show special toast with git init option
329
- showToast ({
330
- title: ' Not a Git repository' ,
331
- message: ' The selected directory is not a Git repository. Would you like to initialize one?' ,
332
- style: ' warning' ,
333
- extraAction: {
334
- label: ' Initialize Repository' ,
335
- onClick : async (dismiss ) => {
336
- try {
337
- const currentProject = projects ?.find ((p ) => p .id === projectId );
338
- if (currentProject ?.path ) {
339
- await projectsService .initGitRepository (currentProject .path );
340
- dismiss ();
341
- showToast ({
342
- title: ' Repository Initialized' ,
343
- message: ` Git repository has been successfully initialized at ${currentProject .path }. Loading project... ` ,
344
- style: ' info'
345
- });
346
- // Retry setting the project active
347
- await setActiveProjectOrRedirect (projectId );
348
- } else {
349
- throw new Error (' Could not find project path' );
350
- }
351
- } catch (initError ) {
352
- console .error (' Failed to initialize repository:' , initError );
353
- dismiss ();
354
- showError (' Failed to initialize repository' , initError );
355
- }
356
- }
357
- }
358
- });
359
- } else {
360
- showError (' Failed to set the project active' , error );
361
- }
323
+ showError (' Failed to set the project active' , error );
362
324
}
363
325
}
364
326
0 commit comments