8000 Push options support within pygit2 · Issue #1126 · libgit2/pygit2 · GitHub
[go: up one dir, main page]

Skip to content

Push options support within pygit2 #1126

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

Closed
kuwv opened this issue Feb 10, 2022 · 2 comments · Fixed by #1282
Closed

Push options support within pygit2 #1126

kuwv opened this issue Feb 10, 2022 · 2 comments · Fixed by #1282

Comments

@kuwv
Copy link
Contributor
kuwv commented Feb 10, 2022

I am trying to determine how to use git_push_options with a remote push. I'm unable to find any documentation, tests or working examples.

My goal is to implement something similar to git using the following: git push --push-option somevar=someval

What I have gleaned from the remote.py context manager is that I probably need to pass libgit2 custom_headers parameter. But, I'm not sure if I'm missing something or just off base.


class CustomRemoteCallbacks(RemoteCallbacks):
    """Provide callback with push options."""

    def __init__(
        self,
        credentials: Optional[Credentials] = None,
        certificate: Optional[Certificate] = None,
        **kwargs: Any,
    ) -> None:
        """Initialize remote callback with custom headers."""
        super().__init__(credentials=credentials, certificate=certificate)
        self.custom_headers = [f"{k}={v}" for k, v in kwargs.items()]
@kuwv kuwv changed the title Push options support within pytgit2 Push options support within pygit2 Feb 10, 2022
@kuwv
Copy link
Contributor Author
kuwv commented Mar 28, 2022

I guess I'll try to solve this.

@kuwv kuwv closed this as completed Mar 28, 2022
@kuwv kuwv reopened this Apr 19, 2022
@kuwv
Copy link
Contributor Author
kuwv commented Apr 19, 2022

While taking a closer look at this I believe that push_options have no way of being set:
https://github.com/libgit2/pygit2/blob/master/pygit2/callbacks.py#L267

As it seems they are just reset with a new pointer:
https://github.com/libgit2/pygit2/blob/master/pygit2/callbacks.py#L271

@jdavid can you confirm that this is correct or if I am mistaken?

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 a pull request may close this issue.

1 participant
0