Skip to content

Add get user agent functionality.#3851

Merged
ethomson merged 1 commit into
libgit2:masterfrom
txdv:get-user-agent
Jul 5, 2016
Merged

Add get user agent functionality.#3851
ethomson merged 1 commit into
libgit2:masterfrom
txdv:get-user-agent

Conversation

@txdv

@txdv txdv commented Jul 5, 2016

Copy link
Copy Markdown
Contributor

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.

Comment thread tests/core/useragent.c
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
Copy Markdown
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

ethomson commented Jul 5, 2016

Copy link
Copy Markdown
Member

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

@txdv

txdv commented Jul 5, 2016

Copy link
Copy Markdown
Contributor Author

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

@ethomson

ethomson commented Jul 5, 2016

Copy link
Copy Markdown
Member

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

txdv commented Jul 5, 2016

Copy link
Copy Markdown
Contributor Author

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

@ethomson

ethomson commented Jul 5, 2016

Copy link
Copy Markdown
Member

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
Comment thread CHANGELOG.md

* 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
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

@ethomson

ethomson commented Jul 5, 2016

Copy link
Copy Markdown
Member

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