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.
This commit is contained in:
Pieter de Bie
2009-03-23 23:33:43 +00:00
parent 8616b38eb3
commit d38c195149
3 changed files with 4 additions and 6 deletions
+1 -1
View File
@@ -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;
+2 -4
View File
@@ -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
+1 -1
View File
@@ -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