-
Notifications
You must be signed in to change notification settings - Fork 281
Give GTTag Some Love #253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Give GTTag Some Love #253
Changes from all commits
f8c0cf9
5adec05
65bbfb2
dabe937
73de89c
98c604a
a2a052c
12e411e
3b92d8c
98883aa
2baa09a
02f4598
f39842e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,30 +38,28 @@ | |
@implementation GTTag | ||
|
||
- (NSString *)description { | ||
return [NSString stringWithFormat:@"<%@: %p> name: %@, message: %@, targetType: %@", NSStringFromClass([self class]), self, [self name], [self message], [self targetType]]; | ||
return [NSString stringWithFormat:@"<%@: %p> name: %@, message: %@, targetType: %d", NSStringFromClass([self class]), self,self.name, self.message, self.targetType]; | ||
} | ||
|
||
|
||
#pragma mark API | ||
|
||
- (NSString *)message { | ||
return [NSString stringWithUTF8String:git_tag_message(self.git_tag)]; | ||
return @(git_tag_message(self.git_tag)); | ||
} | ||
|
||
- (NSString *)name { | ||
return [NSString stringWithUTF8String:git_tag_name(self.git_tag)]; | ||
return @(git_tag_name(self.git_tag)); | ||
} | ||
|
||
- (GTObject *)target { | ||
git_object *t; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we fix the rogue spacing here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I don't see it. :( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe it's a tabs vs spaces issue. Looks like this used to use spaces at some point. |
||
// todo: might want to actually return an error here | ||
int gitError = git_tag_target(&t, self.git_tag); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. More weird legacy spacing here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure here either. |
||
if(gitError < GIT_OK) return nil; | ||
return [GTObject objectWithObj:(git_object *)t inRepository:self.repository]; | ||
if (gitError < GIT_OK) return nil; | ||
return [GTObject objectWithObj:(git_object *)t inRepository:self.repository]; | ||
} | ||
|
||
- (NSString *)targetType { | ||
return [NSString stringWithUTF8String:git_object_type2string(git_tag_target_type(self.git_tag))]; | ||
- (GTObjectType)targetType { | ||
return (GTObjectType)git_tag_target_type(self.git_tag); | ||
} | ||
|
||
- (GTSignature *)tagger { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,7 +106,7 @@ | |
expect(tag.message).to.equal(@"my tag\n"); | ||
expect(tag.name).to.equal(@"a_new_tag"); | ||
expect(tag.target.SHA).to.equal(@"5b5b025afb0b4c913b4c338a42934a3863bf3644"); | ||
expect(tag.targetType).to.equal(@"commit"); | ||
expect(tag.targetType).to.equal(GTObjectTypeCommit); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😍 |
||
|
||
rm_loose(self.class, newOID.SHA); | ||
NSFileManager *m = [[NSFileManager alloc] init]; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// GTOIDSpec.m | ||
// ObjectiveGitFramework | ||
// | ||
// Created by Ezekiel Pierson on 2013-09-06. | ||
// Copyright (c) 2013 GitHub, Inc. All rights reserved. | ||
// | ||
|
||
#import "GTTag.h" | ||
|
||
SpecBegin(GTTag) | ||
|
||
__block GTTag *tag; | ||
|
||
beforeEach(^{ | ||
NSError *error = nil; | ||
GTRepository *repo = [GTRepository repositoryWithURL:[NSURL fileURLWithPath:TEST_REPO_PATH(self.class)] error:&error]; | ||
NSString *tagSHA = @"0c37a5391bbff43c37f0d0371823a5509eed5b1d"; | ||
tag = (GTTag *)[repo lookupObjectBySHA:tagSHA error:&error]; | ||
expect(error).to.beFalsy; | ||
expect(tag).to.beTruthy; | ||
expect(tagSHA).to.equal(tag.SHA); | ||
}); | ||
|
||
it(@"can read tag data", ^{ | ||
expect(tag.type).to.equal(@"tag"); | ||
expect(tag.name).to.equal(@"v1.0"); | ||
expect(tag.message).to.equal(@"test tag message\n"); | ||
expect(tag.target.SHA).to.equal(@"5b5b025afb0b4c913b4c338a42934a3863bf3644"); | ||
expect(GTObjectTypeCommit).to.equal(tag.targetType); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All of the above comparisons are the wrong way round. |
||
|
||
GTSignature *signature = tag.tagger; | ||
expect(signature.name).to.equal(@"Scott Chacon"); | ||
expect((int)[signature.time timeIntervalSince1970]).to.equal(1288114383); | ||
expect(signature.email).to.equal(@"[email protected]"); | ||
}); | ||
|
||
SpecEnd |
This file was deleted.
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.
All this whitespace is unnecessary.