Skip to content

Commit 7347eff

Browse files
committed
Update to 1.7.2
1 parent f23a7b5 commit 7347eff

File tree

11 files changed

+135
-45
lines changed

11 files changed

+135
-45
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Details
44
-------
55

6-
Delphi / Free Pascal bindings for [libgit2](http://libgit2.github.com/) v1.6(.5).
6+
Delphi / Free Pascal bindings for [libgit2](http://libgit2.github.com/) v1.7(.2).
77

88
Since I could not find anything very up to date in the Delphi/Pascal world for recent libgit2 versions I decided to do something myself with assistance from [CHelper](https://wiki.freepascal.org/Chelper).
99

src/git2/common.inc

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ const
145145
GIT_OPT_SET_OWNER_VALIDATION = 36;
146146
GIT_OPT_GET_HOMEDIR = 37;
147147
GIT_OPT_SET_HOMEDIR = 38;
148+
GIT_OPT_SET_SERVER_CONNECT_TIMEOUT = 39;
149+
GIT_OPT_GET_SERVER_CONNECT_TIMEOUT = 40;
150+
GIT_OPT_SET_SERVER_TIMEOUT = 41;
151+
GIT_OPT_GET_SERVER_TIMEOUT = 42;
148152
type
149153
git_libgit2_opt_t = Integer;
150154

@@ -402,12 +406,30 @@ type
402406
* >
403407
* > - `path` directory of home directory.
404408
*
409+
* opts(GIT_OPT_GET_SERVER_CONNECT_TIMEOUT, int *timeout)
410+
* > Gets the timeout (in milliseconds) to attempt connections to
411+
* > a remote server.
412+
*
413+
* opts(GIT_OPT_SET_SERVER_CONNECT_TIMEOUT, int timeout)
414+
* > Sets the timeout (in milliseconds) to attempt connections to
415+
* > a remote server. This is supported only for HTTP(S) connections
416+
* > and is not supported by SSH. Set to 0 to use the system default.
417+
* > Note that this may not be able to be configured longer than the
418+
* > system default, typically 75 seconds.
419+
*
420+
* opts(GIT_OPT_GET_SERVER_TIMEOUT, int *timeout)
421+
* > Gets the timeout (in milliseconds) for reading from and writing
422+
* > to a remote server.
423+
*
424+
* opts(GIT_OPT_SET_SERVER_TIMEOUT, int timeout)
425+
* > Sets the timeout (in milliseconds) for reading from and writing
426+
* > to a remote server. This is supported only for HTTP(S)
427+
* > connections and is not supported by SSH. Set to 0 to use the
428+
* > system default.
429+
*
405430
* @param option Option key
406431
* @param ... value to set the option
407432
* @return 0 on success, <0 on failure
408433
*)
409434

410435
function git_libgit2_opts(option: Integer): Integer; cdecl; varargs; external libgit2_dll;
411-
412-
413-

src/git2/diff.inc

Lines changed: 65 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ const
9696
* diff hunks.
9797
*)
9898
GIT_DIFF_INDENT_HEURISTIC = (1 shl 18);
99-
(** Ignore blank lines *)
100-
GIT_DIFF_IGNORE_BLANK_LINES = (1 shl 19);
99+
(** Ignore blank lines *)
100+
GIT_DIFF_IGNORE_BLANK_LINES = (1 shl 19);
101101
(** Treat all files as text, disabling binary attributes & detection *)
102102
GIT_DIFF_FORCE_TEXT = (1 shl 20);
103103
(** Treat all files as binary, disabling text diffs *)
@@ -234,7 +234,7 @@ type
234234
mode: uint16_t;
235235
(**
236236
* Represents the known length of the `id` field, when
237-
* converted to a hex string. It is generally `GIT_OID_SHA1_HEXSIZE`, unless this
237+
* converted to a hex string. It is generally `GIT_OID_SHA1_HEXSIZE`, unless this
238238
* delta was created from reading a patch file, in which case it may be
239239
* abbreviated to something reasonable, like 7 characters.
240240
*)
@@ -374,6 +374,21 @@ type
374374
* the hunks will be merged into one. Defaults to 0.
375375
*)
376376
interhunk_lines: uint32_t;
377+
(**
378+
* The object ID type to emit in diffs; this is used by functions
379+
* that operate without a repository - namely `git_diff_buffers`,
380+
* or `git_diff_blobs` and `git_diff_blob_to_buffer` when one blob
381+
* is `NULL`.
382+
*
383+
* This may be omitted (set to `0`). If a repository is available,
384+
* the object ID format of the repository will be used. If no
385+
* repository is available then the default is `GIT_OID_SHA`.
386+
*
387+
* If this is specified and a repository is available, then the
388+
* specified `oid_type` must match the repository's object ID
389+
* format.
390+
*)
391+
oid_type: git_oid_t;
377392
(**
378393
* The abbreviation length to use when formatting object ids.
379394
* Defaults to the value of 'core.abbrev' from the config, or 7 if unset.
@@ -700,7 +715,7 @@ type
700715
*)
701716
copy_threshold: uint16_t;
702717
(**
703-
* Threshold below which similar files will be split into a delete/add pair.
718+
* Threshold below which similar files will be split into a delete/add pair.
704719
* This is equivalent to the last part of the -B option. Defaults to 60.
705720
*)
706721
break_rewrite_threshold: uint16_t;
@@ -1075,7 +1090,7 @@ function git_diff_to_buf(out_: Pgit_buf; diff: Pgit_diff; format: git_diff_forma
10751090
(**@} *)
10761091

