Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package system on libgit2 #11196

Merged
merged 90 commits into from
Sep 29, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
865c87c
changing `installed` based to support `libgit2`
wildart May 5, 2015
851c053
merged installed & dependents into `Read`, moved `libgit2` calls into…
wildart May 5, 2015
12a525c
removed `Git` module calls from `Read`
wildart May 5, 2015
b2be2d7
changed string type
wildart May 5, 2015
9c88dbc
renamed to 'libgit2'
wildart May 6, 2015
cdf28d4
fixed to AbstractString
wildart May 7, 2015
c57ec72
added libgit2 error handling
wildart May 8, 2015
7140141
write to repo configuration value with any accepted type
wildart May 8, 2015
f836a71
added `clone` & `fetch`, updated 'Dir' and `Cache`
wildart May 8, 2015
61ba8f0
switching to `Ref` type
wildart May 8, 2015
ba591fe
changed incorrect types & syntax
wildart May 8, 2015
efb5bba
working on `Generate`
wildart May 9, 2015
bb40811
fixed changed api
wildart May 9, 2015
4ca8175
construct type pragmatically
wildart May 9, 2015
25a7d0a
added `with_libgit2` helper function
wildart May 9, 2015
3516046
package generator works!!!
wildart May 10, 2015
3198519
added default value to GitConfig 'get' to prevent exceptions
wildart May 10, 2015
3305ed6
added anyobject type and `checkout` functions
wildart May 10, 2015
071a872
no more `git` in Write
wildart May 10, 2015
87e7fbf
fixed `revparse`, `isdirty` & errors in `Write`
wildart May 10, 2015
409bb27
improved git types description
wildart May 10, 2015
9802b85
transitioned Entry.add
wildart May 11, 2015
e2c1a38
transitioned Entry.clone
wildart May 11, 2015
ff9b5d6
GitError is Exception subclass
wildart May 11, 2015
f55de93
fixed `need_update`, `head_oid`, `revparse`, `CHECKOUT_NONE`, `Checko…
wildart May 11, 2015
6dedbb2
transitioned Entry: `free` & `pin`
wildart May 11, 2015
8fbf905
refactored error handling
wildart May 13, 2015
e4ac8bd
error fix: nonexistent directory case, cannot create empty wrapper
wildart May 13, 2015
8ff8a25
made options structures immutable with convinient constructors
wildart May 13, 2015
273ecfa
rewrote Write module: changed resource management and commit checkout.
wildart May 13, 2015
c1179e7
added proper `checkout` & `branch` functions
wildart May 13, 2015
67435f6
added tests for `libgit2`
wildart May 16, 2015
740194a
removed unnecessary `rethrow` calls
wildart May 16, 2015
30688dc
transitioned `checkout`, `free`, `update`, `register`
wildart May 17, 2015
331f8c2
switched to https
wildart May 17, 2015
dcac546
added `gitdir` (location of repo '.git') and `path` (repo location)
wildart May 17, 2015
52d72cb
import Base for `finalize`s
wildart May 17, 2015
3e957e8
transitioned `tag` & `register`
wildart May 17, 2015
3ff4628
fixed `get` with default for GitConfig
wildart May 18, 2015
c9d04e2
fixed errors, set to run only pkg & libgit2 tests
wildart May 18, 2015
d409e13
added PkgError exception
wildart May 19, 2015
3335bf7
added licence line
wildart May 19, 2015
b5efeef
fixed GitHub saved token retrieval & PkgError visibility
wildart May 19, 2015
efde7ed
added `push`, transitioned `pull_request`
wildart May 19, 2015
f1b5694
fixed import error
wildart May 20, 2015
c1298e8
added `revcount` for counting differences
wildart May 20, 2015
6943209
fixed exceptions in tests
wildart May 20, 2015
8612798
speedup `prefetch` call
wildart May 21, 2015
9016b11
refactored GitConfig methods
wildart May 21, 2015
21fcc2c
removed prefix from `finalize` calls
wildart May 21, 2015
2d456ab
newline at end of file
wildart May 21, 2015
327e989
No more `Git`!
wildart May 23, 2015
307aa8b
partial fix for #11580
wildart Jun 6, 2015
70963a9
adopting CString & refactoring
wildart Jun 27, 2015
f8b0dec
added prototype of git repl
wildart Jun 28, 2015
c0d59a0
added `clone` & `init` command
wildart Jul 2, 2015
09406ad
refactoring commit message call
wildart Jul 8, 2015
50b81f6
rebased, moved `libgit2` to `base`, updated to 0.23 & tests
testurser Jul 9, 2015
c9fcd0b
fixed repl tests
wildart Jul 9, 2015
39aa02b
tuple-based Oid
testurser Jul 9, 2015
8b5dd78
added `Oid` tests, modified `free` with tuple parameters,
testurser Jul 10, 2015
5a4aad0
fixed: string value retrieval from config, resource management in tests
wildart Jul 10, 2015
c254abb
fixed 0.23 compatibility errors, added more commands to git-repl
wildart Jul 13, 2015
f58f762
used new enums, changed location of GITHUB_REGEX, exported PkgError
wildart Jul 13, 2015
fad9263
switch to release build for windows
wildart Jul 14, 2015
93af677
diff & rebase update to v0.23, error fixes
wildart Jul 27, 2015
1347d68
added callbacks, updated push & publish
wildart Jul 28, 2015
25778f7
merge overhaul, added credential & fetchhead callbacks, small fixes &…
wildart Aug 2, 2015
9f3bad9
added extended repo open, ported Base.url
wildart Aug 2, 2015
5fa68d5
fixed Pkg.pull_request, suppress backtrace PkgError & code cleanup
wildart Aug 2, 2015
f3301fb
switch GitRepo to GitRevWalker
wildart Aug 2, 2015
9690fa6
added to GitREPL: branch & tag
wildart Aug 2, 2015
c5350e5
added `commit` to Git REPL & fixed commands help info
wildart Aug 2, 2015
243e1a8
fix Git REPL `commit` output
wildart Aug 2, 2015
7aa333b
added `checkout` to Git REPL
wildart Aug 2, 2015
2f8c7b7
fixed remote branch name
wildart Aug 2, 2015
2853db0
reomoved Git module and its tests
wildart Aug 2, 2015
0ccfdfe
fix error message & add all tests
wildart Aug 3, 2015
4beb9af
fixed cache update, remove redundant `chomp` call from Git REPL `comm…
wildart Aug 3, 2015
7e9caae
fixed: `tag` requirements creation, empty callbacks
wildart Aug 8, 2015
78929ad
fixed tests
wildart Sep 14, 2015
29004a4
removed Git REPL
wildart Sep 14, 2015
116bb4c
fixed bad rebase commit of `inbase`
wildart Sep 14, 2015
b0f07a8
added: tree entry type, tree walker, blob lookup, some refinements
wildart Sep 23, 2015
80f0db7
Union() => Union{}
wildart Sep 23, 2015
0663672
fixed comparisons to `nothing`
wildart Sep 25, 2015
509e4b2
renamed module `GitConst` to `Consts`, added support of ssh-agent
wildart Sep 29, 2015
11f08b5
returned `Pkg.Git` module
wildart Sep 29, 2015
d18efae
fix deprecation warning
jakebolewski Sep 29, 2015
35cd85f
add error branch test for package availablity
jakebolewski Sep 29, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rebased, moved libgit2 to base, updated to 0.23 & tests
  • Loading branch information
