-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Add get user agent functionality. #3851
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
Conversation
|
||
cl_assert_equal_p(NULL, git_libgit2__user_agent()); | ||
cl_git_pass(git_libgit2_opts(GIT_OPT_SET_USER_AGENT, custom_name)); | ||
cl_assert_equal_s(custom_name, git_libgit2__user_agent()); | ||
|
||
git_libgit2_opts(GIT_OPT_GET_USER_AGENT, &buf); | ||
cl_assert_equal_s(custom_name, buf.ptr); |
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.
Please add a git_buf_free(&buf)
here to free the memory.
This is great to have, thanks for adding this. I added two comments inline. |
I added the freeing at the end, not directly on the line, so it frees but the comment is still shown. |
Perfect, can you squash this down into a single commit and then I'll merge it! 😀 |
Your wish is my desire. Is there a place to document this added functionality? |
Yes, thanks for reminding me! Please add this to the |
@@ -12,6 +12,10 @@ v0.24 + 1 | |||
|
|||
### API additions | |||
|
|||
* You can now get the user-agent used by libgit2 using the | |||
`GIT_OPT_GET_USER_AGENT` option with `git_libgit2_opts()`. | |||
It is the counterpart to `GIT_OPT_SET_USER_AGENT`. |
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.
👍
Awesome, thanks again! ✨ |
When exposing the set user agent functionality in the C# binding we saw that we can't really write a good test for whether we set it correctly since getting the set user agent is not possible.
This adds the possibility to get the user agent.