rugged 0.18.0.gh.de28323 → 0.19.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +9 -4
- data/Rakefile +1 -1
- data/ext/rugged/extconf.rb +10 -0
- data/ext/rugged/rugged.c +153 -86
- data/ext/rugged/rugged.h +44 -33
- data/ext/rugged/rugged_blob.c +288 -60
- data/ext/rugged/rugged_branch.c +82 -57
- data/ext/rugged/rugged_commit.c +83 -86
- data/ext/rugged/rugged_config.c +68 -68
- data/ext/rugged/rugged_diff.c +509 -0
- data/ext/rugged/rugged_diff_delta.c +94 -0
- data/ext/rugged/rugged_diff_hunk.c +100 -0
- data/ext/rugged/rugged_diff_line.c +79 -0
- data/ext/rugged/rugged_diff_patch.c +169 -0
- data/ext/rugged/rugged_index.c +539 -8
- data/ext/rugged/rugged_note.c +74 -80
- data/ext/rugged/rugged_object.c +63 -8
- data/ext/rugged/rugged_reference.c +231 -145
- data/ext/rugged/rugged_remote.c +509 -53
- data/ext/rugged/rugged_repo.c +572 -236
- data/ext/rugged/rugged_revwalk.c +59 -36
- data/ext/rugged/rugged_settings.c +7 -9
- data/ext/rugged/rugged_signature.c +7 -11
- data/ext/rugged/rugged_tag.c +93 -39
- data/ext/rugged/rugged_tree.c +321 -58
- data/lib/rugged.rb +1 -0
- data/lib/rugged/commit.rb +16 -1
- data/lib/rugged/console.rb +9 -0
- data/lib/rugged/diff.rb +19 -0
- data/lib/rugged/diff/delta.rb +54 -0
- data/lib/rugged/diff/hunk.rb +23 -0
- data/lib/rugged/diff/line.rb +29 -0
- data/lib/rugged/diff/patch.rb +28 -0
- data/lib/rugged/repository.rb +36 -39
- data/lib/rugged/version.rb +1 -1
- data/test/blob_test.rb +308 -1
- data/test/branch_test.rb +7 -0
- data/test/commit_test.rb +7 -10
- data/test/coverage/cover.rb +9 -1
- data/test/diff_test.rb +777 -0
- data/test/fixtures/archive.tar.gz +0 -0
- data/test/fixtures/attr/attr0 +1 -0
- data/test/fixtures/attr/attr1 +29 -0
- data/test/fixtures/attr/attr2 +21 -0
- data/test/fixtures/attr/attr3 +4 -0
- data/test/fixtures/attr/binfile +1 -0
- data/test/fixtures/attr/dir/file +0 -0
- data/test/fixtures/attr/file +1 -0
- data/test/fixtures/attr/gitattributes +29 -0
- data/test/fixtures/attr/gitignore +2 -0
- data/test/fixtures/attr/ign +1 -0
- data/test/fixtures/attr/macro_bad +1 -0
- data/test/fixtures/attr/macro_test +1 -0
- data/test/fixtures/attr/root_test1 +1 -0
- data/test/fixtures/attr/root_test2 +6 -0
- data/test/fixtures/attr/root_test3 +19 -0
- data/test/fixtures/attr/root_test4.txt +14 -0
- data/test/fixtures/attr/sub/abc +37 -0
- data/test/fixtures/attr/sub/dir/file +0 -0
- data/test/fixtures/attr/sub/file +1 -0
- data/test/fixtures/attr/sub/ign/file +1 -0
- data/test/fixtures/attr/sub/ign/sub/file +1 -0
- data/test/fixtures/attr/sub/sub/dir +0 -0
- data/test/fixtures/attr/sub/sub/file +1 -0
- data/test/fixtures/attr/sub/sub/subsub.txt +1 -0
- data/test/fixtures/attr/sub/subdir_test1 +2 -0
- data/test/fixtures/attr/sub/subdir_test2.txt +1 -0
- data/test/fixtures/diff/another.txt +38 -0
- data/test/fixtures/diff/readme.txt +36 -0
- data/test/fixtures/mergedrepo/conflicts-one.txt +5 -0
- data/test/fixtures/mergedrepo/conflicts-two.txt +5 -0
- data/test/fixtures/mergedrepo/one.txt +10 -0
- data/test/fixtures/mergedrepo/two.txt +12 -0
- data/test/fixtures/status/current_file +1 -0
- data/test/fixtures/status/ignored_file +1 -0
- data/test/fixtures/status/modified_file +2 -0
- data/test/fixtures/status/new_file +1 -0
- data/test/fixtures/status/staged_changes +2 -0
- data/test/fixtures/status/staged_changes_modified_file +3 -0
- data/test/fixtures/status/staged_delete_modified_file +1 -0
- data/test/fixtures/status/staged_new_file +1 -0
- data/test/fixtures/status/staged_new_file_modified_file +2 -0
- data/test/fixtures/status/subdir.txt +2 -0
- data/test/fixtures/status/subdir/current_file +1 -0
- data/test/fixtures/status/subdir/modified_file +2 -0
- data/test/fixtures/status/subdir/new_file +1 -0
- data/test/fixtures/status//350/277/231 +1 -0
- data/test/fixtures/testrepo.git/config +5 -0
- data/test/fixtures/testrepo.git/objects/77/71329dfa3002caf8c61a0ceb62a31d09023f37 +0 -0
- data/test/fixtures/text_file.md +464 -0
- data/test/fixtures/unsymlinked.git/HEAD +1 -0
- data/test/fixtures/unsymlinked.git/config +6 -0
- data/test/fixtures/unsymlinked.git/description +1 -0
- data/test/fixtures/unsymlinked.git/info/exclude +2 -0
- data/test/fixtures/unsymlinked.git/objects/08/8b64704e0d6b8bd061dea879418cb5442a3fbf +0 -0
- data/test/fixtures/unsymlinked.git/objects/13/a5e939bca25940c069fd2169d993dba328e30b +0 -0
- data/test/fixtures/unsymlinked.git/objects/19/bf568e59e3a0b363cafb4106226e62d4a4c41c +0 -0
- data/test/fixtures/unsymlinked.git/objects/58/1fadd35b4cf320d102a152f918729011604773 +0 -0
- data/test/fixtures/unsymlinked.git/objects/5c/87b6791e8b13da658a14d1ef7e09b5dc3bac8c +0 -0
- data/test/fixtures/unsymlinked.git/objects/6f/e5f5398af85fb3de8a6aba0339b6d3bfa26a27 +0 -0
- data/test/fixtures/unsymlinked.git/objects/7f/ccd75616ec188b8f1b23d67506a334cc34a49d +0 -0
- data/test/fixtures/unsymlinked.git/objects/80/6999882bf91d24241e4077906b9017605eb1f3 +0 -0
- data/test/fixtures/unsymlinked.git/objects/83/7d176303c5005505ec1e4a30231c40930c0230 +0 -0
- data/test/fixtures/unsymlinked.git/objects/a8/595ccca04f40818ae0155c8f9c77a230e597b6 +2 -0
- data/test/fixtures/unsymlinked.git/objects/cf/8f1cf5cce859c438d6cc067284cb5e161206e7 +0 -0
- data/test/fixtures/unsymlinked.git/objects/d5/278d05c8607ec420bfee4cf219fbc0eeebfd6a +0 -0
- data/test/fixtures/unsymlinked.git/objects/f4/e16fb76536591a41454194058d048d8e4dd2e9 +0 -0
- data/test/fixtures/unsymlinked.git/objects/f9/e65619d93fdf2673882e0a261c5e93b1a84006 +0 -0
- data/test/fixtures/unsymlinked.git/refs/heads/exe-file +1 -0
- data/test/fixtures/unsymlinked.git/refs/heads/master +1 -0
- data/test/fixtures/unsymlinked.git/refs/heads/reg-file +1 -0
- data/test/index_test.rb +120 -0
- data/test/reference_test.rb +38 -3
- data/test/remote_test.rb +224 -3
- data/test/repo_reset_test.rb +2 -0
- data/test/repo_test.rb +147 -10
- data/test/test_helper.rb +5 -2
- data/vendor/libgit2/include/git2/attr.h +3 -3
- data/vendor/libgit2/include/git2/blob.h +11 -17
- data/vendor/libgit2/include/git2/branch.h +3 -2
- data/vendor/libgit2/include/git2/checkout.h +7 -0
- data/vendor/libgit2/include/git2/clone.h +3 -0
- data/vendor/libgit2/include/git2/commit.h +61 -66
- data/vendor/libgit2/include/git2/common.h +73 -42
- data/vendor/libgit2/include/git2/config.h +57 -71
- data/vendor/libgit2/include/git2/cred_helpers.h +2 -2
- data/vendor/libgit2/include/git2/diff.h +179 -30
- data/vendor/libgit2/include/git2/errors.h +3 -3
- data/vendor/libgit2/include/git2/index.h +225 -146
- data/vendor/libgit2/include/git2/indexer.h +2 -22
- data/vendor/libgit2/include/git2/inttypes.h +9 -9
- data/vendor/libgit2/include/git2/merge.h +123 -5
- data/vendor/libgit2/include/git2/odb.h +59 -38
- data/vendor/libgit2/include/git2/odb_backend.h +45 -104
- data/vendor/libgit2/include/git2/oid.h +30 -19
- data/vendor/libgit2/include/git2/pack.h +21 -3
- data/vendor/libgit2/include/git2/refdb.h +0 -35
- data/vendor/libgit2/include/git2/refs.h +93 -31
- data/vendor/libgit2/include/git2/refspec.h +17 -0
- data/vendor/libgit2/include/git2/remote.h +60 -20
- data/vendor/libgit2/include/git2/repository.h +48 -70
- data/vendor/libgit2/include/git2/reset.h +3 -3
- data/vendor/libgit2/include/git2/revparse.h +22 -0
- data/vendor/libgit2/include/git2/stash.h +1 -1
- data/vendor/libgit2/include/git2/status.h +131 -56
- data/vendor/libgit2/include/git2/strarray.h +2 -2
- data/vendor/libgit2/include/git2/submodule.h +16 -16
- data/vendor/libgit2/include/git2/sys/commit.h +46 -0
- data/vendor/libgit2/include/git2/sys/config.h +71 -0
- data/vendor/libgit2/include/git2/sys/index.h +179 -0
- data/vendor/libgit2/include/git2/sys/odb_backend.h +86 -0
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +158 -0
- data/vendor/libgit2/include/git2/sys/refs.h +38 -0
- data/vendor/libgit2/include/git2/sys/repository.h +106 -0
- data/vendor/libgit2/include/git2/tag.h +44 -18
- data/vendor/libgit2/include/git2/trace.h +1 -2
- data/vendor/libgit2/include/git2/transport.h +74 -0
- data/vendor/libgit2/include/git2/tree.h +12 -22
- data/vendor/libgit2/include/git2/types.h +33 -0
- data/vendor/libgit2/include/git2/version.h +2 -2
- data/vendor/libgit2/src/array.h +66 -0
- data/vendor/libgit2/src/attr.c +26 -13
- data/vendor/libgit2/src/attr_file.c +3 -2
- data/vendor/libgit2/src/attr_file.h +3 -3
- data/vendor/libgit2/src/attrcache.h +4 -4
- data/vendor/libgit2/src/blob.c +13 -9
- data/vendor/libgit2/src/blob.h +2 -2
- data/vendor/libgit2/src/branch.c +67 -49
- data/vendor/libgit2/src/cache.c +224 -54
- data/vendor/libgit2/src/cache.h +33 -20
- data/vendor/libgit2/src/checkout.c +145 -85
- data/vendor/libgit2/src/clone.c +62 -50
- data/vendor/libgit2/src/commit.c +74 -40
- data/vendor/libgit2/src/commit.h +2 -3
- data/vendor/libgit2/src/commit_list.c +14 -8
- data/vendor/libgit2/src/config.c +119 -36
- data/vendor/libgit2/src/config.h +3 -0
- data/vendor/libgit2/src/config_cache.c +24 -7
- data/vendor/libgit2/src/config_file.c +9 -6
- data/vendor/libgit2/src/crlf.c +4 -2
- data/vendor/libgit2/src/date.c +3 -3
- data/vendor/libgit2/src/delta.c +1 -1
- data/vendor/libgit2/src/diff.c +681 -303
- data/vendor/libgit2/src/diff.h +34 -2
- data/vendor/libgit2/src/diff_driver.c +405 -0
- data/vendor/libgit2/src/diff_driver.h +49 -0
- data/vendor/libgit2/src/diff_file.c +447 -0
- data/vendor/libgit2/src/diff_file.h +58 -0
- data/vendor/libgit2/src/diff_patch.c +995 -0
- data/vendor/libgit2/src/diff_patch.h +46 -0
- data/vendor/libgit2/src/diff_print.c +430 -0
- data/vendor/libgit2/src/diff_tform.c +464 -203
- data/vendor/libgit2/src/diff_xdiff.c +166 -0
- data/vendor/libgit2/src/diff_xdiff.h +28 -0
- data/vendor/libgit2/src/fetch.c +11 -4
- data/vendor/libgit2/src/fileops.c +85 -61
- data/vendor/libgit2/src/fileops.h +4 -0
- data/vendor/libgit2/src/global.c +10 -2
- data/vendor/libgit2/src/global.h +0 -8
- data/vendor/libgit2/src/hash/hash_generic.h +3 -3
- data/vendor/libgit2/src/hash/hash_win32.h +4 -4
- data/vendor/libgit2/src/hashsig.c +0 -1
- data/vendor/libgit2/src/ignore.c +68 -28
- data/vendor/libgit2/src/ignore.h +10 -1
- data/vendor/libgit2/src/index.c +666 -84
- data/vendor/libgit2/src/index.h +6 -0
- data/vendor/libgit2/src/indexer.c +10 -28
- data/vendor/libgit2/src/iterator.c +427 -283
- data/vendor/libgit2/src/iterator.h +58 -4
- data/vendor/libgit2/src/merge.c +1892 -32
- data/vendor/libgit2/src/merge.h +132 -5
- data/vendor/libgit2/src/merge_file.c +174 -0
- data/vendor/libgit2/src/merge_file.h +71 -0
- data/vendor/libgit2/src/mwindow.c +1 -1
- data/vendor/libgit2/src/notes.c +45 -48
- data/vendor/libgit2/src/object.c +89 -127
- data/vendor/libgit2/src/object.h +0 -1
- data/vendor/libgit2/src/object_api.c +129 -0
- data/vendor/libgit2/src/odb.c +156 -59
- data/vendor/libgit2/src/odb.h +5 -2
- data/vendor/libgit2/src/odb_loose.c +31 -17
- data/vendor/libgit2/src/odb_pack.c +39 -43
- data/vendor/libgit2/src/oid.c +62 -27
- data/vendor/libgit2/src/oid.h +33 -0
- data/vendor/libgit2/src/oidmap.h +4 -6
- data/vendor/libgit2/src/pack-objects.c +54 -22
- data/vendor/libgit2/src/pack.c +98 -56
- data/vendor/libgit2/src/pack.h +3 -1
- data/vendor/libgit2/src/pathspec.c +26 -1
- data/vendor/libgit2/src/pathspec.h +14 -0
- data/vendor/libgit2/src/pool.c +5 -0
- data/vendor/libgit2/src/posix.c +2 -2
- data/vendor/libgit2/src/posix.h +3 -0
- data/vendor/libgit2/src/push.c +13 -10
- data/vendor/libgit2/src/refdb.c +82 -62
- data/vendor/libgit2/src/refdb.h +16 -16
- data/vendor/libgit2/src/refdb_fs.c +386 -133
- data/vendor/libgit2/src/reflog.c +3 -1
- data/vendor/libgit2/src/refs.c +247 -221
- data/vendor/libgit2/src/refs.h +2 -1
- data/vendor/libgit2/src/refspec.c +18 -1
- data/vendor/libgit2/src/refspec.h +3 -1
- data/vendor/libgit2/src/remote.c +434 -253
- data/vendor/libgit2/src/remote.h +5 -3
- data/vendor/libgit2/src/repository.c +197 -111
- data/vendor/libgit2/src/repository.h +26 -5
- data/vendor/libgit2/src/reset.c +1 -1
- data/vendor/libgit2/src/revparse.c +84 -79
- data/vendor/libgit2/src/revwalk.c +1 -1
- data/vendor/libgit2/src/signature.c +22 -10
- data/vendor/libgit2/src/stash.c +5 -2
- data/vendor/libgit2/src/status.c +311 -107
- data/vendor/libgit2/src/status.h +23 -0
- data/vendor/libgit2/src/submodule.c +21 -13
- data/vendor/libgit2/src/tag.c +42 -31
- data/vendor/libgit2/src/tag.h +2 -3
- data/vendor/libgit2/src/thread-utils.h +105 -3
- data/vendor/libgit2/src/trace.c +1 -2
- data/vendor/libgit2/src/trace.h +3 -3
- data/vendor/libgit2/src/transport.c +18 -6
- data/vendor/libgit2/src/transports/cred.c +103 -1
- data/vendor/libgit2/src/transports/local.c +19 -9
- data/vendor/libgit2/src/transports/smart_protocol.c +32 -12
- data/vendor/libgit2/src/transports/ssh.c +519 -0
- data/vendor/libgit2/src/transports/winhttp.c +3 -1
- data/vendor/libgit2/src/tree.c +26 -28
- data/vendor/libgit2/src/tree.h +3 -3
- data/vendor/libgit2/src/unix/posix.h +2 -0
- data/vendor/libgit2/src/util.c +43 -6
- data/vendor/libgit2/src/util.h +40 -12
- data/vendor/libgit2/src/vector.c +3 -5
- data/vendor/libgit2/src/vector.h +9 -0
- data/vendor/libgit2/src/win32/dir.c +1 -1
- data/vendor/libgit2/src/win32/error.c +2 -0
- data/vendor/libgit2/src/win32/findfile.c +3 -6
- data/vendor/libgit2/src/win32/posix_w32.c +85 -59
- data/vendor/libgit2/src/win32/pthread.c +16 -8
- data/vendor/libgit2/src/win32/pthread.h +7 -4
- metadata +407 -306
- data/test/coverage/HEAD.json +0 -1
- data/vendor/libgit2/include/git2/refdb_backend.h +0 -109
- data/vendor/libgit2/src/diff_output.c +0 -1819
- data/vendor/libgit2/src/diff_output.h +0 -93
@@ -19,6 +19,8 @@
|
|
19
19
|
#include <winhttp.h>
|
20
20
|
#pragma comment(lib, "winhttp")
|
21
21
|
|
22
|
+
#include <strsafe.h>
|
23
|
+
|
22
24
|
/* For UuidCreate */
|
23
25
|
#pragma comment(lib, "rpcrt4")
|
24
26
|
|
@@ -893,7 +895,7 @@ static int winhttp_connect(
|
|
893
895
|
wchar_t *ua = L"git/1.0 (libgit2 " WIDEN(LIBGIT2_VERSION) L")";
|
894
896
|
wchar_t host[GIT_WIN_PATH];
|
895
897
|
int32_t port;
|
896
|
-
const char *default_port;
|
898
|
+
const char *default_port = "80";
|
897
899
|
int ret;
|
898
900
|
|
899
901
|
if (!git__prefixcmp(url, prefix_http)) {
|
data/vendor/libgit2/src/tree.c
CHANGED
@@ -10,6 +10,9 @@
|
|
10
10
|
#include "tree.h"
|
11
11
|
#include "git2/repository.h"
|
12
12
|
#include "git2/object.h"
|
13
|
+
#include "path.h"
|
14
|
+
#include "tree-cache.h"
|
15
|
+
#include "index.h"
|
13
16
|
|
14
17
|
#define DEFAULT_TREE_SIZE 16
|
15
18
|
#define MAX_FILEMODE_BYTES 6
|
@@ -149,7 +152,7 @@ static int tree_key_search(
|
|
149
152
|
/* Initial homing search; find an entry on the tree with
|
150
153
|
* the same prefix as the filename we're looking for */
|
151
154
|
if (git_vector_bsearch2(&homing, entries, &homing_search_cmp, &ksearch) < 0)
|
152
|
-
return GIT_ENOTFOUND;
|
155
|
+
return GIT_ENOTFOUND; /* just a signal error; not passed back to user */
|
153
156
|
|
154
157
|
/* We found a common prefix. Look forward as long as
|
155
158
|
* there are entries that share the common prefix */
|
@@ -219,8 +222,9 @@ git_tree_entry *git_tree_entry_dup(const git_tree_entry *entry)
|
|
219
222
|
return copy;
|
220
223
|
}
|
221
224
|
|
222
|
-
void git_tree__free(
|
225
|
+
void git_tree__free(void *_tree)
|
223
226
|
{
|
227
|
+
git_tree *tree = _tree;
|
224
228
|
size_t i;
|
225
229
|
git_tree_entry *e;
|
226
230
|
|
@@ -231,16 +235,6 @@ void git_tree__free(git_tree *tree)
|
|
231
235
|
git__free(tree);
|
232
236
|
}
|
233
237
|
|
234
|
-
const git_oid *git_tree_id(const git_tree *t)
|
235
|
-
{
|
236
|
-
return git_object_id((const git_object *)t);
|
237
|
-
}
|
238
|
-
|
239
|
-
git_repository *git_tree_owner(const git_tree *t)
|
240
|
-
{
|
241
|
-
return git_object_owner((const git_object *)t);
|
242
|
-
}
|
243
|
-
|
244
238
|
git_filemode_t git_tree_entry_filemode(const git_tree_entry *entry)
|
245
239
|
{
|
246
240
|
return (git_filemode_t)entry->attr;
|
@@ -280,25 +274,27 @@ int git_tree_entry_to_object(
|
|
280
274
|
}
|
281
275
|
|
282
276
|
static const git_tree_entry *entry_fromname(
|
283
|
-
git_tree *tree, const char *name, size_t name_len)
|
277
|
+
const git_tree *tree, const char *name, size_t name_len)
|
284
278
|
{
|
285
279
|
size_t idx;
|
286
280
|
|
287
|
-
|
281
|
+
assert(tree->entries.sorted); /* be safe when we cast away constness */
|
282
|
+
|
283
|
+
if (tree_key_search(&idx, (git_vector *)&tree->entries, name, name_len) < 0)
|
288
284
|
return NULL;
|
289
285
|
|
290
286
|
return git_vector_get(&tree->entries, idx);
|
291
287
|
}
|
292
288
|
|
293
289
|
const git_tree_entry *git_tree_entry_byname(
|
294
|
-
git_tree *tree, const char *filename)
|
290
|
+
const git_tree *tree, const char *filename)
|
295
291
|
{
|
296
292
|
assert(tree && filename);
|
297
293
|
return entry_fromname(tree, filename, strlen(filename));
|
298
294
|
}
|
299
295
|
|
300
296
|
const git_tree_entry *git_tree_entry_byindex(
|
301
|
-
git_tree *tree, size_t idx)
|
297
|
+
const git_tree *tree, size_t idx)
|
302
298
|
{
|
303
299
|
assert(tree);
|
304
300
|
return git_vector_get(&tree->entries, idx);
|
@@ -320,9 +316,9 @@ const git_tree_entry *git_tree_entry_byoid(
|
|
320
316
|
return NULL;
|
321
317
|
}
|
322
318
|
|
323
|
-
int git_tree__prefix_position(git_tree *tree, const char *path)
|
319
|
+
int git_tree__prefix_position(const git_tree *tree, const char *path)
|
324
320
|
{
|
325
|
-
git_vector *entries = &tree->entries;
|
321
|
+
const git_vector *entries = &tree->entries;
|
326
322
|
struct tree_key_search ksearch;
|
327
323
|
size_t at_pos;
|
328
324
|
|
@@ -332,8 +328,11 @@ int git_tree__prefix_position(git_tree *tree, const char *path)
|
|
332
328
|
ksearch.filename = path;
|
333
329
|
ksearch.filename_len = strlen(path);
|
334
330
|
|
331
|
+
assert(tree->entries.sorted); /* be safe when we cast away constness */
|
332
|
+
|
335
333
|
/* Find tree entry with appropriate prefix */
|
336
|
-
git_vector_bsearch2(
|
334
|
+
git_vector_bsearch2(
|
335
|
+
&at_pos, (git_vector *)entries, &homing_search_cmp, &ksearch);
|
337
336
|
|
338
337
|
for (; at_pos < entries->length; ++at_pos) {
|
339
338
|
const git_tree_entry *entry = entries->contents[at_pos];
|
@@ -371,8 +370,12 @@ static int tree_error(const char *str, const char *path)
|
|
371
370
|
return -1;
|
372
371
|
}
|
373
372
|
|
374
|
-
|
373
|
+
int git_tree__parse(void *_tree, git_odb_object *odb_obj)
|
375
374
|
{
|
375
|
+
git_tree *tree = _tree;
|
376
|
+
const char *buffer = git_odb_object_data(odb_obj);
|
377
|
+
const char *buffer_end = buffer + git_odb_object_size(odb_obj);
|
378
|
+
|
376
379
|
if (git_vector_init(&tree->entries, DEFAULT_TREE_SIZE, entry_sort_cmp) < 0)
|
377
380
|
return -1;
|
378
381
|
|
@@ -413,13 +416,9 @@ static int tree_parse_buffer(git_tree *tree, const char *buffer, const char *buf
|
|
413
416
|
buffer += GIT_OID_RAWSZ;
|
414
417
|
}
|
415
418
|
|
416
|
-
|
417
|
-
}
|
419
|
+
git_vector_sort(&tree->entries);
|
418
420
|
|
419
|
-
|
420
|
-
{
|
421
|
-
assert(tree);
|
422
|
-
return tree_parse_buffer(tree, (char *)obj->raw.data, (char *)obj->raw.data + obj->raw.len);
|
421
|
+
return 0;
|
423
422
|
}
|
424
423
|
|
425
424
|
static size_t find_next_dir(const char *dirname, git_index *index, size_t start)
|
@@ -525,7 +524,6 @@ static int write_tree(
|
|
525
524
|
/* Write out the subtree */
|
526
525
|
written = write_tree(&sub_oid, repo, index, subdir, i);
|
527
526
|
if (written < 0) {
|
528
|
-
tree_error("Failed to write subtree", subdir);
|
529
527
|
git__free(subdir);
|
530
528
|
goto on_error;
|
531
529
|
} else {
|
@@ -808,7 +806,7 @@ static size_t subpath_len(const char *path)
|
|
808
806
|
|
809
807
|
int git_tree_entry_bypath(
|
810
808
|
git_tree_entry **entry_out,
|
811
|
-
git_tree *root,
|
809
|
+
const git_tree *root,
|
812
810
|
const char *path)
|
813
811
|
{
|
814
812
|
int error = 0;
|
data/vendor/libgit2/src/tree.h
CHANGED
@@ -37,8 +37,8 @@ GIT_INLINE(bool) git_tree_entry__is_tree(const struct git_tree_entry *e)
|
|
37
37
|
|
38
38
|
extern int git_tree_entry_icmp(const git_tree_entry *e1, const git_tree_entry *e2);
|
39
39
|
|
40
|
-
void git_tree__free(
|
41
|
-
int git_tree__parse(
|
40
|
+
void git_tree__free(void *tree);
|
41
|
+
int git_tree__parse(void *tree, git_odb_object *obj);
|
42
42
|
|
43
43
|
/**
|
44
44
|
* Lookup the first position in the tree with a given prefix.
|
@@ -47,7 +47,7 @@ int git_tree__parse(git_tree *tree, git_odb_object *obj);
|
|
47
47
|
* @param prefix the beginning of a path to find in the tree.
|
48
48
|
* @return index of the first item at or after the given prefix.
|
49
49
|
*/
|
50
|
-
int git_tree__prefix_position(git_tree *tree, const char *prefix);
|
50
|
+
int git_tree__prefix_position(const git_tree *tree, const char *prefix);
|
51
51
|
|
52
52
|
|
53
53
|
/**
|
data/vendor/libgit2/src/util.c
CHANGED
@@ -11,6 +11,7 @@
|
|
11
11
|
#include <ctype.h>
|
12
12
|
#include "posix.h"
|
13
13
|
#include "fileops.h"
|
14
|
+
#include "cache.h"
|
14
15
|
|
15
16
|
#ifdef _MSC_VER
|
16
17
|
# include <Shlwapi.h>
|
@@ -38,7 +39,6 @@ int git_libgit2_capabilities()
|
|
38
39
|
/* Declarations for tuneable settings */
|
39
40
|
extern size_t git_mwindow__window_size;
|
40
41
|
extern size_t git_mwindow__mapped_limit;
|
41
|
-
extern size_t git_odb__cache_size;
|
42
42
|
|
43
43
|
static int config_level_to_futils_dir(int config_level)
|
44
44
|
{
|
@@ -94,12 +94,25 @@ int git_libgit2_opts(int key, ...)
|
|
94
94
|
error = git_futils_dirs_set(error, va_arg(ap, const char *));
|
95
95
|
break;
|
96
96
|
|
97
|
-
case
|
98
|
-
|
97
|
+
case GIT_OPT_SET_CACHE_OBJECT_LIMIT:
|
98
|
+
{
|
99
|
+
git_otype type = (git_otype)va_arg(ap, int);
|
100
|
+
size_t size = va_arg(ap, size_t);
|
101
|
+
error = git_cache_set_max_object_size(type, size);
|
102
|
+
break;
|
103
|
+
}
|
104
|
+
|
105
|
+
case GIT_OPT_SET_CACHE_MAX_SIZE:
|
106
|
+
git_cache__max_storage = va_arg(ap, ssize_t);
|
99
107
|
break;
|
100
108
|
|
101
|
-
case
|
102
|
-
|
109
|
+
case GIT_OPT_ENABLE_CACHING:
|
110
|
+
git_cache__enabled = (va_arg(ap, int) != 0);
|
111
|
+
break;
|
112
|
+
|
113
|
+
case GIT_OPT_GET_CACHED_MEMORY:
|
114
|
+
*(va_arg(ap, ssize_t *)) = git_cache__current_storage.val;
|
115
|
+
*(va_arg(ap, ssize_t *)) = git_cache__max_storage;
|
103
116
|
break;
|
104
117
|
}
|
105
118
|
|
@@ -266,6 +279,28 @@ int git__strcasecmp(const char *a, const char *b)
|
|
266
279
|
return (tolower(*a) - tolower(*b));
|
267
280
|
}
|
268
281
|
|
282
|
+
int git__strcasesort_cmp(const char *a, const char *b)
|
283
|
+
{
|
284
|
+
int cmp = 0;
|
285
|
+
|
286
|
+
while (*a && *b) {
|
287
|
+
if (*a != *b) {
|
288
|
+
if (tolower(*a) != tolower(*b))
|
289
|
+
break;
|
290
|
+
/* use case in sort order even if not in equivalence */
|
291
|
+
if (!cmp)
|
292
|
+
cmp = (int)(*(const uint8_t *)a) - (int)(*(const uint8_t *)b);
|
293
|
+
}
|
294
|
+
|
295
|
+
++a, ++b;
|
296
|
+
}
|
297
|
+
|
298
|
+
if (*a || *b)
|
299
|
+
return tolower(*a) - tolower(*b);
|
300
|
+
|
301
|
+
return cmp;
|
302
|
+
}
|
303
|
+
|
269
304
|
int git__strncmp(const char *a, const char *b, size_t sz)
|
270
305
|
{
|
271
306
|
while (sz && *a && *b && *a == *b)
|
@@ -672,7 +707,9 @@ static int GIT_STDLIB_CALL git__qsort_r_glue_cmp(
|
|
672
707
|
void git__qsort_r(
|
673
708
|
void *els, size_t nel, size_t elsize, git__sort_r_cmp cmp, void *payload)
|
674
709
|
{
|
675
|
-
#if defined(__MINGW32__) || defined(__OpenBSD__)
|
710
|
+
#if defined(__MINGW32__) || defined(__OpenBSD__) || defined(AMIGA) || \
|
711
|
+
defined(__gnu_hurd__) || \
|
712
|
+
(__GLIBC__ == 2 && __GLIBC_MINOR__ < 8)
|
676
713
|
git__insertsort_r(els, nel, elsize, NULL, cmp, payload);
|
677
714
|
#elif defined(GIT_WIN32)
|
678
715
|
git__qsort_r_glue glue = { cmp, payload };
|
data/vendor/libgit2/src/util.h
CHANGED
@@ -7,6 +7,8 @@
|
|
7
7
|
#ifndef INCLUDE_util_h__
|
8
8
|
#define INCLUDE_util_h__
|
9
9
|
|
10
|
+
#include "common.h"
|
11
|
+
|
10
12
|
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
|
11
13
|
#define bitsizeof(x) (CHAR_BIT * sizeof(x))
|
12
14
|
#define MSB(x, bits) ((x) & (~0ULL << (bitsizeof(x) - (bits))))
|
@@ -107,6 +109,13 @@ GIT_INLINE(int) git__is_sizet(git_off_t p)
|
|
107
109
|
return p == (git_off_t)r;
|
108
110
|
}
|
109
111
|
|
112
|
+
/** @return true if p fits into the range of a uint32_t */
|
113
|
+
GIT_INLINE(int) git__is_uint32(size_t p)
|
114
|
+
{
|
115
|
+
uint32_t r = (uint32_t)p;
|
116
|
+
return p == (size_t)r;
|
117
|
+
}
|
118
|
+
|
110
119
|
/* 32-bit cross-platform rotl */
|
111
120
|
#ifdef _MSC_VER /* use built-in method in MSVC */
|
112
121
|
# define git__rotl(v, s) (uint32_t)_rotl(v, s)
|
@@ -185,21 +194,25 @@ extern int git__strcasecmp(const char *a, const char *b);
|
|
185
194
|
extern int git__strncmp(const char *a, const char *b, size_t sz);
|
186
195
|
extern int git__strncasecmp(const char *a, const char *b, size_t sz);
|
187
196
|
|
197
|
+
extern int git__strcasesort_cmp(const char *a, const char *b);
|
198
|
+
|
199
|
+
#include "thread-utils.h"
|
200
|
+
|
188
201
|
typedef struct {
|
189
|
-
|
202
|
+
git_atomic refcount;
|
190
203
|
void *owner;
|
191
204
|
} git_refcount;
|
192
205
|
|
193
206
|
typedef void (*git_refcount_freeptr)(void *r);
|
194
207
|
|
195
208
|
#define GIT_REFCOUNT_INC(r) { \
|
196
|
-
((git_refcount *)(r))->refcount
|
209
|
+
git_atomic_inc(&((git_refcount *)(r))->refcount); \
|
197
210
|
}
|
198
211
|
|
199
212
|
#define GIT_REFCOUNT_DEC(_r, do_free) { \
|
200
213
|
git_refcount *r = (git_refcount *)(_r); \
|
201
|
-
r->refcount
|
202
|
-
if (
|
214
|
+
int val = git_atomic_dec(&r->refcount); \
|
215
|
+
if (val <= 0 && r->owner == NULL) { do_free(_r); } \
|
203
216
|
}
|
204
217
|
|
205
218
|
#define GIT_REFCOUNT_OWN(r, o) { \
|
@@ -260,22 +273,22 @@ GIT_INLINE(size_t) git__size_t_powerof2(size_t v)
|
|
260
273
|
|
261
274
|
GIT_INLINE(bool) git__isupper(int c)
|
262
275
|
{
|
263
|
-
|
276
|
+
return (c >= 'A' && c <= 'Z');
|
264
277
|
}
|
265
278
|
|
266
279
|
GIT_INLINE(bool) git__isalpha(int c)
|
267
280
|
{
|
268
|
-
|
281
|
+
return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'));
|
269
282
|
}
|
270
283
|
|
271
284
|
GIT_INLINE(bool) git__isdigit(int c)
|
272
285
|
{
|
273
|
-
|
286
|
+
return (c >= '0' && c <= '9');
|
274
287
|
}
|
275
288
|
|
276
289
|
GIT_INLINE(bool) git__isspace(int c)
|
277
290
|
{
|
278
|
-
|
291
|
+
return (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r' || c == '\v' || c == 0x85 /* Unicode CR+LF */);
|
279
292
|
}
|
280
293
|
|
281
294
|
GIT_INLINE(bool) git__iswildcard(int c)
|
@@ -284,8 +297,7 @@ GIT_INLINE(bool) git__iswildcard(int c)
|
|
284
297
|
}
|
285
298
|
|
286
299
|
/*
|
287
|
-
* Parse a string value as a boolean, just like Core Git
|
288
|
-
* does.
|
300
|
+
* Parse a string value as a boolean, just like Core Git does.
|
289
301
|
*
|
290
302
|
* Valid values for true are: 'true', 'yes', 'on'
|
291
303
|
* Valid values for false are: 'false', 'no', 'off'
|
@@ -300,15 +312,31 @@ extern int git__parse_bool(int *out, const char *value);
|
|
300
312
|
* - "July 17, 2003"
|
301
313
|
* - "2003-7-17 08:23"
|
302
314
|
*/
|
303
|
-
int git__date_parse(git_time_t *out, const char *date);
|
315
|
+
extern int git__date_parse(git_time_t *out, const char *date);
|
304
316
|
|
305
317
|
/*
|
306
318
|
* Unescapes a string in-place.
|
307
|
-
*
|
319
|
+
*
|
308
320
|
* Edge cases behavior:
|
309
321
|
* - "jackie\" -> "jacky\"
|
310
322
|
* - "chan\\" -> "chan\"
|
311
323
|
*/
|
312
324
|
extern size_t git__unescape(char *str);
|
313
325
|
|
326
|
+
/*
|
327
|
+
* Safely zero-out memory, making sure that the compiler
|
328
|
+
* doesn't optimize away the operation.
|
329
|
+
*/
|
330
|
+
GIT_INLINE(void) git__memzero(void *data, size_t size)
|
331
|
+
{
|
332
|
+
#ifdef _MSC_VER
|
333
|
+
SecureZeroMemory((PVOID)data, size);
|
334
|
+
#else
|
335
|
+
volatile uint8_t *scan = (volatile uint8_t *)data;
|
336
|
+
|
337
|
+
while (size--)
|
338
|
+
*scan++ = 0x0;
|
339
|
+
#endif
|
340
|
+
}
|
341
|
+
|
314
342
|
#endif /* INCLUDE_util_h__ */
|
data/vendor/libgit2/src/vector.c
CHANGED
@@ -277,15 +277,13 @@ void git_vector_swap(git_vector *a, git_vector *b)
|
|
277
277
|
|
278
278
|
int git_vector_resize_to(git_vector *v, size_t new_length)
|
279
279
|
{
|
280
|
-
if (new_length <= v->length)
|
281
|
-
return 0;
|
282
|
-
|
283
280
|
if (new_length > v->_alloc_size &&
|
284
281
|
resize_vector(v, new_length) < 0)
|
285
282
|
return -1;
|
286
283
|
|
287
|
-
|
288
|
-
|
284
|
+
if (new_length > v->length)
|
285
|
+
memset(&v->contents[v->length], 0,
|
286
|
+
sizeof(void *) * (new_length - v->length));
|
289
287
|
|
290
288
|
v->length = new_length;
|
291
289
|
|
data/vendor/libgit2/src/vector.h
CHANGED
@@ -78,4 +78,13 @@ void git_vector_remove_matching(
|
|
78
78
|
int git_vector_resize_to(git_vector *v, size_t new_length);
|
79
79
|
int git_vector_set(void **old, git_vector *v, size_t position, void *value);
|
80
80
|
|
81
|
+
/** Set the comparison function used for sorting the vector */
|
82
|
+
GIT_INLINE(void) git_vector_set_cmp(git_vector *v, git_vector_cmp cmp)
|
83
|
+
{
|
84
|
+
if (cmp != v->_cmp) {
|
85
|
+
v->_cmp = cmp;
|
86
|
+
v->sorted = 0;
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
81
90
|
#endif
|