Skip to content

Commit

Permalink
More tests and functions for remote
Browse files Browse the repository at this point in the history
  • Loading branch information
kshyatt committed Jun 10, 2016
1 parent 396156f commit 8a59b2e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions base/libgit2/remote.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 11 additions & 1 deletion test/libgit2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8a59b2e

Please sign in to comment.