From 4432997fb10828faee81a748d7f8a4e11d87d9e5 Mon Sep 17 00:00:00 2001 From: German Laullon Date: Wed, 18 May 2011 17:21:36 +0200 Subject: [PATCH] [GH-15] disappearing history --- PBGitRevList.mm | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/PBGitRevList.mm b/PBGitRevList.mm index 58992bf..6da2424 100644 --- a/PBGitRevList.mm +++ b/PBGitRevList.mm @@ -102,11 +102,11 @@ using namespace std; std::map encodingMap; NSThread *currentThread = [NSThread currentThread]; - NSString *formatString = @"--pretty=format:%H\01%e\01%aN\01%cN\01%s\01%P\01%at"; + NSString *formatString = @"--pretty=format:%H\01%e\01%aN\01%cN\01%P\01%at\01%s"; BOOL showSign = [rev hasLeftRight]; if (showSign) - formatString = [formatString stringByAppendingString:@"\01%m"]; + formatString = [@"%m\01" stringByAppendingString:formatString]; NSMutableArray *arguments = [NSMutableArray arrayWithObjects:@"log", @"-z", @"--topo-order", @"--children", formatString, nil]; @@ -129,6 +129,16 @@ using namespace std; if ([currentThread isCancelled]) break; + char c; + char sign; + if (showSign) + { + stream >> sign; + stream >> c; // Remove separator + if (sign != '>' && sign != '<' && sign != '^' && sign != '-') + DLog(@"Error loading commits: sign not correct"); + } + string sha; if (!getline(stream, sha, '\1')) break; @@ -151,15 +161,15 @@ using namespace std; git_oid_mkstr(&oid, sha.c_str()); PBGitCommit *newCommit = [PBGitCommit commitWithRepository:repository andSha:[PBGitSHA shaWithOID:oid]]; + if (showSign) + [newCommit setSign: sign]; + string author; getline(stream, author, '\1'); string committer; getline(stream, committer, '\1'); - string subject; - getline(stream, subject, '\1'); - string parentString; getline(stream, parentString, '\1'); if (parentString.size() != 0) @@ -180,26 +190,14 @@ using namespace std; int time; stream >> time; + string subject; + getline(stream, subject, '\0'); + [newCommit setSubject:[NSString stringWithCString:subject.c_str() encoding:encoding]]; [newCommit setAuthor:[NSString stringWithCString:author.c_str() encoding:encoding]]; [newCommit setCommitter:[NSString stringWithCString:committer.c_str() encoding:encoding]]; [newCommit setTimestamp:time]; - if (showSign) - { - char c; - stream >> c; // Remove separator - stream >> c; - if (c != '>' && c != '<' && c != '^' && c != '-') - DLog(@"Error loading commits: sign not correct"); - [newCommit setSign: c]; - } - - char c; - stream >> c; - if (c != '\0') - cout << "Error" << endl; - [revisions addObject: newCommit]; if (isGraphing) [g decorateCommit:newCommit];