Skip to content

Commit

Permalink
do not need to free lookup returned value
Browse files Browse the repository at this point in the history
  • Loading branch information
wildart committed Jun 15, 2016
1 parent badd1ba commit 49571ec
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions test/libgit2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -463,28 +463,25 @@ mktempdir() do dir
# get tree entry by filename
@test isnull(LibGit2.lookup(ht, "no such name"))
tfte = get(LibGit2.lookup(ht, test_file))
try
@test LibGit2.filename(tfte) == test_file
@test LibGit2.filemode(tfte) == Cint(LibGit2.Consts.FILEMODE_BLOB)

@test isnull(LibGit2.GitTreeEntry(ht, LibGit2.Oid()))
tfoid = LibGit2.oid(tfte)
tfte2 = LibGit2.GitTreeEntry(ht, tfoid)
try
@test !isnull(tfte2)
@test LibGit2.filename(get(tfte2)) == test_file
@test LibGit2.filename(tfte) == test_file
@test LibGit2.filemode(tfte) == Cint(LibGit2.Consts.FILEMODE_BLOB)

tfcontent = LibGit2.with(LibGit2.object(repo, get(tfte2))) do obj
LibGit2.with(LibGit2.peel(LibGit2.GitBlob, obj)) do blob
unsafe_string(convert(Cstring, LibGit2.content(blob)))
end
@test isnull(LibGit2.GitTreeEntry(ht, LibGit2.Oid()))
tfoid = LibGit2.oid(tfte)
tfte2 = LibGit2.GitTreeEntry(ht, tfoid)
try
@test !isnull(tfte2)
@test LibGit2.filename(get(tfte2)) == test_file

tfcontent = LibGit2.with(LibGit2.object(repo, get(tfte2))) do obj
LibGit2.with(LibGit2.peel(LibGit2.GitBlob, obj)) do blob
unsafe_string(convert(Cstring, LibGit2.content(blob)))
end
@test startswith(tfcontent, commit_msg1)
finally
finalize(tfte2)
end
@test startswith(tfcontent, commit_msg1)
finally
finalize(tfte)
finalize(tfte2)
end

entrs = LibGit2.treewalk(addfile, ht, String[])[]
Expand Down

0 comments on commit 49571ec

Please sign in to comment.