rugged 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/rugged/rugged_commit.c +1 -1
- data/lib/rugged/commit.rb +16 -2
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +31 -69
- data/vendor/libgit2/cmake/{Modules/AddCFlagIfSupported.cmake → AddCFlagIfSupported.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/EnableWarnings.cmake → EnableWarnings.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindCoreFoundation.cmake → FindCoreFoundation.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindGSSAPI.cmake → FindGSSAPI.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindGSSFramework.cmake → FindGSSFramework.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindHTTP_Parser.cmake → FindHTTP_Parser.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindIconv.cmake → FindIconv.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindPCRE.cmake → FindPCRE.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindPCRE2.cmake → FindPCRE2.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindPkgLibraries.cmake → FindPkgLibraries.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindSecurity.cmake → FindSecurity.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindStatNsec.cmake → FindStatNsec.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindmbedTLS.cmake → FindmbedTLS.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/IdeSplitSources.cmake → IdeSplitSources.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/PkgBuildConfig.cmake → PkgBuildConfig.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/SanitizeBool.cmake → SanitizeBool.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/SelectGSSAPI.cmake → SelectGSSAPI.cmake} +18 -26
- data/vendor/libgit2/cmake/{Modules/SelectHTTPSBackend.cmake → SelectHTTPSBackend.cmake} +25 -32
- data/vendor/libgit2/cmake/{Modules/SelectHashes.cmake → SelectHashes.cmake} +20 -28
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +4 -3
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +6 -5
- data/vendor/libgit2/deps/ntlmclient/compat.h +8 -1
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +8 -11
- data/vendor/libgit2/deps/pcre/LICENCE +93 -0
- data/vendor/libgit2/deps/pcre/pcre.h +2 -2
- data/vendor/libgit2/deps/pcre/pcre_compile.c +29 -17
- data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +4 -4
- data/vendor/libgit2/deps/pcre/pcreposix.c +2 -3
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +6 -5
- data/vendor/libgit2/deps/zlib/deflate.c +1 -0
- data/vendor/libgit2/include/git2/annotated_commit.h +1 -1
- data/vendor/libgit2/include/git2/blame.h +2 -0
- data/vendor/libgit2/include/git2/common.h +15 -3
- data/vendor/libgit2/include/git2/deprecated.h +42 -2
- data/vendor/libgit2/include/git2/errors.h +2 -1
- data/vendor/libgit2/include/git2/index.h +1 -2
- data/vendor/libgit2/include/git2/pack.h +1 -1
- data/vendor/libgit2/include/git2/strarray.h +6 -10
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/src/CMakeLists.txt +53 -41
- data/vendor/libgit2/src/apply.c +5 -1
- data/vendor/libgit2/src/assert_safe.h +58 -0
- data/vendor/libgit2/src/attr_file.c +8 -3
- data/vendor/libgit2/src/attrcache.c +2 -3
- data/vendor/libgit2/src/blame.c +2 -0
- data/vendor/libgit2/src/blame_git.c +6 -3
- data/vendor/libgit2/src/blob.c +2 -0
- data/vendor/libgit2/src/branch.c +19 -21
- data/vendor/libgit2/src/buffer.c +6 -3
- data/vendor/libgit2/src/cache.c +1 -22
- data/vendor/libgit2/src/checkout.c +49 -72
- data/vendor/libgit2/src/cherrypick.c +2 -0
- data/vendor/libgit2/src/clone.c +78 -18
- data/vendor/libgit2/src/common.h +1 -0
- data/vendor/libgit2/src/config.c +3 -7
- data/vendor/libgit2/src/config_entries.c +35 -27
- data/vendor/libgit2/src/config_parse.c +1 -1
- data/vendor/libgit2/src/config_snapshot.c +2 -1
- data/vendor/libgit2/src/describe.c +5 -1
- data/vendor/libgit2/src/diff.c +12 -11
- data/vendor/libgit2/src/diff_file.c +3 -1
- data/vendor/libgit2/src/diff_generate.c +10 -11
- data/vendor/libgit2/src/diff_parse.c +2 -3
- data/vendor/libgit2/src/diff_print.c +63 -60
- data/vendor/libgit2/src/diff_stats.c +12 -11
- data/vendor/libgit2/src/diff_tform.c +2 -3
- data/vendor/libgit2/src/errors.c +2 -0
- data/vendor/libgit2/src/fetch.c +2 -0
- data/vendor/libgit2/src/filter.c +3 -3
- data/vendor/libgit2/src/futils.c +3 -3
- data/vendor/libgit2/src/futils.h +3 -3
- data/vendor/libgit2/src/global.c +3 -1
- data/vendor/libgit2/src/idxmap.c +0 -22
- data/vendor/libgit2/src/index.c +12 -7
- data/vendor/libgit2/src/indexer.c +10 -4
- data/vendor/libgit2/src/iterator.c +4 -4
- data/vendor/libgit2/src/merge.c +13 -7
- data/vendor/libgit2/src/merge_file.c +4 -6
- data/vendor/libgit2/src/midx.c +418 -0
- data/vendor/libgit2/src/midx.h +83 -0
- data/vendor/libgit2/src/mwindow.c +124 -51
- data/vendor/libgit2/src/net.c +6 -1
- data/vendor/libgit2/src/object.c +2 -1
- data/vendor/libgit2/src/odb.c +9 -6
- data/vendor/libgit2/src/odb_loose.c +3 -3
- data/vendor/libgit2/src/odb_mempack.c +2 -0
- data/vendor/libgit2/src/oid.c +2 -0
- data/vendor/libgit2/src/pack-objects.c +29 -21
- data/vendor/libgit2/src/pack.c +47 -28
- data/vendor/libgit2/src/pack.h +19 -2
- data/vendor/libgit2/src/patch_generate.c +1 -3
- data/vendor/libgit2/src/patch_parse.c +4 -2
- data/vendor/libgit2/src/path.c +4 -4
- data/vendor/libgit2/src/pathspec.c +4 -3
- data/vendor/libgit2/src/pool.c +21 -15
- data/vendor/libgit2/src/pool.h +9 -1
- data/vendor/libgit2/src/proxy.c +2 -0
- data/vendor/libgit2/src/push.c +2 -0
- data/vendor/libgit2/src/rebase.c +2 -0
- data/vendor/libgit2/src/refdb.c +135 -0
- data/vendor/libgit2/src/refdb.h +69 -0
- data/vendor/libgit2/src/refdb_fs.c +19 -81
- data/vendor/libgit2/src/reflog.c +2 -6
- data/vendor/libgit2/src/refs.c +60 -188
- data/vendor/libgit2/src/refs.h +1 -19
- data/vendor/libgit2/src/regexp.c +2 -2
- data/vendor/libgit2/src/remote.c +32 -17
- data/vendor/libgit2/src/repository.c +168 -79
- data/vendor/libgit2/src/repository.h +10 -27
- data/vendor/libgit2/src/revert.c +2 -0
- data/vendor/libgit2/src/revparse.c +5 -4
- data/vendor/libgit2/src/revwalk.c +3 -5
- data/vendor/libgit2/src/settings.c +9 -0
- data/vendor/libgit2/src/sortedcache.c +2 -3
- data/vendor/libgit2/src/stash.c +2 -0
- data/vendor/libgit2/src/status.c +2 -0
- data/vendor/libgit2/src/strarray.c +63 -0
- data/vendor/libgit2/src/streams/openssl.c +12 -6
- data/vendor/libgit2/src/streams/registry.c +5 -3
- data/vendor/libgit2/src/submodule.c +6 -4
- data/vendor/libgit2/src/sysdir.c +4 -20
- data/vendor/libgit2/src/sysdir.h +0 -11
- data/vendor/libgit2/src/tag.c +2 -0
- data/vendor/libgit2/src/thread-utils.h +139 -21
- data/vendor/libgit2/src/transaction.c +2 -1
- data/vendor/libgit2/src/transports/credential.c +2 -0
- data/vendor/libgit2/src/transports/credential_helpers.c +2 -0
- data/vendor/libgit2/src/transports/httpclient.c +6 -8
- data/vendor/libgit2/src/transports/local.c +2 -2
- data/vendor/libgit2/src/transports/smart.c +2 -2
- data/vendor/libgit2/src/transports/winhttp.c +18 -7
- data/vendor/libgit2/src/unix/posix.h +13 -1
- data/vendor/libgit2/src/util.c +25 -58
- data/vendor/libgit2/src/util.h +2 -2
- data/vendor/libgit2/src/win32/git2.rc +18 -3
- data/vendor/libgit2/src/win32/path_w32.c +2 -2
- data/vendor/libgit2/src/worktree.c +4 -0
- metadata +27 -25
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.c.in +0 -29
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.cmake +0 -96
- data/vendor/libgit2/src/refdb_fs.h +0 -19
@@ -0,0 +1,83 @@
|
|
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_midx_h__
|
9
|
+
#define INCLUDE_midx_h__
|
10
|
+
|
11
|
+
#include "common.h"
|
12
|
+
|
13
|
+
#include <ctype.h>
|
14
|
+
|
15
|
+
#include "map.h"
|
16
|
+
#include "mwindow.h"
|
17
|
+
|
18
|
+
/*
|
19
|
+
* A multi-pack-index file.
|
20
|
+
*
|
21
|
+
* This file contains a merged index for multiple independent .pack files. This
|
22
|
+
* can help speed up locating objects without requiring a garbage collection
|
23
|
+
* cycle to create a single .pack file.
|
24
|
+
*
|
25
|
+
* Support for this feature was added in git 2.21, and requires the
|
26
|
+
* `core.multiPackIndex` config option to be set.
|
27
|
+
*/
|
28
|
+
typedef struct git_midx_file {
|
29
|
+
git_map index_map;
|
30
|
+
|
31
|
+
/* The table of Packfile Names. */
|
32
|
+
git_vector packfile_names;
|
33
|
+
|
34
|
+
/* The OID Fanout table. */
|
35
|
+
const uint32_t *oid_fanout;
|
36
|
+
/* The total number of objects in the index. */
|
37
|
+
uint32_t num_objects;
|
38
|
+
|
39
|
+
/* The OID Lookup table. */
|
40
|
+
git_oid *oid_lookup;
|
41
|
+
|
42
|
+
/* The Object Offsets table. Each entry has two 4-byte fields with the pack index and the offset. */
|
43
|
+
const unsigned char *object_offsets;
|
44
|
+
|
45
|
+
/* The Object Large Offsets table. */
|
46
|
+
const unsigned char *object_large_offsets;
|
47
|
+
/* The number of entries in the Object Large Offsets table. Each entry has an 8-byte with an offset */
|
48
|
+
size_t num_object_large_offsets;
|
49
|
+
|
50
|
+
/* The trailer of the file. Contains the SHA1-checksum of the whole file. */
|
51
|
+
git_oid checksum;
|
52
|
+
} git_midx_file;
|
53
|
+
|
54
|
+
/*
|
55
|
+
* An entry in the multi-pack-index file. Similar in purpose to git_pack_entry.
|
56
|
+
*/
|
57
|
+
typedef struct git_midx_entry {
|
58
|
+
/* The index within idx->packfile_names where the packfile name can be found. */
|
59
|
+
size_t pack_index;
|
60
|
+
/* The offset within the .pack file where the requested object is found. */
|
61
|
+
off64_t offset;
|
62
|
+
/* The SHA-1 hash of the requested object. */
|
63
|
+
git_oid sha1;
|
64
|
+
} git_midx_entry;
|
65
|
+
|
66
|
+
int git_midx_open(
|
67
|
+
git_midx_file **idx_out,
|
68
|
+
const char *path);
|
69
|
+
int git_midx_entry_find(
|
70
|
+
git_midx_entry *e,
|
71
|
+
git_midx_file *idx,
|
72
|
+
const git_oid *short_oid,
|
73
|
+
size_t len);
|
74
|
+
void git_midx_close(git_midx_file *idx);
|
75
|
+
void git_midx_free(git_midx_file *idx);
|
76
|
+
|
77
|
+
/* This is exposed for use in the fuzzers. */
|
78
|
+
int git_midx_parse(
|
79
|
+
git_midx_file *idx,
|
80
|
+
const unsigned char *data,
|
81
|
+
size_t size);
|
82
|
+
|
83
|
+
#endif
|
@@ -22,11 +22,15 @@
|
|
22
22
|
#define DEFAULT_MAPPED_LIMIT \
|
23
23
|
((1024 * 1024) * (sizeof(void*) >= 8 ? 8192ULL : 256UL))
|
24
24
|
|
25
|
+
/* default is unlimited */
|
26
|
+
#define DEFAULT_FILE_LIMIT 0
|
27
|
+
|
25
28
|
size_t git_mwindow__window_size = DEFAULT_WINDOW_SIZE;
|
26
29
|
size_t git_mwindow__mapped_limit = DEFAULT_MAPPED_LIMIT;
|
30
|
+
size_t git_mwindow__file_limit = DEFAULT_FILE_LIMIT;
|
27
31
|
|
28
32
|
/* Whenever you want to read or modify this, grab git__mwindow_mutex */
|
29
|
-
|
33
|
+
git_mwindow_ctl git_mwindow__mem_ctl;
|
30
34
|
|
31
35
|
/* Global list of mwindow files, to open packs once across repos */
|
32
36
|
git_strmap *git__pack_cache = NULL;
|
@@ -132,7 +136,7 @@ void git_mwindow_free_all(git_mwindow_file *mwf)
|
|
132
136
|
*/
|
133
137
|
void git_mwindow_free_all_locked(git_mwindow_file *mwf)
|
134
138
|
{
|
135
|
-
git_mwindow_ctl *ctl = &
|
139
|
+
git_mwindow_ctl *ctl = &git_mwindow__mem_ctl;
|
136
140
|
size_t i;
|
137
141
|
|
138
142
|
/*
|
@@ -174,82 +178,146 @@ int git_mwindow_contains(git_mwindow *win, off64_t offset)
|
|
174
178
|
&& offset <= (off64_t)(win_off + win->window_map.len);
|
175
179
|
}
|
176
180
|
|
181
|
+
#define GIT_MWINDOW__LRU -1
|
182
|
+
#define GIT_MWINDOW__MRU 1
|
183
|
+
|
177
184
|
/*
|
178
|
-
* Find the least-recently-used window in a file
|
185
|
+
* Find the least- or most-recently-used window in a file that is not currently
|
186
|
+
* being used. The 'only_unused' flag controls whether the caller requires the
|
187
|
+
* file to only have unused windows. If '*out_window' is non-null, it is used as
|
188
|
+
* a starting point for the comparison.
|
189
|
+
*
|
190
|
+
* Returns whether such a window was found in the file.
|
179
191
|
*/
|
180
|
-
static
|
181
|
-
|
182
|
-
|
183
|
-
|
192
|
+
static bool git_mwindow_scan_recently_used(
|
193
|
+
git_mwindow_file *mwf,
|
194
|
+
git_mwindow **out_window,
|
195
|
+
git_mwindow **out_last,
|
196
|
+
bool only_unused,
|
197
|
+
int comparison_sign)
|
184
198
|
{
|
185
|
-
git_mwindow *w, *
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
199
|
+
git_mwindow *w, *w_last;
|
200
|
+
git_mwindow *lru_window = NULL, *lru_last = NULL;
|
201
|
+
bool found = false;
|
202
|
+
|
203
|
+
assert(mwf);
|
204
|
+
assert(out_window);
|
205
|
+
|
206
|
+
lru_window = *out_window;
|
207
|
+
if (out_last)
|
208
|
+
lru_last = *out_last;
|
209
|
+
|
210
|
+
for (w_last = NULL, w = mwf->windows; w; w_last = w, w = w->next) {
|
211
|
+
if (w->inuse_cnt) {
|
212
|
+
if (only_unused)
|
213
|
+
return false;
|
214
|
+
/* This window is currently being used. Skip it. */
|
215
|
+
continue;
|
216
|
+
}
|
217
|
+
|
218
|
+
/*
|
219
|
+
* If the current one is more (or less) recent than the last one,
|
220
|
+
* store it in the output parameter. If lru_window is NULL,
|
221
|
+
* it's the first loop, so store it as well.
|
222
|
+
*/
|
223
|
+
if (!lru_window ||
|
224
|
+
(comparison_sign == GIT_MWINDOW__LRU && lru_window->last_used > w->last_used) ||
|
225
|
+
(comparison_sign == GIT_MWINDOW__MRU && lru_window->last_used < w->last_used)) {
|
226
|
+
lru_window = w;
|
227
|
+
lru_last = w_last;
|
228
|
+
found = true;
|
198
229
|
}
|
199
|
-
w_l = w;
|
200
230
|
}
|
231
|
+
|
232
|
+
if (!found)
|
233
|
+
return false;
|
234
|
+
|
235
|
+
*out_window = lru_window;
|
236
|
+
if (out_last)
|
237
|
+
*out_last = lru_last;
|
238
|
+
return true;
|
201
239
|
}
|
202
240
|
|
203
241
|
/*
|
204
|
-
* Close the least recently used window
|
205
|
-
* the
|
206
|
-
* lock from new_window.
|
242
|
+
* Close the least recently used window (that is currently not being used) out
|
243
|
+
* of all the files. Called under lock from new_window.
|
207
244
|
*/
|
208
|
-
static int
|
245
|
+
static int git_mwindow_close_lru_window(void)
|
209
246
|
{
|
210
|
-
git_mwindow_ctl *ctl = &
|
247
|
+
git_mwindow_ctl *ctl = &git_mwindow__mem_ctl;
|
248
|
+
git_mwindow_file *cur;
|
211
249
|
size_t i;
|
212
|
-
git_mwindow *
|
213
|
-
|
214
|
-
/* FIXME: Does this give us any advantage? */
|
215
|
-
if(mwf->windows)
|
216
|
-
git_mwindow_scan_lru(mwf, &lru_w, &lru_l);
|
250
|
+
git_mwindow *lru_window = NULL, *lru_last = NULL, **list = NULL;
|
217
251
|
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
git_mwindow_scan_lru(cur, &lru_w, &lru_l);
|
222
|
-
if (lru_w != last)
|
252
|
+
git_vector_foreach(&ctl->windowfiles, i, cur) {
|
253
|
+
if (git_mwindow_scan_recently_used(
|
254
|
+
cur, &lru_window, &lru_last, false, GIT_MWINDOW__LRU)) {
|
223
255
|
list = &cur->windows;
|
256
|
+
}
|
224
257
|
}
|
225
258
|
|
226
|
-
if (!
|
259
|
+
if (!lru_window) {
|
227
260
|
git_error_set(GIT_ERROR_OS, "failed to close memory window; couldn't find LRU");
|
228
261
|
return -1;
|
229
262
|
}
|
230
263
|
|
231
|
-
ctl->mapped -=
|
232
|
-
git_futils_mmap_free(&
|
264
|
+
ctl->mapped -= lru_window->window_map.len;
|
265
|
+
git_futils_mmap_free(&lru_window->window_map);
|
233
266
|
|
234
|
-
if (
|
235
|
-
|
267
|
+
if (lru_last)
|
268
|
+
lru_last->next = lru_window->next;
|
236
269
|
else
|
237
|
-
*list =
|
270
|
+
*list = lru_window->next;
|
238
271
|
|
239
|
-
git__free(
|
272
|
+
git__free(lru_window);
|
240
273
|
ctl->open_windows--;
|
241
274
|
|
242
275
|
return 0;
|
243
276
|
}
|
244
277
|
|
278
|
+
/*
|
279
|
+
* Close the file that does not have any open windows AND whose
|
280
|
+
* most-recently-used window is the least-recently used one across all
|
281
|
+
* currently open files.
|
282
|
+
*
|
283
|
+
* Called under lock from new_window.
|
284
|
+
*/
|
285
|
+
static int git_mwindow_close_lru_file(void)
|
286
|
+
{
|
287
|
+
git_mwindow_ctl *ctl = &git_mwindow__mem_ctl;
|
288
|
+
git_mwindow_file *lru_file = NULL, *current_file = NULL;
|
289
|
+
git_mwindow *lru_window = NULL;
|
290
|
+
size_t i;
|
291
|
+
|
292
|
+
git_vector_foreach(&ctl->windowfiles, i, current_file) {
|
293
|
+
git_mwindow *mru_window = NULL;
|
294
|
+
if (!git_mwindow_scan_recently_used(
|
295
|
+
current_file, &mru_window, NULL, true, GIT_MWINDOW__MRU)) {
|
296
|
+
continue;
|
297
|
+
}
|
298
|
+
if (!lru_window || lru_window->last_used > mru_window->last_used)
|
299
|
+
lru_file = current_file;
|
300
|
+
}
|
301
|
+
|
302
|
+
if (!lru_file) {
|
303
|
+
git_error_set(GIT_ERROR_OS, "failed to close memory window file; couldn't find LRU");
|
304
|
+
return -1;
|
305
|
+
}
|
306
|
+
|
307
|
+
git_mwindow_free_all_locked(lru_file);
|
308
|
+
p_close(lru_file->fd);
|
309
|
+
lru_file->fd = -1;
|
310
|
+
|
311
|
+
return 0;
|
312
|
+
}
|
313
|
+
|
245
314
|
/* This gets called under lock from git_mwindow_open */
|
246
315
|
static git_mwindow *new_window(
|
247
|
-
git_mwindow_file *mwf,
|
248
316
|
git_file fd,
|
249
317
|
off64_t size,
|
250
318
|
off64_t offset)
|
251
319
|
{
|
252
|
-
git_mwindow_ctl *ctl = &
|
320
|
+
git_mwindow_ctl *ctl = &git_mwindow__mem_ctl;
|
253
321
|
size_t walign = git_mwindow__window_size / 2;
|
254
322
|
off64_t len;
|
255
323
|
git_mwindow *w;
|
@@ -269,7 +337,7 @@ static git_mwindow *new_window(
|
|
269
337
|
ctl->mapped += (size_t)len;
|
270
338
|
|
271
339
|
while (git_mwindow__mapped_limit < ctl->mapped &&
|
272
|
-
|
340
|
+
git_mwindow_close_lru_window() == 0) /* nop */;
|
273
341
|
|
274
342
|
/*
|
275
343
|
* We treat `mapped_limit` as a soft limit. If we can't find a
|
@@ -283,7 +351,7 @@ static git_mwindow *new_window(
|
|
283
351
|
* we're below our soft limits, so free up what we can and try again.
|
284
352
|
*/
|
285
353
|
|
286
|
-
while (
|
354
|
+
while (git_mwindow_close_lru_window() == 0)
|
287
355
|
/* nop */;
|
288
356
|
|
289
357
|
if (git_futils_mmap_ro(&w->window_map, fd, w->offset, (size_t)len) < 0) {
|
@@ -315,7 +383,7 @@ unsigned char *git_mwindow_open(
|
|
315
383
|
size_t extra,
|
316
384
|
unsigned int *left)
|
317
385
|
{
|
318
|
-
git_mwindow_ctl *ctl = &
|
386
|
+
git_mwindow_ctl *ctl = &git_mwindow__mem_ctl;
|
319
387
|
git_mwindow *w = *cursor;
|
320
388
|
|
321
389
|
if (git_mutex_lock(&git__mwindow_mutex)) {
|
@@ -339,7 +407,7 @@ unsigned char *git_mwindow_open(
|
|
339
407
|
* one.
|
340
408
|
*/
|
341
409
|
if (!w) {
|
342
|
-
w = new_window(mwf
|
410
|
+
w = new_window(mwf->fd, mwf->size, offset);
|
343
411
|
if (w == NULL) {
|
344
412
|
git_mutex_unlock(&git__mwindow_mutex);
|
345
413
|
return NULL;
|
@@ -367,7 +435,7 @@ unsigned char *git_mwindow_open(
|
|
367
435
|
|
368
436
|
int git_mwindow_file_register(git_mwindow_file *mwf)
|
369
437
|
{
|
370
|
-
git_mwindow_ctl *ctl = &
|
438
|
+
git_mwindow_ctl *ctl = &git_mwindow__mem_ctl;
|
371
439
|
int ret;
|
372
440
|
|
373
441
|
if (git_mutex_lock(&git__mwindow_mutex)) {
|
@@ -381,6 +449,11 @@ int git_mwindow_file_register(git_mwindow_file *mwf)
|
|
381
449
|
return -1;
|
382
450
|
}
|
383
451
|
|
452
|
+
if (git_mwindow__file_limit) {
|
453
|
+
while (git_mwindow__file_limit <= ctl->windowfiles.length &&
|
454
|
+
git_mwindow_close_lru_file() == 0) /* nop */;
|
455
|
+
}
|
456
|
+
|
384
457
|
ret = git_vector_insert(&ctl->windowfiles, mwf);
|
385
458
|
git_mutex_unlock(&git__mwindow_mutex);
|
386
459
|
|
@@ -389,7 +462,7 @@ int git_mwindow_file_register(git_mwindow_file *mwf)
|
|
389
462
|
|
390
463
|
void git_mwindow_file_deregister(git_mwindow_file *mwf)
|
391
464
|
{
|
392
|
-
git_mwindow_ctl *ctl = &
|
465
|
+
git_mwindow_ctl *ctl = &git_mwindow__mem_ctl;
|
393
466
|
git_mwindow_file *cur;
|
394
467
|
size_t i;
|
395
468
|
|
data/vendor/libgit2/src/net.c
CHANGED
@@ -336,7 +336,12 @@ bool git_net_url_valid(git_net_url *url)
|
|
336
336
|
|
337
337
|
int git_net_url_is_default_port(git_net_url *url)
|
338
338
|
{
|
339
|
-
|
339
|
+
const char *default_port;
|
340
|
+
|
341
|
+
if ((default_port = default_port_for_scheme(url->scheme)) != NULL)
|
342
|
+
return (strcmp(url->port, default_port) == 0);
|
343
|
+
else
|
344
|
+
return false;
|
340
345
|
}
|
341
346
|
|
342
347
|
void git_net_url_swap(git_net_url *a, git_net_url *b)
|
data/vendor/libgit2/src/object.c
CHANGED
@@ -86,7 +86,8 @@ int git_object__from_raw(
|
|
86
86
|
GIT_ERROR_CHECK_ALLOC(object);
|
87
87
|
object->cached.flags = GIT_CACHE_STORE_PARSED;
|
88
88
|
object->cached.type = type;
|
89
|
-
git_odb_hash(&object->cached.oid, data, size, type)
|
89
|
+
if ((error = git_odb_hash(&object->cached.oid, data, size, type)) < 0)
|
90
|
+
return error;
|
90
91
|
|
91
92
|
/* Parse raw object data */
|
92
93
|
def = &git_objects_table[type];
|
data/vendor/libgit2/src/odb.c
CHANGED
@@ -44,8 +44,8 @@ typedef struct
|
|
44
44
|
|
45
45
|
static git_cache *odb_cache(git_odb *odb)
|
46
46
|
{
|
47
|
-
|
48
|
-
|
47
|
+
git_repository *owner = GIT_REFCOUNT_OWNER(odb);
|
48
|
+
if (owner != NULL) {
|
49
49
|
return &owner->objects;
|
50
50
|
}
|
51
51
|
|
@@ -664,7 +664,7 @@ int git_odb_open(git_odb **out, const char *objects_dir)
|
|
664
664
|
int git_odb__set_caps(git_odb *odb, int caps)
|
665
665
|
{
|
666
666
|
if (caps == GIT_ODB_CAP_FROM_OWNER) {
|
667
|
-
git_repository *repo = odb
|
667
|
+
git_repository *repo = GIT_REFCOUNT_OWNER(odb);
|
668
668
|
int val;
|
669
669
|
|
670
670
|
if (!repo) {
|
@@ -1283,12 +1283,13 @@ int git_odb_write(
|
|
1283
1283
|
git_oid *oid, git_odb *db, const void *data, size_t len, git_object_t type)
|
1284
1284
|
{
|
1285
1285
|
size_t i;
|
1286
|
-
int error
|
1286
|
+
int error;
|
1287
1287
|
git_odb_stream *stream;
|
1288
1288
|
|
1289
1289
|
assert(oid && db);
|
1290
1290
|
|
1291
|
-
git_odb_hash(oid, data, len, type)
|
1291
|
+
if ((error = git_odb_hash(oid, data, len, type)) < 0)
|
1292
|
+
return error;
|
1292
1293
|
|
1293
1294
|
if (git_oid_is_zero(oid))
|
1294
1295
|
return error_null_oid(GIT_EINVALID, "cannot write object");
|
@@ -1296,7 +1297,7 @@ int git_odb_write(
|
|
1296
1297
|
if (git_odb__freshen(db, oid))
|
1297
1298
|
return 0;
|
1298
1299
|
|
1299
|
-
for (i = 0; i < db->backends.length && error < 0; ++i) {
|
1300
|
+
for (i = 0, error = GIT_ERROR; i < db->backends.length && error < 0; ++i) {
|
1300
1301
|
backend_internal *internal = git_vector_get(&db->backends, i);
|
1301
1302
|
git_odb_backend *b = internal->backend;
|
1302
1303
|
|
@@ -1510,10 +1511,12 @@ void *git_odb_backend_data_alloc(git_odb_backend *backend, size_t len)
|
|
1510
1511
|
return git__malloc(len);
|
1511
1512
|
}
|
1512
1513
|
|
1514
|
+
#ifndef GIT_DEPRECATE_HARD
|
1513
1515
|
void *git_odb_backend_malloc(git_odb_backend *backend, size_t len)
|
1514
1516
|
{
|
1515
1517
|
return git_odb_backend_data_alloc(backend, len);
|
1516
1518
|
}
|
1519
|
+
#endif
|
1517
1520
|
|
1518
1521
|
void git_odb_backend_data_free(git_odb_backend *backend, void *data)
|
1519
1522
|
{
|
@@ -304,7 +304,7 @@ static int read_loose_standard(git_rawobj *out, git_buf *obj)
|
|
304
304
|
* (including the initial sequence in the head buffer).
|
305
305
|
*/
|
306
306
|
if (GIT_ADD_SIZET_OVERFLOW(&alloc_size, hdr.size, 1) ||
|
307
|
-
(body =
|
307
|
+
(body = git__calloc(1, alloc_size)) == NULL) {
|
308
308
|
error = -1;
|
309
309
|
goto done;
|
310
310
|
}
|
@@ -386,8 +386,8 @@ static int read_header_loose_standard(
|
|
386
386
|
git_rawobj *out, const unsigned char *data, size_t len)
|
387
387
|
{
|
388
388
|
git_zstream zs = GIT_ZSTREAM_INIT;
|
389
|
-
obj_hdr hdr;
|
390
|
-
unsigned char inflated[MAX_HEADER_LEN];
|
389
|
+
obj_hdr hdr = {0};
|
390
|
+
unsigned char inflated[MAX_HEADER_LEN] = {0};
|
391
391
|
size_t header_len, inflated_len = sizeof(inflated);
|
392
392
|
int error;
|
393
393
|
|