Permalink
Browse files

Fix moving of refs

This was seriously broken after we moved to a hash
to store the refs in ddc9ae7. 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.
  • Loading branch information...
1 parent 8616b38 commit d38c195149779a1a168010b6c8f0cdbff40f90c5 Pieter de Bie committed Mar 23, 2009
Showing with 4 additions and 6 deletions.
  1. +1 −1 PBGitCommit.h
  2. +2 −4 PBGitCommit.m
  3. +1 −1 PBGitRevisionCell.m
View
@@ -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;
View
@@ -94,7 +94,7 @@ - (PBGitTree*) tree
return [PBGitTree rootForCommit: self];
}
-- (void)addRef:(id)ref
+- (void)addRef:(PBGitRef *)ref
{
if (!self.refs)
self.refs = [NSMutableArray arrayWithObject:ref];
@@ -108,8 +108,6 @@ - (void)removeRef:(id)ref
return;
[self.refs removeObject:ref];
- if ([self.refs count] == 0)
- self.refs = NULL;
}
- (NSMutableArray *)refs
@@ -119,7 +117,7 @@ - (NSMutableArray *)refs
- (void) setRefs:(NSMutableArray *)refs
{
- [[repository refs] setObject:[self realSha] forKey:[self realSha]];
+ [[repository refs] setObject:refs forKey:[self realSha]];
}
- (void)finalize
View
@@ -229,7 +229,7 @@ - (void) drawWithFrame: (NSRect) rect inView:(NSView *)view
}
- if ([self.objectValue refs])
+ if ([self.objectValue refs] && [[self.objectValue refs] count])
[self drawRefsInRect:&rect];
// Still use this superclass because of hilighting differences

0 comments on commit d38c195

Please sign in to comment.