Skip to content

Commit 47dd9f4

Browse files
committed
Merge branch 'pr/5940'
2 parents 708d933 + 346f15b commit 47dd9f4

File tree

6 files changed

+265
-133
lines changed

6 files changed

+265
-133
lines changed

include/git2/blame.h

Lines changed: 93 additions & 42 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.
@@ -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
*/
134145
typedef 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

include/git2/checkout.h

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -194,18 +194,6 @@ typedef enum {
194194
* Checkout will invoke an options notification callback (`notify_cb`) for
195195
* certain cases - you pick which ones via `notify_flags`:
196196
*
197-
* - GIT_CHECKOUT_NOTIFY_CONFLICT invokes checkout on conflicting paths.
198-
*
199-
* - GIT_CHECKOUT_NOTIFY_DIRTY notifies about "dirty" files, i.e. those that
200-
* do not need an update but no longer match the baseline. Core git
201-
* displays these files when checkout runs, but won't stop the checkout.
202-
*
203-
* - GIT_CHECKOUT_NOTIFY_UPDATED sends notification for any file changed.
204-
*
205-
* - GIT_CHECKOUT_NOTIFY_UNTRACKED notifies about untracked files.
206-
*
207-
* - GIT_CHECKOUT_NOTIFY_IGNORED notifies about ignored files.
208-
*
209197
* Returning a non-zero value from this callback will cancel the checkout.
210198
* The non-zero return value will be propagated back and returned by the
211199
* git_checkout_... call.
@@ -216,10 +204,32 @@ typedef enum {
216204
*/
217205
typedef enum {
218206
GIT_CHECKOUT_NOTIFY_NONE = 0,
207+
208+
/**
209+
* Invokes checkout on conflicting paths.
210+
*/
219211
GIT_CHECKOUT_NOTIFY_CONFLICT = (1u << 0),
212+
213+
/**
214+
* Notifies about "dirty" files, i.e. those that do not need an update
215+
* but no longer match the baseline. Core git displays these files when
216+
* checkout runs, but won't stop the checkout.
217+
*/
220218
GIT_CHECKOUT_NOTIFY_DIRTY = (1u << 1),
219+
220+
/**
221+
* Sends notification for any file changed.
222+
*/
221223
GIT_CHECKOUT_NOTIFY_UPDATED = (1u << 2),
224+
225+
/**
226+
* Notifies about untracked files.
227+
*/
222228
GIT_CHECKOUT_NOTIFY_UNTRACKED = (1u << 3),
229+
230+
/**
231+
* Notifies about ignored files.
232+
*/
223233
GIT_CHECKOUT_NOTIFY_IGNORED = (1u << 4),
224234

225235
GIT_CHECKOUT_NOTIFY_ALL = 0x0FFFFu

include/git2/diff.h

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -241,32 +241,43 @@ typedef enum {
241241
* Although this is called a "file", it could represent a file, a symbolic
242242
* link, a submodule commit id, or even a tree (although that only if you
243243
* are tracking type changes or ignored/untracked directories).
244-
*
245-
* The `id` is the `git_oid` of the item. If the entry represents an
246-
* absent side of a diff (e.g. the `old_file` of a `GIT_DELTA_ADDED` delta),
247-
* then the oid will be zeroes.
248-
*
249-
* `path` is the NUL-terminated path to the entry relative to the working
250-
* directory of the repository.
251-
*
252-
* `size` is the size of the entry in bytes.
253-
*
254-
* `flags` is a combination of the `git_diff_flag_t` types
255-
*
256-
* `mode` is, roughly, the stat() `st_mode` value for the item. This will
257-
* be restricted to one of the `git_filemode_t` values.
258-
*
259-
* The `id_abbrev` represents the known length of the `id` field, when
260-
* converted to a hex string. It is generally `GIT_OID_HEXSZ`, unless this
261-
* delta was created from reading a patch file, in which case it may be
262-
* abbreviated to something reasonable, like 7 characters.
263244
*/
264245
typedef struct {
246+
/**
247+
* The `git_oid` of the item. If the entry represents an
248+
* absent side of a diff (e.g. the `old_file` of a `GIT_DELTA_ADDED` delta),
249+
* then the oid will be zeroes.
250+
*/
265251
git_oid id;
252+
253+
/**
254+
* The NUL-terminated path to the entry relative to the working
255+
* directory of the repository.
256+
*/
266257
const char *path;
258+
259+
/**
260+
* The size of the entry in bytes.
261+
*/
267262
git_object_size_t size;
263+
264+
/**
265+
* A combination of the `git_diff_flag_t` types
266+
*/
268267
uint32_t flags;
268+
269+
/**
270+
* Roughly, the stat() `st_mode` value for the item. This will
271+
* be restricted to one of the `git_filemode_t` values.
272+
*/
269273
uint16_t mode;
274+
275+
/**
276+
* Represents the known length of the `id` field, when
277+
* converted to a hex string. It is generally `GIT_OID_HEXSZ`, unless this
278+
* delta was created from reading a patch file, in which case it may be
279+
* abbreviated to something reasonable, like 7 characters.
280+
*/
270281
uint16_t id_abbrev;
271282
} git_diff_file;
272283

include/git2/remote.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ GIT_EXTERN(int) git_remote_set_url(git_repository *repo, const char *remote, con
253253
* @param repo the repository in which to perform the change
254254
* @param remote the remote's name
255255
* @param url the url to set
256+
* @return 0, or an error code
256257
*/
257258
GIT_EXTERN(int) git_remote_set_pushurl(git_repository *repo, const char *remote, const char* url);
258259

@@ -876,8 +877,10 @@ GIT_EXTERN(git_remote_autotag_option_t) git_remote_autotag(const git_remote *rem
876877
* @param repo the repository in which to make the change
877878
* @param remote the name of the remote
878879
* @param value the new value to take.
880+
* @return 0, or an error code.
879881
*/
880882
GIT_EXTERN(int) git_remote_set_autotag(git_repository *repo, const char *remote, git_remote_autotag_option_t value);
883+
881884
/**
882885
* Retrieve the ref-prune setting
883886
*
@@ -944,7 +947,7 @@ GIT_EXTERN(int) git_remote_delete(git_repository *repo, const char *name);
944947
*
945948
* This function must only be called after connecting.
946949
*
947-
* @param out the buffern in which to store the reference name
950+
* @param out the buffer in which to store the reference name
948951
* @param remote the remote
949952
* @return 0, GIT_ENOTFOUND if the remote does not have any references
950953
* or none of them point to HEAD's commit, or an error message.

0 commit comments

Comments
 (0)