testurser authored and jakebolewski committed Sep 29, 2015
commit 50b81f6fb91b9a92d056aa6dc30d021f8c85483c
2 changes: 1 addition & 1 deletion base/REPL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ function setup_interface(repl::LineEditREPL; hascolor = repl.hascolor, extra_rep
complete = ShellCompletionProvider(repl),
on_done = respond(repl, julia_prompt) do line
line = strip(line)
:(Pkg.LibGit2.repl_cmd($line))
:(LibGit2.repl_cmd($line))
end)

################################# Stage II #############################
Expand Down
1 change: 1 addition & 0 deletions base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export
Meta,
Operators,
Pkg,
LibGit2,
Profile,
Dates,
Sys,
Expand Down
77 changes: 21 additions & 56 deletions base/pkg/libgit2.jl → base/libgit2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@

module LibGit2

import ...Pkg.PkgError
import Base: merge!, cat

export with, with_warn
export GitRepo, GitConfig, GitIndex

const GITHUB_REGEX =
r"^(?:git@|git:https://|https://(?:[\w\.\+\-]+@)?)github.com[:/](([^/].+)/(.+?))(?:\.git)?$"i
export with, GitRepo, GitConfig

include("libgit2/const.jl")
include("libgit2/types.jl")
Expand All @@ -29,19 +25,14 @@ include("libgit2/blob.jl")
include("libgit2/diff.jl")
include("libgit2/rebase.jl")
include("libgit2/repl.jl")

