File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,9 @@ NS_ASSUME_NONNULL_BEGIN
59
59
// / Returns the found object or nil on error.
60
60
- (id _Nullable)objectByPeelingTagError : (NSError **)error ;
61
61
62
+ // / Delete the receiver.
63
+ - (BOOL )delete : (NSError **)error ;
64
+
62
65
// / The underlying `git_object` as a `git_tag` object.
63
66
- (git_tag *)git_tag __attribute__((objc_returns_inner_pointer));
64
67
Original file line number Diff line number Diff line change @@ -84,4 +84,13 @@ - (id)objectByPeelingTagError:(NSError **)error {
84
84
return [[GTObject alloc ] initWithObj: target inRepository: self .repository];
85
85
}
86
86
87
+ - (BOOL )delete : (NSError **)error {
88
+ int gitError = git_tag_delete (self.repository .git_repository , self.name .UTF8String );
89
+ if (gitError != GIT_OK) {
90
+ if (error) *error = [NSError git_errorFor: gitError description: @" Tag deletion failed" ];
91
+ return NO ;
92
+ }
93
+ return YES ;
94
+ }
95
+
87
96
@end
Original file line number Diff line number Diff line change 39
39
expect (signature.
email ).
to (
equal (
@" [email protected] " ));
40
40
});
41
41
42
+ it (@" can delete tags" , ^{
43
+ NSError *error = nil ;
44
+
45
+ BOOL success = [tag delete: &error];
46
+ expect (@(success)).to (beTruthy ());
47
+ expect (error).to (beNil ());
48
+
49
+ success = [tag delete: &error];
50
+ expect (@(success)).to (beFalsy ());
51
+ expect (error).notTo (beNil ());
52
+ });
53
+
42
54
afterEach (^{
43
55
[self tearDown ];
44
56
});
You can’t perform that action at this time.
0 commit comments