Skip to content

Commit 346f15b

Browse files
committed
status: document GIT_STATUS_OPT_INCLUDE_UNREADABLE
Document `GIT_STATUS_OPT_INCLUDE_UNREADABLE`, and some minor cleanups.
1 parent f169793 commit 346f15b

File tree

2 files changed

+75
-29
lines changed

2 files changed

+75
-29
lines changed

include/git2/blame.h

Lines changed: 55 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,52 @@ GIT_BEGIN_DECL
2626
typedef enum {
2727
/** Normal blame, the default */
2828
GIT_BLAME_NORMAL = 0,
29-
/** Track lines that have moved within a file (like `git blame -M`).
30-
* NOT IMPLEMENTED. */
29+
30+
/**
31+
* Track lines that have moved within a file (like `git blame -M`).
32+
*
33+
* This is not yet implemented and reserved for future use.
34+
*/
3135
GIT_BLAME_TRACK_COPIES_SAME_FILE = (1<<0),
32-
/** Track lines that have moved across files in the same commit (like `git blame -C`).
33-
* NOT IMPLEMENTED. */
36+
37+
/**
38+
* Track lines that have moved across files in the same commit
39+
* (like `git blame -C`).
40+
*
41+
* This is not yet implemented and reserved for future use.
42+
*/
3443
GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES = (1<<1),
35-
/** Track lines that have been copied from another file that exists in the
36-
* same commit (like `git blame -CC`). Implies SAME_FILE.
37-
* NOT IMPLEMENTED. */
44+
45+
/**
46+
* Track lines that have been copied from another file that exists
47+
* in the same commit (like `git blame -CC`). Implies SAME_FILE.
48+
*
49+
* This is not yet implemented and reserved for future use.
50+
*/
3851
GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES = (1<<2),
39-
/** Track lines that have been copied from another file that exists in *any*
40-
* commit (like `git blame -CCC`). Implies SAME_COMMIT_COPIES.
41-
* NOT IMPLEMENTED. */
52+
53+
/**
54+
* Track lines that have been copied from another file that exists in
55+
* *any* commit (like `git blame -CCC`). Implies SAME_COMMIT_COPIES.
56+
*
57+
* This is not yet implemented and reserved for future use.
58+
*/
4259
GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES = (1<<3),
43-
/** Restrict the search of commits to those reachable following only the
44-
* first parents. */
60+
61+
/**
62+
* Restrict the search of commits to those reachable following only
63+
* the first parents.
64+
*/
4565
GIT_BLAME_FIRST_PARENT = (1<<4),
46-
/** Use mailmap file to map author and committer names and email addresses
47-
* to canonical real names and email addresses. The mailmap will be read
48-
* from the working directory, or HEAD in a bare repository. */
66+
67+
/**
68+
* Use mailmap file to map author and committer names and email
69+
* addresses to canonical real names and email addresses. The
70+
* mailmap will be read from the working directory, or HEAD in a
71+
* bare repository.
72+
*/
4973
GIT_BLAME_USE_MAILMAP = (1<<5),
74+
5075
/** Ignore whitespace differences */
5176
GIT_BLAME_IGNORE_WHITESPACE = (1<<6),
5277
} git_blame_flag_t;
@@ -63,25 +88,33 @@ typedef struct git_blame_options {
6388

6489
/** A combination of `git_blame_flag_t` */
6590
uint32_t flags;
66-
/** The lower bound on the number of alphanumeric
67-
* characters that must be detected as moving/copying within a file for it to
68-
* associate those lines with the parent commit. The default value is 20.
69-
* This value only takes effect if any of the `GIT_BLAME_TRACK_COPIES_*`
70-
* flags are specified.
91+
92+
/**
93+
* The lower bound on the number of alphanumeric characters that
94+
* must be detected as moving/copying within a file for it to
95+
* associate those lines with the parent commit. The default value
96+
* is 20.
97+
*
98+
* This value only takes effect if any of the `GIT_BLAME_TRACK_COPIES_*`
99+
* flags are specified.
71100
*/
72101
uint16_t min_match_characters;
102+
73103
/** The id of the newest commit to consider. The default is HEAD. */
74104
git_oid newest_commit;
105+
75106
/**
76107
* The id of the oldest commit to consider.
77108
* The default is the first commit encountered with a NULL parent.
78109
*/
79110
git_oid oldest_commit;
111+
80112
/**
81113
* The first line in the file to blame.
82114
* The default is 1 (line numbers start with 1).
83115
*/
84116
size_t min_line;
117+
85118
/**
86119
* The last line in the file to blame.
87120
* The default is the last line of the file.
@@ -158,8 +191,8 @@ typedef struct git_blame_hunk {
158191
git_signature *orig_signature;
159192

160193
/**
161-
* The 1 iff the hunk has been tracked to a boundary commit (the root, or
162-
* the commit specified in git_blame_options.oldest_commit)
194+
* The 1 iff the hunk has been tracked to a boundary commit (the root,
195+
* or the commit specified in git_blame_options.oldest_commit)
163196
*/
164197
char boundary;
165198
} git_blame_hunk;

include/git2/status.h

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,17 @@ typedef enum {
193193
*/
194194
GIT_STATUS_OPT_UPDATE_INDEX = (1u << 13),
195195

196+
/**
197+
* Normally files that cannot be opened or read are ignored as
198+
* these are often transient files; this option will return
199+
* unreadable files as `GIT_STATUS_WT_UNREADABLE`.
200+
*/
196201
GIT_STATUS_OPT_INCLUDE_UNREADABLE = (1u << 14),
197202

203+
/**
204+
* Unreadable files will be detected and given the status
205+
* untracked instead of unreadable.
206+
*/
198207
GIT_STATUS_OPT_INCLUDE_UNREADABLE_AS_UNTRACKED = (1u << 15),
199208
} git_status_opt_t;
200209

@@ -211,7 +220,10 @@ typedef enum {
211220
*
212221
*/
213222
typedef struct {
214-
unsigned int version; /**< The version */
223+
/**
224+
* The struct version; pass `GIT_STATUS_OPTIONS_VERSION`.
225+
*/
226+
unsigned int version;
215227

216228
/**
217229
* The `show` value is one of the `git_status_show_t` constants that
@@ -220,21 +232,22 @@ typedef struct {
220232
git_status_show_t show;
221233

222234
/**
223-
* The `flags` value is an OR'ed combination of the `git_status_opt_t`
224-
* values above.
235+
* The `flags` value is an OR'ed combination of the
236+
* `git_status_opt_t` values above.
225237
*/
226238
unsigned int flags;
227239

228240
/**
229241
* The `pathspec` is an array of path patterns to match (using
230-
* fnmatch-style matching), or just an array of paths to match exactly if
231-
* `GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH` is specified in the flags.
242+
* fnmatch-style matching), or just an array of paths to match
243+
* exactly if `GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH` is specified
244+
* in the flags.
232245
*/
233246
git_strarray pathspec;
234247

235248
/**
236-
* The `baseline` is the tree to be used for comparison to the working directory
237-
* and index; defaults to HEAD.
249+
* The `baseline` is the tree to be used for comparison to the
250+
* working directory and index; defaults to HEAD.
238251
*/
239252
git_tree *baseline;
240253
} git_status_options;

0 commit comments

Comments
 (0)