Skip to content

Commit 571082a

Browse files
committed
Merge branch 'refs/heads/apla-master'
Conflicts: GLFileView.m
2 parents c0965e3 + 18027a0 commit 571082a

12 files changed

+52
-22
lines changed

Controller/PBSubmoduleController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ - (void) reload {
4242
if ([submoduleLine length] == 0)
4343
continue;
4444
PBGitSubmodule *submodule = [[PBGitSubmodule alloc] initWithRawSubmoduleStatusString:submoduleLine];
45-
[loadedSubmodules addObject:submodule];
45+
if (submodule)
46+
[loadedSubmodules addObject:submodule];
4647
}
4748

4849
NSMutableArray *groupedSubmodules = [[NSMutableArray alloc] init];

GLFileView.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,13 +303,18 @@ + (NSString *)parseDiff:(NSString *)txt
303303
[res appendString:[NSString stringWithFormat:@"<table id='%@' class='diff'><thead><tr><td colspan='3'><div style='float:left;'>",fileName]];
304304
do{
305305
[res appendString:[NSString stringWithFormat:@"<p>%@</p>",line]];
306-
line=[lines objectAtIndex:++i];
306+
line=nil;
307+
if (i<([lines count]-1))
308+
line = [lines objectAtIndex:++i];
307309
}while([GLFileView isDiffHeader:line]);
308310
[res appendString:@"</div>"];
309311
if(![self isBinaryFile:line]){
310312
[res appendString:[NSString stringWithFormat:@"<div class='filemerge'><a href='' onclick='openFileMerge(\"%@\",\"{SHA}\",\"{SHA2}\"); return false;'><img src='GitX://app:/filemerge' width='32' height='32'/><br/>open in<br/>FileMerge</a></div>",fileName]];
311313
}
312314
[res appendString:@"</td></tr></thead><tbody>"];
315+
316+
if (!line)
317+
break; // do nothing, this is probably header-only diff (permissions change, maybe)
313318

314319
if([self isBinaryFile:line]){
315320
NSArray *files=[self getFilesNames:line];

GitX.xcodeproj/project.pbxproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,7 +1855,6 @@
18551855
INFOPLIST_PREPROCESS = YES;
18561856
MACOSX_DEPLOYMENT_TARGET = 10.5;
18571857
PREBINDING = NO;
1858-
RUN_CLANG_STATIC_ANALYZER = YES;
18591858
SDKROOT = macosx10.5;
18601859
};
18611860
name = Debug;
@@ -1872,7 +1871,6 @@
18721871
INFOPLIST_PREPROCESS = YES;
18731872
MACOSX_DEPLOYMENT_TARGET = 10.5;
18741873
PREBINDING = NO;
1875-
RUN_CLANG_STATIC_ANALYZER = YES;
18761874
SDKROOT = macosx10.5;
18771875
};
18781876
name = Release;

Model/PBGitSubmodule.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ typedef enum {
1313
PBGitSubmoduleStateNotInitialized,
1414
PBGitSubmoduleStateMatchingIndex,
1515
PBGitSubmoduleStateDoesNotMatchIndex,
16+
PBGitSubmoduleStateFailed,
1617
} PBGitSubmoduleState;
1718

