diff options
author | Vicent Marti <vicent@github.com> | 2016-02-23 08:16:12 +0100 |
---|---|---|
committer | Vicent Marti <vicent@github.com> | 2016-02-23 08:16:12 +0100 |
commit | fb96b28cd9f66998f38a56abb7398ea899c12512 (patch) | |
tree | d756764c30f83075a079600f776694d13ec35d37 | |
parent | 305c4f95ce365a68db3895ed6852cd82f7315811 (diff) | |
parent | 7bab2e8fbf302fc7d7732ee92652271015db2a58 (diff) | |
download | libgit2-fb96b28cd9f66998f38a56abb7398ea899c12512.tar.gz |
Merge pull request #3629 from ethomson/set_user_agent_doc
git_libgit2_opts: minor documentation & usage fixes
-rw-r--r-- | include/git2/common.h | 6 | ||||
-rw-r--r-- | src/settings.c | 3 | ||||
-rw-r--r-- | tests/core/opts.c | 6 |
3 files changed, 15 insertions, 0 deletions
diff --git a/include/git2/common.h b/include/git2/common.h index ee230dfae..c26030840 100644 --- a/include/git2/common.h +++ b/include/git2/common.h @@ -245,6 +245,12 @@ typedef enum { * * * opts(GIT_OPT_SET_USER_AGENT, const char *user_agent) * + * > Set the value of the User-Agent header. This value will be + * > appended to "git/1.0", for compatibility with other git clients. + * > + * > - `user_agent` is the value that will be delivered as the + * > User-Agent header on HTTP requests. + * * @param option Option key * @param ... value to set the option * @return 0 on success, <0 on failure diff --git a/src/settings.c b/src/settings.c index da99b59e2..d7341abe8 100644 --- a/src/settings.c +++ b/src/settings.c @@ -181,6 +181,9 @@ int git_libgit2_opts(int key, ...) } break; + default: + giterr_set(GITERR_INVALID, "invalid option key"); + error = -1; } va_end(ap); diff --git a/tests/core/opts.c b/tests/core/opts.c index 3173c648b..72408cbe8 100644 --- a/tests/core/opts.c +++ b/tests/core/opts.c @@ -17,3 +17,9 @@ void test_core_opts__readwrite(void) cl_assert(new_val == old_val); } + +void test_core_opts__invalid_option(void) +{ + cl_git_fail(git_libgit2_opts(-1, "foobar")); +} + |