Skip to content

Commit bbf91a5

Browse files
committed
Update to v1.2.0
1 parent ea9812c commit bbf91a5

22 files changed

+614
-211
lines changed

src/git2/attr.inc

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,35 @@ const
121121
*
122122
* Passing the `GIT_ATTR_CHECK_INCLUDE_HEAD` flag will use attributes
123123
* from a `.gitattributes` file in the repository at the HEAD revision.
124+
*
125+
* Passing the `GIT_ATTR_CHECK_INCLUDE_COMMIT` flag will use attributes
126+
* from a `.gitattributes` file in a specific commit.
124127
*)
125128

126129
GIT_ATTR_CHECK_NO_SYSTEM = ( 1 shl 2 );
127130
GIT_ATTR_CHECK_INCLUDE_HEAD = ( 1 shl 3 );
131+
GIT_ATTR_CHECK_INCLUDE_COMMIT = ( 1 shl 4 );
128132
(**
133+
* An options structure for querying attributes.
134+
*)
135+
type
136+
git_attr_options = record
137+
version: Cardinal;
138+
(** A combination of GIT_ATTR_CHECK flags *)
139+
flags: Cardinal;
140+
(**
141+
* The commit to load attributes from, when
142+
* `GIT_ATTR_CHECK_INCLUDE_COMMIT` is specified.
143+
*)
144+
commit_id: Pgit_oid;
145+
end;
146+
Pgit_attr_options = ^git_attr_options;
147+
148+
const
149+
GIT_ATTR_OPTIONS_VERSION = 1;
150+
//GIT_ATTR_OPTIONS_INIT {GIT_ATTR_OPTIONS_VERSION}
151+
152+
(**
129153
* Look up the value of one git attribute for path.
130154
*
131155
* @param value_out Output of the value of the attribute. Use the GIT_ATTR_...
@@ -144,6 +168,24 @@ const
144168
function git_attr_get(value_out: PPAnsiChar; repo: Pgit_repository;
145169
flags: uint32_t; path, name_: PAnsiChar): Integer; cdecl; external libgit2_dll;
146170

171+
(**
172+
* Look up the value of one git attribute for path with extended options.
173+
*
174+
* @param value_out Output of the value of the attribute. Use the GIT_ATTR_...
175+
* macros to test for TRUE, FALSE, UNSPECIFIED, etc. or just
176+
* use the string value for attributes set to a value. You
177+
* should NOT modify or free this value.
178+
* @param repo The repository containing the path.
179+
* @param opts The `git_attr_options` to use when querying these attributes.
180+
* @param path The path to check for attributes. Relative paths are
181+
* interpreted relative to the repo root. The file does
182+
* not have to exist, but if it does not, then it will be
183+
* treated as a plain file (not a directory).
184+
* @param name The name of the attribute to look up.
185+
*)
186+
function git_attr_get_ext(value_out: PPAnsiChar; repo: Pgit_repository;
187+
opts: Pgit_attr_options; path, name_: PAnsiChar): Integer; cdecl; external libgit2_dll;
188+
147189
(**
148190
* Look up a list of git attributes for path.
149191
*
@@ -177,6 +219,25 @@ function git_attr_get(value_out: PPAnsiChar; repo: Pgit_repository;
177219
function git_attr_get_many(values_out: PPAnsiChar; repo: Pgit_repository;
178220
flags: uint32_t; path: PAnsiChar; num_attr: size_t; names: PPAnsiChar): Integer; cdecl; external libgit2_dll;
179221

222+
(**
223+
* Look up a list of git attributes for path with extended options.
224+
*
225+
* @param values_out An array of num_attr entries that will have string
226+
* pointers written into it for the values of the attributes.
227+
* You should not modify or free the values that are written
228+
* into this array (although of course, you should free the
229+
* array itself if you allocated it).
230+
* @param repo The repository containing the path.
231+
* @param opts The `git_attr_options` to use when querying these attributes.
232+
* @param path The path inside the repo to check attributes. This
233+
* does not have to exist, but if it does not, then
234+
* it will be treated as a plain file (i.e. not a directory).
235+
* @param num_attr The number of attributes being looked up
236+
* @param names An array of num_attr strings containing attribute names.
237+
*)
238+
function git_attr_get_many_ext(values_out: PPAnsiChar; repo: Pgit_repository;
239+
opts: Pgit_attr_options; path: PAnsiChar; num_attr: size_t; names: PPAnsiChar): Integer; cdecl; external libgit2_dll;
240+
180241
(**
181242
* The callback used with git_attr_foreach.
182243
*
@@ -215,6 +276,22 @@ type
215276
function git_attr_foreach(repo: Pgit_repository; flags: uint32_t;
216277
path: PAnsiChar; callback: git_attr_foreach_cb; payload: Pointer): Integer; cdecl; external libgit2_dll;
217278

279+
(**
280+
* Loop over all the git attributes for a path with extended options.
281+
*
282+
* @param repo The repository containing the path.
283+
* @param opts The `git_attr_options` to use when querying these attributes.
284+
* @param path Path inside the repo to check attributes. This does not have
285+
* to exist, but if it does not, then it will be treated as a
286+
* plain file (i.e. not a directory).
287+
* @param callback Function to invoke on each attribute name and value.
288+
* See git_attr_foreach_cb.
289+
* @param payload Passed on as extra parameter to callback function.
290+
* @return 0 on success, non-zero callback return value, or error code
291+
*)
292+
function git_attr_foreach_ext(repo: Pgit_repository; opts: Pgit_attr_options;
293+
path: PAnsiChar; callback: git_attr_foreach_cb; payload: Pointer): Integer; cdecl; external libgit2_dll;
294+
218295
(**
219296
* Flush the gitattributes cache.
220297
*

src/git2/blame.inc

Lines changed: 79 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,44 @@
1313
const
1414
(** Normal blame, the default *)
1515
GIT_BLAME_NORMAL = 0;
16-
(** Track lines that have moved within a file (like `git blame -M`).
17-
* NOT IMPLEMENTED. *)
16+
(**
17+
* Track lines that have moved within a file (like `git blame -M`).
18+
*
19+
* This is not yet implemented and reserved for future use.
20+
*)
1821
GIT_BLAME_TRACK_COPIES_SAME_FILE = ( 1 shl 0 );
19-
(** Track lines that have moved across files in the same commit (like `git blame -C`).
20-
* NOT IMPLEMENTED. *)
22+
(**
23+
* Track lines that have moved across files in the same commit
24+
* (like `git blame -C`).
25+
*
26+
* This is not yet implemented and reserved for future use.
27+
*)
2128
GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES = ( 1 shl 1 );
22-
(** Track lines that have been copied from another file that exists in the
23-
* same commit (like `git blame -CC`). Implies SAME_FILE.
24-
* NOT IMPLEMENTED. *)
29+
(**
30+
* Track lines that have been copied from another file that exists
31+
* in the same commit (like `git blame -CC`). Implies SAME_FILE.
32+
*
33+
* This is not yet implemented and reserved for future use.
34+
*)
2535
GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES = ( 1 shl 2 );
26-
(** Track lines that have been copied from another file that exists in *any*
27-
* commit (like `git blame -CCC`). Implies SAME_COMMIT_COPIES.
28-
* NOT IMPLEMENTED. *)
36+
(**
37+
* Track lines that have been copied from another file that exists in
38+
* *any* commit (like `git blame -CCC`). Implies SAME_COMMIT_COPIES.
39+
*
40+
* This is not yet implemented and reserved for future use.
41+
*)
2942
GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES = ( 1 shl 3 );
30-
(** Restrict the search of commits to those reachable following only the
31-
* first parents. *)
43+
(**
44+
* Restrict the search of commits to those reachable following only
45+
* the first parents.
46+
*)
3247
GIT_BLAME_FIRST_PARENT = ( 1 shl 4 );
33-
(** Use mailmap file to map author and committer names and email addresses
34-
* to canonical real names and email addresses. The mailmap will be read
35-
* from the working directory, or HEAD in a bare repository. *)
48+
(**
49+
* Use mailmap file to map author and committer names and email
50+
* addresses to canonical real names and email addresses. The
51+
* mailmap will be read from the working directory, or HEAD in a
52+
* bare repository.
53+
*)
3654
GIT_BLAME_USE_MAILMAP = ( 1 shl 5 );
3755
(** Ignore whitespace differences *)
3856
GIT_BLAME_IGNORE_WHITESPACE = ( 1 shl 6 );
@@ -52,12 +70,15 @@ type
5270
version : Cardinal;
5371
(** A combination of `git_blame_flag_t` *)
5472
flags : uint32_t;
55-
(** The lower bound on the number of alphanumeric
56-
* characters that must be detected as moving/copying within a file for it to
57-
* associate those lines with the parent commit. The default value is 20.
58-
* This value only takes effect if any of the `GIT_BLAME_TRACK_COPIES_*`
59-
* flags are specified.
60-
*)
73+
(**
74+
* The lower bound on the number of alphanumeric characters that
75+
* must be detected as moving/copying within a file for it to
76+
* associate those lines with the parent commit. The default value
77+
* is 20.
78+
*
79+
* This value only takes effect if any of the `GIT_BLAME_TRACK_COPIES_*`
80+
* flags are specified.
81+
*)
6182
min_match_characters : uint16_t;
6283
(** The id of the newest commit to consider. The default is HEAD. *)
6384
newest_commit : git_oid;
@@ -98,41 +119,54 @@ function git_blame_options_init(opts: Pgit_blame_options; version: Cardinal)
98119

99120
(**
100121
* Structure that represents a blame hunk.
101-
*
102-
* - `lines_in_hunk` is the number of lines in this hunk
103-
* - `final_commit_id` is the OID of the commit where this line was last
104-
* changed.
105-
* - `final_start_line_number` is the 1-based line number where this hunk
106-
* begins, in the final version of the file
107-
* - `final_signature` is the author of `final_commit_id`. If
108-
* `GIT_BLAME_USE_MAILMAP` has been specified, it will contain the canonical
109-
* real name and email address.
110-
* - `orig_commit_id` is the OID of the commit where this hunk was found. This
111-
* will usually be the same as `final_commit_id`, except when
112-
* `GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES` has been specified.
113-
* - `orig_path` is the path to the file where this hunk originated, as of the
114-
* commit specified by `orig_commit_id`.
115-
* - `orig_start_line_number` is the 1-based line number where this hunk begins
116-
* in the file named by `orig_path` in the commit specified by
117-
* `orig_commit_id`.
118-
* - `orig_signature` is the author of `orig_commit_id`. If
119-
* `GIT_BLAME_USE_MAILMAP` has been specified, it will contain the canonical
120-
* real name and email address.
121-
* - `boundary` is 1 iff the hunk has been tracked to a boundary commit (the
122-
* root, or the commit specified in git_blame_options.oldest_commit)
123-
*)
122+
*)
124123

125124
type
126125
git_blame_hunk = record
126+
(**
127+
* The number of lines in this hunk.
128+
*)
127129
lines_in_hunk : size_t;
130+
(**
131+
* The OID of the commit where this line was last changed.
132+
*)
128133
final_commit_id : git_oid;
134+
(**
135+
* The 1-based line number where this hunk begins, in the final version
136+
* of the file.
137+
*)
129138
final_start_line_number : size_t;
139+
(**
140+
* The author of `final_commit_id`. If `GIT_BLAME_USE_MAILMAP` has been
141+
* specified, it will contain the canonical real name and email address.
142+
*)
130143
final_signature : Pgit_signature;
144+
(**
145+
* The OID of the commit where this hunk was found.
146+
* This will usually be the same as `final_commit_id`, except when
147+
* `GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES` has been specified.
148+
*)
131149
orig_commit_id : git_oid;
150+
(**
151+
* The path to the file where this hunk originated, as of the commit
152+
* specified by `orig_commit_id`.
153+
*)
132154
orig_path : PAnsiChar;
155+
(**
156+
* The 1-based line number where this hunk begins in the file named by
157+
* `orig_path` in the commit specified by `orig_commit_id`.
158+
*)
133159
orig_start_line_number : size_t;
160+
(**
161+
* The author of `orig_commit_id`. If `GIT_BLAME_USE_MAILMAP` has been
162+
* specified, it will contain the canonical real name and email address.
163+
*)
134164
orig_signature : Pgit_signature;
135-
boundary : AnsiChar;
165+
(**
166+
* The 1 iff the hunk has been tracked to a boundary commit (the root,
167+
* or the commit specified in git_blame_options.oldest_commit)
168+
*)
169+
boundary : AnsiChar;
136170
end;
137171

138172

src/git2/blob.inc

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,20 @@ const
9797
(** When set, filters will not be applied to binary files. *)
9898
GIT_BLOB_FILTER_CHECK_FOR_BINARY = ( 1 shl 0 );
9999
(**
100-
* When set, filters will not load configuration from the
101-
* system-wide `gitattributes` in `/etc` (or system equivalent).
102-
*)
100+
* When set, filters will not load configuration from the
101+
* system-wide `gitattributes` in `/etc` (or system equivalent).
102+
*)
103103
GIT_BLOB_FILTER_NO_SYSTEM_ATTRIBUTES = ( 1 shl 1 );
104104
(**
105-
* When set, filters will be loaded from a `.gitattributes` file
106-
* in the HEAD commit.
107-
*)
105+
* When set, filters will be loaded from a `.gitattributes` file
106+
* in the HEAD commit.
107+
*)
108108
GIT_BLOB_FILTER_ATTRIBUTES_FROM_HEAD = ( 1 shl 2 );
109+
(**
110+
* When set, filters will be loaded from a `.gitattributes` file
111+
* in the specified commit.
112+
*)
113+
GIT_BLOB_FILTER_ATTRIBUTES_FROM_COMMIT = (1 shl 3);
109114
type
110115
git_blob_filter_flag_t = Integer;
111116

@@ -121,6 +126,11 @@ type
121126
version : Integer;
122127
(** Flags to control the filtering process, see `git_blob_filter_flag_t` above *)
123128
flags : uint32_t;
129+
(**
130+
* The commit to load attributes from, when
131+
* `GIT_BLOB_FILTER_ATTRIBUTES_FROM_COMMIT` is specified.
132+
*)
133+
commit_id: Pgit_oid;
124134
end;
125135
Pgit_blob_filter_options = ^git_blob_filter_options;
126136

src/git2/branch.inc

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,20 @@ function git_branch_remote_name(out_: Pgit_buf; repo: Pgit_repository;
291291
function git_branch_upstream_remote(buf: Pgit_buf; repo: Pgit_repository;
292292
refname: PAnsiChar): Integer; cdecl; external libgit2_dll;
293293

294+
(**
295+
* Retrieve the upstream merge of a local branch
296+
*
297+
* This will return the currently configured "branch.*.merge" for a given
298+
* branch. This branch must be local.
299+
*
300+
* @param buf the buffer into which to write the name
301+
* @param repo the repository in which to look
302+
* @param refname the full name of the branch
303+
* @return 0 or an error code
304+
*)
305+
function git_branch_upstream_merge(buf: Pgit_buf; repo: Pgit_repository;
306+
refname: PAnsiChar): Integer; cdecl; external libgit2_dll;
307+
294308
(**
295309
* Determine whether a branch name is valid, meaning that (when prefixed
296310
* with `refs/heads/`) that it is a valid reference name, and that any
@@ -300,10 +314,9 @@ function git_branch_upstream_remote(buf: Pgit_buf; repo: Pgit_repository;
300314
* @param valid output pointer to set with validity of given branch name
301315
* @param name a branch name to test
302316
* @return 0 on success or an error code
303-
*)
304-
305-
function git_branch_name_is_valid(valid: PInteger; name_: PAnsiChar): Integer;
306-
cdecl; external libgit2_dll;
317+
*)
318+
function git_branch_name_is_valid(valid: PInteger; name_: PAnsiChar): Integer;
319+
cdecl; external libgit2_dll;
307320

308321
(** @} *)
309322

src/git2/checkout.inc

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -161,18 +161,6 @@ type
161161
* Checkout will invoke an options notification callback (`notify_cb`) for
162162
* certain cases - you pick which ones via `notify_flags`:
163163
*
164-
* - GIT_CHECKOUT_NOTIFY_CONFLICT invokes checkout on conflicting paths.
165-
*
166-
* - GIT_CHECKOUT_NOTIFY_DIRTY notifies about "dirty" files, i.e. those that
167-
* do not need an update but no longer match the baseline. Core git
168-
* displays these files when checkout runs, but won't stop the checkout.
169-
*
170-
* - GIT_CHECKOUT_NOTIFY_UPDATED sends notification for any file changed.
171-
*
172-
* - GIT_CHECKOUT_NOTIFY_UNTRACKED notifies about untracked files.
173-
*
174-
* - GIT_CHECKOUT_NOTIFY_IGNORED notifies about ignored files.
175-
*
176164
* Returning a non-zero value from this callback will cancel the checkout.
177165
* The non-zero return value will be propagated back and returned by the
178166
* git_checkout_... call.
@@ -184,10 +172,27 @@ type
184172

185173
const
186174
GIT_CHECKOUT_NOTIFY_NONE = 0;
175+
(**
176+
* Invokes checkout on conflicting paths.
177+
*)
187178
GIT_CHECKOUT_NOTIFY_CONFLICT = ( 1 shl 0 );
179+
(**
180+
* Notifies about "dirty" files, i.e. those that do not need an update
181+
* but no longer match the baseline. Core git displays these files when
182+
* checkout runs, but won't stop the checkout.
183+
*)
188184
GIT_CHECKOUT_NOTIFY_DIRTY = ( 1 shl 1 );
185+
(**
186+
* Sends notification for any file changed.
187+
*)
189188
GIT_CHECKOUT_NOTIFY_UPDATED = ( 1 shl 2 );
189+
(**
190+
* Notifies about untracked files.
191+
*)
190192
GIT_CHECKOUT_NOTIFY_UNTRACKED = ( 1 shl 3 );
193+
(**
194+
* Notifies about ignored files.
195+
*)
191196
GIT_CHECKOUT_NOTIFY_IGNORED = ( 1 shl 4 );
192197
GIT_CHECKOUT_NOTIFY_ALL = $0FFFF;
193198
type

0 commit comments

Comments
 (0)