Skip to content

Commit 5be8aed

Browse files
committed
GitIndex: increase refreshStatus before launching task
We used to increase this variable after handing it over to the [handle readToEndOfFileInBackgroundAndNotify], but sometimes a task would quit before getting to that point, causing a premature index refresh event to be called.
1 parent ce89e0f commit 5be8aed

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

PBGitIndex.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,28 +417,28 @@ - (void)indexRefreshFinished:(NSNotification *)notification
417417
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
418418

419419
// Other files (not tracked, not ignored)
420+
refreshStatus++;
420421
NSFileHandle *handle = [PBEasyPipe handleForCommand:[PBGitBinary path]
421422
withArgs:[NSArray arrayWithObjects:@"ls-files", @"--others", @"--exclude-standard", @"-z", nil]
422423
inDir:[workingDirectory path]];
423424
[nc addObserver:self selector:@selector(readOtherFiles:) name:NSFileHandleReadToEndOfFileCompletionNotification object:handle];
424425
[handle readToEndOfFileInBackgroundAndNotify];
425-
refreshStatus++;
426426

427427
// Unstaged files
428+
refreshStatus++;
428429
handle = [PBEasyPipe handleForCommand:[PBGitBinary path]
429430
withArgs:[NSArray arrayWithObjects:@"diff-files", @"-z", nil]
430431
inDir:[workingDirectory path]];
431432
[nc addObserver:self selector:@selector(readUnstagedFiles:) name:NSFileHandleReadToEndOfFileCompletionNotification object:handle];
432433
[handle readToEndOfFileInBackgroundAndNotify];
433-
refreshStatus++;
434434

435435
// Staged files
436+
refreshStatus++;
436437
handle = [PBEasyPipe handleForCommand:[PBGitBinary path]
437438
withArgs:[NSArray arrayWithObjects:@"diff-index", @"--cached", @"-z", [self parentTree], nil]
438439
inDir:[workingDirectory path]];
439440
[nc addObserver:self selector:@selector(readStagedFiles:) name:NSFileHandleReadToEndOfFileCompletionNotification object:handle];
440441
[handle readToEndOfFileInBackgroundAndNotify];
441-
refreshStatus++;
442442
}
443443

444444
- (void)readOtherFiles:(NSNotification *)notification

0 commit comments

Comments
 (0)