mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
Bugfix: obj.realSha() in history.js returns nil/undefined more often than not.
My guess is that this is caused by the rather large buffer size of 2000. Since we know that a full SHA will never be longer than 40+1 bytes, we simply use a default define from libgit2 for the buffer size.
This commit is contained in:
+4
-4
@@ -26,8 +26,8 @@ NSString * const kGitXCommitType = @"commit";
|
||||
NSMutableArray *p = [NSMutableArray arrayWithCapacity:nParents];
|
||||
for (i = 0; i < nParents; ++i)
|
||||
{
|
||||
char buff[2000];
|
||||
char * s = git_oid_to_string(buff, 2000, parentShas + i);
|
||||
char buff[GIT_OID_HEXSZ+1];
|
||||
char * s = git_oid_to_string(buff, GIT_OID_HEXSZ+1, parentShas + i);
|
||||
[p addObject:[NSString stringWithUTF8String:s]];
|
||||
}
|
||||
return p;
|
||||
@@ -127,8 +127,8 @@ NSString * const kGitXCommitType = @"commit";
|
||||
- (NSString *)realSha
|
||||
{
|
||||
if (!realSHA) {
|
||||
char buff[2000];
|
||||
char * hex = git_oid_to_string(buff, 2000, &sha);
|
||||
char buff[GIT_OID_HEXSZ+1];
|
||||
char * hex = git_oid_to_string(buff, GIT_OID_HEXSZ+1, &sha);
|
||||
realSHA = [NSString stringWithUTF8String:hex];
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ var Commit = function(obj) {
|
||||
|
||||
this.refs = obj.refs();
|
||||
this.author_name = obj.author;
|
||||
this.sha = obj.realSha();
|
||||
this.parents = obj.parents;
|
||||
this.sha = obj.realSha();
|
||||
this.parents = obj.parents;
|
||||
this.subject = obj.subject;
|
||||
this.notificationID = null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user