Skip to content

Commit 70dde09

Browse files
committed
Update to 1.6.4
1 parent ce53f23 commit 70dde09

File tree

12 files changed

+434
-100
lines changed

12 files changed

+434
-100
lines changed

src/git2/common.inc

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ const
1818
*)
1919

2020
GIT_PATH_MAX = 4096;
21-
(**
22-
* The string representation of the null object ID.
23-
*)
24-
25-
GIT_OID_HEX_ZERO = '0000000000000000000000000000000000000000';
2621

2722
(**
2823
* Return the version of the libgit2 library
@@ -148,6 +143,8 @@ const
148143
GIT_OPT_SET_EXTENSIONS = 34;
149144
GIT_OPT_GET_OWNER_VALIDATION = 35;
150145
GIT_OPT_SET_OWNER_VALIDATION = 36;
146+
GIT_OPT_GET_HOMEDIR = 37;
147+
GIT_OPT_SET_HOMEDIR = 38;
151148
type
152149
git_libgit2_opt_t = Integer;
153150

@@ -395,6 +392,16 @@ type
395392
* > Set that repository directories should be owned by the current
396393
* > user. The default is to validate ownership.
397394
*
395+
* opts(GIT_OPT_GET_HOMEDIR, git_buf *out)
396+
* > Gets the current user's home directory, as it will be used
397+
* > for file lookups. The path is written to the `out` buffer.
398+
*
399+
* opts(GIT_OPT_SET_HOMEDIR, const char *path)
400+
* > Sets the directory used as the current user's home directory,
401+
* > for file lookups.
402+
* >
403+
* > - `path` directory of home directory.
404+
*
398405
* @param option Option key
399406
* @param ... value to set the option
400407
* @return 0 on success, <0 on failure

src/git2/diff.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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_HEXSZ`, 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
*)

src/git2/indexer.inc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,17 @@ type
5151
type
5252
git_indexer_options = record
5353
version: Cardinal;
54+
{$IFDEF GIT_EXPERIMENTAL_SHA256}
55+
(** permissions to use creating packfile or 0 for defaults *)
56+
mode: Cardinal;
57+
(**
58+
* object database from which to read base objects when
59+
* fixing thin packs. This can be NULL if there are no thin
60+
* packs; if a thin pack is encountered, an error will be
61+
* returned if there are bases missing.
62+
*)
63+
odb: Pgit_odb;
64+
{$ENDIF}
5465
(** progress_cb function to call with progress information *)
5566
progress_cb: git_indexer_progress_cb;
5667
(** progress_cb_payload payload for the progress callback *)
@@ -74,6 +85,10 @@ const
7485

7586
function git_indexer_options_init(opts: Pgit_indexer_options; version: Cardinal): Integer; cdecl; external libgit2_dll;
7687

88+
{$IFDEF GIT_EXPERIMENTAL_SHA256}
89+
function git_indexer_new(out_: PPgit_indexer; path: PAnsiChar; oid_type: git_oid_t;
90+
opts: Pgit_indexer_options): Integer; cdecl; external libgit2_dll;
91+
{$ELSE}
7792
(**
7893
* Create a new indexer instance
7994
*
@@ -90,6 +105,7 @@ function git_indexer_options_init(opts: Pgit_indexer_options; version: Cardinal)
90105

91106
function git_indexer_new(out_: PPgit_indexer; path: PAnsiChar; mode: Cardinal; odb: Pgit_odb;
92107
opts: Pgit_indexer_options): Integer; cdecl; external libgit2_dll;
108+
{$ENDIF}
93109

94110
(**
95111
* Add data to the indexer

src/git2/object.inc

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ function git_object_peel(peeled: PPgit_object; object_: Pgit_object;
210210

211211
function git_object_dup(dest: PPgit_object; source: Pgit_object): Integer; cdecl; external libgit2_dll;
212212

213+
{$IFDEF GIT_EXPERIMENTAL_SHA256}
213214
(**
214215
* Analyzes a buffer of raw object content and determines its validity.
215216
* Tree, commit, and tag objects will be parsed and ensured that they
@@ -223,14 +224,34 @@ function git_object_dup(dest: PPgit_object; source: Pgit_object): Integer; cdecl
223224
* @param valid Output pointer to set with validity of the object content
224225
* @param buf The contents to validate
225226
* @param len The length of the buffer
226-
* @param type The type of the object in the buffer
227+
* @param object_type The type of the object in the buffer
228+
* @param oid_type The object ID type for the OIDs in the given buffer
227229
* @return 0 on success or an error code
228230
*)
229231

232+
function git_object_rawcontent_is_valid(valid: PInteger; buf: PAnsiChar; len: size_t;
233+
type_: git_object_t; oid_type: git_oid_t): Integer; cdecl; external libgit2_dll;
234+
235+
{$ELSE}
236+
(**
237+
* Analyzes a buffer of raw object content and determines its validity.
238+
* Tree, commit, and tag objects will be parsed and ensured that they
239+
* are valid, parseable content. (Blobs are always valid by definition.)
240+
* An error message will be set with an informative message if the object
241+
* is not valid.
242+
*
243+
* @warning This function is experimental and its signature may change in
244+
* the future.
245+
*
246+
* @param valid Output pointer to set with validity of the object content
247+
* @param buf The contents to validate
248+
* @param len The length of the buffer
249+
* @param object_type The type of the object in the buffer
250+
* @return 0 on success or an error code
251+
*)
230252
function git_object_rawcontent_is_valid(valid: PInteger; buf: PAnsiChar; len: size_t;
231253
type_: git_object_t): Integer; cdecl; external libgit2_dll;
254+
{$ENDIF}
232255

233256
(** @} *)
234257

235-
236-

src/git2/odb.inc

Lines changed: 63 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,45 @@ const
2323
type
2424
git_odb_foreach_cb = function(id: Pgit_oid; payload: Pointer): Integer; cdecl;
2525

26+
(** Options for configuring a loose object backend. *)
27+
git_odb_options = record
28+
version: cardinal; (**< version for the struct *)
29+
30+
(**
31+
* Type of object IDs to use for this object database, or
32+
* 0 for default (currently SHA1).
33+
*)
34+
oid_type: git_oid_t;
35+
end;
36+
Pgit_odb_options = ^git_odb_options;
37+
38+
const
39+
(* The current version of the diff options structure *)
40+
GIT_ODB_OPTIONS_VERSION = 1;
41+
42+
(* Stack initializer for odb options. Alternatively use
43+
* `git_odb_options_init` programmatic initialization.
44+
*)
45+
//#define GIT_ODB_OPTIONS_INIT { GIT_ODB_OPTIONS_VERSION }
46+
2647
(**
27-
* Create a new object database with no backends.
28-
*
29-
* Before the ODB can be used for read/writing, a custom database
30-
* backend must be manually added using `git_odb_add_backend()`
31-
*
32-
* @param out location to store the database pointer, if opened.
33-
* Set to NULL if the open failed.
34-
* @return 0 or an error code
35-
*)
48+
* Create a new object database with no backends.
49+
*
50+
* Before the ODB can be used for read/writing, a custom database
51+
* backend must be manually added using `git_odb_add_backend()`
52+
*
53+
* @param out location to store the database pointer, if opened.
54+
* Set to NULL if the open failed.
55+
* @param opts the options for this object database or NULL for defaults
56+
* @return 0 or an error code
57+
*)
58+
59+
{$IFDEF GIT_EXPERIMENTAL_SHA256}
60+
function git_odb_new(out_: PPgit_odb; opts: Pgit_odb_options): Integer; cdecl; external libgit2_dll;
3661

62+
{$ELSE}
3763
function git_odb_new(out_: PPgit_odb): Integer; cdecl; external libgit2_dll;
64+
{$ENDIF}
3865

3966
(**
4067
* Create a new object database and automatically add
@@ -50,11 +77,16 @@ function git_odb_new(out_: PPgit_odb): Integer; cdecl; external libgit2_dll;
5077
* @param out location to store the database pointer, if opened.
5178
* Set to NULL if the open failed.
5279
* @param objects_dir path of the backends' "objects" directory.
80+
* @param opts the options for this object database or NULL for defaults
5381
* @return 0 or an error code
5482
*)
5583

56-
function git_odb_open(out_: PPgit_odb; objects_dir: PAnsiChar): Integer; cdecl; external libgit2_dll;
84+
{$IFDEF GIT_EXPERIMENTAL_SHA256}
85+
function git_odb_open(out_: PPgit_odb; objects_dir: PAnsiChar; opts: Pgit_odb_options): Integer; cdecl; external libgit2_dll;
5786

87+
{$ELSE}
88+
function git_odb_open(out_: PPgit_odb; objects_dir: PAnsiChar): Integer; cdecl; external libgit2_dll;
89+
{$ENDIF}
5890
(**
5991
* Add an on-disk alternate to an existing Object DB.
6092
*
@@ -107,7 +139,7 @@ function git_odb_read(out_: PPgit_odb_object; db: Pgit_odb; id: Pgit_oid): Integ
107139
* This method queries all available ODB backends
108140
* trying to match the 'len' first hexadecimal
109141
* characters of the 'short_id'.
110-
* The remaining (GIT_OID_HEXSZ-len)*4 bits of
142+
* The remaining (GIT_OID_SHA1_HEXSIZE-len)*4 bits of
111143
* 'short_id' must be 0s.
112144
* 'len' must be at least GIT_OID_MINPREFIXLEN,
113145
* and the prefix must be long enough to identify
@@ -217,7 +249,7 @@ type
217249
*
218250
* The given array will be updated in place: for each abbreviated ID that is
219251
* unique in the database, and of the given type (if specified),
220-
* the full object ID, object ID length (`GIT_OID_HEXSZ`) and type will be
252+
* the full object ID, object ID length (`GIT_OID_SHA1_HEXSIZE`) and type will be
221253
* written back to the array. For IDs that are not found (or are ambiguous),
222254
* the array entry will be zeroed.
223255
*
@@ -440,19 +472,26 @@ function git_odb_write_pack(out_: PPgit_odb_writepack; db: Pgit_odb; progress_cb
440472
function git_odb_write_multi_pack_index(db: Pgit_odb): Integer; cdecl; external libgit2_dll;
441473

442474
(**
443-
* Determine the object-ID (sha1 hash) of a data buffer
475+
* Determine the object-ID (sha1 or sha256 hash) of a data buffer
444476
*
445-
* The resulting SHA-1 OID will be the identifier for the data
446-
* buffer as if the data buffer it were to written to the ODB.
477+
* The resulting OID will be the identifier for the data buffer as if
478+
* the data buffer it were to written to the ODB.
447479
*
448480
* @param out the resulting object-ID.
449481
* @param data data to hash
450482
* @param len size of the data
451-
* @param type of the data to hash
483+
* @param object_type of the data to hash
484+
* @param oid_type the oid type to hash to
452485
* @return 0 or an error code
453486
*)
454487

488+
{$IFDEF GIT_EXPERIMENTAL_SHA256}
489+
function git_odb_hash(out_: Pgit_oid; data: Pointer; len: size_t; type_: git_object_t;
490+
oid_type: git_oid_t): Integer; cdecl; external libgit2_dll;
491+
492+
{$ELSE}
455493
function git_odb_hash(out_: Pgit_oid; data: Pointer; len: size_t; type_: git_object_t): Integer; cdecl; external libgit2_dll;
494+
{$ENDIF}
456495

457496
(**
458497
* Read a file from disk and fill a git_oid with the object id
@@ -464,11 +503,18 @@ function git_odb_hash(out_: Pgit_oid; data: Pointer; len: size_t; type_: git_obj
464503
*
465504
* @param out oid structure the result is written into.
466505
* @param path file to read and determine object id for
467-
* @param type the type of the object that will be hashed
506+
* @param object_type of the data to hash
507+
* @param oid_type the oid type to hash to
468508
* @return 0 or an error code
469509
*)
470510

511+
{$IFDEF GIT_EXPERIMENTAL_SHA256}
512+
function git_odb_hashfile(out_: Pgit_oid; path: PAnsiChar; type_: git_object_t;
513+
oid_type: git_oid_t): Integer; cdecl; external libgit2_dll;
514+
515+
{$ELSE}
471516
function git_odb_hashfile(out_: Pgit_oid; path: PAnsiChar; type_: git_object_t): Integer; cdecl; external libgit2_dll;
517+
{$ENDIF}
472518

473519
(**
474520
* Create a copy of an odb_object
@@ -618,5 +664,3 @@ function git_odb_set_commit_graph(odb: Pgit_odb; cgraph: Pgit_commit_graph): Int
618664

619665
(** @} *)
620666

621-
622-

0 commit comments

Comments
 (0)