rugged 0.27.5 → 0.27.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +2 -2
- data/vendor/libgit2/cmake/Modules/FindmbedTLS.cmake +93 -0
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +2 -0
- data/vendor/libgit2/include/git2.h +1 -0
- data/vendor/libgit2/include/git2/attr.h +18 -7
- data/vendor/libgit2/include/git2/blame.h +39 -22
- data/vendor/libgit2/include/git2/blob.h +1 -1
- data/vendor/libgit2/include/git2/branch.h +1 -1
- data/vendor/libgit2/include/git2/buffer.h +14 -2
- data/vendor/libgit2/include/git2/checkout.h +13 -12
- data/vendor/libgit2/include/git2/cherrypick.h +6 -4
- data/vendor/libgit2/include/git2/clone.h +8 -6
- data/vendor/libgit2/include/git2/commit.h +28 -0
- data/vendor/libgit2/include/git2/common.h +27 -0
- data/vendor/libgit2/include/git2/config.h +1 -0
- data/vendor/libgit2/include/git2/describe.h +30 -7
- data/vendor/libgit2/include/git2/diff.h +32 -22
- data/vendor/libgit2/include/git2/errors.h +1 -0
- data/vendor/libgit2/include/git2/ignore.h +2 -2
- data/vendor/libgit2/include/git2/mailmap.h +115 -0
- data/vendor/libgit2/include/git2/merge.h +10 -8
- data/vendor/libgit2/include/git2/proxy.h +9 -5
- data/vendor/libgit2/include/git2/rebase.h +7 -4
- data/vendor/libgit2/include/git2/refspec.h +17 -0
- data/vendor/libgit2/include/git2/remote.h +12 -10
- data/vendor/libgit2/include/git2/repository.h +7 -5
- data/vendor/libgit2/include/git2/revert.h +5 -3
- data/vendor/libgit2/include/git2/stash.h +11 -8
- data/vendor/libgit2/include/git2/status.h +7 -3
- data/vendor/libgit2/include/git2/submodule.h +8 -7
- data/vendor/libgit2/include/git2/sys/alloc.h +101 -0
- data/vendor/libgit2/include/git2/sys/index.h +3 -0
- data/vendor/libgit2/include/git2/sys/mempack.h +35 -35
- data/vendor/libgit2/include/git2/sys/merge.h +6 -1
- data/vendor/libgit2/include/git2/sys/path.h +55 -0
- data/vendor/libgit2/include/git2/transaction.h +1 -0
- data/vendor/libgit2/include/git2/types.h +8 -5
- data/vendor/libgit2/include/git2/version.h +2 -2
- data/vendor/libgit2/include/git2/worktree.h +46 -11
- data/vendor/libgit2/src/CMakeLists.txt +87 -15
- data/vendor/libgit2/src/alloc.c +47 -0
- data/vendor/libgit2/src/alloc.h +40 -0
- data/vendor/libgit2/src/apply.c +4 -4
- data/vendor/libgit2/src/attr.c +4 -4
- data/vendor/libgit2/src/attr_file.c +8 -7
- data/vendor/libgit2/src/attrcache.c +2 -2
- data/vendor/libgit2/src/blame.c +11 -4
- data/vendor/libgit2/src/blame.h +1 -0
- data/vendor/libgit2/src/blame_git.c +8 -5
- data/vendor/libgit2/src/blob.c +5 -5
- data/vendor/libgit2/src/branch.c +20 -20
- data/vendor/libgit2/src/buffer.c +9 -4
- data/vendor/libgit2/src/buffer.h +1 -1
- data/vendor/libgit2/src/checkout.c +33 -24
- data/vendor/libgit2/src/cherrypick.c +3 -3
- data/vendor/libgit2/src/clone.c +13 -13
- data/vendor/libgit2/src/commit.c +16 -3
- data/vendor/libgit2/src/common.h +3 -1
- data/vendor/libgit2/src/config.c +3 -3
- data/vendor/libgit2/src/config_file.c +193 -241
- data/vendor/libgit2/src/config_parse.c +89 -66
- data/vendor/libgit2/src/config_parse.h +2 -2
- data/vendor/libgit2/src/crlf.c +9 -3
- data/vendor/libgit2/src/diff.c +2 -2
- data/vendor/libgit2/src/diff_driver.c +3 -3
- data/vendor/libgit2/src/diff_file.c +3 -3
- data/vendor/libgit2/src/diff_generate.c +4 -3
- data/vendor/libgit2/src/diff_print.c +8 -8
- data/vendor/libgit2/src/diff_tform.c +1 -1
- data/vendor/libgit2/src/diff_xdiff.c +12 -0
- data/vendor/libgit2/src/features.h.in +2 -0
- data/vendor/libgit2/src/fetch.c +2 -2
- data/vendor/libgit2/src/fetchhead.c +5 -5
- data/vendor/libgit2/src/filebuf.c +4 -4
- data/vendor/libgit2/src/fileops.c +10 -10
- data/vendor/libgit2/src/filter.c +3 -3
- data/vendor/libgit2/src/global.c +17 -12
- data/vendor/libgit2/src/hash.h +2 -0
- data/vendor/libgit2/src/hash/hash_mbedtls.c +38 -0
- data/vendor/libgit2/src/hash/hash_mbedtls.h +20 -0
- data/vendor/libgit2/src/ignore.c +15 -20
- data/vendor/libgit2/src/index.c +77 -36
- data/vendor/libgit2/src/index.h +10 -0
- data/vendor/libgit2/src/indexer.c +9 -9
- data/vendor/libgit2/src/iterator.c +8 -8
- data/vendor/libgit2/src/khash.h +3 -1
- data/vendor/libgit2/src/mailmap.c +485 -0
- data/vendor/libgit2/src/mailmap.h +35 -0
- data/vendor/libgit2/src/merge.c +7 -7
- data/vendor/libgit2/src/netops.c +5 -5
- data/vendor/libgit2/src/notes.c +2 -2
- data/vendor/libgit2/src/odb.c +7 -7
- data/vendor/libgit2/src/odb_loose.c +13 -13
- data/vendor/libgit2/src/odb_pack.c +3 -3
- data/vendor/libgit2/src/pack-objects.c +2 -2
- data/vendor/libgit2/src/pack.c +5 -5
- data/vendor/libgit2/src/pack.h +1 -1
- data/vendor/libgit2/src/patch.c +1 -1
- data/vendor/libgit2/src/patch_generate.c +2 -2
- data/vendor/libgit2/src/patch_parse.c +11 -4
- data/vendor/libgit2/src/path.c +42 -66
- data/vendor/libgit2/src/path.h +2 -72
- data/vendor/libgit2/src/pathspec.c +1 -1
- data/vendor/libgit2/src/push.c +2 -2
- data/vendor/libgit2/src/rebase.c +19 -22
- data/vendor/libgit2/src/refdb_fs.c +65 -34
- data/vendor/libgit2/src/refs.c +6 -6
- data/vendor/libgit2/src/refspec.c +30 -5
- data/vendor/libgit2/src/refspec.h +1 -1
- data/vendor/libgit2/src/remote.c +40 -40
- data/vendor/libgit2/src/repository.c +63 -59
- data/vendor/libgit2/src/reset.c +1 -1
- data/vendor/libgit2/src/revert.c +3 -3
- data/vendor/libgit2/src/revparse.c +4 -4
- data/vendor/libgit2/src/revwalk.c +44 -10
- data/vendor/libgit2/src/revwalk.h +2 -1
- data/vendor/libgit2/src/settings.c +25 -1
- data/vendor/libgit2/src/signature.c +1 -1
- data/vendor/libgit2/src/stash.c +80 -34
- data/vendor/libgit2/src/status.c +1 -1
- data/vendor/libgit2/src/stdalloc.c +120 -0
- data/vendor/libgit2/src/stdalloc.h +17 -0
- data/vendor/libgit2/src/streams/mbedtls.c +463 -0
- data/vendor/libgit2/src/streams/mbedtls.h +20 -0
- data/vendor/libgit2/src/streams/openssl.c +132 -34
- data/vendor/libgit2/src/streams/openssl.h +0 -107
- data/vendor/libgit2/src/streams/tls.c +3 -0
- data/vendor/libgit2/src/submodule.c +117 -82
- data/vendor/libgit2/src/sysdir.c +4 -4
- data/vendor/libgit2/src/tag.c +7 -7
- data/vendor/libgit2/src/trace.h +1 -1
- data/vendor/libgit2/src/trailer.c +6 -6
- data/vendor/libgit2/src/transport.c +2 -2
- data/vendor/libgit2/src/transports/auth.c +1 -1
- data/vendor/libgit2/src/transports/auth_negotiate.c +2 -2
- data/vendor/libgit2/src/transports/git.c +1 -1
- data/vendor/libgit2/src/transports/http.c +12 -12
- data/vendor/libgit2/src/transports/local.c +7 -7
- data/vendor/libgit2/src/transports/smart.c +17 -8
- data/vendor/libgit2/src/transports/smart.h +5 -5
- data/vendor/libgit2/src/transports/smart_pkt.c +122 -130
- data/vendor/libgit2/src/transports/smart_protocol.c +48 -38
- data/vendor/libgit2/src/transports/ssh.c +1 -1
- data/vendor/libgit2/src/transports/winhttp.c +6 -6
- data/vendor/libgit2/src/tree.c +12 -53
- data/vendor/libgit2/src/tree.h +0 -12
- data/vendor/libgit2/src/util.c +16 -0
- data/vendor/libgit2/src/util.h +12 -135
- data/vendor/libgit2/src/win32/findfile.c +2 -2
- data/vendor/libgit2/src/win32/posix_w32.c +1 -1
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +94 -0
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +28 -75
- data/vendor/libgit2/src/worktree.c +64 -43
- data/vendor/libgit2/src/worktree.h +2 -0
- data/vendor/libgit2/src/xdiff/xdiffi.c +3 -1
- metadata +16 -2
@@ -529,7 +529,7 @@ static void similarity_unload(similarity_info *info)
|
|
529
529
|
if (info->blob)
|
530
530
|
git_blob_free(info->blob);
|
531
531
|
else
|
532
|
-
|
532
|
+
git_buf_dispose(&info->data);
|
533
533
|
}
|
534
534
|
|
535
535
|
#define FLAG_SET(opts,flag_name) (((opts)->flags & flag_name) != 0)
|
@@ -6,6 +6,7 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
#include "diff_xdiff.h"
|
9
|
+
#include "util.h"
|
9
10
|
|
10
11
|
#include "git2/errors.h"
|
11
12
|
#include "diff.h"
|
@@ -115,6 +116,7 @@ static int git_xdiff_cb(void *priv, mmbuffer_t *bufs, int len)
|
|
115
116
|
const git_diff_delta *delta = patch->base.delta;
|
116
117
|
git_patch_generated_output *output = &info->xo->output;
|
117
118
|
git_diff_line line;
|
119
|
+
size_t buffer_len;
|
118
120
|
|
119
121
|
if (len == 1) {
|
120
122
|
output->error = git_xdiff_parse_hunk(&info->hunk, bufs[0].ptr);
|
@@ -124,6 +126,16 @@ static int git_xdiff_cb(void *priv, mmbuffer_t *bufs, int len)
|
|
124
126
|
info->hunk.header_len = bufs[0].size;
|
125
127
|
if (info->hunk.header_len >= sizeof(info->hunk.header))
|
126
128
|
info->hunk.header_len = sizeof(info->hunk.header) - 1;
|
129
|
+
|
130
|
+
/* Sanitize the hunk header in case there is invalid Unicode */
|
131
|
+
buffer_len = git__utf8_valid_buf_length((const uint8_t *) bufs[0].ptr, info->hunk.header_len);
|
132
|
+
/* Sanitizing the hunk header may delete the newline, so add it back again if there is room */
|
133
|
+
if (buffer_len < info->hunk.header_len) {
|
134
|
+
bufs[0].ptr[buffer_len] = '\n';
|
135
|
+
buffer_len += 1;
|
136
|
+
info->hunk.header_len = buffer_len;
|
137
|
+
}
|
138
|
+
|
127
139
|
memcpy(info->hunk.header, bufs[0].ptr, info->hunk.header_len);
|
128
140
|
info->hunk.header[info->hunk.header_len] = '\0';
|
129
141
|
|
@@ -27,10 +27,12 @@
|
|
27
27
|
#cmakedefine GIT_HTTPS 1
|
28
28
|
#cmakedefine GIT_OPENSSL 1
|
29
29
|
#cmakedefine GIT_SECURE_TRANSPORT 1
|
30
|
+
#cmakedefine GIT_MBEDTLS 1
|
30
31
|
|
31
32
|
#cmakedefine GIT_SHA1_COLLISIONDETECT 1
|
32
33
|
#cmakedefine GIT_SHA1_WIN32 1
|
33
34
|
#cmakedefine GIT_SHA1_COMMON_CRYPTO 1
|
34
35
|
#cmakedefine GIT_SHA1_OPENSSL 1
|
36
|
+
#cmakedefine GIT_SHA1_MBEDTLS 1
|
35
37
|
|
36
38
|
#endif
|
data/vendor/libgit2/src/fetch.c
CHANGED
@@ -78,7 +78,7 @@ static int filter_wants(git_remote *remote, const git_fetch_options *opts)
|
|
78
78
|
goto cleanup;
|
79
79
|
|
80
80
|
error = git_refspec__dwim_one(&remote->active_refspecs, &head, &remote->refs);
|
81
|
-
|
81
|
+
git_refspec__dispose(&head);
|
82
82
|
|
83
83
|
if (error < 0)
|
84
84
|
goto cleanup;
|
@@ -96,7 +96,7 @@ static int filter_wants(git_remote *remote, const git_fetch_options *opts)
|
|
96
96
|
}
|
97
97
|
|
98
98
|
cleanup:
|
99
|
-
|
99
|
+
git_refspec__dispose(&tagspec);
|
100
100
|
|
101
101
|
return error;
|
102
102
|
}
|
@@ -119,11 +119,11 @@ int git_fetchhead_write(git_repository *repo, git_vector *fetchhead_refs)
|
|
119
119
|
return -1;
|
120
120
|
|
121
121
|
if (git_filebuf_open(&file, path.ptr, GIT_FILEBUF_APPEND, GIT_REFS_FILE_MODE) < 0) {
|
122
|
-
|
122
|
+
git_buf_dispose(&path);
|
123
123
|
return -1;
|
124
124
|
}
|
125
125
|
|
126
|
-
|
126
|
+
git_buf_dispose(&path);
|
127
127
|
|
128
128
|
git_vector_sort(fetchhead_refs);
|
129
129
|
|
@@ -283,9 +283,9 @@ int git_repository_fetchhead_foreach(git_repository *repo,
|
|
283
283
|
}
|
284
284
|
|
285
285
|
done:
|
286
|
-
|
287
|
-
|
288
|
-
|
286
|
+
git_buf_dispose(&file);
|
287
|
+
git_buf_dispose(&path);
|
288
|
+
git_buf_dispose(&name);
|
289
289
|
|
290
290
|
return error;
|
291
291
|
}
|
@@ -256,7 +256,7 @@ static int resolve_symlink(git_buf *out, const char *path)
|
|
256
256
|
goto cleanup;
|
257
257
|
|
258
258
|
git_buf_swap(&curpath, &dir);
|
259
|
-
|
259
|
+
git_buf_dispose(&dir);
|
260
260
|
|
261
261
|
if ((error = git_path_apply_relative(&curpath, target.ptr)) < 0)
|
262
262
|
goto cleanup;
|
@@ -267,8 +267,8 @@ static int resolve_symlink(git_buf *out, const char *path)
|
|
267
267
|
error = -1;
|
268
268
|
|
269
269
|
cleanup:
|
270
|
-
|
271
|
-
|
270
|
+
git_buf_dispose(&curpath);
|
271
|
+
git_buf_dispose(&target);
|
272
272
|
return error;
|
273
273
|
}
|
274
274
|
|
@@ -343,7 +343,7 @@ int git_filebuf_open_withsize(git_filebuf *file, const char *path, int flags, mo
|
|
343
343
|
file->fd = git_futils_mktmp(&tmp_path, path, mode);
|
344
344
|
|
345
345
|
if (file->fd < 0) {
|
346
|
-
|
346
|
+
git_buf_dispose(&tmp_path);
|
347
347
|
goto cleanup;
|
348
348
|
}
|
349
349
|
file->fd_is_open = true;
|
@@ -159,7 +159,7 @@ int git_futils_readbuffer_fd(git_buf *buf, git_file fd, size_t len)
|
|
159
159
|
|
160
160
|
if (read_size != (ssize_t)len) {
|
161
161
|
giterr_set(GITERR_OS, "failed to read descriptor");
|
162
|
-
|
162
|
+
git_buf_dispose(buf);
|
163
163
|
return -1;
|
164
164
|
}
|
165
165
|
|
@@ -209,7 +209,7 @@ int git_futils_readbuffer_updated(
|
|
209
209
|
|
210
210
|
if (checksum) {
|
211
211
|
if ((error = git_hash_buf(&checksum_new, buf.ptr, buf.size)) < 0) {
|
212
|
-
|
212
|
+
git_buf_dispose(&buf);
|
213
213
|
return error;
|
214
214
|
}
|
215
215
|
|
@@ -217,7 +217,7 @@ int git_futils_readbuffer_updated(
|
|
217
217
|
* If we were given a checksum, we only want to use it if it's different
|
218
218
|
*/
|
219
219
|
if (!git_oid__cmp(checksum, &checksum_new)) {
|
220
|
-
|
220
|
+
git_buf_dispose(&buf);
|
221
221
|
if (updated)
|
222
222
|
*updated = 0;
|
223
223
|
|
@@ -234,7 +234,7 @@ int git_futils_readbuffer_updated(
|
|
234
234
|
*updated = 1;
|
235
235
|
|
236
236
|
git_buf_swap(out, &buf);
|
237
|
-
|
237
|
+
git_buf_dispose(&buf);
|
238
238
|
|
239
239
|
return 0;
|
240
240
|
}
|
@@ -526,8 +526,8 @@ int git_futils_mkdir(
|
|
526
526
|
parent_path.size ? parent_path.ptr : NULL, mode, flags, &opts);
|
527
527
|
|
528
528
|
done:
|
529
|
-
|
530
|
-
|
529
|
+
git_buf_dispose(&make_path);
|
530
|
+
git_buf_dispose(&parent_path);
|
531
531
|
return error;
|
532
532
|
}
|
533
533
|
|
@@ -661,7 +661,7 @@ retry_lstat:
|
|
661
661
|
}
|
662
662
|
|
663
663
|
done:
|
664
|
-
|
664
|
+
git_buf_dispose(&make_path);
|
665
665
|
return error;
|
666
666
|
}
|
667
667
|
|
@@ -822,7 +822,7 @@ int git_futils_rmdir_r(
|
|
822
822
|
error = 0;
|
823
823
|
}
|
824
824
|
|
825
|
-
|
825
|
+
git_buf_dispose(&fullpath);
|
826
826
|
|
827
827
|
return error;
|
828
828
|
}
|
@@ -1081,8 +1081,8 @@ int git_futils_cp_r(
|
|
1081
1081
|
|
1082
1082
|
error = _cp_r_callback(&info, &path);
|
1083
1083
|
|
1084
|
-
|
1085
|
-
|
1084
|
+
git_buf_dispose(&path);
|
1085
|
+
git_buf_dispose(&info.to);
|
1086
1086
|
|
1087
1087
|
return error;
|
1088
1088
|
}
|
data/vendor/libgit2/src/filter.c
CHANGED
@@ -841,8 +841,8 @@ static void proxy_stream_free(git_writestream *s)
|
|
841
841
|
struct proxy_stream *proxy_stream = (struct proxy_stream *)s;
|
842
842
|
assert(proxy_stream);
|
843
843
|
|
844
|
-
|
845
|
-
|
844
|
+
git_buf_dispose(&proxy_stream->input);
|
845
|
+
git_buf_dispose(&proxy_stream->temp_buf);
|
846
846
|
git__free(proxy_stream);
|
847
847
|
}
|
848
848
|
|
@@ -977,7 +977,7 @@ done:
|
|
977
977
|
if (fd >= 0)
|
978
978
|
p_close(fd);
|
979
979
|
stream_list_free(&filter_streams);
|
980
|
-
|
980
|
+
git_buf_dispose(&abspath);
|
981
981
|
return error;
|
982
982
|
}
|
983
983
|
|
data/vendor/libgit2/src/global.c
CHANGED
@@ -7,11 +7,13 @@
|
|
7
7
|
|
8
8
|
#include "global.h"
|
9
9
|
|
10
|
+
#include "alloc.h"
|
10
11
|
#include "hash.h"
|
11
12
|
#include "sysdir.h"
|
12
13
|
#include "filter.h"
|
13
14
|
#include "merge_driver.h"
|
14
15
|
#include "streams/curl.h"
|
16
|
+
#include "streams/mbedtls.h"
|
15
17
|
#include "streams/openssl.h"
|
16
18
|
#include "thread-utils.h"
|
17
19
|
#include "git2/global.h"
|
@@ -59,13 +61,15 @@ static int init_common(void)
|
|
59
61
|
#endif
|
60
62
|
|
61
63
|
/* Initialize any other subsystems that have global state */
|
62
|
-
if ((ret =
|
64
|
+
if ((ret = git_allocator_global_init()) == 0 &&
|
65
|
+
(ret = git_hash_global_init()) == 0 &&
|
63
66
|
(ret = git_sysdir_global_init()) == 0 &&
|
64
67
|
(ret = git_filter_global_init()) == 0 &&
|
65
68
|
(ret = git_merge_driver_global_init()) == 0 &&
|
66
69
|
(ret = git_transport_ssh_global_init()) == 0 &&
|
67
70
|
(ret = git_openssl_stream_global_init()) == 0 &&
|
68
|
-
(ret = git_curl_stream_global_init()) == 0
|
71
|
+
(ret = git_curl_stream_global_init()) == 0 &&
|
72
|
+
(ret = git_mbedtls_stream_global_init()) == 0)
|
69
73
|
ret = git_mwindow_global_init();
|
70
74
|
|
71
75
|
GIT_MEMORY_BARRIER;
|
@@ -274,10 +278,10 @@ int git_libgit2_init(void)
|
|
274
278
|
{
|
275
279
|
int ret, err;
|
276
280
|
|
277
|
-
ret = git_atomic_inc(&git__n_inits);
|
278
|
-
|
279
281
|
if ((err = pthread_mutex_lock(&_init_mutex)) != 0)
|
280
282
|
return err;
|
283
|
+
|
284
|
+
ret = git_atomic_inc(&git__n_inits);
|
281
285
|
err = pthread_once(&_once_init, init_once);
|
282
286
|
err |= pthread_mutex_unlock(&_init_mutex);
|
283
287
|
|
@@ -291,13 +295,13 @@ int git_libgit2_shutdown(void)
|
|
291
295
|
{
|
292
296
|
void *ptr = NULL;
|
293
297
|
pthread_once_t new_once = PTHREAD_ONCE_INIT;
|
294
|
-
int ret;
|
298
|
+
int error, ret;
|
295
299
|
|
296
|
-
if ((
|
297
|
-
return
|
300
|
+
if ((error = pthread_mutex_lock(&_init_mutex)) != 0)
|
301
|
+
return error;
|
298
302
|
|
299
|
-
if ((ret =
|
300
|
-
|
303
|
+
if ((ret = git_atomic_dec(&git__n_inits)) != 0)
|
304
|
+
goto out;
|
301
305
|
|
302
306
|
/* Shut down any subsystems that have global state */
|
303
307
|
shutdown_common();
|
@@ -312,10 +316,11 @@ int git_libgit2_shutdown(void)
|
|
312
316
|
git_mutex_free(&git__mwindow_mutex);
|
313
317
|
_once_init = new_once;
|
314
318
|
|
315
|
-
|
316
|
-
|
319
|
+
out:
|
320
|
+
if ((error = pthread_mutex_unlock(&_init_mutex)) != 0)
|
321
|
+
return error;
|
317
322
|
|
318
|
-
return
|
323
|
+
return ret;
|
319
324
|
}
|
320
325
|
|
321
326
|
git_global_st *git__global_state(void)
|
data/vendor/libgit2/src/hash.h
CHANGED
@@ -26,6 +26,8 @@ void git_hash_ctx_cleanup(git_hash_ctx *ctx);
|
|
26
26
|
# include "hash/hash_openssl.h"
|
27
27
|
#elif defined(GIT_SHA1_WIN32)
|
28
28
|
# include "hash/hash_win32.h"
|
29
|
+
#elif defined(GIT_SHA1_MBEDTLS)
|
30
|
+
# include "hash/hash_mbedtls.h"
|
29
31
|
#else
|
30
32
|
# include "hash/hash_generic.h"
|
31
33
|
#endif
|
@@ -0,0 +1,38 @@
|
|
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
|
+
#include "common.h"
|
9
|
+
#include "hash.h"
|
10
|
+
#include "hash/hash_mbedtls.h"
|
11
|
+
|
12
|
+
void git_hash_ctx_cleanup(git_hash_ctx *ctx)
|
13
|
+
{
|
14
|
+
assert(ctx);
|
15
|
+
mbedtls_sha1_free(&ctx->c);
|
16
|
+
}
|
17
|
+
|
18
|
+
int git_hash_init(git_hash_ctx *ctx)
|
19
|
+
{
|
20
|
+
assert(ctx);
|
21
|
+
mbedtls_sha1_init(&ctx->c);
|
22
|
+
mbedtls_sha1_starts(&ctx->c);
|
23
|
+
return 0;
|
24
|
+
}
|
25
|
+
|
26
|
+
int git_hash_update(git_hash_ctx *ctx, const void *data, size_t len)
|
27
|
+
{
|
28
|
+
assert(ctx);
|
29
|
+
mbedtls_sha1_update(&ctx->c, data, len);
|
30
|
+
return 0;
|
31
|
+
}
|
32
|
+
|
33
|
+
int git_hash_final(git_oid *out, git_hash_ctx *ctx)
|
34
|
+
{
|
35
|
+
assert(ctx);
|
36
|
+
mbedtls_sha1_finish(&ctx->c, out->id);
|
37
|
+
return 0;
|
38
|
+
}
|
@@ -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_hash_mbedtld_h__
|
9
|
+
#define INCLUDE_hash_mbedtld_h__
|
10
|
+
|
11
|
+
#include <mbedtls/sha1.h>
|
12
|
+
|
13
|
+
struct git_hash_ctx {
|
14
|
+
mbedtls_sha1_context c;
|
15
|
+
};
|
16
|
+
|
17
|
+
#define git_hash_global_init() 0
|
18
|
+
#define git_hash_ctx_init(ctx) git_hash_init(ctx)
|
19
|
+
|
20
|
+
#endif /* INCLUDE_hash_mbedtld_h__ */
|
data/vendor/libgit2/src/ignore.c
CHANGED
@@ -133,23 +133,12 @@ static int does_negate_rule(int *out, git_vector *rules, git_attr_fnmatch *match
|
|
133
133
|
continue;
|
134
134
|
}
|
135
135
|
|
136
|
-
/*
|
137
|
-
* When dealing with a directory, we add '/<star>' so
|
138
|
-
* p_fnmatch() honours FNM_PATHNAME. Checking for LEADINGDIR
|
139
|
-
* alone isn't enough as that's also set for nagations, so we
|
140
|
-
* need to check that NEGATIVE is off.
|
141
|
-
*/
|
142
136
|
git_buf_clear(&buf);
|
143
|
-
if (rule->containing_dir)
|
137
|
+
if (rule->containing_dir)
|
144
138
|
git_buf_puts(&buf, rule->containing_dir);
|
145
|
-
|
146
|
-
|
147
|
-
error = git_buf_puts(&buf, rule->pattern);
|
139
|
+
git_buf_puts(&buf, rule->pattern);
|
148
140
|
|
149
|
-
if ((
|
150
|
-
error = git_buf_PUTS(&buf, "/*");
|
151
|
-
|
152
|
-
if (error < 0)
|
141
|
+
if (git_buf_oom(&buf))
|
153
142
|
goto out;
|
154
143
|
|
155
144
|
if ((error = p_fnmatch(git_buf_cstr(&buf), path, fnflags)) < 0) {
|
@@ -169,7 +158,7 @@ static int does_negate_rule(int *out, git_vector *rules, git_attr_fnmatch *match
|
|
169
158
|
|
170
159
|
out:
|
171
160
|
git__free(path);
|
172
|
-
|
161
|
+
git_buf_dispose(&buf);
|
173
162
|
return error;
|
174
163
|
}
|
175
164
|
|
@@ -203,7 +192,10 @@ static int parse_ignore_file(
|
|
203
192
|
break;
|
204
193
|
}
|
205
194
|
|
206
|
-
match->flags =
|
195
|
+
match->flags =
|
196
|
+
GIT_ATTR_FNMATCH_ALLOWSPACE |
|
197
|
+
GIT_ATTR_FNMATCH_ALLOWNEG |
|
198
|
+
GIT_ATTR_FNMATCH_NOLEADINGDIR;
|
207
199
|
|
208
200
|
if (!(error = git_attr_fnmatch__parse(
|
209
201
|
match, &attrs->pool, context, &scan)))
|
@@ -323,7 +315,7 @@ int git_ignore__for_path(
|
|
323
315
|
(error = git_path_to_dir(&local)) < 0 ||
|
324
316
|
(error = git_buf_joinpath(&ignores->dir, workdir, local.ptr)) < 0)
|
325
317
|
{;} /* Nothing, we just want to stop on the first error */
|
326
|
-
|
318
|
+
git_buf_dispose(&local);
|
327
319
|
} else {
|
328
320
|
error = git_buf_joinpath(&ignores->dir, path, "");
|
329
321
|
}
|
@@ -363,7 +355,7 @@ int git_ignore__for_path(
|
|
363
355
|
git_repository_attr_cache(repo)->cfg_excl_file);
|
364
356
|
|
365
357
|
cleanup:
|
366
|
-
|
358
|
+
git_buf_dispose(&infopath);
|
367
359
|
if (error < 0)
|
368
360
|
git_ignore__free(ignores);
|
369
361
|
|
@@ -435,7 +427,7 @@ void git_ignore__free(git_ignores *ignores)
|
|
435
427
|
}
|
436
428
|
git_vector_free(&ignores->ign_global);
|
437
429
|
|
438
|
-
|
430
|
+
git_buf_dispose(&ignores->dir);
|
439
431
|
}
|
440
432
|
|
441
433
|
static bool ignore_lookup_in_rules(
|
@@ -445,6 +437,9 @@ static bool ignore_lookup_in_rules(
|
|
445
437
|
git_attr_fnmatch *match;
|
446
438
|
|
447
439
|
git_vector_rforeach(&file->rules, j, match) {
|
440
|
+
if (match->flags & GIT_ATTR_FNMATCH_DIRECTORY &&
|
441
|
+
path->is_dir == GIT_DIR_FLAG_FALSE)
|
442
|
+
continue;
|
448
443
|
if (git_attr_fnmatch__match(match, path)) {
|
449
444
|
*ignored = ((match->flags & GIT_ATTR_FNMATCH_NEGATIVE) == 0) ?
|
450
445
|
GIT_IGNORE_TRUE : GIT_IGNORE_FALSE;
|
@@ -637,7 +632,7 @@ int git_ignore__check_pathspec_for_exact_ignores(
|
|
637
632
|
}
|
638
633
|
|
639
634
|
git_index_free(idx);
|
640
|
-
|
635
|
+
git_buf_dispose(&path);
|
641
636
|
|
642
637
|
return error;
|
643
638
|
}
|