@@ -16,7 +16,10 @@ interface GitRepository {
16
16
inputBox : {
17
17
value : string ;
18
18
} ;
19
- commit ( message : string , options : { all : boolean ; files ?: string [ ] } ) : Promise < void > ;
19
+ commit (
20
+ message : string ,
21
+ options : { all : boolean ; files ?: string [ ] }
22
+ ) : Promise < void > ;
20
23
}
21
24
22
25
export class GitProvider implements ISCMProvider {
@@ -44,17 +47,29 @@ export class GitProvider implements ISCMProvider {
44
47
// 优化 getFileStatus 方法
45
48
private async getFileStatus ( file : string ) : Promise < string > {
46
49
try {
47
- const { stdout : status } = await exec ( `git status --porcelain "${ file } "` , {
48
- cwd : this . workspaceRoot ,
49
- } ) ;
50
-
51
- if ( ! status ) return "Unknown" ;
52
-
53
- if ( status . startsWith ( "??" ) ) return "New File" ;
54
- if ( status . startsWith ( " D" ) || status . startsWith ( "D " ) ) return "Deleted File" ;
50
+ const { stdout : status } = await exec (
51
+ `git status --porcelain "${ file } "` ,
52
+ {
53
+ cwd : this . workspaceRoot ,
54
+ }
55
+ ) ;
56
+
57
+ if ( ! status ) {
58
+ return "Unknown" ;
59
+ }
60
+
61
+ if ( status . startsWith ( "??" ) ) {
62
+ return "New File" ;
63
+ }
64
+ if ( status . startsWith ( " D" ) || status . startsWith ( "D " ) ) {
65
+ return "Deleted File" ;
66
+ }
55
67
return "Modified File" ;
56
68
} catch ( error ) {
57
- console . error ( "Failed to get file status:" , error instanceof Error ? error . message : error ) ;
69
+ console . error (
70
+ "Failed to get file status:" ,
71
+ error instanceof Error ? error . message : error
72
+ ) ;
58
73
return "Unknown" ;
59
74
}
60
75
}
@@ -128,7 +143,7 @@ export class GitProvider implements ISCMProvider {
128
143
) ;
129
144
}
130
145
throw new Error (
131
- LocalizationManager . getInstance ( ) . getMessage ( "diff.failed" )
146
+ LocalizationManager . getInstance ( ) . getMessage ( "git. diff.failed" )
132
147
) ;
133
148
}
134
149
}
0 commit comments