mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
Optimize revision walker bindings
This simplifies the procedure used to walk revisions by only loading in commits if the branch selection was changed.
This commit is contained in:
+4
-2
@@ -118,8 +118,8 @@ static NSString* gitPath;
|
||||
|
||||
if (success) {
|
||||
[self readRefs];
|
||||
[self readCurrentBranch];
|
||||
revisionList = [[PBGitRevList alloc] initWithRepository:self];
|
||||
[self readCurrentBranch];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,8 +133,10 @@ static NSString* gitPath;
|
||||
[self setFileURL: gitDirURL];
|
||||
|
||||
[self readRefs];
|
||||
[self selectBranch: [self addBranch: rev]];
|
||||
|
||||
revisionList = [[PBGitRevList alloc] initWithRepository:self];
|
||||
[self selectBranch: [self addBranch: rev]];
|
||||
|
||||
return self;
|
||||
}
|
||||
// The fileURL the document keeps is to the .git dir, but that’s pretty
|
||||
|
||||
+5
-4
@@ -18,8 +18,6 @@
|
||||
- initWithRepository: (id) repo
|
||||
{
|
||||
repository = repo;
|
||||
|
||||
[self readCommits];
|
||||
[repository addObserver:self forKeyPath:@"currentBranch" options:0 context:nil];
|
||||
|
||||
return self;
|
||||
@@ -31,10 +29,13 @@
|
||||
// we can check if the current branch is the same as the previous one
|
||||
// and in that case we don't have to reload the revision list.
|
||||
|
||||
// If no branch was selected, use the current HEAD
|
||||
// If no branch is selected, don't do anything
|
||||
if (![repository currentBranch] || [[repository currentBranch] count] == 0)
|
||||
return;
|
||||
|
||||
NSArray* selectedBranches = [[repository branches] objectsAtIndexes: [repository currentBranch]];
|
||||
|
||||
// Apparently, we don't have a current branch yet. Let's skip it.
|
||||
// Apparently, The selected index does not exist.. don't do anything
|
||||
if ([selectedBranches count] == 0)
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user