Skip to content

Commit ea9812c

Browse files
committed
Update to v1.1.1
1 parent e83d8d2 commit ea9812c

20 files changed

+251
-134
lines changed

src/git2/apply.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ function git_apply_options_init(opts: Pgit_apply_options; version: Cardinal)
8989
* @param preimage the tree to apply the diff to
9090
* @param diff the diff to apply
9191
* @param options the options for the apply (or null for defaults)
92+
* @return 0 or an error code
9293
*)
9394

9495
function git_apply_to_tree(out_: PPgit_index; repo: Pgit_repository;
@@ -123,6 +124,7 @@ type
123124
* @param diff the diff to apply
124125
* @param location the location to apply (workdir, index or both)
125126
* @param options the options for the apply (or null for defaults)
127+
* @return 0 or an error code
126128
*)
127129

128130
function git_apply(repo: Pgit_repository; diff: Pgit_diff;

src/git2/blob.inc

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function git_blob_owner(blob: Pgit_blob): Pgit_repository; cdecl; external libgi
7575
* time.
7676
*
7777
* @param blob pointer to the blob
78-
* @return the pointer
78+
* @return the pointer, or NULL on error
7979
*)
8080

8181
function git_blob_rawcontent(blob: Pgit_blob): Pointer; cdecl; external libgit2_dll;
@@ -105,12 +105,16 @@ const
105105
* When set, filters will be loaded from a `.gitattributes` file
106106
* in the HEAD commit.
107107
*)
108-
GIT_BLOB_FILTER_ATTTRIBUTES_FROM_HEAD = ( 1 shl 2 );
108+
GIT_BLOB_FILTER_ATTRIBUTES_FROM_HEAD = ( 1 shl 2 );
109109
type
110110
git_blob_filter_flag_t = Integer;
111111

112112
(**
113113
* The options used when applying filter options to a file.
114+
*
115+
* Initialize with `GIT_BLOB_FILTER_OPTIONS_INIT`. Alternatively, you can
116+
* use `git_blob_filter_options_init`.
117+
*
114118
*)
115119

