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

add callback before a remote connects and add a callback before a remote will be disconnected #6298

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Murmele
Copy link

@Murmele Murmele commented May 9, 2022

Problem Description:
When updating submodules, the remote of the submodule is not visible outside of the submodule (submodule is a private type and therefore not intended to be used outside). So in that case it is not possible to abort an update operation by aborting the remote connection.

Benefit:
If during the submodule update (fetch, ...) a callback will be called, outside of the submodule the remote is available. This remote can be stored and if the application wants to abort the operation it just stops the operation on that remote.

from #5730
In this particular case, I added the connect/disconnect callbacks because I needed to remember the remote to cancel the transfer later on. This is most important in submodule update, which looks up the remotes internally. Without this, there isn't a way to cancel the transfers initiated by submodule update.

@Murmele
Copy link
Author

Murmele commented May 9, 2022

TODO: Maybe it is possible to just define the disconnect and the remote_ready_cb can be used instead of the connect

@Murmele
Copy link
Author

Murmele commented May 9, 2022

Why git_remote_ready_cb remote_ready; is not defined as GIT_CALLBACK()?

@ethomson
Copy link
Member

ethomson commented May 9, 2022

Why git_remote_ready_cb remote_ready; is not defined as GIT_CALLBACK()?

It is -

typedef int GIT_CALLBACK(git_remote_ready_cb)(git_remote *remote, int direction, void *payload);
? 🤔

@Murmele
Copy link
Author

Murmele commented May 9, 2022

Why git_remote_ready_cb remote_ready; is not defined as GIT_CALLBACK()?

It is -

typedef int GIT_CALLBACK(git_remote_ready_cb)(git_remote *remote, int direction, void *payload);

? 🤔

Ah I haven't seen this thanks. Is this the way it should be added to the struct? So I will change it for my callbacks too

@Murmele
Copy link
Author

Murmele commented May 10, 2022

Current error in the tests: "remote error:
The unauthenticated git protocol on port 9418 is no longer supported.
Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.
"

TODO: use a different repo, because fetching libgit2 takes quite long.

@ethomson which repo do you propose?

…ccess to github over port 9418 is anymore supported
@Murmele Murmele marked this pull request as ready for review May 10, 2022 19:01
@Murmele
Copy link
Author

Murmele commented Jun 12, 2022

@ethomson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants