@@ -96,27 +96,27 @@ class GitService {
9696 window . showInformationMessage ( `${ CONSTANTS . extensionShortName } : ${ msg } ` ) ;
9797 }
9898
99- async getDiff ( repo : Repository , cached = true , nameOnly ?: boolean ) : Promise < string > {
99+ async getDiffAndWarnUser ( repo : Repository , cached = true , nameOnly ?: boolean , silent = false ) {
100100 const diff = await this . getGitDiff ( repo , cached , nameOnly ) ;
101101 if ( ! diff ) {
102102 if ( cached ) {
103103 const diffUncached = await repo . diff ( false ) ;
104104 if ( diffUncached ) {
105- throw new Error ( "Warning: please stage your git changes" ) ;
105+ if ( ! silent ) {
106+ this . showInformationMessage ( "warning: please stage your git changes" ) ;
107+ }
106108 } else {
107- throw new Error ( "No Changes" ) ;
109+ if ( ! silent ) {
110+ this . showInformationMessage ( "No Changes" ) ;
111+ }
108112 }
109113 }
110- throw new Error ( "No changes" ) ;
114+ if ( ! silent ) {
115+ this . showInformationMessage ( "No changes" ) ;
116+ }
111117 }
112118 return diff ;
113119 }
114- async getDiffAndWarnUser ( repo : Repository , cached = true , nameOnly ?: boolean ) {
115- return this . getDiff ( repo , cached , nameOnly ) . catch ( ( error ) => {
116- this . showInformationMessage ( error . message ) ;
117- return null ;
118- } ) ;
119- }
120120 /**
121121 * Check if a file path matches any of the exclusion patterns
122122 * @param filePath - The file path to check
@@ -128,7 +128,11 @@ class GitService {
128128 // Simple glob pattern matching
129129 if ( pattern . includes ( "*" ) ) {
130130 const regex = new RegExp (
131- `^${ pattern . replace ( / \\ / g, "\\\\" ) . replace ( / \. / g, "\\." ) . replace ( / \* / g, ".*" ) . replace ( / \? / g, "." ) } $` ,
131+ `^${ pattern
132+ . replace ( / \\ / g, "\\\\" )
133+ . replace ( / \. / g, "\\." )
134+ . replace ( / \* / g, ".*" )
135+ . replace ( / \? / g, "." ) } $`,
132136 ) ;
133137 if ( regex . test ( filePath ) ) {
134138 return true ;
0 commit comments