@@ -26,27 +26,52 @@ GIT_BEGIN_DECL
2626typedef 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.
@@ -108,41 +141,59 @@ GIT_EXTERN(int) git_blame_options_init(
108141
109142/**
110143 * Structure that represents a blame hunk.
111- *
112- * - `lines_in_hunk` is the number of lines in this hunk
113- * - `final_commit_id` is the OID of the commit where this line was last
114- * changed.
115- * - `final_start_line_number` is the 1-based line number where this hunk
116- * begins, in the final version of the file
117- * - `final_signature` is the author of `final_commit_id`. If
118- * `GIT_BLAME_USE_MAILMAP` has been specified, it will contain the canonical
119- * real name and email address.
120- * - `orig_commit_id` is the OID of the commit where this hunk was found. This
121- * will usually be the same as `final_commit_id`, except when
122- * `GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES` has been specified.
123- * - `orig_path` is the path to the file where this hunk originated, as of the
124- * commit specified by `orig_commit_id`.
125- * - `orig_start_line_number` is the 1-based line number where this hunk begins
126- * in the file named by `orig_path` in the commit specified by
127- * `orig_commit_id`.
128- * - `orig_signature` is the author of `orig_commit_id`. If
129- * `GIT_BLAME_USE_MAILMAP` has been specified, it will contain the canonical
130- * real name and email address.
131- * - `boundary` is 1 iff the hunk has been tracked to a boundary commit (the
132- * root, or the commit specified in git_blame_options.oldest_commit)
133144 */
134145typedef struct git_blame_hunk {
146+ /**
147+ * The number of lines in this hunk.
148+ */
135149 size_t lines_in_hunk ;
136150
151+ /**
152+ * The OID of the commit where this line was last changed.
153+ */
137154 git_oid final_commit_id ;
155+
156+ /**
157+ * The 1-based line number where this hunk begins, in the final version
158+ * of the file.
159+ */
138160 size_t final_start_line_number ;
161+
162+ /**
163+ * The author of `final_commit_id`. If `GIT_BLAME_USE_MAILMAP` has been
164+ * specified, it will contain the canonical real name and email address.
165+ */
139166 git_signature * final_signature ;
140167
168+ /**
169+ * The OID of the commit where this hunk was found.
170+ * This will usually be the same as `final_commit_id`, except when
171+ * `GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES` has been specified.
172+ */
141173 git_oid orig_commit_id ;
174+
175+ /**
176+ * The path to the file where this hunk originated, as of the commit
177+ * specified by `orig_commit_id`.
178+ */
142179 const char * orig_path ;
180+
181+ /**
182+ * The 1-based line number where this hunk begins in the file named by
183+ * `orig_path` in the commit specified by `orig_commit_id`.
184+ */
143185 size_t orig_start_line_number ;
186+
187+ /**
188+ * The author of `orig_commit_id`. If `GIT_BLAME_USE_MAILMAP` has been
189+ * specified, it will contain the canonical real name and email address.
190+ */
144191 git_signature * orig_signature ;
145192
193+ /**
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)
196+ */
146197 char boundary ;
147198} git_blame_hunk ;
148199
0 commit comments