Skip to content

Commit 68bc511

Browse files
committed
Add documentation about parameter and return value
1 parent 03aed8b commit 68bc511

30 files changed

+122
-0
lines changed

include/git2/apply.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ GIT_BEGIN_DECL
3232
*
3333
* @param delta The delta to be applied
3434
* @param payload User-specified payload
35+
* @return 0 if the delta is applied, < 0 if the apply process will be aborted
36+
* or > 0 if the delta will not be applied.
3537
*/
3638
typedef int GIT_CALLBACK(git_apply_delta_cb)(
3739
const git_diff_delta *delta,
@@ -48,6 +50,8 @@ typedef int GIT_CALLBACK(git_apply_delta_cb)(
4850
*
4951
* @param hunk The hunk to be applied
5052
* @param payload User-specified payload
53+
* @return 0 if the hunk is applied, < 0 if the apply process will be aborted
54+
* or > 0 if the hunk will not be applied.
5155
*/
5256
typedef int GIT_CALLBACK(git_apply_hunk_cb)(
5357
const git_diff_hunk *hunk,

include/git2/attr.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ typedef struct {
177177
* not have to exist, but if it does not, then it will be
178178
* treated as a plain file (not a directory).
179179
* @param name The name of the attribute to look up.
180+
* @return 0 or an error code.
180181
*/
181182
GIT_EXTERN(int) git_attr_get(
182183
const char **value_out,
@@ -199,6 +200,7 @@ GIT_EXTERN(int) git_attr_get(
199200
* not have to exist, but if it does not, then it will be
200201
* treated as a plain file (not a directory).
201202
* @param name The name of the attribute to look up.
203+
* @return 0 or an error code.
202204
*/
203205
GIT_EXTERN(int) git_attr_get_ext(
204206
const char **value_out,
@@ -235,6 +237,7 @@ GIT_EXTERN(int) git_attr_get_ext(
235237
* it will be treated as a plain file (i.e. not a directory).
236238
* @param num_attr The number of attributes being looked up
237239
* @param names An array of num_attr strings containing attribute names.
240+
* @return 0 or an error code.
238241
*/
239242
GIT_EXTERN(int) git_attr_get_many(
240243
const char **values_out,
@@ -259,6 +262,7 @@ GIT_EXTERN(int) git_attr_get_many(
259262
* it will be treated as a plain file (i.e. not a directory).
260263
* @param num_attr The number of attributes being looked up
261264
* @param names An array of num_attr strings containing attribute names.
265+
* @return 0 or an error code.
262266
*/
263267
GIT_EXTERN(int) git_attr_get_many_ext(
264268
const char **values_out,
@@ -349,6 +353,11 @@ GIT_EXTERN(int) git_attr_cache_flush(
349353
* macro, you would call:
350354
*
351355
* git_attr_add_macro(repo, "binary", "-diff -crlf");
356+
*
357+
* @param repo The repository where to add the macro.
358+
* @param name The name of the macro.
359+
* @param values The value for the macro.
360+
* @return 0 or an error code.
352361
*/
353362
GIT_EXTERN(int) git_attr_add_macro(
354363
git_repository *repo,

include/git2/blame.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ typedef struct git_blame git_blame;
203203

204204
/**
205205
* Gets the number of hunks that exist in the blame structure.
206+
*
207+
* @param blame The blame structure to query.
208+
* @return The number of hunks.
206209
*/
207210
GIT_EXTERN(uint32_t) git_blame_get_hunk_count(git_blame *blame);
208211

include/git2/blob.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ GIT_EXTERN(int) git_blob_data_is_binary(const char *data, size_t len);
302302
*
303303
* @param out Pointer to store the copy of the object
304304
* @param source Original object to copy
305+
* @return 0.
305306
*/
306307
GIT_EXTERN(int) git_blob_dup(git_blob **out, git_blob *source);
307308

include/git2/branch.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ GIT_BEGIN_DECL
3434
*
3535
* @param out Pointer where to store the underlying reference.
3636
*
37+
* @param repository the repository where to create the branch.
38+
*
3739
* @param branch_name Name for the branch; this name is
3840
* validated for consistency. It should also not conflict with
3941
* an already existing branch name.

include/git2/commit.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ GIT_EXTERN(int) git_commit_create_buffer(
479479
* to the commit and write it into the given repository.
480480
*
481481
* @param out the resulting commit id
482+
* @param repository the repository where to create the commit.
482483
* @param commit_content the content of the unsigned commit object
483484
* @param signature the signature to add to the commit. Leave `NULL`
484485
* to create a commit without adding a signature field.
@@ -499,6 +500,7 @@ GIT_EXTERN(int) git_commit_create_with_signature(
499500
*
500501
* @param out Pointer to store the copy of the commit
501502
* @param source Original commit to copy
503+
* @return 0
502504
*/
503505
GIT_EXTERN(int) git_commit_dup(git_commit **out, git_commit *source);
504506

include/git2/config.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ typedef struct git_config_entry {
7272

7373
/**
7474
* Free a config entry
75+
*
76+
* @param entry The entry to free.
7577
*/
7678
GIT_EXTERN(void) git_config_entry_free(git_config_entry *entry);
7779

@@ -80,6 +82,7 @@ GIT_EXTERN(void) git_config_entry_free(git_config_entry *entry);
8082
*
8183
* @param entry the entry currently being enumerated
8284
* @param payload a user-specified pointer
85+
* @return non-zero to terminate the iteration.
8386
*/
8487
typedef int GIT_CALLBACK(git_config_foreach_cb)(const git_config_entry *entry, void *payload);
8588

@@ -269,6 +272,7 @@ GIT_EXTERN(int) git_config_open_level(
269272
*
270273
* @param out pointer in which to store the config object
271274
* @param config the config object in which to look
275+
* @return 0 or an error code.
272276
*/
273277
GIT_EXTERN(int) git_config_open_global(git_config **out, git_config *config);
274278

@@ -422,6 +426,7 @@ GIT_EXTERN(int) git_config_get_string_buf(git_buf *out, const git_config *cfg, c
422426
* interested in. Use NULL to indicate all
423427
* @param callback the function to be called on each value of the variable
424428
* @param payload opaque pointer to pass to the callback
429+
* @return non-zero to terminate the iteration.
425430
*/
426431
GIT_EXTERN(int) git_config_get_multivar_foreach(const git_config *cfg, const char *name, const char *regexp, git_config_foreach_cb callback, void *payload);
427432

@@ -437,6 +442,7 @@ GIT_EXTERN(int) git_config_get_multivar_foreach(const git_config *cfg, const cha
437442
* @param name the variable's name
438443
* @param regexp regular expression to filter which variables we're
439444
* interested in. Use NULL to indicate all
445+
* @return non-zero to terminate the iteration.
440446
*/
441447
GIT_EXTERN(int) git_config_multivar_iterator_new(git_config_iterator **out, const git_config *cfg, const char *name, const char *regexp);
442448

@@ -515,6 +521,7 @@ GIT_EXTERN(int) git_config_set_string(git_config *cfg, const char *name, const c
515521
* @param name the variable's name
516522
* @param regexp a regular expression to indicate which values to replace
517523
* @param value the new value.
524+
* @return 0 or an error code.
518525
*/
519526
GIT_EXTERN(int) git_config_set_multivar(git_config *cfg, const char *name, const char *regexp, const char *value);
520527

@@ -524,6 +531,7 @@ GIT_EXTERN(int) git_config_set_multivar(git_config *cfg, const char *name, const
524531
*
525532
* @param cfg the configuration
526533
* @param name the variable to delete
534+
* @return 0 or an error code.
527535
*/
528536
GIT_EXTERN(int) git_config_delete_entry(git_config *cfg, const char *name);
529537

@@ -569,6 +577,7 @@ GIT_EXTERN(int) git_config_foreach(
569577
*
570578
* @param out pointer to store the iterator
571579
* @param cfg where to ge the variables from
580+
* @return 0 or an error code.
572581
*/
573582
GIT_EXTERN(int) git_config_iterator_new(git_config_iterator **out, const git_config *cfg);
574583

@@ -585,6 +594,7 @@ GIT_EXTERN(int) git_config_iterator_new(git_config_iterator **out, const git_con
585594
* @param out pointer to store the iterator
586595
* @param cfg where to ge the variables from
587596
* @param regexp regular expression to match the names
597+
* @return 0 or an error code.
588598
*/
589599
GIT_EXTERN(int) git_config_iterator_glob_new(git_config_iterator **out, const git_config *cfg, const char *regexp);
590600

@@ -662,6 +672,7 @@ GIT_EXTERN(int) git_config_get_mapped(
662672
* @param maps array of `git_configmap` objects specifying the possible mappings
663673
* @param map_n number of mapping objects in `maps`
664674
* @param value value to parse
675+
* @return 0 or an error code.
665676
*/
666677
GIT_EXTERN(int) git_config_lookup_map_value(
667678
int *out,
@@ -678,6 +689,7 @@ GIT_EXTERN(int) git_config_lookup_map_value(
678689
*
679690
* @param out place to store the result of the parsing
680691
* @param value value to parse
692+
* @return 0 or an error code.
681693
*/
682694
GIT_EXTERN(int) git_config_parse_bool(int *out, const char *value);
683695

@@ -690,6 +702,7 @@ GIT_EXTERN(int) git_config_parse_bool(int *out, const char *value);
690702
*
691703
* @param out place to store the result of the parsing
692704
* @param value value to parse
705+
* @return 0 or an error code.
693706
*/
694707
GIT_EXTERN(int) git_config_parse_int32(int32_t *out, const char *value);
695708

@@ -702,6 +715,7 @@ GIT_EXTERN(int) git_config_parse_int32(int32_t *out, const char *value);
702715
*
703716
* @param out place to store the result of the parsing
704717
* @param value value to parse
718+
* @return 0 or an error code.
705719
*/
706720
GIT_EXTERN(int) git_config_parse_int64(int64_t *out, const char *value);
707721

@@ -717,6 +731,7 @@ GIT_EXTERN(int) git_config_parse_int64(int64_t *out, const char *value);
717731
*
718732
* @param out placae to store the result of parsing
719733
* @param value the path to evaluate
734+
* @return 0 or an error code.
720735
*/
721736
GIT_EXTERN(int) git_config_parse_path(git_buf *out, const char *value);
722737

@@ -735,6 +750,7 @@ GIT_EXTERN(int) git_config_parse_path(git_buf *out, const char *value);
735750
* @param regexp regular expression to match against config names (can be NULL)
736751
* @param callback the function to call on each variable
737752
* @param payload the data to pass to the callback
753+
* @return non-zero to terminate the iteration.
738754
*/
739755
GIT_EXTERN(int) git_config_backend_foreach_match(
740756
git_config_backend *backend,

include/git2/credential.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ typedef void GIT_CALLBACK(git_credential_ssh_interactive_cb)(
254254
* Create a new ssh keyboard-interactive based credential object.
255255
* The supplied credential parameter will be internally duplicated.
256256
*
257+
* @param out The newly created credential object.
257258
* @param username Username to use to authenticate.
258259
* @param prompt_callback The callback method used for prompts.
259260
* @param payload Additional data to pass to the callback.

include/git2/credential_helpers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ typedef struct git_credential_userpass_payload {
3939
* @param allowed_types A bitmask stating which credential types are OK to return.
4040
* @param payload The payload provided when specifying this callback. (This is
4141
* interpreted as a `git_credential_userpass_payload*`.)
42+
* @return 0 or an error code.
4243
*/
4344
GIT_EXTERN(int) git_credential_userpass(
4445
git_credential **out,

include/git2/describe.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ typedef struct git_describe_result git_describe_result;
142142
* you're done with it.
143143
* @param committish a committish to describe
144144
* @param opts the lookup options (or NULL for defaults)
145+
* @return 0 or an error code.
145146
*/
146147
GIT_EXTERN(int) git_describe_commit(
147148
git_describe_result **result,
@@ -159,6 +160,7 @@ GIT_EXTERN(int) git_describe_commit(
159160
* you're done with it.
160161
* @param repo the repository in which to perform the describe
161162
* @param opts the lookup options (or NULL for defaults)
163+
* @return 0 or an error code.
162164
*/
163165
GIT_EXTERN(int) git_describe_workdir(
164166
git_describe_result **out,
@@ -172,6 +174,7 @@ GIT_EXTERN(int) git_describe_workdir(
172174
* @param result the result from `git_describe_commit()` or
173175
* `git_describe_workdir()`.
174176
* @param opts the formatting options (or NULL for defaults)
177+
* @return 0 or an error code.
175178
*/
176179
GIT_EXTERN(int) git_describe_format(
177180
git_buf *out,
@@ -180,6 +183,8 @@ GIT_EXTERN(int) git_describe_format(
180183

181184
/**
182185
* Free the describe result.
186+
*
187+
* @param result The result to free.
183188
*/
184189
GIT_EXTERN(void) git_describe_result_free(git_describe_result *result);
185190

0 commit comments

Comments
 (0)