@@ -36,39 +36,14 @@ public enum EditorType
36
36
37
37
public bool Exec ( )
38
38
{
39
+ Log ? . AppendLine ( $ "$ git { Args } \n ") ;
40
+
39
41
var start = CreateGitStartInfo ( ) ;
40
42
var errs = new List < string > ( ) ;
41
43
var proc = new Process ( ) { StartInfo = start } ;
42
44
43
- Log ? . AppendLine ( $ "$ git { Args } \n ") ;
44
-
45
- proc . OutputDataReceived += ( _ , e ) =>
46
- {
47
- if ( e . Data is { } line )
48
- Log ? . AppendLine ( line ) ;
49
- } ;
50
-
51
- proc . ErrorDataReceived += ( _ , e ) =>
52
- {
53
- var line = e . Data ?? string . Empty ;
54
- Log ? . AppendLine ( line ) ;
55
-
56
- // Lines to hide in error message.
57
- if ( line . Length > 0 )
58
- {
59
- if ( line . StartsWith ( "remote: Enumerating objects:" , StringComparison . Ordinal ) ||
60
- line . StartsWith ( "remote: Counting objects:" , StringComparison . Ordinal ) ||
61
- line . StartsWith ( "remote: Compressing objects:" , StringComparison . Ordinal ) ||
62
- line . StartsWith ( "Filtering content:" , StringComparison . Ordinal ) ||
63
- line . StartsWith ( "hint:" , StringComparison . Ordinal ) )
64
- return ;
65
-
66
- if ( REG_PROGRESS ( ) . IsMatch ( line ) )
67
- return ;
68
- }
69
-
70
- errs . Add ( line ) ;
71
- } ;
45
+ proc . OutputDataReceived += ( _ , e ) => HandleOutput ( e . Data , errs ) ;
46
+ proc . ErrorDataReceived += ( _ , e ) => HandleOutput ( e . Data , errs ) ;
72
47
73
48
var dummy = null as Process ;
74
49
var dummyProcLock = new object ( ) ;
@@ -217,6 +192,28 @@ private ProcessStartInfo CreateGitStartInfo()
217
192
return start ;
218
193
}
219
194
195
+ private void HandleOutput ( string line , List < string > errs )
196
+ {
197
+ line = line ?? string . Empty ;
198
+ Log ? . AppendLine ( line ) ;
199
+
200
+ // Lines to hide in error message.
201
+ if ( line . Length > 0 )
202
+ {
203
+ if ( line . StartsWith ( "remote: Enumerating objects:" , StringComparison . Ordinal ) ||
204
+ line . StartsWith ( "remote: Counting objects:" , StringComparison . Ordinal ) ||
205
+ line . StartsWith ( "remote: Compressing objects:" , StringComparison . Ordinal ) ||
206
+ line . StartsWith ( "Filtering content:" , StringComparison . Ordinal ) ||
207
+ line . StartsWith ( "hint:" , StringComparison . Ordinal ) )
208
+ return ;
209
+
210
+ if ( REG_PROGRESS ( ) . IsMatch ( line ) )
211
+ return ;
212
+ }
213
+
214
+ errs . Add ( line ) ;
215
+ }
216
+
220
217
[ GeneratedRegex ( @"\d+%" ) ]
221
218
private static partial Regex REG_PROGRESS ( ) ;
222
219
}
0 commit comments