mirror of
https://github.com/gosticks/SwiftGit2.git
synced 2025-10-16 11:55:34 +00:00
Implement tagWithName()
This commit is contained in:
parent
4a0bcede38
commit
411b23cbbe
@ -283,6 +283,13 @@ final public class Repository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func tagWithName(name: String) -> Result<TagReference> {
|
public func tagWithName(name: String) -> Result<TagReference> {
|
||||||
return failure()
|
return referenceWithName("refs/tags/" + name)
|
||||||
|
.flatMap {
|
||||||
|
if let tag = $0 as? TagReference {
|
||||||
|
return success(tag)
|
||||||
|
} else {
|
||||||
|
return failure()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -335,5 +335,17 @@ class RepositorySpec: QuickSpec {
|
|||||||
expect(result.error()).notTo(beNil())
|
expect(result.error()).notTo(beNil())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
describe("-tagWithName()") {
|
||||||
|
it("should return the tag if it exists") {
|
||||||
|
let result = Fixtures.simpleRepository.tagWithName("tag-2")
|
||||||
|
expect(result.value()?.longName).to(equal("refs/tags/tag-2"))
|
||||||
|
}
|
||||||
|
|
||||||
|
it("should error if the branch doesn't exists") {
|
||||||
|
let result = Fixtures.simpleRepository.tagWithName("nonexistent")
|
||||||
|
expect(result.error()).notTo(beNil())
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user