@@ -26,27 +26,52 @@ GIT_BEGIN_DECL
26
26
typedef enum {
27
27
/** Normal blame, the default */
28
28
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
+ */
31
35
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
+ */
34
43
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
+ */
38
51
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
+ */
42
59
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
+ */
45
65
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
+ */
49
73
GIT_BLAME_USE_MAILMAP = (1 <<5 ),
74
+
50
75
/** Ignore whitespace differences */
51
76
GIT_BLAME_IGNORE_WHITESPACE = (1 <<6 ),
52
77
} git_blame_flag_t ;
@@ -63,25 +88,33 @@ typedef struct git_blame_options {
63
88
64
89
/** A combination of `git_blame_flag_t` */
65
90
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.
71
100
*/
72
101
uint16_t min_match_characters ;
102
+
73
103
/** The id of the newest commit to consider. The default is HEAD. */
74
104
git_oid newest_commit ;
105
+
75
106
/**
76
107
* The id of the oldest commit to consider.
77
108
* The default is the first commit encountered with a NULL parent.
78
109
*/
79
110
git_oid oldest_commit ;
111
+
80
112
/**
81
113
* The first line in the file to blame.
82
114
* The default is 1 (line numbers start with 1).
83
115
*/
84
116
size_t min_line ;
117
+
85
118
/**
86
119
* The last line in the file to blame.
87
120
* The default is the last line of the file.
@@ -108,41 +141,59 @@ GIT_EXTERN(int) git_blame_options_init(
108
141
109
142
/**
110
143
* 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)
133
144
*/
134
145
typedef struct git_blame_hunk {
146
+ /**
147
+ * The number of lines in this hunk.
148
+ */
135
149
size_t lines_in_hunk ;
136
150
151
+ /**
152
+ * The OID of the commit where this line was last changed.
153
+ */
137
154
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
+ */
138
160
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
+ */
139
166
git_signature * final_signature ;
140
167
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
+ */
141
173
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
+ */
142
179
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
+ */
143
185
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
+ */
144
191
git_signature * orig_signature ;
145
192
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
+ */
146
197
char boundary ;
147
198
} git_blame_hunk ;
148
199
0 commit comments