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

Doc missing rebase methods #22556

Merged
merged 5 commits into from
Jun 28, 2017
Merged
Changes from 3 commits
Commits
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
24 changes: 24 additions & 0 deletions base/libgit2/rebase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ function Base.count(rb::GitRebase)
return ccall((:git_rebase_operation_entrycount, :libgit2), Csize_t, (Ptr{Void},), rb.ptr)
end

"""
current(rb::GitRebase) -> Csize_t

Return the index of the current [`RebaseOperation`](@ref). If no operation has
yet been applied (because the [`GitRebase`](@ref) has been constructed but `next`
has not yet been called or iteration over `rb` has not yet begun), return
`GIT_REBASE_NO_OPERATION`, which is equal to `SIZE_MAX` of `Csize_t`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that the same as the julia typemax(Csize_t) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be, but doesn't this vary by system?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Csize_t is pointer-sized in Julia, but not sure what width GIT_REBASE_NO_OPERATION is on the libgit2 side

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's really cool that this is documented

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for someone who knows julia but not C, SIZE_MAX isn't very meaningful - even if you do know C, it's the kind of thing I'd need to look up every time

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make it sizemax(Csize_t)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typemax, if that's the same value

"""
function current(rb::GitRebase)
return ccall((:git_rebase_operation_current, :libgit2), Csize_t, (Ptr{Void},), rb.ptr)
end
Expand Down Expand Up @@ -69,11 +77,27 @@ function commit(rb::GitRebase, sig::GitSignature)
return oid_ptr[]
end

"""
abort(rb::GitRebase) -> Csize_t

Cancels the in-progress rebase, undoing all changes made so far and returning
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Cancel," perhaps?

the parent repository of `rb` and its working directory to their state before
the rebase was initiated. Returns `0` if the abort is successful, `GIT_ENOTFOUND`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this under one of the julia side enums?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ENOTFOUND? I think so.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the julia enum name has a different prefix, should use that

if no rebase is in progress (for example, if the rebase had completed), and `-1`
for other errors.
"""
function abort(rb::GitRebase)
return ccall((:git_rebase_abort, :libgit2), Csize_t,
(Ptr{Void},), rb.ptr)
end

"""
finish(rb::GitRebase, sig::GitSignature) -> Csize_t

Complete the rebase described by `rb`. `sig` is a [`GitSignature`](@ref)
to specify the identity of the user finishing the rebase. Returns `0` if the
rebase finishes successfully, `-1` if there is an error.
"""
function finish(rb::GitRebase, sig::GitSignature)
return ccall((:git_rebase_finish, :libgit2), Csize_t,
(Ptr{Void}, Ptr{SignatureStruct}),
Expand Down