Skip to content

Commit

Permalink
GitIndex: increase refreshStatus before launching task
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pieter committed Oct 1, 2009
1 parent ce89e0f commit 5be8aed
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions PBGitIndex.m
Original file line number Diff line number Diff line change
Expand Up @@ -417,28 +417,28 @@ - (void)indexRefreshFinished:(NSNotification *)notification
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];

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

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

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

- (void)readOtherFiles:(NSNotification *)notification
Expand Down

0 comments on commit 5be8aed

Please sign in to comment.