File tree Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -245,6 +245,12 @@ typedef enum {
245245 *
246246 * * opts(GIT_OPT_SET_USER_AGENT, const char *user_agent)
247247 *
248+ * > Set the value of the User-Agent header. This value will be
249+ * > appended to "git/1.0", for compatibility with other git clients.
250+ * >
251+ * > - `user_agent` is the value that will be delivered as the
252+ * > User-Agent header on HTTP requests.
253+ *
248254 * @param option Option key
249255 * @param ... value to set the option
250256 * @return 0 on success, <0 on failure
Original file line number Diff line number Diff line change @@ -181,6 +181,9 @@ int git_libgit2_opts(int key, ...)
181181 }
182182
183183 break ;
184+ default :
185+ giterr_set (GITERR_INVALID , "invalid option key" );
186+ error = -1 ;
184187 }
185188
186189 va_end (ap );
Original file line number Diff line number Diff line change @@ -17,3 +17,9 @@ void test_core_opts__readwrite(void)
1717
1818 cl_assert (new_val == old_val );
1919}
20+
21+ void test_core_opts__invalid_option (void )
22+ {
23+ cl_git_fail (git_libgit2_opts (-1 , "foobar" ));
24+ }
25+
You can’t perform that action at this time.
0 commit comments