-
-
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
Convenience API and bug fixes for git tree walking #25432
Conversation
@@ -139,6 +139,8 @@ function GitHash(obj::GitObject) | |||
GitHash(ccall((:git_object_id, :libgit2), Ptr{UInt8}, (Ptr{Cvoid},), obj.ptr)) | |||
end | |||
|
|||
==(obj1::GitObject, obj2::GitObject) = GitHash(obj1) == GitHash(obj2) |
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.
This seemed like a reasonable thing to do, but is not really required for this PR (it simplifies a test).
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.
It seems reasonable to me as well, so long as there's a test for it. 🙂
base/libgit2/tree.jl
Outdated
@@ -122,3 +131,47 @@ function Base.show(io::IO, tree::GitTree) | |||
println(io, "Owner: ", repository(tree)) | |||
println(io, "Number of entries: ", count(tree)) | |||
end | |||
|
|||
""" | |||
getindex(tree::GitTree, target::AbstractString)::GitHash |
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.
Base still uses ->
to show return types in docstrings
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.
why?
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.
Partly historical artifact, partly because it's often used in such a way that the :: T
return type syntax would be wrong or inappropriate.
0a16f68
to
a0e9e40
Compare
Bump? Comments have been addressed. Or should this wait until after 1.0? |
No, this can be merged now if someone familiar with the LibGit2 code takes a look at it. Maybe @kshyatt? |
base/libgit2/tree.jl
Outdated
""" | ||
getindex(tree::GitTree, target::AbstractString) -> GitObject | ||
|
||
Look up `target` path in the `tree`, returning a `GitObject` (a `GitBlob` in the case of a |
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.
X-refs here?
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.
other than the minor request to xref docs this lgtm sorry for the wait on the review
OK, addressed all comments. Will merge if CI is green. |
AppVeyor failures where libgit2 remote exceptions. I've restarted them to make sure they're not actually related since this change does touch libgit2 code. Suspiciously, the Travis Linux 64 failure was also a libgit2 remote exception. I've restarted that one as well, so we'll see... |
I'll look into it if any more suspicious failures turn up, after all I've also rebased the branch which might have introduced something. |
So this keeps throwing the
I'll set-up a windows system tomorrow and debug this. |
You can also RDP to an appveyor job: https://www.appveyor.com/docs/how-to/rdp-to-build-worker/ |
OK, this was a bug on Windows indeed: I was using Only remaining CI failure is a seemingly unrelated ProcessExitedException on CircleCI; @KristofferC is it OK if I merge this before #25706? |
I've rebased #25706 N times, so rebasing it N+1 times is no problem. |
This PR fixes a bug with LibGit2's
treewalk
wrapper, and adds a conveniencegetindex
-based API for accessing objects in a tree by path. First time working with libgit2(.jl), so feel free to bikeshed 🙂EDIT: I only ran the
libgit2
tests locally because of the device I'm working on, so this might cause test failures.