Created
November 19, 2008 13:40
-
-
Save pieter/26508 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 879a79bd78549264458a4d4a8f617b7d21a230da Mon Sep 17 00:00:00 2001 | |
From: Pieter de Bie <pdebie@ai.rug.nl> | |
Date: Wed, 19 Nov 2008 14:40:41 +0100 | |
Subject: [PATCH] Revert "Revert "Merge branch 'master' of git://github.com/bkerley/gitx"" | |
This reverts commit 22800c8fd3075a7770cb874ba4545e839ac32720. | |
--- | |
PBEasyPipe.h | 1 + | |
PBEasyPipe.m | 2 +- | |
PBGitCommit.m | 5 ++--- | |
PBGitRevList.m | 5 ++++- | |
4 files changed, 8 insertions(+), 5 deletions(-) | |
diff --git a/PBEasyPipe.h b/PBEasyPipe.h | |
index 8b15646..03b80b9 100644 | |
--- a/PBEasyPipe.h | |
+++ b/PBEasyPipe.h | |
@@ -12,6 +12,7 @@ | |
@interface PBEasyPipe : NSObject { | |
} | |
++ (NSTask *) taskForCommand:(NSString *)cmd withArgs:(NSArray *)args inDir:(NSString *)dir; | |
+ (NSFileHandle*) handleForCommand: (NSString*) cmd withArgs: (NSArray*) args; | |
+ (NSFileHandle*) handleForCommand: (NSString*) cmd withArgs: (NSArray*) args inDir: (NSString*) dir; | |
diff --git a/PBEasyPipe.m b/PBEasyPipe.m | |
index 1fe7f37..b18c12e 100644 | |
--- a/PBEasyPipe.m | |
+++ b/PBEasyPipe.m | |
@@ -106,7 +106,7 @@ | |
NSData* data = [handle readDataToEndOfFile]; | |
NSString* string = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; | |
- | |
+ [task waitUntilExit]; | |
// Strip trailing newline | |
if ([string hasSuffix:@"\n"]) | |
string = [string substringToIndex:[string length]-1]; | |
diff --git a/PBGitCommit.m b/PBGitCommit.m | |
index 8e9a50d..f38bf43 100644 | |
--- a/PBGitCommit.m | |
+++ b/PBGitCommit.m | |
@@ -40,9 +40,8 @@ | |
if (details != nil) | |
return details; | |
- NSFileHandle* handle = [self.repository handleForCommand:[@"show --pretty=raw " stringByAppendingString:self.sha]]; | |
- details = [[NSString alloc] initWithData:[handle readDataToEndOfFile] encoding: NSUTF8StringEncoding]; | |
- | |
+ details = [self.repository outputForCommand:[@"show --pretty=raw " stringByAppendingString:self.sha]]; | |
+ | |
return details; | |
} | |
diff --git a/PBGitRevList.m b/PBGitRevList.m | |
index 98922e8..b4d37ec 100644 | |
--- a/PBGitRevList.m | |
+++ b/PBGitRevList.m | |
@@ -82,7 +82,9 @@ | |
if ([rev hasPathLimiter]) | |
[arguments insertObject:@"--children" atIndex:1]; | |
- NSFileHandle* handle = [repository handleForArguments: arguments]; | |
+ NSTask *task = [PBEasyPipe taskForCommand:[PBGitBinary path] withArgs:arguments inDir:[repository fileURL].path]; | |
+ [task launch]; | |
+ NSFileHandle* handle = [task.standardOutput fileHandleForReading]; | |
int fd = [handle fileDescriptor]; | |
FILE* f = fdopen(fd, "r"); | |
@@ -147,6 +149,7 @@ | |
// Make sure the commits are stored before exiting. | |
[self performSelectorOnMainThread:@selector(setCommits:) withObject:revisions waitUntilDone:YES]; | |
+ [task waitUntilExit]; | |
} | |
@end | |
-- | |
1.6.0.3.875.g5bf73+GitX |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment