Commit
…anagement, and some small bug fixes
- Loading branch information
There are no files selected for viewing
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
|
@@ -54,6 +54,7 @@ - (void) initWithGit:(ObjGit *)git gitPath:(NSString *)gitRepoPath input:(NSInpu | ||
* either upload-pack for fetches or receive-pack for pushes | * either upload-pack for fetches or receive-pack for pushes | ||
*/ | */ | ||
- (void) handleRequest { | - (void) handleRequest { | ||
NSLog(@"HANDLE REQUEST"); | |||
NSString *header, *command, *repository, *repo, *hostpath; | NSString *header, *command, *repository, *repo, *hostpath; | ||
header = [self packetReadLine]; | header = [self packetReadLine]; | ||
|
|
||
|
@@ -84,6 +85,9 @@ - (void) uploadPack:(NSString *)repositoryName { | ||
[self sendRefs]; | [self sendRefs]; | ||
[self receiveNeeds]; | [self receiveNeeds]; | ||
[self uploadPackFile]; | [self uploadPackFile]; | ||
//NSLog(@"out:%@", outStream); | |||
//NSLog(@"out avail:%d", [outStream hasSpaceAvailable]); | |||
//NSLog(@" in avail:%d", [inStream hasBytesAvailable]); | |||
} | } | ||
|
|
||
- (void) receiveNeeds | - (void) receiveNeeds | ||
|
@@ -247,9 +251,11 @@ - (void) gatherObjectShasFromCommit:(NSString *)shaValue | ||
|
|
||
- (void) gatherObjectShasFromTree:(NSString *)shaValue | - (void) gatherObjectShasFromTree:(NSString *)shaValue | ||
{ | { | ||
ObjGitTree *tree = [[ObjGitTree alloc] initFromGitObject:[gitRepo getObjectFromSha:shaValue]]; | ObjGitTree *tree = [ObjGitTree alloc]; | ||
This comment has been minimized.
Sorry, something went wrong.
sebnow
|
|||
[tree initFromGitObject:[gitRepo getObjectFromSha:shaValue]]; | |||
[refDict setObject:@"/" forKey:shaValue]; | [refDict setObject:@"/" forKey:shaValue]; | ||
NSEnumerator *e = [[tree treeEntries] objectEnumerator]; | NSEnumerator *e = [[tree treeEntries] objectEnumerator]; | ||
//[tree release]; | |||
NSArray *entries; | NSArray *entries; | ||
NSString *name, *sha, *mode; | NSString *name, *sha, *mode; | ||
while ( (entries = [e nextObject]) ) { | while ( (entries = [e nextObject]) ) { | ||
|
@@ -419,6 +425,7 @@ - (void) unpackDeltified:(int)type size:(int)size { | ||
contents = [self patchDelta:objectData withObject:object]; | contents = [self patchDelta:objectData withObject:object]; | ||
//NSLog(@"unpacked delta: %@ : %@", contents, [object type]); | //NSLog(@"unpacked delta: %@ : %@", contents, [object type]); | ||
[gitRepo writeObject:contents withType:[object type] withSize:[contents length]]; | [gitRepo writeObject:contents withType:[object type] withSize:[contents length]]; | ||
//[object release]; | |||
} else { | } else { | ||
// TODO : OBJECT ISN'T HERE YET, SAVE THIS DELTA FOR LATER // | // TODO : OBJECT ISN'T HERE YET, SAVE THIS DELTA FOR LATER // | ||
/* | /* | ||
|
@@ -510,10 +517,13 @@ - (NSData *) patchDelta:(NSData *)deltaData withObject:(ObjGitObject *)gitObject | ||
[destination appendBytes:[buffer bytes] length:cp_size]; | [destination appendBytes:[buffer bytes] length:cp_size]; | ||
//NSLog(@"dest: %@", destination); | //NSLog(@"dest: %@", destination); | ||
} else if(c[0] != 0) { | } else if(c[0] != 0) { | ||
if(c[0] > destSize) | |||
break; | |||
//NSLog(@"thingy: %d, %d", position, c[0]); | //NSLog(@"thingy: %d, %d", position, c[0]); | ||
[source getBytes:[buffer mutableBytes] range:NSMakeRange(position, c[0])]; | [deltaData getBytes:[buffer mutableBytes] range:NSMakeRange(position, c[0])]; | ||
[destination appendBytes:[buffer bytes] length:c[0]]; | [destination appendBytes:[buffer bytes] length:c[0]]; | ||
position += c[0]; | position += c[0]; | ||
destSize -= c[0]; | |||
} else { | } else { | ||
NSLog(@"invalid delta data"); | NSLog(@"invalid delta data"); | ||
} | } | ||
|
3 comments
on commit 679496b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sebnow: I might have fixed several of these issues already in my fork. I also urge you to take a look at geoffgarside/cocoagit. Don’t be confused by the name, cocoagit only depends on Foundation, not cocoa. That codebase currently has pretty decent read-support for loose and packed objects. We just need to add some of the methods for writing loose objects and it should do what objective-git does (minus a few parts of the serverhandler) without any memory issues or GPL code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
amazing – how did I not know about cocoagit? i could have sworn i searched for stuff before I started this. we should merge these projects – i can’t imagine it would be too hard…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@schacon: you sent me a message about it a months back, we discussed integration but didn’t get very far with it :-P
Shouldn’t be too difficult to merge the code provided the GPL isn’t an issue. I’d personally prefer to keep the MIT licence rather than move to GPL.
This should be autoreleased before returning. If it is only allocated, it must be released somewhere else. In Objective-C only objects that “own” something should retain, others should autorelease.