diff --git a/base/libgit2/remote.jl b/base/libgit2/remote.jl index ef0da8c76d4a8f..d757180c6d59c5 100644 --- a/base/libgit2/remote.jl +++ b/base/libgit2/remote.jl @@ -88,3 +88,9 @@ function push{T<:AbstractString}(rmt::GitRemote, refspecs::Vector{T}; !no_refs && finalize(sa) end end + +function name(rmt::GitRemote) + str_ptr = ccall((:git_remote_name, :libgit2), Cstring, (Ptr{Void}, ), rmt.ptr) + str_ptr == C_NULL && throw(Error.GitError(Error.ERROR)) + return unsafe_string(str_ptr) +end diff --git a/test/libgit2.jl b/test/libgit2.jl index 312cfa7747602f..a0bcfa18b654f5 100644 --- a/test/libgit2.jl +++ b/test/libgit2.jl @@ -52,6 +52,16 @@ const LIBGIT2_VER = v"0.23.0" finally finalize(sa2) end + vs = vec([p1,p2]) + sa4 = LibGit2.StrArrayStruct(vs) + try + arr3 = convert(Vector{AbstractString}, sa4) + @test arr3[1] == p1 + @test arr3[2] == p2 + finally + finalize(sa4) + end + #end #@testset "Signature" begin @@ -143,7 +153,6 @@ mktempdir() do dir config = joinpath(cache_repo, ".git", "config") lines = split(open(readstring, config, "r"), "\n") @test any(x->x == "[remote \"upstream\"]", lines) - remote = LibGit2.get(LibGit2.GitRemote, repo, branch) @test LibGit2.url(remote) == repo_url @test LibGit2.isattached(repo) @@ -218,6 +227,7 @@ mktempdir() do dir @test LibGit2.fetch_refspecs(rmt)[1] == "+refs/*:refs/*" @test LibGit2.isattached(repo) @test LibGit2.remotes(repo) == ["origin"] + @test LibGit2.name(rmt) == "origin" finally finalize(rmt) end