116120
git_blob_filter_options = record
@@ -123,6 +127,21 @@ type
123127
const
124128
GIT_BLOB_FILTER_OPTIONS_VERSION = 1;
125129
//GIT_BLOB_FILTER_OPTIONS_INIT = { GIT_BLOB_FILTER_OPTIONS_VERSION , GIT_BLOB_FILTER_CHECK_FOR_BINARY };
130+
131+
(**
132+
* Initialize git_blob_filter_options structure
133+
*
134+
* Initializes a `git_blob_filter_options` with default values. Equivalent
135+
* to creating an instance with `GIT_BLOB_FILTER_OPTIONS_INIT`.
136+
*
137+
* @param opts The `git_blob_filter_options` struct to initialize.
138+
* @param version The struct version; pass `GIT_BLOB_FILTER_OPTIONS_VERSION`.
139+
* @return Zero on success; -1 on failure.
140+
*)
141+
142+
function git_blob_filter_options_init(opts: Pgit_blob_filter_options; version: Cardinal):
143+
Integer; cdecl; external libgit2_dll;
144+
126145
(**
127146
* Get a buffer with the filtered content of a blob.
128147
*
@@ -224,7 +243,7 @@ function git_blob_create_from_stream_commit(out_: Pgit_oid;
224243
* Write an in-memory buffer to the ODB as a blob
225244
*
226245
* @param id return the id of the written blob
227-
* @param repo repository where to blob will be written
246+
* @param repo repository where the blob will be written
228247
* @param buffer data to be written into the blob
229248
* @param len length of the data
230249
* @return 0 or an error code

src/git2/branch.inc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,5 +291,19 @@ 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+
* Determine whether a branch name is valid, meaning that (when prefixed
296+
* with `refs/heads/`) that it is a valid reference name, and that any
297+
* additional branch name restrictions are imposed (eg, it cannot start
298+
* with a `-`).
299+
*
300+
* @param valid output pointer to set with validity of given branch name
301+
* @param name a branch name to test
302+
* @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;
307+
294308
(** @} *)
295309

src/git2/cert.inc

Lines changed: 51 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -77,35 +77,70 @@ const
7777
GIT_CERT_SSH_SHA1 = ( 1 shl 1 );
7878
(** SHA-256 is available *)
7979
GIT_CERT_SSH_SHA256 = ( 1 shl 2 );
80+
(** Raw hostkey is available *)
81+
GIT_CERT_SSH_RAW = ( 1 shl 3 );
8082
type
8183
git_cert_ssh_t = Integer;
8284

85+
const
86+
(** The raw key is of an unknown type. *)
87+
GIT_CERT_SSH_RAW_TYPE_UNKNOWN = 0;
88+
(** The raw key is an RSA key. *)
89+
GIT_CERT_SSH_RAW_TYPE_RSA = 1;
90+
(** The raw key is a DSS key. *)
91+
GIT_CERT_SSH_RAW_TYPE_DSS = 2;
92+
(** The raw key is a ECDSA 256 key. *)
93+
GIT_CERT_SSH_RAW_TYPE_KEY_ECDSA_256 = 3;
94+
(** The raw key is a ECDSA 384 key. *)
95+
GIT_CERT_SSH_RAW_TYPE_KEY_ECDSA_384 = 4;
96+
(** The raw key is a ECDSA 521 key. *)
97+
GIT_CERT_SSH_RAW_TYPE_KEY_ECDSA_521 = 5;
98+
(** The raw key is a ED25519 key. *)
99+
GIT_CERT_SSH_RAW_TYPE_KEY_ED25519 = 6;
100+
type
101+
git_cert_ssh_raw_type_t = Integer;
102+
103+
83104
(**
84105
* Hostkey information taken from libssh2
85106
*)
86107

87108
git_cert_hostkey = record
88109
parent : git_cert; (**< The parent cert *)
89110
(**
90-
* A hostkey type from libssh2, either
91-
* `GIT_CERT_SSH_MD5` or `GIT_CERT_SSH_SHA1`
92-
*)
111+
* A bitmask containing the available fields.
112+
*)
93113
type_ : git_cert_ssh_t;
94114
(**
95-
* Hostkey hash. If type has `GIT_CERT_SSH_MD5` set, this will
96-
* have the MD5 hash of the hostkey.
97-
*)
115+
* Hostkey hash. If `type` has `GIT_CERT_SSH_MD5` set, this will
116+
* have the MD5 hash of the hostkey.
117+
*)
98118
hash_md5 : array [0..15] of Byte;
99119
(**
100-
* Hostkey hash. If type has `GIT_CERT_SSH_SHA1` set, this will
101-
* have the SHA-1 hash of the hostkey.
102-
*)
120+
* Hostkey hash. If `type` has `GIT_CERT_SSH_SHA1` set, this will
121+
* have the SHA-1 hash of the hostkey.
122+
*)
103123
hash_sha1 : array [0..19] of Byte;
104124
(**
105-
* Hostkey hash. If type has `GIT_CERT_SSH_SHA256` set, this will
106-
* have the SHA-256 hash of the hostkey.
107-
*)
125+
* Hostkey hash. If `type` has `GIT_CERT_SSH_SHA256` set, this will
126+
* have the SHA-256 hash of the hostkey.
127+
*)
108128
hash_sha256 : array [0..31] of Byte;
129+
(**
130+
* Raw hostkey type. If `type` has `GIT_CERT_SSH_RAW` set, this will
131+
* have the type of the raw hostkey.
132+
*)
133+
raw_type: git_cert_ssh_raw_type_t;
134+
(**
135+
* Pointer to the raw hostkey. If `type` has `GIT_CERT_SSH_RAW` set,
136+
* this will have the raw contents of the hostkey.
137+
*)
138+
hostkey: PAnsiChar;
139+
(**
140+
* Raw hostkey length. If `type` has `GIT_CERT_SSH_RAW` set, this will
141+
* have the length of the raw contents of the hostkey.
142+
*)
143+
hostkey_len: size_t;
109144
end;
110145
Pgit_cert_hostkey = ^git_cert_hostkey;
111146

@@ -116,12 +151,12 @@ type
116151
git_cert_x509 = record
117152
parent : git_cert; (**< The parent cert *)
118153
(**
119-
* Pointer to the X.509 certificate data
120-
*)
154+
* Pointer to the X.509 certificate data
155+
*)
121156
data : Pointer;
122157
(**
123-
* Length of the memory block pointed to by `data`.
124-
*)
158+
* Length of the memory block pointed to by `data`.
159+
*)
125160
len : size_t;
126161
end;
127162
Pgit_cert_x509 = ^git_cert_x509;

src/git2/common.inc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,11 @@ type
280280
* >
281281
* > - `ciphers` is the list of ciphers that are eanbled.
282282
*
283+
* * opts(GIT_OPT_GET_USER_AGENT, git_buf *out)
284+
*
285+
* > Get the value of the User-Agent header.
286+
* > The User-Agent is written to the `out` buffer.
287+
*
283288
* * opts(GIT_OPT_ENABLE_OFS_DELTA, int enabled)
284289
*
285290
* > Enable or disable the use of "offset deltas" when creating packfiles,

