Commit a295bd2dc4a1ac2b15b9c39089d148499e6e9e00

Carlos Martín Nieto 2014-12-06T03:36:18

doc: add documentation to all the public structs and enums This makes them show up in the reference, even if the text itself isn't the most descriptive. These have been found with grep -Przon '\n\ntypedef struct.*?\{' -- include grep -Przon '\n\ntypedef enum.*?\{' -- include

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
diff --git a/include/git2/blame.h b/include/git2/blame.h
index 7f0de17..173e999 100644
--- a/include/git2/blame.h
+++ b/include/git2/blame.h
@@ -67,7 +67,6 @@ typedef enum {
  *	- `max_line` is the last line in the file to blame.  The default is the last
  *	             line of the file.
  */
-
 typedef struct git_blame_options {
 	unsigned int version;
 
diff --git a/include/git2/cherrypick.h b/include/git2/cherrypick.h
index dea67c1..208166c 100644
--- a/include/git2/cherrypick.h
+++ b/include/git2/cherrypick.h
@@ -20,14 +20,17 @@
  */
 GIT_BEGIN_DECL
 
+/**
+ * Cherry-pick options
+ */
 typedef struct {
 	unsigned int version;
 
 	/** For merge commits, the "mainline" is treated as the parent. */
 	unsigned int mainline;
 
-	git_merge_options merge_opts;
-	git_checkout_options checkout_opts;
+	git_merge_options merge_opts; /*< Options for the merging */
+	git_checkout_options checkout_opts; /*< Options for the checkout */
 } git_cherrypick_options;
 
 #define GIT_CHERRYPICK_OPTIONS_VERSION 1
diff --git a/include/git2/clone.h b/include/git2/clone.h
index fa2e25b..4644085 100644
--- a/include/git2/clone.h
+++ b/include/git2/clone.h
@@ -100,7 +100,6 @@ typedef int (*git_repository_create_cb)(
  *
  *		git_clone_options opts = GIT_CLONE_OPTIONS_INIT;
  */
-
 typedef struct git_clone_options {
 	unsigned int version;
 
diff --git a/include/git2/common.h b/include/git2/common.h
index 1363316..d84a765 100644
--- a/include/git2/common.h
+++ b/include/git2/common.h
@@ -123,7 +123,12 @@ typedef enum {
  */
 GIT_EXTERN(int) git_libgit2_features(void);
 
-
+/**
+ * Global library options
+ *
+ * These are used to select which global option to set or get and are
+ * used in `git_libgit2_opts()`.
+ */
 typedef enum {
 	GIT_OPT_GET_MWINDOW_SIZE,
 	GIT_OPT_SET_MWINDOW_SIZE,
diff --git a/include/git2/config.h b/include/git2/config.h
index 1fd98b2..e32c614 100644
--- a/include/git2/config.h
+++ b/include/git2/config.h
@@ -55,15 +55,21 @@ typedef enum {
 	GIT_CONFIG_HIGHEST_LEVEL = -1,
 } git_config_level_t;
 
+/**
+ * An entry in a configuration file
+ */
 typedef struct {
-	const char *name;
-	const char *value;
-	git_config_level_t level;
+	const char *name; /*< Name of the entry (normalised) */
+	const char *value; /*< String value of the entry */
+	git_config_level_t level; /*< Which config file this was found in */
 } git_config_entry;
 
 typedef int  (*git_config_foreach_cb)(const git_config_entry *, void *);
 typedef struct git_config_iterator git_config_iterator;
 
+/**
+ * Config var type
+ */
 typedef enum {
 	GIT_CVAR_FALSE = 0,
 	GIT_CVAR_TRUE = 1,
@@ -71,6 +77,9 @@ typedef enum {
 	GIT_CVAR_STRING
 } git_cvar_t;
 
+/**
+ * Mapping from config variables to values.
+ */
 typedef struct {
 	git_cvar_t cvar_type;
 	const char *str_match;
diff --git a/include/git2/filter.h b/include/git2/filter.h
index e57a67e..5b3f403 100644
--- a/include/git2/filter.h
+++ b/include/git2/filter.h
@@ -35,6 +35,9 @@ typedef enum {
 	GIT_FILTER_CLEAN = GIT_FILTER_TO_ODB,
 } git_filter_mode_t;
 
+/**
+ * Filter option flags.
+ */
 typedef enum {
 	GIT_FILTER_OPT_DEFAULT = 0u,
 	GIT_FILTER_OPT_ALLOW_UNSAFE = (1u << 0),
diff --git a/include/git2/index.h b/include/git2/index.h
index 0b4476b..4382c2f 100644
--- a/include/git2/index.h
+++ b/include/git2/index.h
@@ -75,6 +75,9 @@ typedef struct git_index_entry {
 #define GIT_IDXENTRY_STAGEMASK (0x3000)
 #define GIT_IDXENTRY_STAGESHIFT 12
 
+/**
+ * Flags for index entries
+ */
 typedef enum {
 	GIT_IDXENTRY_EXTENDED  = (0x4000),
 	GIT_IDXENTRY_VALID     = (0x8000),
diff --git a/include/git2/merge.h b/include/git2/merge.h
index fb06d6e..09900f1 100644
--- a/include/git2/merge.h
+++ b/include/git2/merge.h
@@ -110,20 +110,26 @@ typedef enum {
 	GIT_MERGE_FILE_FAVOR_UNION = 3,
 } git_merge_file_favor_t;
 
+/**
+ * File merging flags
+ */
 typedef enum {
-	/* Defaults */
+	/** Defaults */
 	GIT_MERGE_FILE_DEFAULT = 0,
 
-	/* Create standard conflicted merge files */
+	/** Create standard conflicted merge files */
 	GIT_MERGE_FILE_STYLE_MERGE = (1 << 0),
 
-	/* Create diff3-style files */
+	/** Create diff3-style files */
 	GIT_MERGE_FILE_STYLE_DIFF3 = (1 << 1),
 
-	/* Condense non-alphanumeric regions for simplified diff file */
+	/** Condense non-alphanumeric regions for simplified diff file */
 	GIT_MERGE_FILE_SIMPLIFY_ALNUM = (1 << 2),
 } git_merge_file_flags_t;
 
+/**
+ * Options for merging a file
+ */
 typedef struct {
 	unsigned int version;
 
@@ -168,6 +174,9 @@ GIT_EXTERN(int) git_merge_file_init_options(
 	git_merge_file_options *opts,
 	unsigned int version);
 
+/**
+ * Information about file-level merging
+ */
 typedef struct {
 	/**
 	 * True if the output was automerged, false if the output contains
@@ -191,6 +200,9 @@ typedef struct {
 	size_t len;
 } git_merge_file_result;
 
+/**
+ * Merging options
+ */
 typedef struct {
 	unsigned int version;
 	git_merge_tree_flag_t flags;
@@ -270,8 +282,11 @@ typedef enum {
 	GIT_MERGE_ANALYSIS_UNBORN = (1 << 3),
 } git_merge_analysis_t;
 
+/**
+ * The user's stated preference for merges.
+ */
 typedef enum {
-	/*
+	/**
 	 * No configuration was found that suggests a preferred behavior for
 	 * merge.
 	 */
diff --git a/include/git2/net.h b/include/git2/net.h
index 8cffa18..04dff34 100644
--- a/include/git2/net.h
+++ b/include/git2/net.h
@@ -21,12 +21,13 @@ GIT_BEGIN_DECL
 
 #define GIT_DEFAULT_PORT "9418"
 
-/*
+/**
+ * Direction of the connection.
+ *
  * We need this because we need to know whether we should call
  * git-upload-pack or git-receive-pack on the remote end when get_refs
  * gets called.
  */
-
 typedef enum {
 	GIT_DIRECTION_FETCH = 0,
 	GIT_DIRECTION_PUSH  = 1
diff --git a/include/git2/rebase.h b/include/git2/rebase.h
index 095975e..1924650 100644
--- a/include/git2/rebase.h
+++ b/include/git2/rebase.h
@@ -21,6 +21,11 @@
  */
 GIT_BEGIN_DECL
 
+/**
+ * Rebase options
+ *
+ * Use to tell the rebase machinery how to operate.
+ */
 typedef struct {
 	unsigned int version;
 
@@ -40,7 +45,9 @@ typedef struct {
 	const char *rewrite_notes_ref;
 } git_rebase_options;
 
-/** Type of rebase operation in-progress after calling `git_rebase_next`. */
+/**
+ * Type of rebase operation in-progress after calling `git_rebase_next`.
+ */
 typedef enum {
 	/**
 	 * The given commit is to be cherry-picked.  The client should commit
@@ -82,6 +89,12 @@ typedef enum {
 #define GIT_REBASE_OPTIONS_VERSION 1
 #define GIT_REBASE_OPTIONS_INIT {GIT_REBASE_OPTIONS_VERSION}
 
+/**
+ * A rebase operation
+ *
+ * Describes a single instruction/operation to be performed during the
+ * rebase.
+ */
 typedef struct {
 	/** The type of rebase operation. */
 	git_rebase_operation_t type;
diff --git a/include/git2/refs.h b/include/git2/refs.h
index 54a865e..43dda7c 100644
--- a/include/git2/refs.h
+++ b/include/git2/refs.h
@@ -629,7 +629,13 @@ GIT_EXTERN(int) git_reference_is_tag(const git_reference *ref);
  */
 GIT_EXTERN(int) git_reference_is_note(const git_reference *ref);
 
+/**
+ * Normalization options for reference lookup
+ */
 typedef enum {
+	/**
+	 * No particular normalization.
+	 */
 	GIT_REF_FORMAT_NORMAL = 0u,
 
 	/**
diff --git a/include/git2/remote.h b/include/git2/remote.h
index 56acf06..15a8d48 100644
--- a/include/git2/remote.h
+++ b/include/git2/remote.h
@@ -555,6 +555,11 @@ GIT_EXTERN(const git_remote_callbacks *) git_remote_get_callbacks(git_remote *re
  */
 GIT_EXTERN(const git_transfer_progress *) git_remote_stats(git_remote *remote);
 
+/**
+ * Automatic tag following option
+ *
+ * Lets us select the --tags option to use.
+ */
 typedef enum {
 	GIT_REMOTE_DOWNLOAD_TAGS_AUTO = 0,
 	GIT_REMOTE_DOWNLOAD_TAGS_NONE = 1,
diff --git a/include/git2/repository.h b/include/git2/repository.h
index 2687826..124aa67 100644
--- a/include/git2/repository.h
+++ b/include/git2/repository.h
@@ -661,6 +661,12 @@ GIT_EXTERN(int) git_repository_detach_head(
 	const git_signature *signature,
 	const char *reflog_message);
 
+/**
+ * Repository state
+ *
+ * These values represent possible states for the repository to be in,
+ * based on the current operation which is ongoing.
+ */
 typedef enum {
 	GIT_REPOSITORY_STATE_NONE,
 	GIT_REPOSITORY_STATE_MERGE,
diff --git a/include/git2/revert.h b/include/git2/revert.h
index ab9dd9a..476148d 100644
--- a/include/git2/revert.h
+++ b/include/git2/revert.h
@@ -20,14 +20,17 @@
  */
 GIT_BEGIN_DECL
 
+/**
+ * Options for revert
+ */
 typedef struct {
 	unsigned int version;
 
 	/** For merge commits, the "mainline" is treated as the parent. */
 	unsigned int mainline;
 
-	git_merge_options merge_opts;
-	git_checkout_options checkout_opts;
+	git_merge_options merge_opts; /*< Options for the merging */
+	git_checkout_options checkout_opts; /*< Options for the checkout */
 } git_revert_options;
 
 #define GIT_REVERT_OPTIONS_VERSION 1
diff --git a/include/git2/stash.h b/include/git2/stash.h
index e2fe2cf..280c647 100644
--- a/include/git2/stash.h
+++ b/include/git2/stash.h
@@ -18,21 +18,30 @@
  */
 GIT_BEGIN_DECL
 
+/**
+ * Stash flags
+ */
 typedef enum {
+	/**
+	 * No option, default
+	 */
 	GIT_STASH_DEFAULT = 0,
 
-	/* All changes already added to the index
-	 * are left intact in the working directory
+	/**
+	 * All changes already added to the index are left intact in
+	 * the working directory
 	 */
 	GIT_STASH_KEEP_INDEX = (1 << 0),
 
-	/* All untracked files are also stashed and then
-	 * cleaned up from the working directory
+	/**
+	 * All untracked files are also stashed and then cleaned up
+	 * from the working directory
 	 */
 	GIT_STASH_INCLUDE_UNTRACKED = (1 << 1),
 
-	/* All ignored files are also stashed and then
-	 * cleaned up from the working directory
+	/**
+	 * All ignored files are also stashed and then cleaned up from
+	 * the working directory
 	 */
 	GIT_STASH_INCLUDE_IGNORED = (1 << 2),
 } git_stash_flags;
diff --git a/include/git2/sys/diff.h b/include/git2/sys/diff.h
index 48d72f4..034d5c4 100644
--- a/include/git2/sys/diff.h
+++ b/include/git2/sys/diff.h
@@ -61,10 +61,13 @@ GIT_EXTERN(int) git_diff_print_callback__to_file_handle(
 	void *payload); /*< payload must be a `FILE *` */
 
 
+/**
+ * Performance data from diffing
+ */
 typedef struct {
 	unsigned int version;
-	size_t stat_calls;
-	size_t oid_calculations;
+	size_t stat_calls; /*< Number of stat() calls performed */
+	size_t oid_calculations; /*< Number of ID calculations */
 } git_diff_perfdata;
 
 #define GIT_DIFF_PERFDATA_VERSION 1
diff --git a/include/git2/sys/hashsig.h b/include/git2/sys/hashsig.h
index cd735e1..2bc32f3 100644
--- a/include/git2/sys/hashsig.h
+++ b/include/git2/sys/hashsig.h
@@ -16,6 +16,9 @@ GIT_BEGIN_DECL
  */
 typedef struct git_hashsig git_hashsig;
 
+/**
+ * Options for hashsig calculation
+ */
 typedef enum {
 	GIT_HASHSIG_NORMAL = 0, /* use all data */
 	GIT_HASHSIG_IGNORE_WHITESPACE = 1, /* ignore whitespace */
diff --git a/include/git2/sys/transport.h b/include/git2/sys/transport.h
index b50438e..69d4e15 100644
--- a/include/git2/sys/transport.h
+++ b/include/git2/sys/transport.h
@@ -21,6 +21,11 @@
 
 GIT_BEGIN_DECL
 
+/**
+ * Flags to pass to transport
+ *
+ * Currently unused.
+ */
 typedef enum {
 	GIT_TRANSPORTFLAGS_NONE = 0,
 } git_transport_flags_t;
@@ -286,12 +291,20 @@ typedef int (*git_smart_subtransport_cb)(
 	git_smart_subtransport **out,
 	git_transport* owner);
 
+/**
+ * Definition for a "subtransport"
+ *
+ * This is used to let the smart protocol code know about the protocol
+ * which you are implementing.
+ */
 typedef struct git_smart_subtransport_definition {
-	/* The function to use to create the git_smart_subtransport */
+	/** The function to use to create the git_smart_subtransport */
 	git_smart_subtransport_cb callback;
 
-	/* True if the protocol is stateless; false otherwise. For example,
-	 * http:// is stateless, but git:// is not. */
+	/**
+	 * True if the protocol is stateless; false otherwise. For example,
+	 * http:// is stateless, but git:// is not.
+	 */
 	unsigned rpc;
 } git_smart_subtransport_definition;