Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 1 commit into from
Jul 5, 2016
Merged

Conversation

txdv
Copy link
Contributor

@txdv txdv commented Jul 5, 2016

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.


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);
Copy link
Member

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.

@ethomson
Copy link
Member

ethomson commented Jul 5, 2016

This is great to have, thanks for adding this. I added two comments inline.

@txdv
Copy link
Contributor Author

txdv commented Jul 5, 2016

I added the freeing at the end, not directly on the line, so it frees but the comment is still shown.

@ethomson
Copy link
Member

ethomson commented Jul 5, 2016

Perfect, can you squash this down into a single commit and then I'll merge it! 😀

@txdv txdv force-pushed the get-user-agent branch from a0d8144 to a3338ef Compare July 5, 2016 15:02
@txdv
Copy link
Contributor Author

txdv commented Jul 5, 2016

Your wish is my desire. Is there a place to document this added functionality?

@ethomson
Copy link
Member

ethomson commented Jul 5, 2016

Yes, thanks for reminding me! Please add this to the CHANGELOG.md. :D

@txdv txdv force-pushed the get-user-agent branch from a3338ef to f1dba14 Compare July 5, 2016 15:10
@@ -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`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@ethomson
Copy link
Member

ethomson commented Jul 5, 2016

Awesome, thanks again! ✨

@ethomson ethomson merged commit c18a2bc into libgit2:master Jul 5, 2016
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