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

Skip to content

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_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

* 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