rugged 1.5.0.1 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/rugged/extconf.rb +2 -2
- data/ext/rugged/rugged_allocator.c +0 -54
- data/ext/rugged/rugged_blame.c +2 -0
- data/ext/rugged/rugged_blob.c +3 -0
- data/ext/rugged/rugged_commit.c +1 -0
- data/ext/rugged/rugged_config.c +2 -0
- data/ext/rugged/rugged_diff.c +1 -0
- data/ext/rugged/rugged_index.c +2 -0
- data/ext/rugged/rugged_patch.c +1 -0
- data/ext/rugged/rugged_rebase.c +1 -0
- data/ext/rugged/rugged_reference.c +1 -0
- data/ext/rugged/rugged_remote.c +1 -0
- data/ext/rugged/rugged_repo.c +5 -2
- data/ext/rugged/rugged_revwalk.c +5 -1
- data/ext/rugged/rugged_submodule.c +1 -0
- data/ext/rugged/rugged_tag.c +1 -0
- data/ext/rugged/rugged_tree.c +4 -0
- data/lib/rugged/index.rb +1 -1
- data/lib/rugged/tree.rb +1 -1
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +7 -8
- data/vendor/libgit2/COPYING +30 -0
- data/vendor/libgit2/cmake/CheckPrototypeDefinitionSafe.cmake +16 -0
- data/vendor/libgit2/cmake/ExperimentalFeatures.cmake +23 -0
- data/vendor/libgit2/cmake/SelectGSSAPI.cmake +3 -3
- data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +21 -2
- data/vendor/libgit2/cmake/SelectHashes.cmake +4 -0
- data/vendor/libgit2/cmake/SelectXdiff.cmake +9 -0
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +2 -0
- data/vendor/libgit2/deps/pcre/LICENCE +5 -5
- data/vendor/libgit2/deps/pcre/pcre.h +2 -2
- data/vendor/libgit2/deps/pcre/pcre_compile.c +6 -3
- data/vendor/libgit2/deps/pcre/pcre_exec.c +2 -2
- data/vendor/libgit2/deps/xdiff/CMakeLists.txt +28 -0
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/git-xdiff.h +4 -1
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xdiffi.c +19 -18
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xdiffi.h +2 -4
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xemit.c +3 -3
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xhistogram.c +7 -18
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xmacros.h +18 -1
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xmerge.c +24 -22
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xpatience.c +21 -30
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xprepare.c +13 -30
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xutils.c +18 -1
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xutils.h +2 -1
- data/vendor/libgit2/include/git2/common.h +38 -6
- data/vendor/libgit2/include/git2/deprecated.h +6 -0
- data/vendor/libgit2/include/git2/diff.h +42 -4
- data/vendor/libgit2/include/git2/errors.h +4 -2
- data/vendor/libgit2/include/git2/experimental.h +20 -0
- data/vendor/libgit2/include/git2/index.h +9 -0
- data/vendor/libgit2/include/git2/indexer.h +29 -0
- data/vendor/libgit2/include/git2/object.h +28 -2
- data/vendor/libgit2/include/git2/odb.h +58 -7
- data/vendor/libgit2/include/git2/odb_backend.h +106 -18
- data/vendor/libgit2/include/git2/oid.h +116 -16
- data/vendor/libgit2/include/git2/remote.h +18 -0
- data/vendor/libgit2/include/git2/repository.h +32 -3
- data/vendor/libgit2/include/git2/stash.h +60 -6
- data/vendor/libgit2/include/git2/strarray.h +0 -13
- data/vendor/libgit2/include/git2/sys/alloc.h +0 -34
- data/vendor/libgit2/include/git2/sys/commit_graph.h +12 -2
- data/vendor/libgit2/include/git2/sys/midx.h +5 -1
- data/vendor/libgit2/include/git2/sys/odb_backend.h +1 -1
- data/vendor/libgit2/include/git2/sys/stream.h +16 -2
- data/vendor/libgit2/include/git2/sys/transport.h +32 -2
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2/worktree.h +3 -1
- data/vendor/libgit2/include/git2.h +1 -0
- data/vendor/libgit2/src/CMakeLists.txt +34 -17
- data/vendor/libgit2/src/cli/CMakeLists.txt +5 -2
- data/vendor/libgit2/src/cli/cmd_clone.c +22 -6
- data/vendor/libgit2/src/cli/cmd_hash_object.c +27 -8
- data/vendor/libgit2/src/cli/opt.c +1 -1
- data/vendor/libgit2/src/cli/progress.c +9 -8
- data/vendor/libgit2/src/cli/progress.h +4 -4
- data/vendor/libgit2/src/libgit2/CMakeLists.txt +25 -34
- data/vendor/libgit2/src/libgit2/annotated_commit.c +2 -2
- data/vendor/libgit2/src/libgit2/annotated_commit.h +1 -1
- data/vendor/libgit2/src/libgit2/apply.c +4 -3
- data/vendor/libgit2/src/libgit2/attr_file.c +1 -1
- data/vendor/libgit2/src/libgit2/attrcache.c +1 -1
- data/vendor/libgit2/src/libgit2/blame.c +23 -14
- data/vendor/libgit2/src/libgit2/blame_git.c +0 -1
- data/vendor/libgit2/src/libgit2/blob.c +4 -2
- data/vendor/libgit2/src/libgit2/blob.h +2 -2
- data/vendor/libgit2/src/libgit2/branch.c +2 -2
- data/vendor/libgit2/src/libgit2/cherrypick.c +3 -3
- data/vendor/libgit2/src/libgit2/clone.c +34 -3
- data/vendor/libgit2/src/libgit2/commit.c +78 -21
- data/vendor/libgit2/src/libgit2/commit.h +25 -7
- data/vendor/libgit2/src/libgit2/commit_graph.c +129 -47
- data/vendor/libgit2/src/libgit2/commit_graph.h +23 -4
- data/vendor/libgit2/src/libgit2/commit_list.c +16 -5
- data/vendor/libgit2/src/libgit2/commit_list.h +1 -0
- data/vendor/libgit2/src/libgit2/config.c +6 -3
- data/vendor/libgit2/src/libgit2/config_file.c +16 -10
- data/vendor/libgit2/src/libgit2/describe.c +11 -8
- data/vendor/libgit2/src/libgit2/diff.c +19 -6
- data/vendor/libgit2/src/libgit2/diff.h +6 -6
- data/vendor/libgit2/src/libgit2/diff_file.c +16 -7
- data/vendor/libgit2/src/libgit2/diff_generate.c +37 -11
- data/vendor/libgit2/src/libgit2/diff_parse.c +20 -4
- data/vendor/libgit2/src/libgit2/diff_print.c +26 -7
- data/vendor/libgit2/src/libgit2/diff_tform.c +4 -0
- data/vendor/libgit2/src/libgit2/diff_xdiff.h +1 -1
- data/vendor/libgit2/src/libgit2/email.c +4 -3
- data/vendor/libgit2/src/libgit2/errors.c +73 -18
- data/vendor/libgit2/src/libgit2/experimental.h.in +13 -0
- data/vendor/libgit2/src/libgit2/fetch.c +38 -13
- data/vendor/libgit2/src/libgit2/fetch.h +0 -2
- data/vendor/libgit2/src/libgit2/fetchhead.c +11 -9
- data/vendor/libgit2/src/libgit2/grafts.c +272 -0
- data/vendor/libgit2/src/libgit2/grafts.h +36 -0
- data/vendor/libgit2/src/libgit2/ident.c +3 -3
- data/vendor/libgit2/src/libgit2/index.c +327 -123
- data/vendor/libgit2/src/libgit2/index.h +14 -1
- data/vendor/libgit2/src/libgit2/indexer.c +116 -46
- data/vendor/libgit2/src/libgit2/iterator.c +21 -4
- data/vendor/libgit2/src/libgit2/iterator.h +3 -0
- data/vendor/libgit2/src/libgit2/libgit2.c +58 -0
- data/vendor/libgit2/src/libgit2/merge.c +14 -9
- data/vendor/libgit2/src/libgit2/merge_file.c +0 -2
- data/vendor/libgit2/src/libgit2/midx.c +68 -38
- data/vendor/libgit2/src/libgit2/midx.h +13 -3
- data/vendor/libgit2/src/libgit2/mwindow.c +5 -2
- data/vendor/libgit2/src/libgit2/mwindow.h +4 -1
- data/vendor/libgit2/src/libgit2/notes.c +9 -8
- data/vendor/libgit2/src/libgit2/object.c +118 -29
- data/vendor/libgit2/src/libgit2/object.h +17 -2
- data/vendor/libgit2/src/libgit2/odb.c +224 -55
- data/vendor/libgit2/src/libgit2/odb.h +43 -4
- data/vendor/libgit2/src/libgit2/odb_loose.c +128 -70
- data/vendor/libgit2/src/libgit2/odb_pack.c +111 -46
- data/vendor/libgit2/src/libgit2/oid.c +141 -77
- data/vendor/libgit2/src/libgit2/oid.h +183 -9
- data/vendor/libgit2/src/libgit2/oidarray.c +49 -3
- data/vendor/libgit2/src/libgit2/oidarray.h +5 -1
- data/vendor/libgit2/src/libgit2/pack-objects.c +31 -13
- data/vendor/libgit2/src/libgit2/pack-objects.h +5 -2
- data/vendor/libgit2/src/libgit2/pack.c +93 -70
- data/vendor/libgit2/src/libgit2/pack.h +29 -15
- data/vendor/libgit2/src/libgit2/parse.c +8 -4
- data/vendor/libgit2/src/libgit2/parse.h +1 -1
- data/vendor/libgit2/src/libgit2/patch.h +7 -1
- data/vendor/libgit2/src/libgit2/patch_generate.c +24 -5
- data/vendor/libgit2/src/libgit2/patch_parse.c +16 -8
- data/vendor/libgit2/src/libgit2/push.c +13 -3
- data/vendor/libgit2/src/libgit2/reader.c +1 -1
- data/vendor/libgit2/src/libgit2/rebase.c +72 -83
- data/vendor/libgit2/src/libgit2/refdb_fs.c +92 -52
- data/vendor/libgit2/src/libgit2/reflog.c +7 -5
- data/vendor/libgit2/src/libgit2/reflog.h +1 -2
- data/vendor/libgit2/src/libgit2/refs.c +9 -0
- data/vendor/libgit2/src/libgit2/remote.c +47 -37
- data/vendor/libgit2/src/libgit2/remote.h +41 -0
- data/vendor/libgit2/src/libgit2/repository.c +784 -329
- data/vendor/libgit2/src/libgit2/repository.h +26 -2
- data/vendor/libgit2/src/libgit2/reset.c +2 -2
- data/vendor/libgit2/src/libgit2/revert.c +8 -11
- data/vendor/libgit2/src/libgit2/revparse.c +23 -7
- data/vendor/libgit2/src/libgit2/revwalk.c +31 -5
- data/vendor/libgit2/src/libgit2/stash.c +209 -33
- data/vendor/libgit2/src/libgit2/strarray.c +1 -0
- data/vendor/libgit2/src/libgit2/strarray.h +25 -0
- data/vendor/libgit2/src/libgit2/streams/mbedtls.c +0 -1
- data/vendor/libgit2/src/libgit2/streams/openssl.c +9 -17
- data/vendor/libgit2/src/libgit2/streams/openssl_dynamic.c +7 -3
- data/vendor/libgit2/src/libgit2/streams/schannel.c +715 -0
- data/vendor/libgit2/src/libgit2/streams/schannel.h +28 -0
- data/vendor/libgit2/src/libgit2/streams/socket.c +240 -51
- data/vendor/libgit2/src/libgit2/streams/socket.h +3 -1
- data/vendor/libgit2/src/libgit2/streams/stransport.c +40 -12
- data/vendor/libgit2/src/libgit2/streams/tls.c +5 -0
- data/vendor/libgit2/src/libgit2/submodule.c +6 -2
- data/vendor/libgit2/src/libgit2/submodule.h +3 -3
- data/vendor/libgit2/src/libgit2/sysdir.c +294 -7
- data/vendor/libgit2/src/libgit2/sysdir.h +41 -9
- data/vendor/libgit2/src/libgit2/tag.c +29 -10
- data/vendor/libgit2/src/libgit2/tag.h +2 -2
- data/vendor/libgit2/src/libgit2/threadstate.c +15 -2
- data/vendor/libgit2/src/libgit2/threadstate.h +1 -3
- data/vendor/libgit2/src/libgit2/transports/auth.h +1 -2
- data/vendor/libgit2/src/libgit2/transports/{auth_negotiate.c → auth_gssapi.c} +32 -32
- data/vendor/libgit2/src/libgit2/transports/auth_negotiate.h +1 -1
- data/vendor/libgit2/src/libgit2/transports/auth_ntlm.h +1 -1
- data/vendor/libgit2/src/libgit2/transports/{auth_ntlm.c → auth_ntlmclient.c} +12 -12
- data/vendor/libgit2/src/libgit2/transports/auth_sspi.c +341 -0
- data/vendor/libgit2/src/libgit2/transports/git.c +7 -8
- data/vendor/libgit2/src/libgit2/transports/http.c +15 -9
- data/vendor/libgit2/src/libgit2/transports/httpclient.c +14 -0
- data/vendor/libgit2/src/libgit2/transports/httpclient.h +10 -0
- data/vendor/libgit2/src/libgit2/transports/local.c +27 -4
- data/vendor/libgit2/src/libgit2/transports/smart.c +68 -27
- data/vendor/libgit2/src/libgit2/transports/smart.h +33 -9
- data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +281 -49
- data/vendor/libgit2/src/libgit2/transports/smart_protocol.c +192 -55
- data/vendor/libgit2/src/libgit2/transports/ssh.c +334 -102
- data/vendor/libgit2/src/libgit2/transports/winhttp.c +22 -18
- data/vendor/libgit2/src/libgit2/tree-cache.c +26 -16
- data/vendor/libgit2/src/libgit2/tree-cache.h +5 -3
- data/vendor/libgit2/src/libgit2/tree.c +23 -17
- data/vendor/libgit2/src/libgit2/tree.h +2 -2
- data/vendor/libgit2/src/libgit2/worktree.c +30 -10
- data/vendor/libgit2/src/util/CMakeLists.txt +6 -1
- data/vendor/libgit2/src/util/alloc.c +65 -6
- data/vendor/libgit2/src/util/alloc.h +34 -9
- data/vendor/libgit2/src/util/allocators/failalloc.c +0 -60
- data/vendor/libgit2/src/util/allocators/failalloc.h +0 -6
- data/vendor/libgit2/src/util/allocators/stdalloc.c +2 -105
- data/vendor/libgit2/src/util/allocators/win32_leakcheck.c +0 -68
- data/vendor/libgit2/src/util/array.h +6 -1
- data/vendor/libgit2/src/util/cc-compat.h +2 -0
- data/vendor/libgit2/src/util/filebuf.c +6 -1
- data/vendor/libgit2/src/util/filebuf.h +19 -6
- data/vendor/libgit2/src/util/fs_path.c +2 -2
- data/vendor/libgit2/src/util/futils.c +8 -8
- data/vendor/libgit2/src/{features.h.in → util/git2_features.h.in} +9 -3
- data/vendor/libgit2/src/util/git2_util.h +2 -2
- data/vendor/libgit2/src/util/hash/openssl.c +4 -3
- data/vendor/libgit2/src/util/hash/rfc6234/sha.h +0 -112
- data/vendor/libgit2/src/util/hash.h +13 -0
- data/vendor/libgit2/src/util/net.c +492 -87
- data/vendor/libgit2/src/util/net.h +32 -0
- data/vendor/libgit2/src/util/posix.c +54 -0
- data/vendor/libgit2/src/util/posix.h +24 -0
- data/vendor/libgit2/src/util/rand.c +10 -4
- data/vendor/libgit2/src/util/regexp.c +3 -3
- data/vendor/libgit2/src/util/staticstr.h +66 -0
- data/vendor/libgit2/src/util/thread.h +20 -19
- data/vendor/libgit2/src/util/util.c +15 -10
- data/vendor/libgit2/src/util/util.h +25 -16
- data/vendor/libgit2/src/util/win32/error.c +1 -1
- data/vendor/libgit2/src/util/win32/path_w32.c +8 -8
- data/vendor/libgit2/src/util/win32/posix_w32.c +1 -1
- data/vendor/libgit2/src/util/win32/utf-conv.c +73 -75
- data/vendor/libgit2/src/util/win32/utf-conv.h +81 -14
- data/vendor/libgit2/src/util/win32/w32_util.c +1 -1
- metadata +34 -26
- data/vendor/libgit2/cmake/SelectWinHTTP.cmake +0 -17
- data/vendor/libgit2/src/libgit2/netops.c +0 -124
- data/vendor/libgit2/src/libgit2/netops.h +0 -68
- data/vendor/libgit2/src/util/win32/findfile.c +0 -286
- data/vendor/libgit2/src/util/win32/findfile.h +0 -22
- /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xdiff.h +0 -0
- /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xemit.h +0 -0
- /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xinclude.h +0 -0
- /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xprepare.h +0 -0
- /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xtypes.h +0 -0
@@ -122,7 +122,7 @@ long xdl_guess_lines(mmfile_t *mf, long sample) {
|
|
122
122
|
long nl = 0, size, tsize = 0;
|
123
123
|
char const *data, *cur, *top;
|
124
124
|
|
125
|
-
if ((cur = data = xdl_mmfile_first(mf, &size))
|
125
|
+
if ((cur = data = xdl_mmfile_first(mf, &size))) {
|
126
126
|
for (top = data + size; nl < sample && cur < top; ) {
|
127
127
|
nl++;
|
128
128
|
if (!(cur = memchr(cur, '\n', top - cur)))
|
@@ -432,3 +432,20 @@ int xdl_fall_back_diff(xdfenv_t *diff_env, xpparam_t const *xpp,
|
|
432
432
|
|
433
433
|
return 0;
|
434
434
|
}
|
435
|
+
|
436
|
+
void* xdl_alloc_grow_helper(void *p, long nr, long *alloc, size_t size)
|
437
|
+
{
|
438
|
+
void *tmp = NULL;
|
439
|
+
size_t n = ((LONG_MAX - 16) / 2 >= *alloc) ? 2 * *alloc + 16 : LONG_MAX;
|
440
|
+
if (nr > n)
|
441
|
+
n = nr;
|
442
|
+
if (SIZE_MAX / size >= n)
|
443
|
+
tmp = xdl_realloc(p, n * size);
|
444
|
+
if (tmp) {
|
445
|
+
*alloc = n;
|
446
|
+
} else {
|
447
|
+
xdl_free(p);
|
448
|
+
*alloc = 0;
|
449
|
+
}
|
450
|
+
return tmp;
|
451
|
+
}
|
@@ -42,6 +42,7 @@ int xdl_emit_hunk_hdr(long s1, long c1, long s2, long c2,
|
|
42
42
|
int xdl_fall_back_diff(xdfenv_t *diff_env, xpparam_t const *xpp,
|
43
43
|
int line1, int count1, int line2, int count2);
|
44
44
|
|
45
|
-
|
45
|
+
/* Do not call this function, use XDL_ALLOC_GROW instead */
|
46
|
+
void* xdl_alloc_grow_helper(void* p, long nr, long* alloc, size_t size);
|
46
47
|
|
47
48
|
#endif /* #if !defined(XUTILS_H) */
|
@@ -105,11 +105,6 @@ GIT_BEGIN_DECL
|
|
105
105
|
*/
|
106
106
|
#define GIT_PATH_MAX 4096
|
107
107
|
|
108
|
-
/**
|
109
|
-
* The string representation of the null object ID.
|
110
|
-
*/
|
111
|
-
#define GIT_OID_HEX_ZERO "0000000000000000000000000000000000000000"
|
112
|
-
|
113
108
|
/**
|
114
109
|
* Return the version of the libgit2 library
|
115
110
|
* being currently used.
|
@@ -227,7 +222,13 @@ typedef enum {
|
|
227
222
|
GIT_OPT_GET_EXTENSIONS,
|
228
223
|
GIT_OPT_SET_EXTENSIONS,
|
229
224
|
GIT_OPT_GET_OWNER_VALIDATION,
|
230
|
-
GIT_OPT_SET_OWNER_VALIDATION
|
225
|
+
GIT_OPT_SET_OWNER_VALIDATION,
|
226
|
+
GIT_OPT_GET_HOMEDIR,
|
227
|
+
GIT_OPT_SET_HOMEDIR,
|
228
|
+
GIT_OPT_SET_SERVER_CONNECT_TIMEOUT,
|
229
|
+
GIT_OPT_GET_SERVER_CONNECT_TIMEOUT,
|
230
|
+
GIT_OPT_SET_SERVER_TIMEOUT,
|
231
|
+
GIT_OPT_GET_SERVER_TIMEOUT
|
231
232
|
} git_libgit2_opt_t;
|
232
233
|
|
233
234
|
/**
|
@@ -473,6 +474,37 @@ typedef enum {
|
|
473
474
|
* > Set that repository directories should be owned by the current
|
474
475
|
* > user. The default is to validate ownership.
|
475
476
|
*
|
477
|
+
* opts(GIT_OPT_GET_HOMEDIR, git_buf *out)
|
478
|
+
* > Gets the current user's home directory, as it will be used
|
479
|
+
* > for file lookups. The path is written to the `out` buffer.
|
480
|
+
*
|
481
|
+
* opts(GIT_OPT_SET_HOMEDIR, const char *path)
|
482
|
+
* > Sets the directory used as the current user's home directory,
|
483
|
+
* > for file lookups.
|
484
|
+
* >
|
485
|
+
* > - `path` directory of home directory.
|
486
|
+
*
|
487
|
+
* opts(GIT_OPT_GET_SERVER_CONNECT_TIMEOUT, int *timeout)
|
488
|
+
* > Gets the timeout (in milliseconds) to attempt connections to
|
489
|
+
* > a remote server.
|
490
|
+
*
|
491
|
+
* opts(GIT_OPT_SET_SERVER_CONNECT_TIMEOUT, int timeout)
|
492
|
+
* > Sets the timeout (in milliseconds) to attempt connections to
|
493
|
+
* > a remote server. This is supported only for HTTP(S) connections
|
494
|
+
* > and is not supported by SSH. Set to 0 to use the system default.
|
495
|
+
* > Note that this may not be able to be configured longer than the
|
496
|
+
* > system default, typically 75 seconds.
|
497
|
+
*
|
498
|
+
* opts(GIT_OPT_GET_SERVER_TIMEOUT, int *timeout)
|
499
|
+
* > Gets the timeout (in milliseconds) for reading from and writing
|
500
|
+
* > to a remote server.
|
501
|
+
*
|
502
|
+
* opts(GIT_OPT_SET_SERVER_TIMEOUT, int timeout)
|
503
|
+
* > Sets the timeout (in milliseconds) for reading from and writing
|
504
|
+
* > to a remote server. This is supported only for HTTP(S)
|
505
|
+
* > connections and is not supported by SSH. Set to 0 to use the
|
506
|
+
* > system default.
|
507
|
+
*
|
476
508
|
* @param option Option key
|
477
509
|
* @param ... value to set the option
|
478
510
|
* @return 0 on success, <0 on failure
|
@@ -777,6 +777,12 @@ typedef git_trace_cb git_trace_callback;
|
|
777
777
|
*/
|
778
778
|
/**@{*/
|
779
779
|
|
780
|
+
#ifndef GIT_EXPERIMENTAL_SHA256
|
781
|
+
# define GIT_OID_RAWSZ GIT_OID_SHA1_SIZE
|
782
|
+
# define GIT_OID_HEXSZ GIT_OID_SHA1_HEXSIZE
|
783
|
+
# define GIT_OID_HEX_ZERO GIT_OID_SHA1_HEXZERO
|
784
|
+
#endif
|
785
|
+
|
780
786
|
GIT_EXTERN(int) git_oid_iszero(const git_oid *id);
|
781
787
|
|
782
788
|
/**@}*/
|
@@ -274,7 +274,7 @@ typedef struct {
|
|
274
274
|
|
275
275
|
/**
|
276
276
|
* Represents the known length of the `id` field, when
|
277
|
-
* converted to a hex string. It is generally `
|
277
|
+
* converted to a hex string. It is generally `GIT_OID_SHA1_HEXSIZE`, unless this
|
278
278
|
* delta was created from reading a patch file, in which case it may be
|
279
279
|
* abbreviated to something reasonable, like 7 characters.
|
280
280
|
*/
|
@@ -421,6 +421,22 @@ typedef struct {
|
|
421
421
|
*/
|
422
422
|
uint32_t interhunk_lines;
|
423
423
|
|
424
|
+
/**
|
425
|
+
* The object ID type to emit in diffs; this is used by functions
|
426
|
+
* that operate without a repository - namely `git_diff_buffers`,
|
427
|
+
* or `git_diff_blobs` and `git_diff_blob_to_buffer` when one blob
|
428
|
+
* is `NULL`.
|
429
|
+
*
|
430
|
+
* This may be omitted (set to `0`). If a repository is available,
|
431
|
+
* the object ID format of the repository will be used. If no
|
432
|
+
* repository is available then the default is `GIT_OID_SHA`.
|
433
|
+
*
|
434
|
+
* If this is specified and a repository is available, then the
|
435
|
+
* specified `oid_type` must match the repository's object ID
|
436
|
+
* format.
|
437
|
+
*/
|
438
|
+
git_oid_t oid_type;
|
439
|
+
|
424
440
|
/**
|
425
441
|
* The abbreviation length to use when formatting object ids.
|
426
442
|
* Defaults to the value of 'core.abbrev' from the config, or 7 if unset.
|
@@ -1153,9 +1169,8 @@ GIT_EXTERN(int) git_diff_to_buf(
|
|
1153
1169
|
|
1154
1170
|
/**@}*/
|
1155
1171
|
|
1156
|
-
|
1157
1172
|
/*
|
1158
|
-
*
|
1173
|
+
* Low-level file comparison, invoking callbacks per difference.
|
1159
1174
|
*/
|
1160
1175
|
|
1161
1176
|
/**
|
@@ -1271,6 +1286,25 @@ GIT_EXTERN(int) git_diff_buffers(
|
|
1271
1286
|
git_diff_line_cb line_cb,
|
1272
1287
|
void *payload);
|
1273
1288
|
|
1289
|
+
/* Patch file parsing. */
|
1290
|
+
|
1291
|
+
/**
|
1292
|
+
* Options for parsing a diff / patch file.
|
1293
|
+
*/
|
1294
|
+
typedef struct {
|
1295
|
+
unsigned int version;
|
1296
|
+
git_oid_t oid_type;
|
1297
|
+
} git_diff_parse_options;
|
1298
|
+
|
1299
|
+
/* The current version of the diff parse options structure */
|
1300
|
+
#define GIT_DIFF_PARSE_OPTIONS_VERSION 1
|
1301
|
+
|
1302
|
+
/* Stack initializer for diff parse options. Alternatively use
|
1303
|
+
* `git_diff_parse_options_init` programmatic initialization.
|
1304
|
+
*/
|
1305
|
+
#define GIT_DIFF_PARSE_OPTIONS_INIT \
|
1306
|
+
{ GIT_DIFF_PARSE_OPTIONS_VERSION, GIT_OID_DEFAULT }
|
1307
|
+
|
1274
1308
|
/**
|
1275
1309
|
* Read the contents of a git patch file into a `git_diff` object.
|
1276
1310
|
*
|
@@ -1293,7 +1327,11 @@ GIT_EXTERN(int) git_diff_buffers(
|
|
1293
1327
|
GIT_EXTERN(int) git_diff_from_buffer(
|
1294
1328
|
git_diff **out,
|
1295
1329
|
const char *content,
|
1296
|
-
size_t content_len
|
1330
|
+
size_t content_len
|
1331
|
+
#ifdef GIT_EXPERIMENTAL_SHA256
|
1332
|
+
, git_diff_parse_options *opts
|
1333
|
+
#endif
|
1334
|
+
);
|
1297
1335
|
|
1298
1336
|
/**
|
1299
1337
|
* This is an opaque structure which is allocated by `git_diff_get_stats`.
|
@@ -58,7 +58,8 @@ typedef enum {
|
|
58
58
|
GIT_EMISMATCH = -33, /**< Hashsum mismatch in object */
|
59
59
|
GIT_EINDEXDIRTY = -34, /**< Unsaved changes in the index would be overwritten */
|
60
60
|
GIT_EAPPLYFAIL = -35, /**< Patch application failed */
|
61
|
-
GIT_EOWNER = -36 /**< The object is not owned by the current user */
|
61
|
+
GIT_EOWNER = -36, /**< The object is not owned by the current user */
|
62
|
+
GIT_TIMEOUT = -37 /**< The operation timed out */
|
62
63
|
} git_error_code;
|
63
64
|
|
64
65
|
/**
|
@@ -109,7 +110,8 @@ typedef enum {
|
|
109
110
|
GIT_ERROR_WORKTREE,
|
110
111
|
GIT_ERROR_SHA,
|
111
112
|
GIT_ERROR_HTTP,
|
112
|
-
GIT_ERROR_INTERNAL
|
113
|
+
GIT_ERROR_INTERNAL,
|
114
|
+
GIT_ERROR_GRAFTS
|
113
115
|
} git_error_t;
|
114
116
|
|
115
117
|
/**
|
@@ -0,0 +1,20 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
|
+
*
|
4
|
+
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
|
+
* a Linking Exception. For full terms see the included COPYING file.
|
6
|
+
*/
|
7
|
+
|
8
|
+
#ifndef INCLUDE_experimental_h__
|
9
|
+
#define INCLUDE_experimental_h__
|
10
|
+
|
11
|
+
/*
|
12
|
+
* This file exists to support users who build libgit2 with a bespoke
|
13
|
+
* build system and do not use our cmake configuration. Normally, cmake
|
14
|
+
* will create `experimental.h` from the `experimental.h.in` file and
|
15
|
+
* will include the generated file instead of this one. For non-cmake
|
16
|
+
* users, we bundle this `experimental.h` file which will be used
|
17
|
+
* instead.
|
18
|
+
*/
|
19
|
+
|
20
|
+
#endif
|
@@ -184,7 +184,12 @@ typedef enum {
|
|
184
184
|
* @param index_path the path to the index file in disk
|
185
185
|
* @return 0 or an error code
|
186
186
|
*/
|
187
|
+
|
188
|
+
#ifdef GIT_EXPERIMENTAL_SHA256
|
189
|
+
GIT_EXTERN(int) git_index_open(git_index **out, const char *index_path, git_oid_t oid_type);
|
190
|
+
#else
|
187
191
|
GIT_EXTERN(int) git_index_open(git_index **out, const char *index_path);
|
192
|
+
#endif
|
188
193
|
|
189
194
|
/**
|
190
195
|
* Create an in-memory index object.
|
@@ -197,7 +202,11 @@ GIT_EXTERN(int) git_index_open(git_index **out, const char *index_path);
|
|
197
202
|
* @param out the pointer for the new index
|
198
203
|
* @return 0 or an error code
|
199
204
|
*/
|
205
|
+
#ifdef GIT_EXPERIMENTAL_SHA256
|
206
|
+
GIT_EXTERN(int) git_index_new(git_index **out, git_oid_t oid_type);
|
207
|
+
#else
|
200
208
|
GIT_EXTERN(int) git_index_new(git_index **out);
|
209
|
+
#endif
|
201
210
|
|
202
211
|
/**
|
203
212
|
* Free an existing index object.
|
@@ -62,6 +62,19 @@ typedef int GIT_CALLBACK(git_indexer_progress_cb)(const git_indexer_progress *st
|
|
62
62
|
typedef struct git_indexer_options {
|
63
63
|
unsigned int version;
|
64
64
|
|
65
|
+
#ifdef GIT_EXPERIMENTAL_SHA256
|
66
|
+
/** permissions to use creating packfile or 0 for defaults */
|
67
|
+
unsigned int mode;
|
68
|
+
|
69
|
+
/**
|
70
|
+
* object database from which to read base objects when
|
71
|
+
* fixing thin packs. This can be NULL if there are no thin
|
72
|
+
* packs; if a thin pack is encountered, an error will be
|
73
|
+
* returned if there are bases missing.
|
74
|
+
*/
|
75
|
+
git_odb *odb;
|
76
|
+
#endif
|
77
|
+
|
65
78
|
/** progress_cb function to call with progress information */
|
66
79
|
git_indexer_progress_cb progress_cb;
|
67
80
|
|
@@ -87,6 +100,21 @@ GIT_EXTERN(int) git_indexer_options_init(
|
|
87
100
|
git_indexer_options *opts,
|
88
101
|
unsigned int version);
|
89
102
|
|
103
|
+
#ifdef GIT_EXPERIMENTAL_SHA256
|
104
|
+
/**
|
105
|
+
* Create a new indexer instance
|
106
|
+
*
|
107
|
+
* @param out where to store the indexer instance
|
108
|
+
* @param path to the directory where the packfile should be stored
|
109
|
+
* @param oid_type the oid type to use for objects
|
110
|
+
* @return 0 or an error code.
|
111
|
+
*/
|
112
|
+
GIT_EXTERN(int) git_indexer_new(
|
113
|
+
git_indexer **out,
|
114
|
+
const char *path,
|
115
|
+
git_oid_t oid_type,
|
116
|
+
git_indexer_options *opts);
|
117
|
+
#else
|
90
118
|
/**
|
91
119
|
* Create a new indexer instance
|
92
120
|
*
|
@@ -106,6 +134,7 @@ GIT_EXTERN(int) git_indexer_new(
|
|
106
134
|
unsigned int mode,
|
107
135
|
git_odb *odb,
|
108
136
|
git_indexer_options *opts);
|
137
|
+
#endif
|
109
138
|
|
110
139
|
/**
|
111
140
|
* Add data to the indexer
|
@@ -225,6 +225,7 @@ GIT_EXTERN(int) git_object_peel(
|
|
225
225
|
*/
|
226
226
|
GIT_EXTERN(int) git_object_dup(git_object **dest, git_object *source);
|
227
227
|
|
228
|
+
#ifdef GIT_EXPERIMENTAL_SHA256
|
228
229
|
/**
|
229
230
|
* Analyzes a buffer of raw object content and determines its validity.
|
230
231
|
* Tree, commit, and tag objects will be parsed and ensured that they
|
@@ -238,14 +239,39 @@ GIT_EXTERN(int) git_object_dup(git_object **dest, git_object *source);
|
|
238
239
|
* @param valid Output pointer to set with validity of the object content
|
239
240
|
* @param buf The contents to validate
|
240
241
|
* @param len The length of the buffer
|
241
|
-
* @param
|
242
|
+
* @param object_type The type of the object in the buffer
|
243
|
+
* @param oid_type The object ID type for the OIDs in the given buffer
|
242
244
|
* @return 0 on success or an error code
|
243
245
|
*/
|
244
246
|
GIT_EXTERN(int) git_object_rawcontent_is_valid(
|
245
247
|
int *valid,
|
246
248
|
const char *buf,
|
247
249
|
size_t len,
|
248
|
-
git_object_t
|
250
|
+
git_object_t object_type,
|
251
|
+
git_oid_t oid_type);
|
252
|
+
#else
|
253
|
+
/**
|
254
|
+
* Analyzes a buffer of raw object content and determines its validity.
|
255
|
+
* Tree, commit, and tag objects will be parsed and ensured that they
|
256
|
+
* are valid, parseable content. (Blobs are always valid by definition.)
|
257
|
+
* An error message will be set with an informative message if the object
|
258
|
+
* is not valid.
|
259
|
+
*
|
260
|
+
* @warning This function is experimental and its signature may change in
|
261
|
+
* the future.
|
262
|
+
*
|
263
|
+
* @param valid Output pointer to set with validity of the object content
|
264
|
+
* @param buf The contents to validate
|
265
|
+
* @param len The length of the buffer
|
266
|
+
* @param object_type The type of the object in the buffer
|
267
|
+
* @return 0 on success or an error code
|
268
|
+
*/
|
269
|
+
GIT_EXTERN(int) git_object_rawcontent_is_valid(
|
270
|
+
int *valid,
|
271
|
+
const char *buf,
|
272
|
+
size_t len,
|
273
|
+
git_object_t object_type);
|
274
|
+
#endif
|
249
275
|
|
250
276
|
/** @} */
|
251
277
|
GIT_END_DECL
|
@@ -38,6 +38,25 @@ typedef enum {
|
|
38
38
|
*/
|
39
39
|
typedef int GIT_CALLBACK(git_odb_foreach_cb)(const git_oid *id, void *payload);
|
40
40
|
|
41
|
+
/** Options for configuring a loose object backend. */
|
42
|
+
typedef struct {
|
43
|
+
unsigned int version; /**< version for the struct */
|
44
|
+
|
45
|
+
/**
|
46
|
+
* Type of object IDs to use for this object database, or
|
47
|
+
* 0 for default (currently SHA1).
|
48
|
+
*/
|
49
|
+
git_oid_t oid_type;
|
50
|
+
} git_odb_options;
|
51
|
+
|
52
|
+
/* The current version of the diff options structure */
|
53
|
+
#define GIT_ODB_OPTIONS_VERSION 1
|
54
|
+
|
55
|
+
/* Stack initializer for odb options. Alternatively use
|
56
|
+
* `git_odb_options_init` programmatic initialization.
|
57
|
+
*/
|
58
|
+
#define GIT_ODB_OPTIONS_INIT { GIT_ODB_OPTIONS_VERSION }
|
59
|
+
|
41
60
|
/**
|
42
61
|
* Create a new object database with no backends.
|
43
62
|
*
|
@@ -46,9 +65,14 @@ typedef int GIT_CALLBACK(git_odb_foreach_cb)(const git_oid *id, void *payload);
|
|
46
65
|
*
|
47
66
|
* @param out location to store the database pointer, if opened.
|
48
67
|
* Set to NULL if the open failed.
|
68
|
+
* @param opts the options for this object database or NULL for defaults
|
49
69
|
* @return 0 or an error code
|
50
70
|
*/
|
71
|
+
#ifdef GIT_EXPERIMENTAL_SHA256
|
72
|
+
GIT_EXTERN(int) git_odb_new(git_odb **out, const git_odb_options *opts);
|
73
|
+
#else
|
51
74
|
GIT_EXTERN(int) git_odb_new(git_odb **out);
|
75
|
+
#endif
|
52
76
|
|
53
77
|
/**
|
54
78
|
* Create a new object database and automatically add
|
@@ -64,9 +88,17 @@ GIT_EXTERN(int) git_odb_new(git_odb **out);
|
|
64
88
|
* @param out location to store the database pointer, if opened.
|
65
89
|
* Set to NULL if the open failed.
|
66
90
|
* @param objects_dir path of the backends' "objects" directory.
|
91
|
+
* @param opts the options for this object database or NULL for defaults
|
67
92
|
* @return 0 or an error code
|
68
93
|
*/
|
94
|
+
#ifdef GIT_EXPERIMENTAL_SHA256
|
95
|
+
GIT_EXTERN(int) git_odb_open(
|
96
|
+
git_odb **out,
|
97
|
+
const char *objects_dir,
|
98
|
+
const git_odb_options *opts);
|
99
|
+
#else
|
69
100
|
GIT_EXTERN(int) git_odb_open(git_odb **out, const char *objects_dir);
|
101
|
+
#endif
|
70
102
|
|
71
103
|
/**
|
72
104
|
* Add an on-disk alternate to an existing Object DB.
|
@@ -117,7 +149,7 @@ GIT_EXTERN(int) git_odb_read(git_odb_object **out, git_odb *db, const git_oid *i
|
|
117
149
|
* This method queries all available ODB backends
|
118
150
|
* trying to match the 'len' first hexadecimal
|
119
151
|
* characters of the 'short_id'.
|
120
|
-
* The remaining (
|
152
|
+
* The remaining (GIT_OID_SHA1_HEXSIZE-len)*4 bits of
|
121
153
|
* 'short_id' must be 0s.
|
122
154
|
* 'len' must be at least GIT_OID_MINPREFIXLEN,
|
123
155
|
* and the prefix must be long enough to identify
|
@@ -218,7 +250,7 @@ typedef struct git_odb_expand_id {
|
|
218
250
|
*
|
219
251
|
* The given array will be updated in place: for each abbreviated ID that is
|
220
252
|
* unique in the database, and of the given type (if specified),
|
221
|
-
* the full object ID, object ID length (`
|
253
|
+
* the full object ID, object ID length (`GIT_OID_SHA1_HEXSIZE`) and type will be
|
222
254
|
* written back to the array. For IDs that are not found (or are ambiguous),
|
223
255
|
* the array entry will be zeroed.
|
224
256
|
*
|
@@ -435,18 +467,28 @@ GIT_EXTERN(int) git_odb_write_multi_pack_index(
|
|
435
467
|
git_odb *db);
|
436
468
|
|
437
469
|
/**
|
438
|
-
* Determine the object-ID (sha1 hash) of a data buffer
|
470
|
+
* Determine the object-ID (sha1 or sha256 hash) of a data buffer
|
439
471
|
*
|
440
|
-
* The resulting
|
441
|
-
*
|
472
|
+
* The resulting OID will be the identifier for the data buffer as if
|
473
|
+
* the data buffer it were to written to the ODB.
|
442
474
|
*
|
443
475
|
* @param out the resulting object-ID.
|
444
476
|
* @param data data to hash
|
445
477
|
* @param len size of the data
|
446
|
-
* @param
|
478
|
+
* @param object_type of the data to hash
|
479
|
+
* @param oid_type the oid type to hash to
|
447
480
|
* @return 0 or an error code
|
448
481
|
*/
|
482
|
+
#ifdef GIT_EXPERIMENTAL_SHA256
|
483
|
+
GIT_EXTERN(int) git_odb_hash(
|
484
|
+
git_oid *out,
|
485
|
+
const void *data,
|
486
|
+
size_t len,
|
487
|
+
git_object_t object_type,
|
488
|
+
git_oid_t oid_type);
|
489
|
+
#else
|
449
490
|
GIT_EXTERN(int) git_odb_hash(git_oid *out, const void *data, size_t len, git_object_t type);
|
491
|
+
#endif
|
450
492
|
|
451
493
|
/**
|
452
494
|
* Read a file from disk and fill a git_oid with the object id
|
@@ -458,10 +500,19 @@ GIT_EXTERN(int) git_odb_hash(git_oid *out, const void *data, size_t len, git_obj
|
|
458
500
|
*
|
459
501
|
* @param out oid structure the result is written into.
|
460
502
|
* @param path file to read and determine object id for
|
461
|
-
* @param
|
503
|
+
* @param object_type of the data to hash
|
504
|
+
* @param oid_type the oid type to hash to
|
462
505
|
* @return 0 or an error code
|
463
506
|
*/
|
507
|
+
#ifdef GIT_EXPERIMENTAL_SHA256
|
508
|
+
GIT_EXTERN(int) git_odb_hashfile(
|
509
|
+
git_oid *out,
|
510
|
+
const char *path,
|
511
|
+
git_object_t object_type,
|
512
|
+
git_oid_t oid_type);
|
513
|
+
#else
|
464
514
|
GIT_EXTERN(int) git_odb_hashfile(git_oid *out, const char *path, git_object_t type);
|
515
|
+
#endif
|
465
516
|
|
466
517
|
/**
|
467
518
|
* Create a copy of an odb_object
|
@@ -24,6 +24,26 @@ GIT_BEGIN_DECL
|
|
24
24
|
* Constructors for in-box ODB backends.
|
25
25
|
*/
|
26
26
|
|
27
|
+
/** Options for configuring a packfile object backend. */
|
28
|
+
typedef struct {
|
29
|
+
unsigned int version; /**< version for the struct */
|
30
|
+
|
31
|
+
/**
|
32
|
+
* Type of object IDs to use for this object database, or
|
33
|
+
* 0 for default (currently SHA1).
|
34
|
+
*/
|
35
|
+
git_oid_t oid_type;
|
36
|
+
} git_odb_backend_pack_options;
|
37
|
+
|
38
|
+
/* The current version of the diff options structure */
|
39
|
+
#define GIT_ODB_BACKEND_PACK_OPTIONS_VERSION 1
|
40
|
+
|
41
|
+
/* Stack initializer for odb pack backend options. Alternatively use
|
42
|
+
* `git_odb_backend_pack_options_init` programmatic initialization.
|
43
|
+
*/
|
44
|
+
#define GIT_ODB_BACKEND_PACK_OPTIONS_INIT \
|
45
|
+
{ GIT_ODB_BACKEND_PACK_OPTIONS_VERSION }
|
46
|
+
|
27
47
|
/**
|
28
48
|
* Create a backend for the packfiles.
|
29
49
|
*
|
@@ -32,20 +52,96 @@ GIT_BEGIN_DECL
|
|
32
52
|
*
|
33
53
|
* @return 0 or an error code
|
34
54
|
*/
|
35
|
-
|
55
|
+
#ifdef GIT_EXPERIMENTAL_SHA256
|
56
|
+
GIT_EXTERN(int) git_odb_backend_pack(
|
57
|
+
git_odb_backend **out,
|
58
|
+
const char *objects_dir,
|
59
|
+
const git_odb_backend_pack_options *opts);
|
60
|
+
#else
|
61
|
+
GIT_EXTERN(int) git_odb_backend_pack(
|
62
|
+
git_odb_backend **out,
|
63
|
+
const char *objects_dir);
|
64
|
+
#endif
|
65
|
+
|
66
|
+
/**
|
67
|
+
* Create a backend out of a single packfile
|
68
|
+
*
|
69
|
+
* This can be useful for inspecting the contents of a single
|
70
|
+
* packfile.
|
71
|
+
*
|
72
|
+
* @param out location to store the odb backend pointer
|
73
|
+
* @param index_file path to the packfile's .idx file
|
74
|
+
*
|
75
|
+
* @return 0 or an error code
|
76
|
+
*/
|
77
|
+
#ifdef GIT_EXPERIMENTAL_SHA256
|
78
|
+
GIT_EXTERN(int) git_odb_backend_one_pack(
|
79
|
+
git_odb_backend **out,
|
80
|
+
const char *index_file,
|
81
|
+
const git_odb_backend_pack_options *opts);
|
82
|
+
#else
|
83
|
+
GIT_EXTERN(int) git_odb_backend_one_pack(
|
84
|
+
git_odb_backend **out,
|
85
|
+
const char *index_file);
|
86
|
+
#endif
|
87
|
+
|
88
|
+
typedef enum {
|
89
|
+
GIT_ODB_BACKEND_LOOSE_FSYNC = (1 << 0)
|
90
|
+
} git_odb_backend_loose_flag_t;
|
91
|
+
|
92
|
+
/** Options for configuring a loose object backend. */
|
93
|
+
typedef struct {
|
94
|
+
unsigned int version; /**< version for the struct */
|
95
|
+
|
96
|
+
/** A combination of the `git_odb_backend_loose_flag_t` types. */
|
97
|
+
uint32_t flags;
|
98
|
+
|
99
|
+
/**
|
100
|
+
* zlib compression level to use (0-9), where 1 is the fastest
|
101
|
+
* at the expense of larger files, and 9 produces the best
|
102
|
+
* compression at the expense of speed. 0 indicates that no
|
103
|
+
* compression should be performed. -1 is the default (currently
|
104
|
+
* optimizing for speed).
|
105
|
+
*/
|
106
|
+
int compression_level;
|
107
|
+
|
108
|
+
/** Permissions to use creating a directory or 0 for defaults */
|
109
|
+
unsigned int dir_mode;
|
110
|
+
|
111
|
+
/** Permissions to use creating a file or 0 for defaults */
|
112
|
+
unsigned int file_mode;
|
113
|
+
|
114
|
+
/**
|
115
|
+
* Type of object IDs to use for this object database, or
|
116
|
+
* 0 for default (currently SHA1).
|
117
|
+
*/
|
118
|
+
git_oid_t oid_type;
|
119
|
+
} git_odb_backend_loose_options;
|
120
|
+
|
121
|
+
/* The current version of the diff options structure */
|
122
|
+
#define GIT_ODB_BACKEND_LOOSE_OPTIONS_VERSION 1
|
123
|
+
|
124
|
+
/* Stack initializer for odb loose backend options. Alternatively use
|
125
|
+
* `git_odb_backend_loose_options_init` programmatic initialization.
|
126
|
+
*/
|
127
|
+
#define GIT_ODB_BACKEND_LOOSE_OPTIONS_INIT \
|
128
|
+
{ GIT_ODB_BACKEND_LOOSE_OPTIONS_VERSION, 0, -1 }
|
36
129
|
|
37
130
|
/**
|
38
131
|
* Create a backend for loose objects
|
39
132
|
*
|
40
133
|
* @param out location to store the odb backend pointer
|
41
134
|
* @param objects_dir the Git repository's objects directory
|
42
|
-
* @param
|
43
|
-
* @param do_fsync whether to do an fsync() after writing
|
44
|
-
* @param dir_mode permissions to use creating a directory or 0 for defaults
|
45
|
-
* @param file_mode permissions to use creating a file or 0 for defaults
|
135
|
+
* @param opts options for the loose object backend or NULL
|
46
136
|
*
|
47
137
|
* @return 0 or an error code
|
48
138
|
*/
|
139
|
+
#ifdef GIT_EXPERIMENTAL_SHA256
|
140
|
+
GIT_EXTERN(int) git_odb_backend_loose(
|
141
|
+
git_odb_backend **out,
|
142
|
+
const char *objects_dir,
|
143
|
+
git_odb_backend_loose_options *opts);
|
144
|
+
#else
|
49
145
|
GIT_EXTERN(int) git_odb_backend_loose(
|
50
146
|
git_odb_backend **out,
|
51
147
|
const char *objects_dir,
|
@@ -53,19 +149,7 @@ GIT_EXTERN(int) git_odb_backend_loose(
|
|
53
149
|
int do_fsync,
|
54
150
|
unsigned int dir_mode,
|
55
151
|
unsigned int file_mode);
|
56
|
-
|
57
|
-
/**
|
58
|
-
* Create a backend out of a single packfile
|
59
|
-
*
|
60
|
-
* This can be useful for inspecting the contents of a single
|
61
|
-
* packfile.
|
62
|
-
*
|
63
|
-
* @param out location to store the odb backend pointer
|
64
|
-
* @param index_file path to the packfile's .idx file
|
65
|
-
*
|
66
|
-
* @return 0 or an error code
|
67
|
-
*/
|
68
|
-
GIT_EXTERN(int) git_odb_backend_one_pack(git_odb_backend **out, const char *index_file);
|
152
|
+
#endif
|
69
153
|
|
70
154
|
/** Streaming mode */
|
71
155
|
typedef enum {
|
@@ -87,6 +171,10 @@ struct git_odb_stream {
|
|
87
171
|
unsigned int mode;
|
88
172
|
void *hash_ctx;
|
89
173
|
|
174
|
+
#ifdef GIT_EXPERIMENTAL_SHA256
|
175
|
+
git_oid_t oid_type;
|
176
|
+
#endif
|
177
|
+
|
90
178
|
git_object_size_t declared_size;
|
91
179
|
git_object_size_t received_bytes;
|
92
180
|
|