Skip to content

Commit

Permalink
Trial run of adding newbase back
Browse files Browse the repository at this point in the history
Addresses part of #19839
  • Loading branch information
kshyatt committed Jan 10, 2017
1 parent 0316883 commit 85d062c
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions base/libgit2/libgit2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ function merge!(repo::GitRepo;
end

"""
LibGit2.rebase!(repo::GitRepo[, upstream::AbstractString])
LibGit2.rebase!(repo::GitRepo, upstream::AbstractString="", newbase::AbstractString="")
Attempt an automatic merge rebase of the current branch, from `upstream` if provided, or
otherwise from the upstream tracking branch.
Expand All @@ -472,7 +472,7 @@ a `GitError`. This is roughly equivalent to the following command line statement
fi
"""
function rebase!(repo::GitRepo, upstream::AbstractString="")
function rebase!(repo::GitRepo, upstream::AbstractString="", newbase::AbstractString="")
with(head(repo)) do head_ref
head_ann = GitAnnotated(repo, head_ref)
upst_ann = if isempty(upstream)
Expand All @@ -489,10 +489,15 @@ function rebase!(repo::GitRepo, upstream::AbstractString="")
else
GitAnnotated(repo, upstream)
end
onto_ann = if isempty(newbase)
Nullable{GitAnnotated}()
else
Nullable{GitAnnotated}(GitAnnotated(repo, newbase))
end
try
sig = default_signature(repo)
try
rbs = GitRebase(repo, head_ann, upst_ann)
rbs = GitRebase(repo, head_ann, upst_ann, onto=onto_ann)
try
while (rbs_op = next(rbs)) !== nothing
commit(rbs, sig)
Expand All @@ -509,6 +514,9 @@ function rebase!(repo::GitRepo, upstream::AbstractString="")
close(sig)
end
finally
if !isempty(newbase)
close(get(onto_ann))
end
close(upst_ann)
close(head_ann)
end
Expand Down

0 comments on commit 85d062c

Please sign in to comment.