Skip to content

Commit

Permalink
Merge pull request JuliaLang#23714 from JuliaLang/ksh/libgit2test
Browse files Browse the repository at this point in the history
Little misc tests for libgit2
  • Loading branch information
ararslan committed Sep 16, 2017
2 parents 99189e4 + 8c07a74 commit b6b093e
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion test/libgit2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -777,10 +777,13 @@ mktempdir() do dir
show_strs = split(sprint(show, tag1ref), "\n")
@test show_strs[1] == "GitReference:"
@test show_strs[2] == "Tag with name refs/tags/$tag1"
tag1tag = LibGit2.peel(LibGit2.GitTag,tag1ref)
tag1tag = LibGit2.peel(LibGit2.GitTag, tag1ref)
@test LibGit2.name(tag1tag) == tag1
@test LibGit2.target(tag1tag) == commit_oid1
@test sprint(show, tag1tag) == "GitTag:\nTag name: $tag1 target: $commit_oid1"
# peels to the commit the tag points to
tag1cmt = LibGit2.peel(tag1ref)
@test LibGit2.GitHash(tag1cmt) == commit_oid1
tag_oid2 = LibGit2.tag_create(repo, tag2, commit_oid2)
@test !LibGit2.iszero(tag_oid2)
tags = LibGit2.tag_list(repo)
Expand Down Expand Up @@ -1037,6 +1040,23 @@ mktempdir() do dir
# from branch/ff_c using branch name
@test LibGit2.merge!(repo, branch="refs/heads/branch/ff_c")
@test LibGit2.is_ancestor_of(string(oldhead), string(LibGit2.head_oid(repo)), repo)

LibGit2.branch!(repo, "branch/ff_d")
open(joinpath(LibGit2.path(repo),"ff_file7"),"w") do f
write(f, "777\n")
end
LibGit2.add!(repo, "ff_file7")
LibGit2.commit(repo, "add ff_file7")
branchhead = LibGit2.head_oid(repo)
LibGit2.branch!(repo, "master")
# switch back, now try to ff-merge the changes
# from branch/a
# set up the merge using GitAnnotated objects
# from a fetchhead
fh = LibGit2.fetchheads(repo)
upst_ann = LibGit2.GitAnnotated(repo, fh[1])
@test LibGit2.merge!(repo, [upst_ann], true)
@test LibGit2.is_ancestor_of(string(oldhead), string(LibGit2.head_oid(repo)), repo)
finally
close(repo)
end
Expand Down

0 comments on commit b6b093e

Please sign in to comment.