From d38c195149779a1a168010b6c8f0cdbff40f90c5 Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Mon, 23 Mar 2009 23:33:43 +0000 Subject: [PATCH] Fix moving of refs This was seriously broken after we moved to a hash to store the refs in ddc9ae7654. Apparently nobody noticed this earlier. We fix it by doing the right thing. Don't remove the array if it's empty, but check in the drawing if we really have refs. --- PBGitCommit.h | 2 +- PBGitCommit.m | 6 ++---- PBGitRevisionCell.m | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/PBGitCommit.h b/PBGitCommit.h index 70a6001..9a7832e 100644 --- a/PBGitCommit.h +++ b/PBGitCommit.h @@ -30,7 +30,7 @@ - initWithRepository:(PBGitRepository *)repo andSha:(git_oid)sha; -- (void)addRef:(id)ref; +- (void)addRef:(PBGitRef *)ref; - (void)removeRef:(id)ref; - (NSString *)realSha; diff --git a/PBGitCommit.m b/PBGitCommit.m index 37dc312..dbfdbdf 100644 --- a/PBGitCommit.m +++ b/PBGitCommit.m @@ -94,7 +94,7 @@ return [PBGitTree rootForCommit: self]; } -- (void)addRef:(id)ref +- (void)addRef:(PBGitRef *)ref { if (!self.refs) self.refs = [NSMutableArray arrayWithObject:ref]; @@ -108,8 +108,6 @@ return; [self.refs removeObject:ref]; - if ([self.refs count] == 0) - self.refs = NULL; } - (NSMutableArray *)refs @@ -119,7 +117,7 @@ - (void) setRefs:(NSMutableArray *)refs { - [[repository refs] setObject:[self realSha] forKey:[self realSha]]; + [[repository refs] setObject:refs forKey:[self realSha]]; } - (void)finalize diff --git a/PBGitRevisionCell.m b/PBGitRevisionCell.m index 83bf906..7d0d079 100644 --- a/PBGitRevisionCell.m +++ b/PBGitRevisionCell.m @@ -229,7 +229,7 @@ } - if ([self.objectValue refs]) + if ([self.objectValue refs] && [[self.objectValue refs] count]) [self drawRefsInRect:&rect]; // Still use this superclass because of hilighting differences