Skip to content

Commit e6a5b40

Browse files
committed
libgit2: use peel() in the pygit2 example
get_object() is deprecated, and we now have the common peeling mechanism which we can use to get to the commit more elegantly.
1 parent 05b0468 commit e6a5b40

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

book/B-embedding-git/sections/libgit2.asc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,9 @@ Our example program:
228228
[source,python]
229229
----
230230
pygit2.Repository("/path/to/repo") # open repository
231-
.head.resolve() # get a direct ref
232-
.get_object().message # get commit, read message
231+
.head # get the current branch
232+
.peel(pygit2.Commit) # walk down to the commit
233+
.message # read the message
233234
----
234235

235236

0 commit comments

Comments
 (0)