Skip to content

Commit 6323916

Browse files
committed
objective-git and rugged
1 parent ef8abe0 commit 6323916

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

en/book/10-git-in-other-environments/chapter10.asc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,15 @@ For desktop Windows applications, there's a NuGet package that will help you get
283283
===== objective-git
284284

285285
If your application is running on an Apple platform, you're likely using Objective C as your implementation language.
286-
Objective-Git (TODO: URL) is the name of the Libgit2 bindings for that environment.
286+
Objective-Git (https://github.com/libgit2/objective-git[]) is the name of the Libgit2 bindings for that environment.
287287
Again, here's how to read HEAD's commit message:
288288

289289
[source,objc]
290290
-----
291-
// TODO
291+
GTRepository *repo = [[GTRepository alloc] initWithURL:[NSURL fileURLWithPath:"/path/to/repo"] error:NULL];
292+
GTReference *head = [repo headReferenceWithError:NULL];
293+
GTCommit *tip = head.resolvedTarget;
294+
NSString *message = tip.message;
292295
-----
293296

294297
===== rugged
@@ -298,7 +301,10 @@ Once again, HEAD's commit message:
298301

299302
[source,ruby]
300303
----
301-
# TODO
304+
repo = Rugged::Repository.new('path/to/my/repository')
305+
head = repo.head
306+
tip = repo.lookup head.resolve.target
307+
msg = tip.message
302308
----
303309

304310

0 commit comments

Comments
 (0)