-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Improvements to libgit2 #16861
Improvements to libgit2 #16861
Conversation
@@ -1,4 +1,16 @@ | |||
# This file is a part of Julia. License is MIT: http://julialang.org/license | |||
function GitBlob(path::AbstractString) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put at least one blank line after the license header
ac4be76
to
8a59b2e
Compare
@@ -21,9 +21,12 @@ function current(rb::GitRebase) | |||
end | |||
|
|||
function Base.getindex(rb::GitRebase, i::Csize_t) | |||
if i < 1 || i >= count(rb) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about here, is asking for the last element valid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Knew I missed one!
8a59b2e
to
d7d7bba
Compare
AppVeyor seems to have timed out. @tkelman, is this ok to go? |
Not if |
|
||
function owner(blob::GitBlob) | ||
repo_ptr = @check ccall((:git_blob_owner, :libgit2), Ptr{Void}, (Ptr{Void},), blob.ptr) | ||
return GitRepo(repo_ptr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong, do not use @check
. Test result for C_NULL.
Now actually `throw(BoundsError)` when we should, and don't just fail silently if something bad happens.
d7d7bba
to
52bac64
Compare
|
||
function name(rmt::GitRemote) | ||
str_ptr = ccall((:git_remote_name, :libgit2), Cstring, (Ptr{Void}, ), rmt.ptr) | ||
str_ptr == C_NULL && return nothing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty string or error?
edit: just saw the above
No need for exception, return nothing, because C_NULL is returned for in-memory remotes.
why would we want nothing
for an in-memory remote? should we have a better way of dealing with that distinction?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, rmt
may be anonymous, in which case it has no name
, right? This seems like a prime candidate for judicious application of Nullable
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or empty string
Superseded by #19839 and friends I think. |
I know there's a lot going on here.
BoundsError
-ing that really need to be, cc @tkelman