mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
Bugfix: Stop committer names from getting mangled
If the commit's detail is not UTF8 then PBWebHistoryController's commitDetailsLoaded: method will drop down to Latin1. That can cause character's in the committer's name to not be converted correctly. Move parsing the name to PBGitRevList where the correct encoding can be determined.
This commit is contained in:
@@ -23,6 +23,7 @@ extern NSString * const kGitXCommitType;
|
||||
|
||||
NSString* subject;
|
||||
NSString* author;
|
||||
NSString *committer;
|
||||
NSString* details;
|
||||
NSString *_patch;
|
||||
NSArray* parents;
|
||||
@@ -53,6 +54,7 @@ extern NSString * const kGitXCommitType;
|
||||
@property (readonly) git_oid *sha;
|
||||
@property (copy) NSString* subject;
|
||||
@property (copy) NSString* author;
|
||||
@property (copy) NSString *committer;
|
||||
@property (readonly) NSArray* parents; // TODO: remove this and its uses
|
||||
|
||||
@property (assign) git_oid *parentShas;
|
||||
|
||||
@@ -16,6 +16,7 @@ NSString * const kGitXCommitType = @"commit";
|
||||
@implementation PBGitCommit
|
||||
|
||||
@synthesize repository, subject, timestamp, author, parentShas, nParents, sign, lineInfo;
|
||||
@synthesize committer;
|
||||
|
||||
- (NSArray *) parents
|
||||
{
|
||||
|
||||
+5
-1
@@ -96,7 +96,7 @@ using namespace std;
|
||||
std::map<string, NSStringEncoding> encodingMap;
|
||||
NSThread *currentThread = [NSThread currentThread];
|
||||
|
||||
NSString *formatString = @"--pretty=format:%H\01%e\01%an\01%s\01%P\01%at";
|
||||
NSString *formatString = @"--pretty=format:%H\01%e\01%an\01%cn\01%s\01%P\01%at";
|
||||
BOOL showSign = [rev hasLeftRight];
|
||||
|
||||
if (showSign)
|
||||
@@ -145,6 +145,9 @@ using namespace std;
|
||||
string author;
|
||||
getline(stream, author, '\1');
|
||||
|
||||
string committer;
|
||||
getline(stream, committer, '\1');
|
||||
|
||||
string subject;
|
||||
getline(stream, subject, '\1');
|
||||
|
||||
@@ -171,6 +174,7 @@ using namespace std;
|
||||
|
||||
[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)
|
||||
|
||||
@@ -7,6 +7,7 @@ var Commit = function(obj) {
|
||||
|
||||
this.refs = obj.refs();
|
||||
this.author_name = obj.author;
|
||||
this.committer_name = obj.committer;
|
||||
this.sha = obj.realSha();
|
||||
this.parents = obj.parents;
|
||||
this.subject = obj.subject;
|
||||
@@ -37,21 +38,17 @@ var Commit = function(obj) {
|
||||
if (typeof match !== 'undefined' && typeof match[2] !== 'undefined') {
|
||||
if (!(match[2].match(/@[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/)))
|
||||
this.author_email = match[2];
|
||||
|
||||
this.author_date = new Date(parseInt(match[3]) * 1000);
|
||||
|
||||
|
||||
if (typeof match[3] !== 'undefined')
|
||||
this.author_date = new Date(parseInt(match[3]) * 1000);
|
||||
|
||||
match = this.header.match(/\ncommitter (.*) <(.*@.*|.*)> ([0-9].*)/);
|
||||
if (typeof match !== 'undefined') {
|
||||
this.committer_name = match[1];
|
||||
this.committer_email = match[2];
|
||||
} else {
|
||||
this.committer_name = "undefined";
|
||||
this.committer_email = "undefined";
|
||||
}
|
||||
if (typeof match[2] !== 'undefined')
|
||||
this.committer_email = match[2];
|
||||
if (typeof match[3] !== 'undefined')
|
||||
this.committer_date = new Date(parseInt(match[3]) * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
this.committer_date = new Date(parseInt(match[3]) * 1000);
|
||||
}
|
||||
|
||||
this.reloadRefs = function() {
|
||||
|
||||
Reference in New Issue
Block a user