1819
@interface PBGitSubmodule : NSObject<PBPresentable> {

Model/PBGitSubmodule.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ - (id) initWithRawSubmoduleStatusString:(NSString *) submoduleStatusString {
3535
if ((self = [super init])) {
3636
unichar status = [submoduleStatusString characterAtIndex:0];
3737
submoduleState = [PBGitSubmodule submoduleStateFromCharacter:status];
38+
if (submoduleState == PBGitSubmoduleStateFailed) {
39+
NSLog(@"Submodule status failed:\n %@", submoduleStatusString);
40+
return nil;
41+
}
3842
NSScanner *scanner = [NSScanner scannerWithString:[submoduleStatusString substringFromIndex:1]];
3943
NSString *sha1 = nil;
4044
NSString *fullPath = nil;
@@ -114,7 +118,7 @@ + (PBGitSubmoduleState) submoduleStateFromCharacter:(unichar) character {
114118
} else if (character == '+') {
115119
state = PBGitSubmoduleStateDoesNotMatchIndex;
116120
} else if (character != ' ') {
117-
NSAssert1(NO, @"Ooops unsupported submodule status character: %c", character);
121+
return PBGitSubmoduleStateFailed;
118122
}
119123

120124
return state;

PBGitCommitController.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ - (void)commitFinished:(NSNotification *)notification
172172
[commitMessageView setEditable:YES];
173173
[commitMessageView setString:@""];
174174
[webController setStateMessage:[NSString stringWithFormat:[[notification userInfo] objectForKey:@"description"]]];
175+
[repository reloadRefs];
175176
}
176177

177178
- (void)commitFailed:(NSNotification *)notification

PBGitHistoryController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
PBGitTree *gitTree;
5656
PBGitCommit *webCommit;
5757
PBGitCommit *selectedCommit;
58+
PBGitCommit *selectedCommitBeforeRefresh;
5859
}
5960

6061
@property (readonly) NSTreeController* treeController;

PBGitHistoryController.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,9 @@ - (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(
250250
}else if([(NSString *)context isEqualToString:@"updateCommitCount"] || [(NSString *)context isEqualToString:@"revisionListUpdating"]) {
251251
[self updateStatus];
252252

253-
if ([repository.currentBranch isSimpleRef])
253+
if (selectedCommitBeforeRefresh && [repository commitForSHA:[selectedCommitBeforeRefresh sha]])
254+
[self selectCommit:[selectedCommitBeforeRefresh sha]];
255+
else if ([repository.currentBranch isSimpleRef])
254256
[self selectCommit:[repository shaForRef:[repository.currentBranch ref]]];
255257
else
256258
[self selectCommit:[[self firstCommit] sha]];
@@ -405,11 +407,13 @@ - (void) updateQuicklookForce:(BOOL)force
405407

406408
- (IBAction) refresh:(id)sender
407409
{
410+
selectedCommitBeforeRefresh = selectedCommit;
408411
[repository forceUpdateRevisions];
409412
}
410413

411414
- (void) updateView
412415
{
416+
[self refresh: nil];
413417
[self updateKeys];
414418
}
415419

PBGitIndex.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ - (void)commitWithMessage:(NSString *)commitMessage andVerify:(BOOL) doVerify
235235
return;
236236

237237
repository.hasChanged = YES;
238+
[repository reloadRefs];
238239

239240
amendEnvironment = nil;
240241
if (amend)

PBGitRepository.m

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -690,22 +690,34 @@ - (void) beginPushRef:(PBGitRef *)ref toRemote:(PBGitRef *)remoteRef
690690
}
691691
NSString *remoteName = [remoteRef remoteName];
692692
[arguments addObject:remoteName];
693-
693+
694694
NSString *branchName = nil;
695-
if ([ref isRemote] || !ref) {
696-
branchName = @"all updates";
697-
}
698-
else if ([ref isTag]) {
699-
branchName = [NSString stringWithFormat:@"tag '%@'", [ref tagName]];
700-
[arguments addObject:@"tag"];
701-
[arguments addObject:[ref tagName]];
702-
}
703-
else {
704-
branchName = [ref shortName];
705-
[arguments addObject:branchName];
695+
NSString *actionType = nil;
696+
697+
if ([config valueForKeyPath:[NSString stringWithFormat:@"remote.%@.mirror", remoteName]]) {
698+
// we must check for mirror parameter in config.
699+
// if we push branch name in this case to the arguments, push failed
700+
actionType = @"Mirroring";
701+
} else {
702+
703+
if ([ref isRemote] || !ref) {
704+
branchName = @"all updates";
705+
}
706+
else if ([ref isTag]) {
707+
branchName = [NSString stringWithFormat:@"tag '%@'", [ref tagName]];
708+
[arguments addObject:@"tag"];
709+
[arguments addObject:[ref tagName]];
710+
}
711+
else {
712+
branchName = [ref shortName];
713+
[arguments addObject:branchName];
714+
}
715+
716+
actionType = [NSString stringWithFormat:@"Pushing %@", branchName];
717+
706718
}
707719

708-
NSString *description = [NSString stringWithFormat:@"Pushing %@ to %@", branchName, remoteName];
720+
NSString *description = [actionType stringByAppendingFormat:@" to %@", remoteName];
709721
NSString *title = @"Pushing to remote";
710722
[PBRemoteProgressSheet beginRemoteProgressSheetForArguments:arguments title:title description:description inRepository:self];
711723
}
@@ -1270,7 +1282,7 @@ - (NSString*) parseSymbolicReference:(NSString*) reference
12701282

12711283
- (void) finalize
12721284
{
1273-
NSLog(@"Dealloc of repository");
1285+
//NSLog(@"Dealloc of repository");
12741286
[super finalize];
12751287
}
12761288
@end

0 commit comments

Comments
 (0)