@@ -11,7 +11,7 @@ interface IRepositoryWatcher : IDisposable
11
11
{
12
12
void Start ( ) ;
13
13
void Stop ( ) ;
14
- event Action < string > HeadChanged ;
14
+ event Action HeadChanged ;
15
15
event Action IndexChanged ;
16
16
event Action ConfigChanged ;
17
17
event Action < string > LocalBranchChanged ;
@@ -38,7 +38,7 @@ class RepositoryWatcher : IRepositoryWatcher
38
38
private bool processingEvents ;
39
39
private readonly ManualResetEventSlim signalProcessingEventsDone = new ManualResetEventSlim ( false ) ;
40
40
41
- public event Action < string > HeadChanged ;
41
+ public event Action HeadChanged ;
42
42
public event Action IndexChanged ;
43
43
public event Action ConfigChanged ;
44
44
public event Action < string > LocalBranchChanged ;
@@ -168,8 +168,6 @@ private int ProcessEvents(Event[] fileEvents)
168
168
var repositoryChanged = false ;
169
169
var indexChanged = false ;
170
170
171
- string headContent = null ;
172
-
173
171
foreach ( var fileEvent in fileEvents )
174
172
{
175
173
if ( ! running )
@@ -200,19 +198,26 @@ private int ProcessEvents(Event[] fileEvents)
200
198
if ( ! configChanged && fileA . Equals ( paths . DotGitConfig ) )
201
199
{
202
200
configChanged = true ;
201
+
202
+ Logger . Trace ( "ConfigChanged" ) ;
203
+ ConfigChanged ? . Invoke ( ) ;
204
+ eventsProcessed ++ ;
203
205
}
204
206
else if ( ! headChanged && fileA . Equals ( paths . DotGitHead ) )
205
207
{
206
- if ( fileEvent . Type != EventType . DELETED )
207
- {
208
- headContent = paths . DotGitHead . ReadAllLines ( ) . FirstOrDefault ( ) ;
209
- }
210
-
211
208
headChanged = true ;
209
+
210
+ Logger . Trace ( "HeadChanged" ) ;
211
+ HeadChanged ? . Invoke ( ) ;
212
+ eventsProcessed ++ ;
212
213
}
213
214
else if ( ! indexChanged && fileA . Equals ( paths . DotGitIndex ) )
214
215
{
215
216
indexChanged = true ;
217
+
218
+ Logger . Trace ( "IndexChanged" ) ;
219
+ IndexChanged ? . Invoke ( ) ;
220
+ eventsProcessed ++ ;
216
221
}
217
222
else if ( fileA . IsChildOf ( paths . RemotesPath ) )
218
223
{
@@ -349,35 +354,11 @@ private int ProcessEvents(Event[] fileEvents)
349
354
}
350
355
351
356
repositoryChanged = true ;
352
- }
353
- }
354
-
355
- if ( configChanged )
356
- {
357
- Logger . Trace ( "ConfigChanged" ) ;
358
- ConfigChanged ? . Invoke ( ) ;
359
- eventsProcessed ++ ;
360
- }
361
-
362
- if ( headChanged )
363
- {
364
- Logger . Trace ( "HeadChanged: {0}" , headContent ?? "[null]" ) ;
365
- HeadChanged ? . Invoke ( headContent ) ;
366
- eventsProcessed ++ ;
367
- }
368
357
369
- if ( indexChanged )
370
- {
371
- Logger . Trace ( "IndexChanged" ) ;
372
- IndexChanged ? . Invoke ( ) ;
373
- eventsProcessed ++ ;
374
- }
375
-
376
- if ( repositoryChanged )
377
- {
378
- Logger . Trace ( "RepositoryChanged" ) ;
379
- RepositoryChanged ? . Invoke ( ) ;
380
- eventsProcessed ++ ;
358
+ Logger . Trace ( "RepositoryChanged" ) ;
359
+ RepositoryChanged ? . Invoke ( ) ;
360
+ eventsProcessed ++ ;
361
+ }
381
362
}
382
363
383
364
return eventsProcessed ;
0 commit comments