include("libgit2/utils.jl")

immutable State
head::Oid
index::Oid
work::Oid
end

function normalize_url(url::AbstractString)
m = match(GITHUB_REGEX,url)
m == nothing ? url : "https://github.com/$(m.captures[1]).git"
end

"""Return HEAD Oid as string"""
function head(pkg::AbstractString)
with(GitRepo, pkg) do repo
Expand Down Expand Up @@ -115,22 +106,6 @@ function diff_files(repo::GitRepo, branch1::AbstractString, branch2::AbstractStr
return files
end

function merge_base(one::AbstractString, two::AbstractString, repo::GitRepo)
oid1_ptr = Ref(Oid(one))
oid2_ptr = Ref(Oid(two))
moid_ptr = Ref(Oid())
moid = try
@check ccall((:git_merge_base, :libgit2), Cint,
(Ptr{Oid}, Ptr{Void}, Ptr{Oid}, Ptr{Oid}),
moid_ptr, repo.ptr, oid1_ptr, oid2_ptr)
moid_ptr[]
catch e
#warn("Pkg:",path(repo),"=>",e.msg)
Oid()
end
return moid
end

function is_ancestor_of(a::AbstractString, b::AbstractString, repo::GitRepo)
A = revparseid(repo, a)
merge_base(a, b, repo) == A
Expand Down Expand Up @@ -187,9 +162,7 @@ function fetch{T<:AbstractString}(repo::GitRepo;
GitRemoteAnon(repo, remoteurl)
end
try
with(default_signature(repo)) do sig
fetch(rmt, sig, refspecs, msg="from $(url(rmt))")
end
fetch(rmt, refspecs, msg="from $(url(rmt))")
catch err
warn("fetch: $err")
finally
Expand All @@ -209,9 +182,7 @@ function push{T<:AbstractString}(repo::GitRepo;
GitRemoteAnon(repo, remoteurl)
end
try
with(default_signature(repo)) do sig
push(rmt, sig, refspecs, force=force, msg="to $(url(rmt))")
end
push(rmt, refspecs, force=force, msg="to $(url(rmt))")
catch err
warn("push: $err")
finally
Expand All @@ -222,13 +193,13 @@ end
""" git branch """
function branch(repo::GitRepo)
head_ref = head(repo)
brnch = ""
try
brnch = branch(head_ref)
branch(head_ref)
catch
""
finally
finalize(head_ref)
end
return brnch
end

""" git checkout [-b|-B] <branch> [<start-point>] [--track <remote>/<branch>] """
Expand Down Expand Up @@ -306,8 +277,8 @@ function checkout!(repo::GitRepo, commit::AbstractString = "";
try
peeled = peel(obj, GitConst.OBJ_COMMIT)
peeled == nothing && return
opts = force ? CheckoutOptionsStruct(checkout_strategy = GitConst.CHECKOUT_FORCE) :
CheckoutOptionsStruct()
opts = force ? CheckoutOptions(checkout_strategy = GitConst.CHECKOUT_FORCE) :
CheckoutOptions()
try
# detach commit
obj_oid = Oid(peeled)
Expand All @@ -327,24 +298,18 @@ function checkout!(repo::GitRepo, commit::AbstractString = "";
end

""" git clone [-b <branch>] [--bare] <url> <dir> """
function clone(url::AbstractString, path::AbstractString;
branch::AbstractString="",
bare::Bool = false,
function clone(repo_url::AbstractString, repo_path::AbstractString;
checkout_branch::AbstractString="",
isbare::Bool = false,
remote_cb::Ptr{Void} = C_NULL)
# setup colne options
clone_opts = CloneOptionsStruct(
bare = Int32(bare),
checkout_branch = isempty(branch) ? Ptr{UInt8}(C_NULL) : pointer(branch),
clone_opts = CloneOptions(
bare = Int32(isbare),
checkout_branch = isempty(checkout_branch) ? Cstring_NULL :
convert(Cstring, pointer(checkout_branch)),
remote_cb = remote_cb
)

# start cloning
clone_opts_ref = Ref(clone_opts)
repo_ptr_ptr = Ref{Ptr{Void}}(C_NULL)
@check ccall((:git_clone, :libgit2), Cint,
(Ptr{Ptr{Void}}, Cstring, Cstring, Ref{CloneOptionsStruct}),
repo_ptr_ptr, url, path, clone_opts_ref)
return GitRepo(repo_ptr_ptr[])
return clone(repo_url, repo_path, clone_opts)
end

""" git reset [<committish>] [--] <pathspecs>... """
Expand Down Expand Up @@ -417,7 +382,7 @@ function merge!(repo::GitRepo, committish::AbstractString=""; fast_forward::Bool
reset!(repo, brn_ref_oid, GitConst.RESET_HARD)
elseif (ma & GitConst.MERGE_ANALYSIS_NORMAL == GitConst.MERGE_ANALYSIS_NORMAL)
fast_forward && return false # do not do merge
merge(repo, hua)
merge!(repo, hua)
cleanup(repo)
info("Review and commit merged changes.")
else
Expand Down Expand Up @@ -507,7 +472,7 @@ function restore(s::State, repo::GitRepo)
reset!(repo, GitConst.HEAD_FILE, "*") # unstage everything
with(GitIndex, repo) do idx
read_tree!(idx, s.work) # move work tree to index
opts = CheckoutOptionsStruct(
opts = CheckoutOptions(
checkout_strategy = GitConst.CHECKOUT_FORCE | # check the index out to work
GitConst.CHECKOUT_REMOVE_UNTRACKED) # remove everything else
checkout_index(repo, Nullable(idx), options = opts)
Expand All @@ -530,7 +495,7 @@ end

function __init__()
err = ccall((:git_libgit2_init, :libgit2), Cint, ())
err > 0 || throw(PkgError("error initializing LibGit2 module"))
err > 0 || throw(ErrorException("error initializing LibGit2 module"))
atexit() do
ccall((:git_libgit2_shutdown, :libgit2), Cint, ())
end
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions base/pkg/libgit2/commit.jl → base/libgit2/commit.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# This file is a part of Julia. License is MIT: http:https://julialang.org/license

function message(c::GitCommit, raw::Bool=false)
local msg_ptr::Ptr{UInt8}
msg_ptr = raw? ccall((:git_commit_message_raw, :libgit2), CString, (Ptr{Void},), c.ptr) :
ccall((:git_commit_message, :libgit2), CString, (Ptr{Void},), c.ptr)
if msg_ptr == C_NULL
local msg_ptr::Cstring
msg_ptr = raw? ccall((:git_commit_message_raw, :libgit2), Cstring, (Ptr{Void},), c.ptr) :
ccall((:git_commit_message, :libgit2), Cstring, (Ptr{Void},), c.ptr)
if msg_ptr == Cstring_NULL
return nothing
end
return bytestring(msg_ptr)
Expand Down
2 changes: 1 addition & 1 deletion base/pkg/libgit2/config.jl → base/libgit2/config.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
function GitConfig(path::AbstractString)
cfg_ptr_ptr = Ref{Ptr{Void}}(C_NULL)
err = ccall((:git_config_open_ondisk, :libgit2), Cint,
(Ptr{Ptr{Void}}, Ptr{UInt8}), cfg_ptr_ptr, path)
(Ptr{Ptr{Void}}, Cstring), cfg_ptr_ptr, path)
err !=0 && return nothing
return GitConfig(cfg_ptr_ptr[])
end
Expand Down
24 changes: 22 additions & 2 deletions base/pkg/libgit2/const.jl → base/libgit2/const.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ module GitConst
# checkout
const CHECKOUT_NONE = Cuint(0)
const CHECKOUT_SAFE = Cuint(1 << 0)
const CHECKOUT_SAFE_CREATE = Cuint(1 << 1)
const CHECKOUT_FORCE = Cuint(1 << 2)
const CHECKOUT_FORCE = Cuint(1 << 1)
const CHECKOUT_RECREATE_MISSING = Cuint(1 << 2)
const CHECKOUT_ALLOW_CONFLICTS = Cuint(1 << 4)
const CHECKOUT_REMOVE_UNTRACKED = Cuint(1 << 5)
const CHECKOUT_REMOVE_IGNORED = Cuint(1 << 6)
Expand All @@ -54,6 +54,9 @@ module GitConst
const CHECKOUT_DISABLE_PATHSPEC_MATCH = Cuint(1 << 13)
const CHECKOUT_SKIP_LOCKED_DIRECTORIES = Cuint(1 << 18)
const CHECKOUT_DONT_OVERWRITE_IGNORED = Cuint(1 << 19)
const CHECKOUT_CONFLICT_STYLE_MERGE = Cuint(1 << 20)
const CHECKOUT_CONFLICT_STYLE_DIFF3 = Cuint(1 << 21)
const CHECKOUT_DONT_REMOVE_EXISTING = Cuint(1 << 22)

const CHECKOUT_UPDATE_SUBMODULES = Cuint(1 << 16)
const CHECKOUT_UPDATE_SUBMODULES_IF_CHANGED = Cuint(1 << 17)
Expand Down Expand Up @@ -191,4 +194,21 @@ module GitConst
const CREDTYPE_SSH_KEY = Cuint(1 << 1)
const CREDTYPE_SSH_CUSTOM = Cuint(1 << 2)
const CREDTYPE_DEFAULT = Cuint(1 << 3)

# fetch_prune
const FETCH_PRUNE_UNSPECIFIED = Cint(0)
const FETCH_PRUNE = Cint(1)
const FETCH_NO_PRUNE = Cint(2)

# remote_autotag
const REMOTE_DOWNLOAD_TAGS_UNSPECIFIED = Cint(0)
const REMOTE_DOWNLOAD_TAGS_AUTO = Cint(1)
const REMOTE_DOWNLOAD_TAGS_NONE = Cint(2)
const REMOTE_DOWNLOAD_TAGS_ALL = Cint(3)

# clone
const CLONE_LOCAL_AUTO = Cint(0)
const CLONE_LOCAL = Cint(1)
const CLONE_NO_LOCAL = Cint(2)
const CLONE_LOCAL_NO_LINKS = Cint(3)
end
File renamed without changes.
4 changes: 1 addition & 3 deletions base/pkg/libgit2/error.jl → base/libgit2/error.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ module Error
EPEEL = Cint(-19), # the requested peel operation is not possible
PASSTHROUGH = Cint(-30), # internal only
ITEROVER = Cint(-31)) # signals end of iteration

Base.(:(==))(c::Code, e::Integer) = c.val == e
Base.(:(==))(e::Integer, c::Code) = c.val == e
Base.getindex(c::Code) = c.val

@enum(Class, None,
NoMemory,
Expand Down
File renamed without changes.
22 changes: 19 additions & 3 deletions base/pkg/libgit2/merge.jl → base/libgit2/merge.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,28 @@ function merge_analysis(repo::GitRepo, ann::GitAnnotated)
end

""" Merge changes into current head """
function merge(repo::GitRepo, their_head::GitAnnotated;
function merge!(repo::GitRepo, their_head::GitAnnotated;
merge_opts = MergeOptionsStruct(),
checkout_opts = CheckoutOptionsStruct(checkout_strategy = GitConst.CHECKOUT_SAFE))
checkout_opts = CheckoutOptions(checkout_strategy = GitConst.CHECKOUT_SAFE))
return @check ccall((:git_merge, :libgit2), Cint,
(Ptr{Void}, Ptr{Ptr{Void}}, Csize_t,
Ptr{MergeOptionsStruct}, Ptr{CheckoutOptionsStruct}),
Ptr{MergeOptionsStruct}, Ptr{CheckoutOptions}),
repo.ptr, Ref{Ptr{Void}}(their_head.ptr), 1,
Ref(merge_opts), Ref(checkout_opts))
end

function merge_base(repo::GitRepo, one::AbstractString, two::AbstractString)
oid1_ptr = Ref(Oid(one))
oid2_ptr = Ref(Oid(two))
moid_ptr = Ref(Oid())
moid = try
@check ccall((:git_merge_base, :libgit2), Cint,
(Ptr{Oid}, Ptr{Void}, Ptr{Oid}, Ptr{Oid}),
moid_ptr, repo.ptr, oid1_ptr, oid2_ptr)
moid_ptr[]
catch e
#warn("Pkg:",path(repo),"=>",e.msg)
Oid()
end
return moid
end
File renamed without changes.
17 changes: 8 additions & 9 deletions base/pkg/libgit2/rebase.jl → base/libgit2/rebase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
function GitRebase(repo::GitRepo, branch::GitAnnotated, upstream::GitAnnotated;
onto::Nullable{GitAnnotated}=Nullable{GitAnnotated}(),
sig::Nullable{GitSignature}=Nullable{GitSignature}(),
opts::RebaseOptionsStruct = RebaseOptionsStruct())
opts::RebaseOptions = RebaseOptions())
rebase_ptr_ptr = Ref{Ptr{Void}}(C_NULL)
sig_obj = isnull(sig) ? default_signature(repo) : Base.get(sig)
try
@check ccall((:git_rebase_init, :libgit2), Cint,
(Ptr{Ptr{Void}}, Ptr{Void}, Ptr{Void}, Ptr{Void},
Ptr{Void}, Ptr{SignatureStruct}, Ptr{RebaseOptionsStruct}),
Ptr{Void}, Ptr{SignatureStruct}, Ptr{RebaseOptions}),
rebase_ptr_ptr, repo.ptr, branch.ptr, upstream.ptr,
isnull(onto) ? C_NULL : Base.get(onto).ptr, sig_obj.ptr, Ref(opts))
finally
Expand All @@ -34,21 +34,20 @@ function Base.getindex(rb::GitRebase, i::Csize_t)
end
Base.getindex(rb::GitRebase, i::Int) = getindex(rb, Csize_t(i))

function Base.next(rb::GitRebase; opts::CheckoutOptionsStruct = CheckoutOptionsStruct())
function Base.next(rb::GitRebase; opts::CheckoutOptions = CheckoutOptions())
rb_op_ptr_ptr = Ref{Ptr{RebaseOperation}}(C_NULL)
try
@check ccall((:git_rebase_next, :libgit2), Cint,
(Ptr{Ptr{RebaseOperation}}, Ptr{Void}, Ptr{CheckoutOptionsStruct}),
(Ptr{Ptr{RebaseOperation}}, Ptr{Void}, Ptr{CheckoutOptions}),
rb_op_ptr_ptr, rb.ptr, Ref(opts))
catch err
err.code == Error.ITEROVER && return nothing
err.code == Error.ITEROVER[] && return nothing
rethrow(err)
end
return unsafe_load(convert(Ptr{RebaseOperation}, rb_op_ptr_ptr[]), 1)
end

function commit(rb::GitRebase, sig::GitSignature;
opts::CheckoutOptionsStruct = CheckoutOptionsStruct())
function commit(rb::GitRebase, sig::GitSignature)
oid_ptr = Ref(Oid())
@check ccall((:git_rebase_commit, :libgit2), Cint,
(Ptr{Oid}, Ptr{Void}, Ptr{SignatureStruct}, Ptr{SignatureStruct}, Ptr{UInt8}, Ptr{UInt8}),
Expand All @@ -61,8 +60,8 @@ function abort(rb::GitRebase, sig::GitSignature)
(Ptr{Void}, Ptr{SignatureStruct}), rb.ptr, sig.ptr)
end

function finish(rb::GitRebase, sig::GitSignature; opts::RebaseOptionsStruct = RebaseOptionsStruct())
function finish(rb::GitRebase, sig::GitSignature; opts::RebaseOptions = RebaseOptions())
return ccall((:git_rebase_finish, :libgit2), Csize_t,
(Ptr{Void}, Ptr{SignatureStruct}, Ptr{RebaseOptionsStruct}),
(Ptr{Void}, Ptr{SignatureStruct}, Ptr{RebaseOptions}),
rb.ptr, sig.ptr, Ref(opts))
end
8 changes: 4 additions & 4 deletions base/pkg/libgit2/reference.jl → base/libgit2/reference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ function peel(ref::GitReference, obj_type::Cint)
obj_ptr_ptr = Ref{Ptr{Void}}(C_NULL)
err = ccall((:git_reference_peel, :libgit2), Cint,
(Ptr{Ptr{Void}}, Ptr{Void}, Cint), obj_ptr_ptr, ref.ptr, obj_type)
if err == Error.ENOTFOUND
if err == Error.ENOTFOUND[]
return Oid()
elseif err != Error.GIT_OK
elseif err != Error.GIT_OK[]
if obj_ptr_ptr[] != C_NULL
finalize(GitAnyObject(obj_ptr_ptr[]))
end
Expand Down Expand Up @@ -116,9 +116,9 @@ function lookup_branch(repo::GitRepo, branch_name::AbstractString, remote::Bool=
err = ccall((:git_branch_lookup, :libgit2), Cint,
(Ptr{Ptr{Void}}, Ptr{Void}, Ptr{UInt8}, Cint),
ref_ptr_ptr, repo.ptr, branch_name, branch_type)
if err == Error.ENOTFOUND
if err == Error.ENOTFOUND[]
return nothing
elseif err != Error.GIT_OK
elseif err != Error.GIT_OK[]
if repo_ptr_ptr[] != C_NULL
finalize(GitReference(ref_ptr_ptr[]))
end
Expand Down
Loading