Permalink
Browse files

Reload commits after doing a commit

  • Loading branch information...
1 parent 1f7d745 commit a2217fe09918ce55cfe953006b21fa3f54866f67 @pieter committed Sep 28, 2008
Showing with 22 additions and 1 deletion.
  1. +1 −0 PBGitCommitController.m
  2. +7 −0 PBGitHistoryController.m
  3. +3 −0 PBGitRepository.h
  4. +11 −1 PBGitRepository.m
View
1 PBGitCommitController.m
@@ -203,6 +203,7 @@ - (IBAction) commit:(id) sender
otherButton:nil
informativeTextWithFormat:@"Successfully created commit %@", commit] runModal];
+ repository.hasChanged = YES;
self.busy--;
[commitMessageView setString:@""];
[self refresh:self];
View
7 PBGitHistoryController.m
@@ -27,6 +27,13 @@ - (void)awakeFromNib
[commitList setIntercellSpacing:cellSpacing];
[fileBrowser setTarget:self];
[fileBrowser setDoubleAction:@selector(openSelectedFile:)];
+
+ if ([repository.currentBranch count] == 0) {
+ [repository reloadRefs];
+ [repository readCurrentBranch];
+ }
+ else
+ [repository lazyReload];
}
- (void) updateKeys
View
3 PBGitRepository.h
@@ -16,6 +16,7 @@ extern NSString* PBGitRepositoryErrorDomain;
PBGitRevList* revisionList;
NSWindowController *windowController;
+ BOOL hasChanged;
NSMutableArray* branches;
NSIndexSet* currentBranch;
NSMutableDictionary* refs;
@@ -36,6 +37,7 @@ extern NSString* PBGitRepositoryErrorDomain;
- (BOOL) reloadRefs;
- (void) addRef:(PBGitRef *)ref fromParameters:(NSArray *)params;
- (BOOL) removeRef:(NSString *)ref;
+- (void) lazyReload;
- (void) readCurrentBranch;
- (PBGitRevSpecifier*) addBranch: (PBGitRevSpecifier*) rev;
@@ -50,6 +52,7 @@ extern NSString* PBGitRepositoryErrorDomain;
- (id) initWithURL: (NSURL*) path;
- (void) setup;
+@property (assign) BOOL hasChanged;
@property (readonly) NSWindowController *windowController;
@property (retain) PBGitRevList* revisionList;
@property (assign) NSMutableArray* branches;
View
12 PBGitRepository.m
@@ -19,7 +19,7 @@
@implementation PBGitRepository
-@synthesize revisionList, branches, currentBranch, refs, windowController;
+@synthesize revisionList, branches, currentBranch, refs, windowController, hasChanged;
static NSString* gitPath;
+ (void) initialize
@@ -220,6 +220,16 @@ - (BOOL) reloadRefs
return ret;
}
+- (void) lazyReload
+{
+ if (!hasChanged)
+ return;
+
+ [self reloadRefs];
+ [self.revisionList reload];
+ hasChanged = NO;
+}
+
- (PBGitRevSpecifier*) headRef
{
NSString* branch = [self parseSymbolicReference: @"HEAD"];

0 comments on commit a2217fe

Please sign in to comment.