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
@@ -9,8 +9,6 @@
|
|
9
9
|
|
10
10
|
static void *stdalloc__malloc(size_t len, const char *file, int line)
|
11
11
|
{
|
12
|
-
void *ptr;
|
13
|
-
|
14
12
|
GIT_UNUSED(file);
|
15
13
|
GIT_UNUSED(line);
|
16
14
|
|
@@ -19,86 +17,11 @@ static void *stdalloc__malloc(size_t len, const char *file, int line)
|
|
19
17
|
return NULL;
|
20
18
|
#endif
|
21
19
|
|
22
|
-
|
23
|
-
|
24
|
-
if (!ptr)
|
25
|
-
git_error_set_oom();
|
26
|
-
|
27
|
-
return ptr;
|
28
|
-
}
|
29
|
-
|
30
|
-
static void *stdalloc__calloc(size_t nelem, size_t elsize, const char *file, int line)
|
31
|
-
{
|
32
|
-
void *ptr;
|
33
|
-
|
34
|
-
GIT_UNUSED(file);
|
35
|
-
GIT_UNUSED(line);
|
36
|
-
|
37
|
-
#ifdef GIT_DEBUG_STRICT_ALLOC
|
38
|
-
if (!elsize || !nelem)
|
39
|
-
return NULL;
|
40
|
-
#endif
|
41
|
-
|
42
|
-
ptr = calloc(nelem, elsize);
|
43
|
-
|
44
|
-
if (!ptr)
|
45
|
-
git_error_set_oom();
|
46
|
-
|
47
|
-
return ptr;
|
48
|
-
}
|
49
|
-
|
50
|
-
static char *stdalloc__strdup(const char *str, const char *file, int line)
|
51
|
-
{
|
52
|
-
char *ptr;
|
53
|
-
|
54
|
-
GIT_UNUSED(file);
|
55
|
-
GIT_UNUSED(line);
|
56
|
-
|
57
|
-
ptr = strdup(str);
|
58
|
-
|
59
|
-
if (!ptr)
|
60
|
-
git_error_set_oom();
|
61
|
-
|
62
|
-
return ptr;
|
63
|
-
}
|
64
|
-
|
65
|
-
static char *stdalloc__strndup(const char *str, size_t n, const char *file, int line)
|
66
|
-
{
|
67
|
-
size_t length = 0, alloclength;
|
68
|
-
char *ptr;
|
69
|
-
|
70
|
-
length = p_strnlen(str, n);
|
71
|
-
|
72
|
-
if (GIT_ADD_SIZET_OVERFLOW(&alloclength, length, 1) ||
|
73
|
-
!(ptr = stdalloc__malloc(alloclength, file, line)))
|
74
|
-
return NULL;
|
75
|
-
|
76
|
-
if (length)
|
77
|
-
memcpy(ptr, str, length);
|
78
|
-
|
79
|
-
ptr[length] = '\0';
|
80
|
-
|
81
|
-
return ptr;
|
82
|
-
}
|
83
|
-
|
84
|
-
static char *stdalloc__substrdup(const char *start, size_t n, const char *file, int line)
|
85
|
-
{
|
86
|
-
char *ptr;
|
87
|
-
size_t alloclen;
|
88
|
-
|
89
|
-
if (GIT_ADD_SIZET_OVERFLOW(&alloclen, n, 1) ||
|
90
|
-
!(ptr = stdalloc__malloc(alloclen, file, line)))
|
91
|
-
return NULL;
|
92
|
-
|
93
|
-
memcpy(ptr, start, n);
|
94
|
-
ptr[n] = '\0';
|
95
|
-
return ptr;
|
20
|
+
return malloc(len);
|
96
21
|
}
|
97
22
|
|
98
23
|
static void *stdalloc__realloc(void *ptr, size_t size, const char *file, int line)
|
99
24
|
{
|
100
|
-
void *new_ptr;
|
101
|
-
|
102
25
|
GIT_UNUSED(file);
|
103
26
|
GIT_UNUSED(line);
|
104
27
|
|
@@ -107,27 +30,7 @@ static void *stdalloc__realloc(void *ptr, size_t size, const char *file, int lin
|
|
107
30
|
return NULL;
|
108
31
|
#endif
|
109
32
|
|
110
|
-
|
111
|
-
|
112
|
-
if (!new_ptr)
|
113
|
-
git_error_set_oom();
|
114
|
-
|
115
|
-
return new_ptr;
|
116
|
-
}
|
117
|
-
|
118
|
-
static void *stdalloc__reallocarray(void *ptr, size_t nelem, size_t elsize, const char *file, int line)
|
119
|
-
{
|
120
|
-
size_t newsize;
|
121
|
-
|
122
|
-
if (GIT_MULTIPLY_SIZET_OVERFLOW(&newsize, nelem, elsize))
|
123
|
-
return NULL;
|
124
|
-
|
125
|
-
return stdalloc__realloc(ptr, newsize, file, line);
|
126
|
-
}
|
127
|
-
|
128
|
-
static void *stdalloc__mallocarray(size_t nelem, size_t elsize, const char *file, int line)
|
129
|
-
{
|
130
|
-
return stdalloc__reallocarray(NULL, nelem, elsize, file, line);
|
33
|
+
return realloc(ptr, size);
|
131
34
|
}
|
132
35
|
|
133
36
|
static void stdalloc__free(void *ptr)
|
@@ -138,13 +41,7 @@ static void stdalloc__free(void *ptr)
|
|
138
41
|
int git_stdalloc_init_allocator(git_allocator *allocator)
|
139
42
|
{
|
140
43
|
allocator->gmalloc = stdalloc__malloc;
|
141
|
-
allocator->gcalloc = stdalloc__calloc;
|
142
|
-
allocator->gstrdup = stdalloc__strdup;
|
143
|
-
allocator->gstrndup = stdalloc__strndup;
|
144
|
-
allocator->gsubstrdup = stdalloc__substrdup;
|
145
44
|
allocator->grealloc = stdalloc__realloc;
|
146
|
-
allocator->greallocarray = stdalloc__reallocarray;
|
147
|
-
allocator->gmallocarray = stdalloc__mallocarray;
|
148
45
|
allocator->gfree = stdalloc__free;
|
149
46
|
return 0;
|
150
47
|
}
|
@@ -18,53 +18,6 @@ static void *leakcheck_malloc(size_t len, const char *file, int line)
|
|
18
18
|
return ptr;
|
19
19
|
}
|
20
20
|
|
21
|
-
static void *leakcheck_calloc(size_t nelem, size_t elsize, const char *file, int line)
|
22
|
-
{
|
23
|
-
void *ptr = _calloc_dbg(nelem, elsize, _NORMAL_BLOCK, git_win32_leakcheck_stacktrace(1,file), line);
|
24
|
-
if (!ptr) git_error_set_oom();
|
25
|
-
return ptr;
|
26
|
-
}
|
27
|
-
|
28
|
-
static char *leakcheck_strdup(const char *str, const char *file, int line)
|
29
|
-
{
|
30
|
-
char *ptr = _strdup_dbg(str, _NORMAL_BLOCK, git_win32_leakcheck_stacktrace(1,file), line);
|
31
|
-
if (!ptr) git_error_set_oom();
|
32
|
-
return ptr;
|
33
|
-
}
|
34
|
-
|
35
|
-
static char *leakcheck_strndup(const char *str, size_t n, const char *file, int line)
|
36
|
-
{
|
37
|
-
size_t length = 0, alloclength;
|
38
|
-
char *ptr;
|
39
|
-
|
40
|
-
length = p_strnlen(str, n);
|
41
|
-
|
42
|
-
if (GIT_ADD_SIZET_OVERFLOW(&alloclength, length, 1) ||
|
43
|
-
!(ptr = leakcheck_malloc(alloclength, file, line)))
|
44
|
-
return NULL;
|
45
|
-
|
46
|
-
if (length)
|
47
|
-
memcpy(ptr, str, length);
|
48
|
-
|
49
|
-
ptr[length] = '\0';
|
50
|
-
|
51
|
-
return ptr;
|
52
|
-
}
|
53
|
-
|
54
|
-
static char *leakcheck_substrdup(const char *start, size_t n, const char *file, int line)
|
55
|
-
{
|
56
|
-
char *ptr;
|
57
|
-
size_t alloclen;
|
58
|
-
|
59
|
-
if (GIT_ADD_SIZET_OVERFLOW(&alloclen, n, 1) ||
|
60
|
-
!(ptr = leakcheck_malloc(alloclen, file, line)))
|
61
|
-
return NULL;
|
62
|
-
|
63
|
-
memcpy(ptr, start, n);
|
64
|
-
ptr[n] = '\0';
|
65
|
-
return ptr;
|
66
|
-
}
|
67
|
-
|
68
21
|
static void *leakcheck_realloc(void *ptr, size_t size, const char *file, int line)
|
69
22
|
{
|
70
23
|
void *new_ptr = _realloc_dbg(ptr, size, _NORMAL_BLOCK, git_win32_leakcheck_stacktrace(1,file), line);
|
@@ -72,21 +25,6 @@ static void *leakcheck_realloc(void *ptr, size_t size, const char *file, int lin
|
|
72
25
|
return new_ptr;
|
73
26
|
}
|
74
27
|
|
75
|
-
static void *leakcheck_reallocarray(void *ptr, size_t nelem, size_t elsize, const char *file, int line)
|
76
|
-
{
|
77
|
-
size_t newsize;
|
78
|
-
|
79
|
-
if (GIT_MULTIPLY_SIZET_OVERFLOW(&newsize, nelem, elsize))
|
80
|
-
return NULL;
|
81
|
-
|
82
|
-
return leakcheck_realloc(ptr, newsize, file, line);
|
83
|
-
}
|
84
|
-
|
85
|
-
static void *leakcheck_mallocarray(size_t nelem, size_t elsize, const char *file, int line)
|
86
|
-
{
|
87
|
-
return leakcheck_reallocarray(NULL, nelem, elsize, file, line);
|
88
|
-
}
|
89
|
-
|
90
28
|
static void leakcheck_free(void *ptr)
|
91
29
|
{
|
92
30
|
free(ptr);
|
@@ -95,13 +33,7 @@ static void leakcheck_free(void *ptr)
|
|
95
33
|
int git_win32_leakcheck_init_allocator(git_allocator *allocator)
|
96
34
|
{
|
97
35
|
allocator->gmalloc = leakcheck_malloc;
|
98
|
-
allocator->gcalloc = leakcheck_calloc;
|
99
|
-
allocator->gstrdup = leakcheck_strdup;
|
100
|
-
allocator->gstrndup = leakcheck_strndup;
|
101
|
-
allocator->gsubstrdup = leakcheck_substrdup;
|
102
36
|
allocator->grealloc = leakcheck_realloc;
|
103
|
-
allocator->greallocarray = leakcheck_reallocarray;
|
104
|
-
allocator->gmallocarray = leakcheck_mallocarray;
|
105
37
|
allocator->gfree = leakcheck_free;
|
106
38
|
return 0;
|
107
39
|
}
|
@@ -33,6 +33,9 @@
|
|
33
33
|
#define git_array_init_to_size(a, desired) \
|
34
34
|
do { (a).size = 0; (a).asize = desired; (a).ptr = git__calloc(desired, sizeof(*(a).ptr)); } while (0)
|
35
35
|
|
36
|
+
#define git_array_dispose(a) \
|
37
|
+
do { git__free((a).ptr); } while (0)
|
38
|
+
|
36
39
|
#define git_array_clear(a) \
|
37
40
|
do { git__free((a).ptr); git_array_init(a); } while (0)
|
38
41
|
|
@@ -85,12 +88,14 @@ on_oom:
|
|
85
88
|
#define git_array_foreach(a, i, element) \
|
86
89
|
for ((i) = 0; (i) < (a).size && ((element) = &(a).ptr[(i)]); (i)++)
|
87
90
|
|
91
|
+
typedef int (*git_array_compare_cb)(const void *, const void *);
|
92
|
+
|
88
93
|
GIT_INLINE(int) git_array__search(
|
89
94
|
size_t *out,
|
90
95
|
void *array_ptr,
|
91
96
|
size_t item_size,
|
92
97
|
size_t array_len,
|
93
|
-
|
98
|
+
git_array_compare_cb compare,
|
94
99
|
const void *key)
|
95
100
|
{
|
96
101
|
size_t lim;
|
@@ -43,8 +43,10 @@
|
|
43
43
|
__typeof__(x) _unused __attribute__((unused)); \
|
44
44
|
_unused = (x); \
|
45
45
|
} while (0)
|
46
|
+
# define GIT_UNUSED_ARG __attribute__((unused))
|
46
47
|
#else
|
47
48
|
# define GIT_UNUSED(x) ((void)(x))
|
49
|
+
# define GIT_UNUSED_ARG
|
48
50
|
#endif
|
49
51
|
|
50
52
|
/* Define the printf format specifier to use for size_t output */
|
@@ -302,11 +302,16 @@ int git_filebuf_open_withsize(git_filebuf *file, const char *path, int flags, mo
|
|
302
302
|
}
|
303
303
|
|
304
304
|
/* If we are hashing on-write, allocate a new hash context */
|
305
|
-
if (flags &
|
305
|
+
if (flags & GIT_FILEBUF_HASH_SHA1) {
|
306
306
|
file->compute_digest = 1;
|
307
307
|
|
308
308
|
if (git_hash_ctx_init(&file->digest, GIT_HASH_ALGORITHM_SHA1) < 0)
|
309
309
|
goto cleanup;
|
310
|
+
} else if (flags & GIT_FILEBUF_HASH_SHA256) {
|
311
|
+
file->compute_digest = 1;
|
312
|
+
|
313
|
+
if (git_hash_ctx_init(&file->digest, GIT_HASH_ALGORITHM_SHA256) < 0)
|
314
|
+
goto cleanup;
|
310
315
|
}
|
311
316
|
|
312
317
|
compression = flags >> GIT_FILEBUF_DEFLATE_SHIFT;
|
@@ -17,13 +17,14 @@
|
|
17
17
|
# define GIT_FILEBUF_THREADS
|
18
18
|
#endif
|
19
19
|
|
20
|
-
#define
|
21
|
-
#define
|
20
|
+
#define GIT_FILEBUF_HASH_SHA1 (1 << 0)
|
21
|
+
#define GIT_FILEBUF_HASH_SHA256 (1 << 1)
|
22
|
+
#define GIT_FILEBUF_APPEND (1 << 2)
|
22
23
|
#define GIT_FILEBUF_CREATE_LEADING_DIRS (1 << 3)
|
23
|
-
#define GIT_FILEBUF_TEMPORARY
|
24
|
-
#define GIT_FILEBUF_DO_NOT_BUFFER
|
25
|
-
#define GIT_FILEBUF_FSYNC
|
26
|
-
#define GIT_FILEBUF_DEFLATE_SHIFT
|
24
|
+
#define GIT_FILEBUF_TEMPORARY (1 << 4)
|
25
|
+
#define GIT_FILEBUF_DO_NOT_BUFFER (1 << 5)
|
26
|
+
#define GIT_FILEBUF_FSYNC (1 << 6)
|
27
|
+
#define GIT_FILEBUF_DEFLATE_SHIFT (7)
|
27
28
|
|
28
29
|
#define GIT_FILELOCK_EXTENSION ".lock\0"
|
29
30
|
#define GIT_FILELOCK_EXTLENGTH 6
|
@@ -91,4 +92,16 @@ int git_filebuf_hash(unsigned char *out, git_filebuf *file);
|
|
91
92
|
int git_filebuf_flush(git_filebuf *file);
|
92
93
|
int git_filebuf_stats(time_t *mtime, size_t *size, git_filebuf *file);
|
93
94
|
|
95
|
+
GIT_INLINE(int) git_filebuf_hash_flags(git_hash_algorithm_t algorithm)
|
96
|
+
{
|
97
|
+
switch (algorithm) {
|
98
|
+
case GIT_HASH_ALGORITHM_SHA1:
|
99
|
+
return GIT_FILEBUF_HASH_SHA1;
|
100
|
+
case GIT_HASH_ALGORITHM_SHA256:
|
101
|
+
return GIT_FILEBUF_HASH_SHA256;
|
102
|
+
default:
|
103
|
+
return 0;
|
104
|
+
}
|
105
|
+
}
|
106
|
+
|
94
107
|
#endif
|
@@ -1855,7 +1855,7 @@ static int file_owner_sid(PSID *out, const char *path)
|
|
1855
1855
|
PSECURITY_DESCRIPTOR descriptor = NULL;
|
1856
1856
|
PSID owner_sid;
|
1857
1857
|
DWORD ret;
|
1858
|
-
int error =
|
1858
|
+
int error = GIT_EINVALID;
|
1859
1859
|
|
1860
1860
|
if (git_win32_path_from_utf8(path_w32, path) < 0)
|
1861
1861
|
return -1;
|
@@ -2015,7 +2015,7 @@ int git_fs_path_find_executable(git_str *fullpath, const char *executable)
|
|
2015
2015
|
git_win32_path fullpath_w, executable_w;
|
2016
2016
|
int error;
|
2017
2017
|
|
2018
|
-
if (
|
2018
|
+
if (git_utf8_to_16(executable_w, GIT_WIN_PATH_MAX, executable) < 0)
|
2019
2019
|
return -1;
|
2020
2020
|
|
2021
2021
|
error = git_win32_path_find_executable(fullpath_w, executable_w);
|
@@ -13,9 +13,6 @@
|
|
13
13
|
#include "rand.h"
|
14
14
|
|
15
15
|
#include <ctype.h>
|
16
|
-
#if GIT_WIN32
|
17
|
-
#include "win32/findfile.h"
|
18
|
-
#endif
|
19
16
|
|
20
17
|
#define GIT_FILEMODE_DEFAULT 0100666
|
21
18
|
|
@@ -224,14 +221,14 @@ int git_futils_readbuffer_fd_full(git_str *buf, git_file fd)
|
|
224
221
|
int git_futils_readbuffer_updated(
|
225
222
|
git_str *out,
|
226
223
|
const char *path,
|
227
|
-
unsigned char checksum[
|
224
|
+
unsigned char checksum[GIT_HASH_SHA256_SIZE],
|
228
225
|
int *updated)
|
229
226
|
{
|
230
227
|
int error;
|
231
228
|
git_file fd;
|
232
229
|
struct stat st;
|
233
230
|
git_str buf = GIT_STR_INIT;
|
234
|
-
unsigned char checksum_new[
|
231
|
+
unsigned char checksum_new[GIT_HASH_SHA256_SIZE];
|
235
232
|
|
236
233
|
GIT_ASSERT_ARG(out);
|
237
234
|
GIT_ASSERT_ARG(path && *path);
|
@@ -264,7 +261,10 @@ int git_futils_readbuffer_updated(
|
|
264
261
|
p_close(fd);
|
265
262
|
|
266
263
|
if (checksum) {
|
267
|
-
|
264
|
+
error = git_hash_buf(checksum_new, buf.ptr,
|
265
|
+
buf.size, GIT_HASH_ALGORITHM_SHA256);
|
266
|
+
|
267
|
+
if (error < 0) {
|
268
268
|
git_str_dispose(&buf);
|
269
269
|
return error;
|
270
270
|
}
|
@@ -272,7 +272,7 @@ int git_futils_readbuffer_updated(
|
|
272
272
|
/*
|
273
273
|
* If we were given a checksum, we only want to use it if it's different
|
274
274
|
*/
|
275
|
-
if (!memcmp(checksum, checksum_new,
|
275
|
+
if (!memcmp(checksum, checksum_new, GIT_HASH_SHA256_SIZE)) {
|
276
276
|
git_str_dispose(&buf);
|
277
277
|
if (updated)
|
278
278
|
*updated = 0;
|
@@ -280,7 +280,7 @@ int git_futils_readbuffer_updated(
|
|
280
280
|
return 0;
|
281
281
|
}
|
282
282
|
|
283
|
-
memcpy(checksum, checksum_new,
|
283
|
+
memcpy(checksum, checksum_new, GIT_HASH_SHA256_SIZE);
|
284
284
|
}
|
285
285
|
|
286
286
|
/*
|
@@ -24,9 +24,10 @@
|
|
24
24
|
#cmakedefine GIT_REGEX_PCRE2
|
25
25
|
#cmakedefine GIT_REGEX_BUILTIN 1
|
26
26
|
|
27
|
-
#cmakedefine
|
28
|
-
#cmakedefine
|
29
|
-
#cmakedefine
|
27
|
+
#cmakedefine GIT_QSORT_BSD
|
28
|
+
#cmakedefine GIT_QSORT_GNU
|
29
|
+
#cmakedefine GIT_QSORT_C11
|
30
|
+
#cmakedefine GIT_QSORT_MSC
|
30
31
|
|
31
32
|
#cmakedefine GIT_SSH 1
|
32
33
|
#cmakedefine GIT_SSH_MEMORY_CREDENTIALS 1
|
@@ -41,6 +42,7 @@
|
|
41
42
|
#cmakedefine GIT_OPENSSL_DYNAMIC 1
|
42
43
|
#cmakedefine GIT_SECURE_TRANSPORT 1
|
43
44
|
#cmakedefine GIT_MBEDTLS 1
|
45
|
+
#cmakedefine GIT_SCHANNEL 1
|
44
46
|
|
45
47
|
#cmakedefine GIT_SHA1_COLLISIONDETECT 1
|
46
48
|
#cmakedefine GIT_SHA1_WIN32 1
|
@@ -59,4 +61,8 @@
|
|
59
61
|
#cmakedefine GIT_RAND_GETENTROPY 1
|
60
62
|
#cmakedefine GIT_RAND_GETLOADAVG 1
|
61
63
|
|
64
|
+
#cmakedefine GIT_IO_POLL 1
|
65
|
+
#cmakedefine GIT_IO_WSAPOLL 1
|
66
|
+
#cmakedefine GIT_IO_SELECT 1
|
67
|
+
|
62
68
|
#endif
|
@@ -10,8 +10,8 @@
|
|
10
10
|
#ifdef GIT_OPENSSL_DYNAMIC
|
11
11
|
# include <dlfcn.h>
|
12
12
|
|
13
|
-
int handle_count;
|
14
|
-
void *openssl_handle;
|
13
|
+
static int handle_count;
|
14
|
+
static void *openssl_handle;
|
15
15
|
|
16
16
|
static int git_hash_openssl_global_shutdown(void)
|
17
17
|
{
|
@@ -30,7 +30,8 @@ static int git_hash_openssl_global_init(void)
|
|
30
30
|
(openssl_handle = dlopen("libssl.1.1.dylib", RTLD_NOW)) == NULL &&
|
31
31
|
(openssl_handle = dlopen("libssl.so.1.0.0", RTLD_NOW)) == NULL &&
|
32
32
|
(openssl_handle = dlopen("libssl.1.0.0.dylib", RTLD_NOW)) == NULL &&
|
33
|
-
(openssl_handle = dlopen("libssl.so.10", RTLD_NOW)) == NULL
|
33
|
+
(openssl_handle = dlopen("libssl.so.10", RTLD_NOW)) == NULL &&
|
34
|
+
(openssl_handle = dlopen("libssl.so.3", RTLD_NOW)) == NULL) {
|
34
35
|
git_error_set(GIT_ERROR_SSL, "could not load ssl libraries");
|
35
36
|
return -1;
|
36
37
|
}
|
@@ -191,49 +191,6 @@ typedef struct SHA256Context SHA224Context;
|
|
191
191
|
*/
|
192
192
|
typedef struct SHA512Context SHA384Context;
|
193
193
|
|
194
|
-
/*
|
195
|
-
* This structure holds context information for all SHA
|
196
|
-
* hashing operations.
|
197
|
-
*/
|
198
|
-
typedef struct USHAContext {
|
199
|
-
int whichSha; /* which SHA is being used */
|
200
|
-
union {
|
201
|
-
SHA1Context sha1Context;
|
202
|
-
SHA224Context sha224Context; SHA256Context sha256Context;
|
203
|
-
SHA384Context sha384Context; SHA512Context sha512Context;
|
204
|
-
} ctx;
|
205
|
-
} USHAContext;
|
206
|
-
|
207
|
-
/*
|
208
|
-
* This structure will hold context information for the HMAC
|
209
|
-
* keyed-hashing operation.
|
210
|
-
*/
|
211
|
-
typedef struct HMACContext {
|
212
|
-
int whichSha; /* which SHA is being used */
|
213
|
-
int hashSize; /* hash size of SHA being used */
|
214
|
-
int blockSize; /* block size of SHA being used */
|
215
|
-
USHAContext shaContext; /* SHA context */
|
216
|
-
unsigned char k_opad[USHA_Max_Message_Block_Size];
|
217
|
-
/* outer padding - key XORd with opad */
|
218
|
-
int Computed; /* Is the MAC computed? */
|
219
|
-
int Corrupted; /* Cumulative corruption code */
|
220
|
-
|
221
|
-
} HMACContext;
|
222
|
-
|
223
|
-
/*
|
224
|
-
* This structure will hold context information for the HKDF
|
225
|
-
* extract-and-expand Key Derivation Functions.
|
226
|
-
*/
|
227
|
-
typedef struct HKDFContext {
|
228
|
-
int whichSha; /* which SHA is being used */
|
229
|
-
HMACContext hmacContext;
|
230
|
-
int hashSize; /* hash size of SHA being used */
|
231
|
-
unsigned char prk[USHAMaxHashSize];
|
232
|
-
/* pseudo-random key - output of hkdfInput */
|
233
|
-
int Computed; /* Is the key material computed? */
|
234
|
-
int Corrupted; /* Cumulative corruption code */
|
235
|
-
} HKDFContext;
|
236
|
-
|
237
194
|
/*
|
238
195
|
* Function Prototypes
|
239
196
|
*/
|
@@ -283,73 +240,4 @@ extern int SHA512FinalBits(SHA512Context *, uint8_t bits,
|
|
283
240
|
extern int SHA512Result(SHA512Context *,
|
284
241
|
uint8_t Message_Digest[SHA512HashSize]);
|
285
242
|
|
286
|
-
/* Unified SHA functions, chosen by whichSha */
|
287
|
-
extern int USHAReset(USHAContext *context, SHAversion whichSha);
|
288
|
-
extern int USHAInput(USHAContext *context,
|
289
|
-
const uint8_t *bytes, unsigned int bytecount);
|
290
|
-
extern int USHAFinalBits(USHAContext *context,
|
291
|
-
uint8_t bits, unsigned int bit_count);
|
292
|
-
extern int USHAResult(USHAContext *context,
|
293
|
-
uint8_t Message_Digest[USHAMaxHashSize]);
|
294
|
-
extern int USHABlockSize(enum SHAversion whichSha);
|
295
|
-
extern int USHAHashSize(enum SHAversion whichSha);
|
296
|
-
extern int USHAHashSizeBits(enum SHAversion whichSha);
|
297
|
-
extern const char *USHAHashName(enum SHAversion whichSha);
|
298
|
-
|
299
|
-
/*
|
300
|
-
* HMAC Keyed-Hashing for Message Authentication, RFC 2104,
|
301
|
-
* for all SHAs.
|
302
|
-
* This interface allows a fixed-length text input to be used.
|
303
|
-
*/
|
304
|
-
extern int hmac(SHAversion whichSha, /* which SHA algorithm to use */
|
305
|
-
const unsigned char *text, /* pointer to data stream */
|
306
|
-
int text_len, /* length of data stream */
|
307
|
-
const unsigned char *key, /* pointer to authentication key */
|
308
|
-
int key_len, /* length of authentication key */
|
309
|
-
uint8_t digest[USHAMaxHashSize]); /* caller digest to fill in */
|
310
|
-
|
311
|
-
/*
|
312
|
-
* HMAC Keyed-Hashing for Message Authentication, RFC 2104,
|
313
|
-
* for all SHAs.
|
314
|
-
* This interface allows any length of text input to be used.
|
315
|
-
*/
|
316
|
-
extern int hmacReset(HMACContext *context, enum SHAversion whichSha,
|
317
|
-
const unsigned char *key, int key_len);
|
318
|
-
extern int hmacInput(HMACContext *context, const unsigned char *text,
|
319
|
-
int text_len);
|
320
|
-
extern int hmacFinalBits(HMACContext *context, uint8_t bits,
|
321
|
-
unsigned int bit_count);
|
322
|
-
extern int hmacResult(HMACContext *context,
|
323
|
-
uint8_t digest[USHAMaxHashSize]);
|
324
|
-
|
325
|
-
/*
|
326
|
-
* HKDF HMAC-based Extract-and-Expand Key Derivation Function,
|
327
|
-
* RFC 5869, for all SHAs.
|
328
|
-
*/
|
329
|
-
extern int hkdf(SHAversion whichSha, const unsigned char *salt,
|
330
|
-
int salt_len, const unsigned char *ikm, int ikm_len,
|
331
|
-
const unsigned char *info, int info_len,
|
332
|
-
uint8_t okm[ ], int okm_len);
|
333
|
-
extern int hkdfExtract(SHAversion whichSha, const unsigned char *salt,
|
334
|
-
int salt_len, const unsigned char *ikm,
|
335
|
-
int ikm_len, uint8_t prk[USHAMaxHashSize]);
|
336
|
-
extern int hkdfExpand(SHAversion whichSha, const uint8_t prk[ ],
|
337
|
-
int prk_len, const unsigned char *info,
|
338
|
-
int info_len, uint8_t okm[ ], int okm_len);
|
339
|
-
|
340
|
-
/*
|
341
|
-
* HKDF HMAC-based Extract-and-Expand Key Derivation Function,
|
342
|
-
* RFC 5869, for all SHAs.
|
343
|
-
* This interface allows any length of text input to be used.
|
344
|
-
*/
|
345
|
-
extern int hkdfReset(HKDFContext *context, enum SHAversion whichSha,
|
346
|
-
const unsigned char *salt, int salt_len);
|
347
|
-
extern int hkdfInput(HKDFContext *context, const unsigned char *ikm,
|
348
|
-
int ikm_len);
|
349
|
-
extern int hkdfFinalBits(HKDFContext *context, uint8_t ikm_bits,
|
350
|
-
unsigned int ikm_bit_count);
|
351
|
-
extern int hkdfResult(HKDFContext *context,
|
352
|
-
uint8_t prk[USHAMaxHashSize],
|
353
|
-
const unsigned char *info, int info_len,
|
354
|
-
uint8_t okm[USHAMaxHashSize], int okm_len);
|
355
243
|
#endif /* _SHA_H_ */
|
@@ -23,6 +23,8 @@ typedef enum {
|
|
23
23
|
GIT_HASH_ALGORITHM_SHA256
|
24
24
|
} git_hash_algorithm_t;
|
25
25
|
|
26
|
+
#define GIT_HASH_MAX_SIZE GIT_HASH_SHA256_SIZE
|
27
|
+
|
26
28
|
typedef struct git_hash_ctx {
|
27
29
|
union {
|
28
30
|
git_hash_sha1_ctx sha1;
|
@@ -45,4 +47,15 @@ int git_hash_vec(unsigned char *out, git_str_vec *vec, size_t n, git_hash_algori
|
|
45
47
|
|
46
48
|
int git_hash_fmt(char *out, unsigned char *hash, size_t hash_len);
|
47
49
|
|
50
|
+
GIT_INLINE(size_t) git_hash_size(git_hash_algorithm_t algorithm) {
|
51
|
+
switch (algorithm) {
|
52
|
+
case GIT_HASH_ALGORITHM_SHA1:
|
53
|
+
return GIT_HASH_SHA1_SIZE;
|
54
|
+
case GIT_HASH_ALGORITHM_SHA256:
|
55
|
+
return GIT_HASH_SHA256_SIZE;
|
56
|
+
default:
|
57
|
+
return 0;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
48
61
|
#endif
|