src/git2/config.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ function git_config_open_level(out_: PPgit_config; parent: Pgit_config;
260260
*
261261
* Git allows you to store your global configuration at
262262
* `$HOME/.gitconfig` or `$XDG_CONFIG_HOME/git/config`. For backwards
263-
* compatability, the XDG file shouldn't be used unless the use has
263+
* compatibility, the XDG file shouldn't be used unless the use has
264264
* created it explicitly. With this function you'll open the correct
265265
* one to write to.
266266
*

src/git2/diff.inc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ const
126126
* can apply given diff information to binary files.
127127
*)
128128
GIT_DIFF_SHOW_BINARY = ( 1 shl 30 );
129+
(** Ignore blank lines *)
130+
GIT_DIFF_IGNORE_BLANK_LINES = ( 1 shl 31 );
129131
type
130132
git_diff_option_t = Integer;
131133

@@ -943,7 +945,7 @@ function git_diff_num_deltas(diff: Pgit_diff): size_t; cdecl; external libgit2_d
943945
(**
944946
* Query how many diff deltas are there in a diff filtered by type.
945947
*
946-
* This works just like `git_diff_entrycount()` with an extra parameter
948+
* This works just like `git_diff_num_deltas()` with an extra parameter
947949
* that is a `git_delta_t` and returns just the count of how many deltas
948950
* match that particular type.
949951
*

src/git2/filter.inc

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -112,26 +112,15 @@ function git_filter_list_contains(filters: Pgit_filter_list; name_: PAnsiChar)
112112
(**
113113
* Apply filter list to a data buffer.
114114
*
115-
* See `git2/buffer.h` for background on `git_buf` objects.
116-
*
117-
* If the `in` buffer holds data allocated by libgit2 (i.e. `in->asize` is
118-
* not zero), then it will be overwritten when applying the filters. If
119-
* not, then it will be left untouched.
120-
*
121-
* If there are no filters to apply (or `filters` is NULL), then the `out`
122-
* buffer will reference the `in` buffer data (with `asize` set to zero)
123-
* instead of allocating data. This keeps allocations to a minimum, but
124-
* it means you have to be careful about freeing the `in` data since `out`
125-
* may be pointing to it!
126-
*
127115
* @param out Buffer to store the result of the filtering
128116
* @param filters A loaded git_filter_list (or NULL)
129117
* @param in Buffer containing the data to filter
118+
* @param in_len The length of the input buffer
130119
* @return 0 on success, an error code otherwise
131120
*)
132121

133-
function git_filter_list_apply_to_data(out_: Pgit_buf;
134-
filters: Pgit_filter_list; in_: Pgit_buf): Integer; cdecl; external libgit2_dll;
122+
function git_filter_list_apply_to_buffer(out_: Pgit_buf;
123+
filters: Pgit_filter_list; const in_: PAnsiChar; in_len: size_t): Integer; cdecl; external libgit2_dll;
135124

136125
(**
137126
* Apply a filter list to the contents of a file on disk
@@ -161,12 +150,13 @@ function git_filter_list_apply_to_blob(out_: Pgit_buf;
161150
* Apply a filter list to an arbitrary buffer as a stream
162151
*
163152
* @param filters the list of filters to apply
164-
* @param data the buffer to filter
153+
* @param buffer the buffer to filter
154+
* @param len the size of the buffer
165155
* @param target the stream into which the data will be written
166156
*)
167157

168-
function git_filter_list_stream_data(filters: Pgit_filter_list; data: Pgit_buf;
169-
target: Pgit_writestream): Integer; cdecl; external libgit2_dll;
158+
function git_filter_list_stream_buffer(filters: Pgit_filter_list; const buffer: PAnsiChar;
159+
len: size_t; target: Pgit_writestream): Integer; cdecl; external libgit2_dll;
170160

171161
(**
172162
* Apply a filter list to a file as a stream

src/git2/index.inc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ function git_index_write_tree(out_: Pgit_oid; index_: Pgit_index): Integer; cdec
348348
*
349349
* The index must not contain any file in conflict.
350350
*
351-
* @param out Pointer where to store OID of the the written tree
351+
* @param out Pointer where to store OID of the written tree
352352
* @param index Index to write
353353
* @param repo Repository where to write the tree
354354
* @return 0 on success, GIT_EUNMERGED when the index is not clean
@@ -715,7 +715,7 @@ function git_index_update_all(index_: Pgit_index; pathspec: Pgit_strarray;
715715
* @param at_pos the address to which the position of the index entry is written (optional)
716716
* @param index an existing index object
717717
* @param path path to search
718-
* @return a zero-based position in the index if found; GIT_ENOTFOUND otherwise
718+
* @return 0 or an error code
719719
*)
720720

721721
type
@@ -730,7 +730,7 @@ function git_index_find(at_pos: Psize_t; index_: Pgit_index; path: PAnsiChar)
730730
* @param at_pos the address to which the position of the index entry is written (optional)
731731
* @param index an existing index object
732732
* @param prefix the prefix to search for
733-
* @return 0 with valid value in at_pos; an error code otherwise
733+
* @return 0 or an error code
734734
*)
735735

736736
function git_index_find_prefix(at_pos: Psize_t; index_: Pgit_index;

0 commit comments

Comments
 (0)