diff --git a/base/deprecated.jl b/base/deprecated.jl index 487fbfa131150..6cbb1669286ab 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -1763,4 +1763,11 @@ end) return false end +# Not exported +eval(LibGit2, quote + function owner(x) + depwarn("owner(x) is deprecated, use repository(x) instead.", :owner) + repository(x) + end +end) # End deprecations scheduled for 0.6 diff --git a/base/libgit2/index.jl b/base/libgit2/index.jl index d5e7a303f51d7..476be19a3c16c 100644 --- a/base/libgit2/index.jl +++ b/base/libgit2/index.jl @@ -24,13 +24,16 @@ function write_tree!(idx::GitIndex) return oid_ptr[] end -function owner(idx::GitIndex) - isnull(idx.nrepo) && throw(GitError(Error.Index, Error.ENOTFOUND, "Index does not have an owning repository.")) - return Base.get(idx.nrepo) +function repository(idx::GitIndex) + if isnull(idx.nrepo) + throw(GitError(Error.Index, Error.ENOTFOUND, "Index does not have an owning repository.")) + else + return Base.get(idx.nrepo) + end end function read_tree!(idx::GitIndex, tree_id::GitHash) - repo = owner(idx) + repo = repository(idx) tree = get(GitTree, repo, tree_id) try @check ccall((:git_index_read_tree, :libgit2), Cint, @@ -114,5 +117,5 @@ end stage(ie::IndexEntry) = ccall((:git_index_entry_stage, :libgit2), Cint, (Ptr{IndexEntry},), Ref(ie)) function Base.show(io::IO, idx::GitIndex) - println(io, "GitIndex:\nOwner: ", owner(idk), "\nNumber of elements: ", count(idx)) + println(io, "GitIndex:\nRepository: ", repository(idk), "\nNumber of elements: ", count(idx)) end diff --git a/base/libgit2/reference.jl b/base/libgit2/reference.jl index 2484b2ffcd7bc..5a5677a660bc4 100644 --- a/base/libgit2/reference.jl +++ b/base/libgit2/reference.jl @@ -196,7 +196,7 @@ function upstream(ref::GitReference) return GitReference(ref.repo, ref_ptr_ptr[]) end -owner(ref::GitReference) = ref.repo +repository(ref::GitReference) = ref.repo function target!(ref::GitReference, new_oid::GitHash; msg::AbstractString="") ref_ptr_ptr = Ref{Ptr{Void}}(C_NULL) diff --git a/base/libgit2/tree.jl b/base/libgit2/tree.jl index 03545ee175d34..8509f6ae628cb 100644 --- a/base/libgit2/tree.jl +++ b/base/libgit2/tree.jl @@ -16,7 +16,7 @@ function treewalk(f::Function, tree::GitTree, payload=Any[], post::Bool = false) return cbf_payload end -function owner(tree::GitTree) +function repository(tree::GitTree) repo_ptr = ccall((:git_tree_owner, :libgit2), Ptr{Void}, (Ptr{Void},), tree.ptr) return GitRepo(repo_ptr) diff --git a/test/libgit2.jl b/test/libgit2.jl index c86994547b602..a46665cca7921 100644 --- a/test/libgit2.jl +++ b/test/libgit2.jl @@ -325,7 +325,7 @@ mktempdir() do dir @test LibGit2.shortname(brref) == master_branch @test LibGit2.ishead(brref) @test LibGit2.upstream(brref) === nothing - @test repo.ptr == LibGit2.owner(brref).ptr + @test repo.ptr == LibGit2.repository(brref).ptr @test brnch == master_branch @test LibGit2.headname(repo) == master_branch LibGit2.branch!(repo, test_branch, string(commit_oid1), set_head=false)