-
-
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
LibGit2: allow using a void ptr for payload and add git_transfer_progress struct #26387
Conversation
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.
I believe you won't be able to use the progress feature and with our credential system at the same time. Would be worth trying this out.
total_deltas::Cuint | ||
indexed_deltas::Cuint | ||
received_bytes::Csize_t | ||
end |
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.
Potentially you could make GitTransferProgress
a subtype of Payload
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.
Hm, I'm not really using it as a Payload
though. The relevant code is at https://github.com/JuliaLang/Pkg3.jl/pull/177/files#diff-ce43f67c143e1d23513f24ec8464985eR61 and it makes a progress bar print when cloning something. The payload is just any julia object that I want to have access to in the callback.
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.
Thanks for the link. I think this struct can stay as is.
Unfortunately the way you are using julia/stdlib/LibGit2/src/LibGit2.jl Lines 524 to 551 in 4947e25
|
Ok, but this should just require some API re-organization? It seems not so nice for us to hijack very valuable slots. Couldn't the credentials and the user-passed payload be together, and the credentials callback takes care of the credentials and the user-passed callback is wrapped so that the credentials are removed before calling it... Or something like that. |
Yes, we just need to make some additional API changes. Some extra work but nothing too difficult. I would just hate to lose credential handling in Pkg3 for a progress bar. The one trick here is both the credential callback and your progress meter are both trying to set the payload. We may need to have a special payload type which can isolate some payload data for an individual callback. |
I would hate to lose the pretty progress bar for boring credential handling :D |
@KristofferC Do you want to take a crack at supporting both of these? I may have some time on the weekend. |
You are much more familiar with the code so if you have some time that would be great. Otherwise I will probably try get to it at some point because "I ai' losin' ma progress ba'". |
I've made some attempts to address this within LibGit2. I am not quite satisfied with the changes so far but I do know we'll have to make some minor changes to Pkg3 so that it is aware of credentials. For example Pkg3 will need to create a CachedCredentials instance to temporarily retain credentials between multiple git clones. I'm hoping to have some changes ready for tomorrow. |
Thanks for working on this. I do think that a progress bar is a significant boost to the user experience when you need to get a large repo. |
Would it make sense to include the progress bar as part of LibGit2? |
I was thinking about that too. On one hand, it makes sense, anyone can take advantage of it, but on the other hand, it opens up a whole can of bikeshedding opportunities. (Exactly what should be displayed, how should the progress bar look, what should the colors be, etc etc). |
#26437 addresses the |
I want to be able to send in an arbitrary pointer for the payload but the current constructor has too tight types.
Also adds the
git_transfer_progress
struct https://libgit2.github.com/libgit2/#HEAD/type/git_transfer_progress.Useful if one wants to print some progress bar when cloning.
cc @Keno