8000 Push options by bansheerubber · Pull Request #6281 · libgit2/libgit2 · GitHub
[go: up one dir, main page]

Skip to content

Push options #6281

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
wants to merge 2 commits into from
Closed

Push options #6281

wants to merge 2 commits into from

Conversation

bansheerubber
Copy link
Contributor
@bansheerubber bansheerubber commented Apr 20, 2022

My classmates and I, with help from someone on the GitKraken team, implemented a way to upload push options.

A refresher on what push options are: https://git-scm.com/docs/git-push#Documentation/git-push.txt--oltoptiongt

Justification: Push options are a popular way to specify additional parameters for Git hosting services. GitLab uses them to specify CI variables in their CI pipeline (https://docs.gitlab.com/ee/user/project/push_options.html), for instance. With the advent of Git GUIs using libgit2 to implement their Git support, we feel it important to reduce the functionality gap between the Git CLI and libgit2.


Intended use:

git_remote *remote = ...;
git_strarray refspecs = ...;
git_push_options options;
const char *args[2] = {
    "Lorem Ipsum es simplemente el texto",
    "That still only counts as one!"
};
options.arguments = (git_strarray){
    args,
    2
};

git_remote_push(remote, &refspecs, &options);

Should be noted that the way we designed this potentially breaks ABI compatibility. Open to suggestions on how to re-implement if this is not desired.

Let me know if there are any questions on the implementation. Tests ended up being a little weird because there didn't seem to be a nice way to implement them in the normal ctest suite, so we implemented our tests as CI tests. The changes we made aren't super complicated, so I'm hoping the code should be more-or-less self-explanatory but I of course could be wrong about that.

bansheerubber and others added 2 commits April 20, 2022 12:02
https://git-scm.com/docs/git-push#Documentation/git-push.txt---push-optionltoptiongt
Push options are a way for a user to transmit strings to a git server via the command line. Push options are then passed to the `pre-receive` and `post-receive` hooks, where the server is able to interpret and make use of the user options. Some git repository hosting services like GitLab expose special options for users, like skipping CI tests on a specific push.

Co-Authored-By: pireads <pireads@gmail.com>
Co-Authored-By: lotdeef <lcfisch2@asu.edu>
Co-Authored-By: PSI497 <497.psi.497@gmail.com>
We found that the best way to test push options was to receive them via a git hooks script, and output them to a location that the CI tests could read to check and see if the push options were interpreted by git correctly.

Co-Authored-By: pireads <pireads@gmail.com>
Co-Authored-By: lotdeef <lcfisch2@asu.edu>
Co-Authored-By: PSI497 <497.psi.497@gmail.com>
@ethomson
Copy link
Member

Cool! Thanks for the contribution @bansheerubber! I'll review it 🔜 . 🎉

@bansheerubber
Copy link
Contributor Author

Cool! Thanks for the contribution @bansheerubber! I'll review it soon . tada

Thank you! Forgot to tag them in the post, but a lot of help was received from my classmates @pireads, @lotdeef, and @PSI497.

@ethomson
Copy link
Member
ethomson commented Mar 9, 2024

Fixed via #6439 - thanks much for your contributions.

@ethomson ethomson closed this Mar 9, 2024
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.

2 participants
0