Skip to content

Commit

Permalink
Merge pull request #20638 from JuliaLang/ksh/fixblob
Browse files Browse the repository at this point in the history
Fix bug in GitBlob lookup and add test
  • Loading branch information
kshyatt authored Feb 17, 2017
2 parents cb50dee + 61d5912 commit ded2d87
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
1 change: 1 addition & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,7 @@ end
@deprecate object(repo::GitRepo, te::GitTreeEntry) GitObject(repo, te) false
@deprecate commit(ann::GitAnnotated) GitHash(ann) false
@deprecate cat{T<:GitObject}(repo::GitRepo, ::Type{T}, object::AbstractString) cat(repo, object)
@deprecate lookup(repo::GitRepo, oid::GitHash) GitBlob(repo, oid) false
end

# when this deprecation is deleted, remove all calls to it, and all
Expand Down
8 changes: 0 additions & 8 deletions base/libgit2/blob.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@ function isbinary(blob::GitBlob)
return bin_flag == 1
end

function lookup(repo::GitRepo, oid::GitHash)
blob_ptr_ptr = Ref{Ptr{Void}}(C_NULL)
@check ccall((:git_blob_lookup, :libgit2), Cint,
(Ptr{Ptr{Void}}, Ptr{Void}, Ref{GitHash}),
blob_ptr_ptr, repo.ptr, Ref(oid))
return GitBlob(blob_ptr_ptr[])
end

"""
LibGit2.addblob!(repo::GitRepo, path::AbstractString)
Expand Down
5 changes: 5 additions & 0 deletions test/libgit2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -446,10 +446,15 @@ mktempdir() do dir
id = LibGit2.addblob!(repo, blob_file)
blob = LibGit2.GitBlob(repo, id)
@test LibGit2.isbinary(blob)
len1 = length(blob)
blob_show_strs = split(sprint(show, blob), "\n")
@test blob_show_strs[1] == "GitBlob:"
@test contains(blob_show_strs[2], "Blob id:")
@test blob_show_strs[3] == "Contents are binary."

blob2 = LibGit2.GitBlob(repo, LibGit2.GitHash(blob))
@test LibGit2.isbinary(blob2)
@test length(blob2) == len1
finally
close(repo)
end
Expand Down

2 comments on commit ded2d87

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @jrevels

Please sign in to comment.