Skip to content
This repository was archived by the owner on Oct 17, 2021. It is now read-only.

Commit 4fa011a

Browse files
committed
Rename add to addNote
1 parent dc6d4d2 commit 4fa011a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Sources/Git/Object.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public class Object {
8080
}
8181

8282
@discardableResult
83-
public func add(note: String, author: Signature? = nil, committer: Signature? = nil, force: Bool = false) throws -> Note? {
83+
public func addNote(_ message: String, author: Signature? = nil, committer: Signature? = nil, force: Bool = false) throws -> Note? {
8484
let repository = owner
8585

8686
var committer = (try committer ?? author ?? Signature.default(for: repository)).rawValue
@@ -89,7 +89,7 @@ public class Object {
8989
// TODO determine parent Note commit
9090

9191
var objectOID = id.rawValue
92-
try attempt { git_note_create(nil, repository.pointer, nil, &author, &committer, &objectOID, note, force ? 1 : 0) }
92+
try attempt { git_note_create(nil, repository.pointer, nil, &author, &committer, &objectOID, message, force ? 1 : 0) }
9393

9494
return self.note
9595
}

Tests/GitTests/GitTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ final class GitTests: XCTestCase {
9898
XCTAssertNotNil(blob)
9999
XCTAssertEqual(String(data: blob!.data, encoding: .utf8), "Hello, world!")
100100

101-
let note = try commit.add(note: #"{"test": true }"#, author: signature, committer: signature)
101+
let note = try commit.addNote(#"{"test": true }"#, author: signature, committer: signature)
102102
XCTAssertNotNil(note?.message, #"{"test": true }"#)
103103

104104
try repository.createLightweightTag(named: "0.0.1", target: commit)
@@ -108,6 +108,7 @@ final class GitTests: XCTestCase {
108108
XCTAssertEqual((repository["0.0.1"]?.target as? Commit)?.message, "Initial commit")
109109
XCTAssertEqual((repository["master"]?.target as? Commit)?.message, "Initial commit")
110110
XCTAssertEqual((repository["HEAD"]?.target as? Commit)?.message, "Initial commit")
111+
XCTAssertEqual((repository["HEAD"]?.target as? Commit)?.note?.message, #"{"test": true }"#)
111112
}
112113
}
113114

0 commit comments

Comments
 (0)