Skip to content

Commit

Permalink
Deprecate GitAnyObject -> GitUnknownObject (#19935)
Browse files Browse the repository at this point in the history
  • Loading branch information
kshyatt authored and simonbyrne committed Jan 9, 2017
1 parent 9c3c2d5 commit ade8097
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
3 changes: 3 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1522,4 +1522,7 @@ unsafe_wrap(::Type{String}, p::Cstring, len::Integer, own::Bool=false) =
@deprecate finalize(sa::LibGit2.StrArrayStruct) close(sa)
@deprecate finalize(sa::LibGit2.Buffer) close(sa)

# Rename LibGit2.GitAnyObject to LibGit2.GitUnknownObject (part of #19839)
eval(LibGit2, :(Base.@deprecate_binding GitAnyObject GitUnknownObject))

# End deprecations scheduled for 0.6
4 changes: 2 additions & 2 deletions base/libgit2/libgit2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ function checkout!(repo::GitRepo, commit::AbstractString = "";
end

# search for commit to get a commit object
obj = get(GitAnyObject, repo, Oid(commit))
obj = get(GitUnknownObject, repo, Oid(commit))
obj === nothing && return
try
peeled = peel(obj, Consts.OBJ_COMMIT)
Expand Down Expand Up @@ -341,7 +341,7 @@ end

""" git reset [--soft | --mixed | --hard] <commit> """
function reset!(repo::GitRepo, commit::Oid, mode::Cint = Consts.RESET_MIXED)
obj = get(GitAnyObject, repo, commit)
obj = get(GitUnknownObject, repo, commit)
# object must exist for reset
obj === nothing && throw(GitError(Error.Object, Error.ERROR, "Commit `$(string(commit))` object not found"))
try
Expand Down
2 changes: 1 addition & 1 deletion base/libgit2/reference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function peel{T <: GitObject}(::Type{T}, ref::GitReference)
return Oid()
elseif err != Int(Error.GIT_OK)
if obj_ptr_ptr[] != C_NULL
close(GitAnyObject(ref.repo, obj_ptr_ptr[]))
close(GitUnknownObject(ref.repo, obj_ptr_ptr[]))
end
throw(Error.GitError(err))
end
Expand Down
6 changes: 3 additions & 3 deletions base/libgit2/repository.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function revparse(repo::GitRepo, objname::AbstractString)
err = ccall((:git_revparse_single, :libgit2), Cint,
(Ptr{Ptr{Void}}, Ptr{Void}, Cstring), obj_ptr_ptr, repo.ptr, objname)
err != 0 && return nothing
return GitAnyObject(repo, obj_ptr_ptr[])
return GitUnknownObject(repo, obj_ptr_ptr[])
end

""" Returns id of a found object """
Expand Down Expand Up @@ -104,7 +104,7 @@ function get{T <: GitObject}(::Type{T}, repo::GitRepo, oid::Oid, oid_size::Int=O
return nothing
elseif err != Int(Error.GIT_OK)
if obj_ptr_ptr[] != C_NULL
close(GitAnyObject(repo, obj_ptr_ptr[]))
close(GitUnknownObject(repo, obj_ptr_ptr[]))
end
throw(Error.GitError(err))
end
Expand Down Expand Up @@ -134,7 +134,7 @@ function peel(obj::GitObject, obj_type::Cint)
return Oid()
elseif err != Int(Error.GIT_OK)
if peeled_ptr_ptr[] != C_NULL
close(GitAnyObject(obj.repo, peeled_ptr_ptr[]))
close(GitUnknownObject(obj.repo, peeled_ptr_ptr[]))
end
throw(Error.GitError(err))
end
Expand Down
2 changes: 1 addition & 1 deletion base/libgit2/tree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ function object(repo::GitRepo, te::GitTreeEntry)
@check ccall((:git_tree_entry_to_object, :libgit2), Cint,
(Ptr{Ptr{Void}}, Ptr{Void}, Ref{Void}),
obj_ptr_ptr, repo.ptr, te.ptr)
return GitAnyObject(repo, obj_ptr_ptr[])
return GitUnknownObject(repo, obj_ptr_ptr[])
end
10 changes: 5 additions & 5 deletions base/libgit2/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ for (typ, reporef, sup, cname) in [
(:GitRebase, :GitRepo, :AbstractGitObject, :git_rebase),
(:GitStatus, :GitRepo, :AbstractGitObject, :git_status_list),
(:GitBranchIter, :GitRepo, :AbstractGitObject, :git_branch_iterator),
(:GitAnyObject, :GitRepo, :GitObject, :git_object),
(:GitUnknownObject, :GitRepo, :GitObject, :git_object),
(:GitCommit, :GitRepo, :GitObject, :git_commit),
(:GitBlob, :GitRepo, :GitObject, :git_blob),
(:GitTree, :GitRepo, :GitObject, :git_tree),
Expand Down Expand Up @@ -527,8 +527,8 @@ function getobjecttype{T<:GitObject}(::Type{T})
Consts.OBJ_BLOB
elseif T == GitTag
Consts.OBJ_TAG
elseif T == GitAnyObject
Consts.OBJ_ANY
elseif T == GitUnknownObject
Consts.OBJ_ANY # this name comes from the header
else
throw(GitError(Error.Object, Error.ENOTFOUND, "Type $T is not supported"))
end
Expand All @@ -543,8 +543,8 @@ function getobjecttype(obj_type::Cint)
GitBlob
elseif obj_type == Consts.OBJ_TAG
GitTag
elseif obj_type == Consts.OBJ_ANY
GitAnyObject
elseif obj_type == Consts.OBJ_ANY #this name comes from the header
GitUnknownObject
else
throw(GitError(Error.Object, Error.ENOTFOUND, "Object type $obj_type is not supported"))
end
Expand Down

0 comments on commit ade8097

Please sign in to comment.