10771092
(*
1078-
* Misc
1093+
* Low-level file comparison, invoking callbacks per difference.
10791094
*)
10801095

10811096
(**
@@ -1168,27 +1183,53 @@ function git_diff_buffers(old_buffer: Pointer; old_len: size_t; old_as_path: PAn
11681183
binary_cb: git_diff_binary_cb; hunk_cb: git_diff_hunk_cb; line_cb: git_diff_line_cb;
11691184
payload: Pointer): Integer; cdecl; external libgit2_dll;
11701185

1186+
(* Patch file parsing. *)
1187+
11711188
(**
1172-
* Read the contents of a git patch file into a `git_diff` object.
1173-
*
1174-
* The diff object produced is similar to the one that would be
1175-
* produced if you actually produced it computationally by comparing
1176-
* two trees, however there may be subtle differences. For example,
1177-
* a patch file likely contains abbreviated object IDs, so the
1178-
* object IDs in a `git_diff_delta` produced by this function will
1179-
* also be abbreviated.
1180-
*
1181-
* This function will only read patch files created by a git
1182-
* implementation, it will not read unified diffs produced by
1183-
* the `diff` program, nor any other types of patch files.
1184-
*
1185-
* @param out A pointer to a git_diff pointer that will be allocated.
1186-
* @param content The contents of a patch file
1187-
* @param content_len The length of the patch file contents
1188-
* @return 0 or an error code
1189+
* Options for parsing a diff / patch file.
11891190
*)
1191+
type
1192+
git_diff_parse_options = record
1193+
version: Cardinal;
1194+
oid_type: git_oid_t;
1195+
end;
1196+
Pgit_diff_parse_options = ^git_diff_parse_options;
1197+
1198+
(* The current version of the diff parse options structure *)
1199+
const
1200+
GIT_DIFF_PARSE_OPTIONS_VERSION = 1;
1201+
1202+
(* Stack initializer for diff parse options. Alternatively use
1203+
* `git_diff_parse_options_init` programmatic initialization.
1204+
*)
1205+
//#define GIT_DIFF_PARSE_OPTIONS_INIT \
1206+
// { GIT_DIFF_PARSE_OPTIONS_VERSION, GIT_OID_DEFAULT }
1207+
1208+
(**
1209+
* Read the contents of a git patch file into a `git_diff` object.
1210+
*
1211+
* The diff object produced is similar to the one that would be
1212+
* produced if you actually produced it computationally by comparing
1213+
* two trees, however there may be subtle differences. For example,
1214+
* a patch file likely contains abbreviated object IDs, so the
1215+
* object IDs in a `git_diff_delta` produced by this function will
1216+
* also be abbreviated.
1217+
*
1218+
* This function will only read patch files created by a git
1219+
* implementation, it will not read unified diffs produced by
1220+
* the `diff` program, nor any other types of patch files.
1221+
*
1222+
* @param out A pointer to a git_diff pointer that will be allocated.
1223+
* @param content The contents of a patch file
1224+
* @param content_len The length of the patch file contents
1225+
* @return 0 or an error code
1226+
*)
11901227

1191-
function git_diff_from_buffer(out_: PPgit_diff; content: PAnsiChar; content_len: size_t): Integer; cdecl; external libgit2_dll;
1228+
function git_diff_from_buffer(out_: PPgit_diff; content: PAnsiChar; content_len: size_t
1229+
{$IFDEF GIT_EXPERIMENTAL_SHA256}
1230+
; opts: Pgit_diff_parse_options
1231+
{$ENDIF}
1232+
): Integer; cdecl; external libgit2_dll;
11921233

11931234
(**
11941235
* This is an opaque structure which is allocated by `git_diff_get_stats`.
@@ -1229,6 +1270,7 @@ type
12291270
type
12301271
PPgit_diff_stats = ^Pgit_diff_stats;
12311272
Pgit_diff_stats = ^git_diff_stats;
1273+
12321274
function git_diff_get_stats(out_: PPgit_diff_stats; diff: Pgit_diff): Integer; cdecl; external libgit2_dll;
12331275

12341276
(**
@@ -1334,5 +1376,3 @@ function git_diff_patchid(out_: Pgit_oid; diff: Pgit_diff; opts: Pgit_diff_patch
13341376

13351377
(** @} *)
13361378

1337-
1338-

src/git2/errors.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const
4444
GIT_EINDEXDIRTY = -34; (**< Unsaved changes in the index would be overwritten *)
4545
GIT_EAPPLYFAIL = -35; (**< Patch application failed *)
4646
GIT_EOWNER = -36; (**< The object is not owned by the current user *)
47+
GIT_TIMEOUT = -37; (**< The operation timed out *)
4748
type
4849
git_error_code = Integer;
4950

@@ -99,6 +100,7 @@ const
99100
GIT_ERROR_SHA = 33;
100101
GIT_ERROR_HTTP = 34;
101102
GIT_ERROR_INTERNAL = 35;
103+
GIT_ERROR_GRAFTS = 36;
102104
type
103105
git_error_t = Integer;
104106

@@ -169,5 +171,3 @@ procedure git_error_set_oom; cdecl; external libgit2_dll;
169171

170172
(** @} *)
171173

172-
173-

src/git2/index.inc

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,11 @@ type
169169
* @return 0 or an error code
170170
*)
171171

172-
function git_index_open(out_: PPgit_index; index_path: PAnsiChar): Integer; cdecl; external libgit2_dll;
172+
function git_index_open(out_: PPgit_index; index_path: PAnsiChar
173+
{$IFDEF GIT_EXPERIMENTAL_SHA256}
174+
; oid_type: git_oid_t
175+
{$ENDIF}
176+
): Integer; cdecl; external libgit2_dll;
173177

174178
(**
175179
* Create an in-memory index object.
@@ -183,7 +187,11 @@ function git_index_open(out_: PPgit_index; index_path: PAnsiChar): Integer; cdec
183187
* @return 0 or an error code
184188
*)
185189

186-
function git_index_new(out_: PPgit_index): Integer; cdecl; external libgit2_dll;
190+
function git_index_new(out_: PPgit_index
191+
{$IFDEF GIT_EXPERIMENTAL_SHA256}
192+
; oid_type: git_oid_t
193+
{$ENDIF}
194+
): Integer; cdecl; external libgit2_dll;
187195

188196
(**
189197
* Free an existing index object.
@@ -842,5 +850,3 @@ procedure git_index_conflict_iterator_free(iterator: Pgit_index_conflict_iterato
842850

843851
(** @} *)
844852

845-
846-

src/git2/oid.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ function git_oid_pathfmt(out_: PAnsiChar; id: Pgit_oid): Integer; cdecl; externa
226226
* concurrent calls of the function.
227227
*
228228
* @param oid The oid structure to format
229-
* @return the c-string
229+
* @return the c-string or NULL on failure
230230
*)
231231

232232
function git_oid_tostr_s(oid: Pgit_oid): PAnsiChar; cdecl; external libgit2_dll;

src/git2/remote.inc

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,14 @@ const
289289
type
290290
git_remote_redirect_t = Integer;
291291

292+
const
293+
(** Constants for fetch depth (shallowness of fetch). *)
294+
(** The fetch is "full" (not shallow). This is the default. *)
295+
GIT_FETCH_DEPTH_FULL = 0;
296+
297+
(** The fetch should "unshallow" and fetch missing data. *)
298+
GIT_FETCH_DEPTH_UNSHALLOW = 2147483647;
299+
292300
(**
293301
* Fetch options structure.
294302
*
@@ -297,7 +305,7 @@ type
297305
*
298306
* git_fetch_options opts = GIT_FETCH_OPTIONS_INIT;
299307
*)
300-
308+
type
301309
git_fetch_options = record
302310
version: Cardinal;
303311
(**
@@ -325,6 +333,14 @@ type
325333
* Proxy options to use, by default no proxy is used.
326334
*)
327335
proxy_opts: git_proxy_options;
336+
(**
337+
* Depth of the fetch to perform, or `GIT_FETCH_DEPTH_FULL`
338+
* (or `0`) for full history, or `GIT_FETCH_DEPTH_UNSHALLOW`
339+
* to "unshallow" a shallow repository.
340+
*
341+
* The default is full (`GIT_FETCH_DEPTH_FULL` or `0`).
342+
*)
343+
depth: Integer;
328344
(**
329345
* Whether to allow off-site redirects. If this is not
330346
* specified, the `http.followRedirects` configuration setting
@@ -1129,5 +1145,3 @@ function git_remote_default_branch(out_: Pgit_buf; remote: Pgit_remote): Integer
11291145

11301146
(** @} *)
11311147

1132-
1133-

src/git2/repository.inc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,14 @@ function git_repository_open_from_worktree(out_: PPgit_repository; wt: Pgit_work
4545
* @param out pointer to the repo
4646
* @param odb the object database to wrap
4747
* @return 0 or an error code
48+
* @param oid_type the oid type of the object database
4849
*)
4950

50-
function git_repository_wrap_odb(out_: PPgit_repository; odb: Pgit_odb): Integer; cdecl; external libgit2_dll;
51+
function git_repository_wrap_odb(out_: PPgit_repository; odb: Pgit_odb
52+
{$IFDEF GIT_EXPERIMENTAL_SHA256}
53+
; oid_type: git_oid_t
54+
{$ENDIF}
55+
): Integer; cdecl; external libgit2_dll;
5156

5257
(**
5358
* Look for a git repository and copy its path in the given buffer.

src/git2/version.inc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ const
33
* The version string for libgit2. This string follows semantic
44
* versioning (v2) guidelines.
55
*)
6-
LIBGIT2_VERSION = '1.6.5';
6+
LIBGIT2_VERSION = '1.7.2';
77

88
(** The major version number for this version of libgit2. *)
99
LIBGIT2_VER_MAJOR = 1;
1010

1111
(** The minor version number for this version of libgit2. *)
12-
LIBGIT2_VER_MINOR = 6;
12+
LIBGIT2_VER_MINOR = 7;
1313

1414
(** The revision ("teeny") version number for this version of libgit2. *)
15-
LIBGIT2_VER_REVISION = 5;
15+
LIBGIT2_VER_REVISION = 2;
1616

1717
(** The Windows DLL patch number for this version of libgit2. *)
1818
LIBGIT2_VER_PATCH = 0;
@@ -26,7 +26,7 @@ const
2626
LIBGIT2_VER_PRERELEASE : PAnsiChar = nil;
2727

2828
(** The library ABI soversion for this version of libgit2. *)
29-
LIBGIT2_SOVERSION = '1.6';
29+
LIBGIT2_SOVERSION = '1.7';
3030

3131

3232

src/git2/worktree.inc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,9 @@ function git_worktree_prune_options_init(opts: Pgit_worktree_prune_options; vers
228228
*
229229
* If the worktree is not valid and not locked or if the above
230230
* flags have been passed in, this function will return a
231-
* positive value.
231+
* positive value. If the worktree is not prunable, an error
232+
* message will be set (visible in `giterr_last`) with details about
233+
* why.
232234
*
233235
* @param wt Worktree to check.
234236
* @param opts The prunable options.

0 commit comments

Comments
 (0)