rugged 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -0
- data/README.md +1 -1
- data/ext/rugged/rugged.c +7 -4
- data/ext/rugged/rugged_object.c +1 -1
- data/ext/rugged/rugged_repo.c +3 -3
- data/lib/rugged/repository.rb +2 -2
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +11 -6
- data/vendor/libgit2/COPYING +109 -1
- data/vendor/libgit2/cmake/Findfutimens.cmake +14 -0
- data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +4 -0
- data/vendor/libgit2/cmake/SelectHashes.cmake +1 -0
- data/vendor/libgit2/deps/chromium-zlib/CMakeLists.txt +101 -0
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +17 -5
- data/vendor/libgit2/deps/ntlmclient/crypt.h +14 -9
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +20 -20
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +3 -3
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +37 -36
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +4 -3
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +178 -51
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +74 -5
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +150 -118
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +13 -9
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +16 -3
- data/vendor/libgit2/deps/ntlmclient/unicode.h +10 -4
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +16 -27
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.h +20 -0
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +28 -52
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.h +22 -0
- data/vendor/libgit2/include/git2/attr.h +89 -0
- data/vendor/libgit2/include/git2/blame.h +93 -42
- data/vendor/libgit2/include/git2/blob.h +14 -2
- data/vendor/libgit2/include/git2/branch.h +25 -0
- data/vendor/libgit2/include/git2/cert.h +42 -5
- data/vendor/libgit2/include/git2/checkout.h +28 -12
- data/vendor/libgit2/include/git2/commit.h +35 -19
- data/vendor/libgit2/include/git2/common.h +14 -4
- data/vendor/libgit2/include/git2/deprecated.h +206 -6
- data/vendor/libgit2/include/git2/diff.h +34 -19
- data/vendor/libgit2/include/git2/errors.h +6 -6
- data/vendor/libgit2/include/git2/filter.h +57 -17
- data/vendor/libgit2/include/git2/graph.h +20 -2
- data/vendor/libgit2/include/git2/index.h +2 -2
- data/vendor/libgit2/include/git2/odb.h +29 -0
- data/vendor/libgit2/include/git2/patch.h +8 -0
- data/vendor/libgit2/include/git2/rebase.h +25 -1
- data/vendor/libgit2/include/git2/refs.h +6 -2
- data/vendor/libgit2/include/git2/remote.h +59 -6
- data/vendor/libgit2/include/git2/revparse.h +5 -5
- data/vendor/libgit2/include/git2/status.h +115 -59
- data/vendor/libgit2/include/git2/submodule.h +9 -0
- data/vendor/libgit2/include/git2/sys/commit_graph.h +174 -0
- data/vendor/libgit2/include/git2/sys/filter.h +49 -28
- data/vendor/libgit2/include/git2/sys/midx.h +74 -0
- data/vendor/libgit2/include/git2/sys/odb_backend.h +7 -0
- data/vendor/libgit2/include/git2/sys/transport.h +1 -0
- data/vendor/libgit2/include/git2/tag.h +12 -0
- data/vendor/libgit2/include/git2/tree.h +0 -14
- data/vendor/libgit2/include/git2/types.h +9 -0
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2/worktree.h +1 -0
- data/vendor/libgit2/src/CMakeLists.txt +25 -4
- data/vendor/libgit2/src/alloc.c +21 -8
- data/vendor/libgit2/src/allocators/failalloc.c +92 -0
- data/vendor/libgit2/src/allocators/failalloc.h +23 -0
- data/vendor/libgit2/src/allocators/stdalloc.c +41 -10
- data/vendor/libgit2/src/allocators/win32_leakcheck.c +118 -0
- data/vendor/libgit2/src/allocators/{win32_crtdbg.h → win32_leakcheck.h} +3 -3
- data/vendor/libgit2/src/annotated_commit.c +21 -9
- data/vendor/libgit2/src/apply.c +16 -7
- data/vendor/libgit2/src/array.h +11 -11
- data/vendor/libgit2/src/attr.c +181 -74
- data/vendor/libgit2/src/attr_file.c +84 -39
- data/vendor/libgit2/src/attr_file.h +32 -11
- data/vendor/libgit2/src/attrcache.c +42 -37
- data/vendor/libgit2/src/attrcache.h +4 -5
- data/vendor/libgit2/src/blame.c +11 -5
- data/vendor/libgit2/src/blob.c +35 -24
- data/vendor/libgit2/src/branch.c +69 -17
- data/vendor/libgit2/src/buffer.c +334 -25
- data/vendor/libgit2/src/buffer.h +153 -2
- data/vendor/libgit2/src/cache.c +2 -2
- data/vendor/libgit2/src/cache.h +7 -7
- data/vendor/libgit2/src/cc-compat.h +10 -2
- data/vendor/libgit2/src/checkout.c +48 -26
- data/vendor/libgit2/src/cherrypick.c +6 -2
- data/vendor/libgit2/src/clone.c +41 -47
- data/vendor/libgit2/src/commit.c +41 -28
- data/vendor/libgit2/src/commit_graph.c +1209 -0
- data/vendor/libgit2/src/commit_graph.h +162 -0
- data/vendor/libgit2/src/commit_list.c +46 -0
- data/vendor/libgit2/src/commit_list.h +2 -0
- data/vendor/libgit2/src/common.h +25 -2
- data/vendor/libgit2/src/config.c +37 -15
- data/vendor/libgit2/src/config_cache.c +5 -3
- data/vendor/libgit2/src/config_file.c +16 -8
- data/vendor/libgit2/src/config_parse.c +4 -6
- data/vendor/libgit2/src/crlf.c +16 -6
- data/vendor/libgit2/src/date.c +4 -3
- data/vendor/libgit2/src/delta.c +1 -1
- data/vendor/libgit2/src/describe.c +6 -3
- data/vendor/libgit2/src/diff.c +11 -8
- data/vendor/libgit2/src/diff_driver.c +21 -17
- data/vendor/libgit2/src/diff_file.c +2 -6
- data/vendor/libgit2/src/diff_generate.c +46 -17
- data/vendor/libgit2/src/diff_print.c +19 -6
- data/vendor/libgit2/src/diff_stats.c +7 -5
- data/vendor/libgit2/src/diff_tform.c +9 -8
- data/vendor/libgit2/src/diff_xdiff.c +4 -2
- data/vendor/libgit2/src/diff_xdiff.h +1 -1
- data/vendor/libgit2/src/errors.c +24 -19
- data/vendor/libgit2/src/features.h.in +5 -1
- data/vendor/libgit2/src/fetch.c +5 -2
- data/vendor/libgit2/src/fetchhead.c +8 -4
- data/vendor/libgit2/src/filebuf.c +9 -7
- data/vendor/libgit2/src/filter.c +206 -110
- data/vendor/libgit2/src/filter.h +24 -5
- data/vendor/libgit2/src/futils.c +5 -5
- data/vendor/libgit2/src/futils.h +1 -1
- data/vendor/libgit2/src/graph.c +64 -9
- data/vendor/libgit2/src/hash/sha1/collisiondetect.c +3 -3
- data/vendor/libgit2/src/hash/sha1/common_crypto.c +3 -3
- data/vendor/libgit2/src/hash/sha1/generic.h +1 -1
- data/vendor/libgit2/src/hash/sha1/mbedtls.c +12 -12
- data/vendor/libgit2/src/hash/sha1/openssl.c +3 -3
- data/vendor/libgit2/src/hash/sha1/sha1dc/sha1.c +0 -2
- data/vendor/libgit2/src/hash/sha1/win32.c +15 -11
- data/vendor/libgit2/src/hash.c +16 -13
- data/vendor/libgit2/src/hash.h +1 -1
- data/vendor/libgit2/src/hashsig.c +23 -10
- data/vendor/libgit2/src/ident.c +13 -3
- data/vendor/libgit2/src/ignore.c +35 -19
- data/vendor/libgit2/src/index.c +106 -70
- data/vendor/libgit2/src/index.h +1 -1
- data/vendor/libgit2/src/indexer.c +31 -29
- data/vendor/libgit2/src/integer.h +64 -2
- data/vendor/libgit2/src/iterator.c +36 -24
- data/vendor/libgit2/src/iterator.h +1 -1
- data/vendor/libgit2/src/khash.h +2 -11
- data/vendor/libgit2/src/{settings.c → libgit2.c} +117 -50
- data/vendor/libgit2/src/libgit2.h +15 -0
- data/vendor/libgit2/src/mailmap.c +23 -10
- data/vendor/libgit2/src/map.h +3 -3
- data/vendor/libgit2/src/merge.c +70 -30
- data/vendor/libgit2/src/merge.h +2 -1
- data/vendor/libgit2/src/merge_driver.c +19 -13
- data/vendor/libgit2/src/merge_file.c +11 -3
- data/vendor/libgit2/src/message.c +3 -1
- data/vendor/libgit2/src/midx.c +471 -10
- data/vendor/libgit2/src/midx.h +28 -1
- data/vendor/libgit2/src/mwindow.c +103 -59
- data/vendor/libgit2/src/mwindow.h +3 -3
- data/vendor/libgit2/src/net.c +127 -3
- data/vendor/libgit2/src/net.h +16 -2
- data/vendor/libgit2/src/netops.c +6 -4
- data/vendor/libgit2/src/netops.h +2 -2
- data/vendor/libgit2/src/notes.c +10 -10
- data/vendor/libgit2/src/object.c +22 -14
- data/vendor/libgit2/src/odb.c +285 -48
- data/vendor/libgit2/src/odb.h +16 -2
- data/vendor/libgit2/src/odb_loose.c +28 -18
- data/vendor/libgit2/src/odb_mempack.c +1 -1
- data/vendor/libgit2/src/odb_pack.c +391 -114
- data/vendor/libgit2/src/oid.c +5 -4
- data/vendor/libgit2/src/pack-objects.c +54 -48
- data/vendor/libgit2/src/pack.c +329 -119
- data/vendor/libgit2/src/pack.h +25 -7
- data/vendor/libgit2/src/patch.c +14 -7
- data/vendor/libgit2/src/patch_generate.c +2 -2
- data/vendor/libgit2/src/patch_parse.c +2 -1
- data/vendor/libgit2/src/path.c +98 -53
- data/vendor/libgit2/src/path.h +79 -6
- data/vendor/libgit2/src/pathspec.c +8 -8
- data/vendor/libgit2/src/pool.c +13 -7
- data/vendor/libgit2/src/posix.c +11 -3
- data/vendor/libgit2/src/reader.c +10 -6
- data/vendor/libgit2/src/rebase.c +93 -49
- data/vendor/libgit2/src/refdb.c +30 -13
- data/vendor/libgit2/src/refdb_fs.c +121 -69
- data/vendor/libgit2/src/reflog.c +19 -14
- data/vendor/libgit2/src/refs.c +76 -41
- data/vendor/libgit2/src/refspec.c +32 -12
- data/vendor/libgit2/src/remote.c +272 -102
- data/vendor/libgit2/src/remote.h +2 -1
- data/vendor/libgit2/src/repository.c +176 -103
- data/vendor/libgit2/src/repository.h +12 -1
- data/vendor/libgit2/src/reset.c +7 -6
- data/vendor/libgit2/src/revert.c +6 -2
- data/vendor/libgit2/src/revparse.c +14 -9
- data/vendor/libgit2/src/revwalk.c +32 -15
- data/vendor/libgit2/src/runtime.c +162 -0
- data/vendor/libgit2/src/runtime.h +62 -0
- data/vendor/libgit2/src/settings.h +11 -0
- data/vendor/libgit2/src/signature.c +6 -5
- data/vendor/libgit2/src/sortedcache.h +10 -8
- data/vendor/libgit2/src/stash.c +3 -1
- data/vendor/libgit2/src/status.c +7 -4
- data/vendor/libgit2/src/strarray.c +2 -1
- data/vendor/libgit2/src/streams/mbedtls.c +14 -17
- data/vendor/libgit2/src/streams/mbedtls.h +1 -1
- data/vendor/libgit2/src/streams/openssl.c +101 -201
- data/vendor/libgit2/src/streams/openssl.h +9 -1
- data/vendor/libgit2/src/streams/openssl_dynamic.c +309 -0
- data/vendor/libgit2/src/streams/openssl_dynamic.h +348 -0
- data/vendor/libgit2/src/streams/openssl_legacy.c +203 -0
- data/vendor/libgit2/src/streams/openssl_legacy.h +63 -0
- data/vendor/libgit2/src/streams/registry.c +5 -6
- data/vendor/libgit2/src/streams/socket.c +6 -2
- data/vendor/libgit2/src/streams/stransport.c +6 -3
- data/vendor/libgit2/src/streams/tls.c +5 -3
- data/vendor/libgit2/src/submodule.c +128 -62
- data/vendor/libgit2/src/submodule.h +9 -9
- data/vendor/libgit2/src/sysdir.c +4 -6
- data/vendor/libgit2/src/tag.c +47 -11
- data/vendor/libgit2/src/thread.c +140 -0
- data/vendor/libgit2/src/thread.h +479 -0
- data/vendor/libgit2/src/threadstate.c +83 -0
- data/vendor/libgit2/src/threadstate.h +24 -0
- data/vendor/libgit2/src/trace.c +2 -2
- data/vendor/libgit2/src/trace.h +17 -13
- data/vendor/libgit2/src/transaction.c +19 -8
- data/vendor/libgit2/src/transport.c +3 -3
- data/vendor/libgit2/src/transports/auth.c +1 -1
- data/vendor/libgit2/src/transports/auth_negotiate.c +11 -4
- data/vendor/libgit2/src/transports/auth_ntlm.c +10 -6
- data/vendor/libgit2/src/transports/credential.c +15 -7
- data/vendor/libgit2/src/transports/git.c +1 -3
- data/vendor/libgit2/src/transports/http.c +19 -17
- data/vendor/libgit2/src/transports/http.h +1 -0
- data/vendor/libgit2/src/transports/httpclient.c +53 -26
- data/vendor/libgit2/src/transports/httpclient.h +1 -1
- data/vendor/libgit2/src/transports/local.c +3 -3
- data/vendor/libgit2/src/transports/smart.c +12 -7
- data/vendor/libgit2/src/transports/smart.h +1 -1
- data/vendor/libgit2/src/transports/smart_protocol.c +11 -5
- data/vendor/libgit2/src/transports/ssh.c +51 -17
- data/vendor/libgit2/src/transports/winhttp.c +41 -31
- data/vendor/libgit2/src/tree.c +100 -77
- data/vendor/libgit2/src/tree.h +1 -0
- data/vendor/libgit2/src/tsort.c +0 -2
- data/vendor/libgit2/src/unix/map.c +3 -1
- data/vendor/libgit2/src/unix/pthread.h +2 -1
- data/vendor/libgit2/src/utf8.c +150 -0
- data/vendor/libgit2/src/utf8.h +52 -0
- data/vendor/libgit2/src/util.c +53 -129
- data/vendor/libgit2/src/util.h +33 -39
- data/vendor/libgit2/src/vector.c +23 -19
- data/vendor/libgit2/src/vector.h +4 -2
- data/vendor/libgit2/src/win32/findfile.c +4 -2
- data/vendor/libgit2/src/win32/map.c +1 -1
- data/vendor/libgit2/src/win32/msvc-compat.h +9 -1
- data/vendor/libgit2/src/win32/path_w32.c +22 -24
- data/vendor/libgit2/src/win32/path_w32.h +0 -1
- data/vendor/libgit2/src/win32/posix_w32.c +7 -1
- data/vendor/libgit2/src/win32/precompiled.h +0 -1
- data/vendor/libgit2/src/win32/reparse.h +4 -4
- data/vendor/libgit2/src/win32/thread.c +24 -15
- data/vendor/libgit2/src/win32/thread.h +1 -1
- data/vendor/libgit2/src/win32/w32_buffer.c +3 -3
- data/vendor/libgit2/src/win32/w32_common.h +18 -9
- data/vendor/libgit2/src/win32/{w32_crtdbg_stacktrace.c → w32_leakcheck.c} +269 -33
- data/vendor/libgit2/src/win32/w32_leakcheck.h +222 -0
- data/vendor/libgit2/src/win32/w32_util.h +6 -6
- data/vendor/libgit2/src/worktree.c +27 -16
- data/vendor/libgit2/src/zstream.c +1 -1
- metadata +32 -16
- data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
- data/vendor/libgit2/src/buf_text.c +0 -316
- data/vendor/libgit2/src/buf_text.h +0 -122
- data/vendor/libgit2/src/global.c +0 -363
- data/vendor/libgit2/src/global.h +0 -41
- data/vendor/libgit2/src/thread-utils.c +0 -58
- data/vendor/libgit2/src/thread-utils.h +0 -369
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +0 -127
- data/vendor/libgit2/src/win32/w32_stack.c +0 -188
- data/vendor/libgit2/src/win32/w32_stack.h +0 -140
data/vendor/libgit2/src/path.h
CHANGED
@@ -67,8 +67,6 @@ extern int git_path_basename_r(git_buf *buffer, const char *path);
|
|
67
67
|
*/
|
68
68
|
extern size_t git_path_basename_offset(git_buf *buffer);
|
69
69
|
|
70
|
-
extern const char *git_path_topdir(const char *path);
|
71
|
-
|
72
70
|
/**
|
73
71
|
* Find offset to root of path if path has one.
|
74
72
|
*
|
@@ -285,7 +283,7 @@ extern int git_path_prettify_dir(git_buf *path_out, const char *path, const char
|
|
285
283
|
* appends the trailing '/'. If the path does not exist, it is
|
286
284
|
* treated like a regular filename.
|
287
285
|
*/
|
288
|
-
extern int git_path_find_dir(git_buf *dir
|
286
|
+
extern int git_path_find_dir(git_buf *dir);
|
289
287
|
|
290
288
|
/**
|
291
289
|
* Resolve relative references within a path.
|
@@ -628,20 +626,95 @@ extern int git_path_from_url_or_path(git_buf *local_path_out, const char *url_or
|
|
628
626
|
#define GIT_PATH_REJECT_INDEX_DEFAULTS \
|
629
627
|
GIT_PATH_REJECT_TRAVERSAL | GIT_PATH_REJECT_DOT_GIT
|
630
628
|
|
631
|
-
|
632
|
-
*
|
629
|
+
/**
|
630
|
+
* Validate a "bare" git path. This ensures that the given path is legal
|
631
|
+
* to place in the index or a tree. This should be checked by mechanisms
|
632
|
+
* like `git_index_add` and `git_treebuilder_insert` when taking user
|
633
|
+
* data, and by `git_checkout` before constructing on-disk paths.
|
634
|
+
*
|
635
|
+
* This will ensure that a git path does not contain any "unsafe" components,
|
633
636
|
* a '.' or '..' component, or a component that is ".git" (in any case).
|
634
637
|
*
|
638
|
+
* (Note: if you take or construct an on-disk path -- a workdir path,
|
639
|
+
* a path to a git repository or a reference name that could be a loose
|
640
|
+
* ref -- you should _also_ validate that with `git_path_validate_workdir`.)
|
641
|
+
*
|
635
642
|
* `repo` is optional. If specified, it will be used to determine the short
|
636
643
|
* path name to reject (if `GIT_PATH_REJECT_DOS_SHORTNAME` is specified),
|
637
644
|
* in addition to the default of "git~1".
|
638
645
|
*/
|
639
|
-
extern bool
|
646
|
+
extern bool git_path_validate(
|
640
647
|
git_repository *repo,
|
641
648
|
const char *path,
|
642
649
|
uint16_t mode,
|
643
650
|
unsigned int flags);
|
644
651
|
|
652
|
+
/**
|
653
|
+
* Validate an on-disk path, taking into account that it will have a
|
654
|
+
* suffix appended (eg, `.lock`).
|
655
|
+
*/
|
656
|
+
GIT_INLINE(int) git_path_validate_filesystem_with_suffix(
|
657
|
+
const char *path,
|
658
|
+
size_t path_len,
|
659
|
+
size_t suffix_len)
|
660
|
+
{
|
661
|
+
#ifdef GIT_WIN32
|
662
|
+
size_t path_chars, total_chars;
|
663
|
+
|
664
|
+
path_chars = git_utf8_char_length(path, path_len);
|
665
|
+
|
666
|
+
if (GIT_ADD_SIZET_OVERFLOW(&total_chars, path_chars, suffix_len) ||
|
667
|
+
total_chars > MAX_PATH) {
|
668
|
+
git_error_set(GIT_ERROR_FILESYSTEM, "path too long: '%s'", path);
|
669
|
+
return -1;
|
670
|
+
}
|
671
|
+
return 0;
|
672
|
+
#else
|
673
|
+
GIT_UNUSED(path);
|
674
|
+
GIT_UNUSED(path_len);
|
675
|
+
GIT_UNUSED(suffix_len);
|
676
|
+
return 0;
|
677
|
+
#endif
|
678
|
+
}
|
679
|
+
|
680
|
+
/**
|
681
|
+
* Validate an path on the filesystem. This ensures that the given
|
682
|
+
* path is valid for the operating system/platform; for example, this
|
683
|
+
* will ensure that the given absolute path is smaller than MAX_PATH on
|
684
|
+
* Windows.
|
685
|
+
*
|
686
|
+
* For paths within the working directory, you should use ensure that
|
687
|
+
* `core.longpaths` is obeyed. Use `git_path_validate_workdir`.
|
688
|
+
*/
|
689
|
+
GIT_INLINE(int) git_path_validate_filesystem(
|
690
|
+
const char *path,
|
691
|
+
size_t path_len)
|
692
|
+
{
|
693
|
+
return git_path_validate_filesystem_with_suffix(path, path_len, 0);
|
694
|
+
}
|
695
|
+
|
696
|
+
/**
|
697
|
+
* Validate a path relative to the repo's worktree. This ensures that
|
698
|
+
* the given working tree path is valid for the operating system/platform.
|
699
|
+
* This will ensure that an absolute path is smaller than MAX_PATH on
|
700
|
+
* Windows, while keeping `core.longpaths` configuration settings in mind.
|
701
|
+
*
|
702
|
+
* This should be checked by mechamisms like `git_checkout` after
|
703
|
+
* contructing on-disk paths and before trying to write them.
|
704
|
+
*
|
705
|
+
* If the repository is null, no repository configuration is applied.
|
706
|
+
*/
|
707
|
+
extern int git_path_validate_workdir(
|
708
|
+
git_repository *repo,
|
709
|
+
const char *path);
|
710
|
+
extern int git_path_validate_workdir_with_len(
|
711
|
+
git_repository *repo,
|
712
|
+
const char *path,
|
713
|
+
size_t path_len);
|
714
|
+
extern int git_path_validate_workdir_buf(
|
715
|
+
git_repository *repo,
|
716
|
+
git_buf *buf);
|
717
|
+
|
645
718
|
/**
|
646
719
|
* Convert any backslashes into slashes
|
647
720
|
*/
|
@@ -9,7 +9,6 @@
|
|
9
9
|
|
10
10
|
#include "git2/pathspec.h"
|
11
11
|
#include "git2/diff.h"
|
12
|
-
#include "buf_text.h"
|
13
12
|
#include "attr_file.h"
|
14
13
|
#include "iterator.h"
|
15
14
|
#include "repository.h"
|
@@ -25,7 +24,7 @@ char *git_pathspec_prefix(const git_strarray *pathspec)
|
|
25
24
|
const char *scan;
|
26
25
|
|
27
26
|
if (!pathspec || !pathspec->count ||
|
28
|
-
|
27
|
+
git_buf_common_prefix(&prefix, pathspec) < 0)
|
29
28
|
return NULL;
|
30
29
|
|
31
30
|
/* diff prefix will only be leading non-wildcards */
|
@@ -41,7 +40,7 @@ char *git_pathspec_prefix(const git_strarray *pathspec)
|
|
41
40
|
return NULL;
|
42
41
|
}
|
43
42
|
|
44
|
-
|
43
|
+
git_buf_unescape(&prefix);
|
45
44
|
|
46
45
|
return git_buf_detach(&prefix);
|
47
46
|
}
|
@@ -289,7 +288,8 @@ int git_pathspec_matches_path(
|
|
289
288
|
bool no_fnmatch = (flags & GIT_PATHSPEC_NO_GLOB) != 0;
|
290
289
|
bool casefold = (flags & GIT_PATHSPEC_IGNORE_CASE) != 0;
|
291
290
|
|
292
|
-
|
291
|
+
GIT_ASSERT_ARG(ps);
|
292
|
+
GIT_ASSERT_ARG(path);
|
293
293
|
|
294
294
|
return (0 != git_pathspec__match(
|
295
295
|
&ps->pathspec, path, no_fnmatch, casefold, NULL, NULL));
|
@@ -526,7 +526,7 @@ int git_pathspec_match_workdir(
|
|
526
526
|
git_iterator_options iter_opts = GIT_ITERATOR_OPTIONS_INIT;
|
527
527
|
int error = 0;
|
528
528
|
|
529
|
-
|
529
|
+
GIT_ASSERT_ARG(repo);
|
530
530
|
|
531
531
|
iter_opts.flags = pathspec_match_iter_flags(flags);
|
532
532
|
|
@@ -548,7 +548,7 @@ int git_pathspec_match_index(
|
|
548
548
|
git_iterator_options iter_opts = GIT_ITERATOR_OPTIONS_INIT;
|
549
549
|
int error = 0;
|
550
550
|
|
551
|
-
|
551
|
+
GIT_ASSERT_ARG(index);
|
552
552
|
|
553
553
|
iter_opts.flags = pathspec_match_iter_flags(flags);
|
554
554
|
|
@@ -570,7 +570,7 @@ int git_pathspec_match_tree(
|
|
570
570
|
git_iterator_options iter_opts = GIT_ITERATOR_OPTIONS_INIT;
|
571
571
|
int error = 0;
|
572
572
|
|
573
|
-
|
573
|
+
GIT_ASSERT_ARG(tree);
|
574
574
|
|
575
575
|
iter_opts.flags = pathspec_match_iter_flags(flags);
|
576
576
|
|
@@ -598,7 +598,7 @@ int git_pathspec_match_diff(
|
|
598
598
|
const git_diff_delta *delta, **match;
|
599
599
|
git_bitvec used_patterns;
|
600
600
|
|
601
|
-
|
601
|
+
GIT_ASSERT_ARG(diff);
|
602
602
|
|
603
603
|
if (git_bitvec_init(&used_patterns, patterns->length) < 0)
|
604
604
|
return -1;
|
data/vendor/libgit2/src/pool.c
CHANGED
@@ -36,8 +36,8 @@ int git_pool_global_init(void)
|
|
36
36
|
|
37
37
|
int git_pool_init(git_pool *pool, size_t item_size)
|
38
38
|
{
|
39
|
-
|
40
|
-
|
39
|
+
GIT_ASSERT_ARG(pool);
|
40
|
+
GIT_ASSERT_ARG(item_size >= 1);
|
41
41
|
|
42
42
|
memset(pool, 0, sizeof(git_pool));
|
43
43
|
pool->item_size = item_size;
|
@@ -131,8 +131,8 @@ static int git_pool__ptr_cmp(const void * a, const void * b)
|
|
131
131
|
|
132
132
|
int git_pool_init(git_pool *pool, size_t item_size)
|
133
133
|
{
|
134
|
-
|
135
|
-
|
134
|
+
GIT_ASSERT_ARG(pool);
|
135
|
+
GIT_ASSERT_ARG(item_size >= 1);
|
136
136
|
|
137
137
|
memset(pool, 0, sizeof(git_pool));
|
138
138
|
pool->item_size = item_size;
|
@@ -205,7 +205,9 @@ char *git_pool_strndup(git_pool *pool, const char *str, size_t n)
|
|
205
205
|
{
|
206
206
|
char *ptr = NULL;
|
207
207
|
|
208
|
-
|
208
|
+
GIT_ASSERT_ARG_WITH_RETVAL(pool, NULL);
|
209
|
+
GIT_ASSERT_ARG_WITH_RETVAL(str, NULL);
|
210
|
+
GIT_ASSERT_ARG_WITH_RETVAL(pool->item_size == sizeof(char), NULL);
|
209
211
|
|
210
212
|
if (n == SIZE_MAX)
|
211
213
|
return NULL;
|
@@ -220,7 +222,10 @@ char *git_pool_strndup(git_pool *pool, const char *str, size_t n)
|
|
220
222
|
|
221
223
|
char *git_pool_strdup(git_pool *pool, const char *str)
|
222
224
|
{
|
223
|
-
|
225
|
+
GIT_ASSERT_ARG_WITH_RETVAL(pool, NULL);
|
226
|
+
GIT_ASSERT_ARG_WITH_RETVAL(str, NULL);
|
227
|
+
GIT_ASSERT_ARG_WITH_RETVAL(pool->item_size == sizeof(char), NULL);
|
228
|
+
|
224
229
|
return git_pool_strndup(pool, str, strlen(str));
|
225
230
|
}
|
226
231
|
|
@@ -234,7 +239,8 @@ char *git_pool_strcat(git_pool *pool, const char *a, const char *b)
|
|
234
239
|
void *ptr;
|
235
240
|
size_t len_a, len_b, total;
|
236
241
|
|
237
|
-
|
242
|
+
GIT_ASSERT_ARG_WITH_RETVAL(pool, NULL);
|
243
|
+
GIT_ASSERT_ARG_WITH_RETVAL(pool->item_size == sizeof(char), NULL);
|
238
244
|
|
239
245
|
len_a = a ? strlen(a) : 0;
|
240
246
|
len_b = b ? strlen(b) : 0;
|
data/vendor/libgit2/src/posix.c
CHANGED
@@ -109,6 +109,13 @@ int p_open(const char *path, volatile int flags, ...)
|
|
109
109
|
{
|
110
110
|
mode_t mode = 0;
|
111
111
|
|
112
|
+
#ifdef GIT_DEBUG_STRICT_OPEN
|
113
|
+
if (strstr(path, "//") != NULL) {
|
114
|
+
errno = EACCES;
|
115
|
+
return -1;
|
116
|
+
}
|
117
|
+
#endif
|
118
|
+
|
112
119
|
if (flags & O_CREAT) {
|
113
120
|
va_list arg_list;
|
114
121
|
|
@@ -129,7 +136,8 @@ int p_getcwd(char *buffer_out, size_t size)
|
|
129
136
|
{
|
130
137
|
char *cwd_buffer;
|
131
138
|
|
132
|
-
|
139
|
+
GIT_ASSERT_ARG(buffer_out);
|
140
|
+
GIT_ASSERT_ARG(size > 0);
|
133
141
|
|
134
142
|
cwd_buffer = getcwd(buffer_out, size);
|
135
143
|
|
@@ -196,7 +204,7 @@ int p_write(git_file fd, const void *buf, size_t cnt)
|
|
196
204
|
while (cnt) {
|
197
205
|
ssize_t r;
|
198
206
|
#ifdef GIT_WIN32
|
199
|
-
|
207
|
+
GIT_ASSERT((size_t)((unsigned int)cnt) == cnt);
|
200
208
|
r = write(fd, b, (unsigned int)cnt);
|
201
209
|
#else
|
202
210
|
r = write(fd, b, cnt);
|
@@ -282,7 +290,7 @@ int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, off64_t offset
|
|
282
290
|
|
283
291
|
int p_munmap(git_map *map)
|
284
292
|
{
|
285
|
-
|
293
|
+
GIT_ASSERT_ARG(map);
|
286
294
|
git__free(map->data);
|
287
295
|
|
288
296
|
/* Initializing will help debug use-after-free */
|
data/vendor/libgit2/src/reader.c
CHANGED
@@ -61,7 +61,8 @@ int git_reader_for_tree(git_reader **out, git_tree *tree)
|
|
61
61
|
{
|
62
62
|
tree_reader *reader;
|
63
63
|
|
64
|
-
|
64
|
+
GIT_ASSERT_ARG(out);
|
65
|
+
GIT_ASSERT_ARG(tree);
|
65
66
|
|
66
67
|
reader = git__calloc(1, sizeof(tree_reader));
|
67
68
|
GIT_ERROR_CHECK_ALLOC(reader);
|
@@ -97,8 +98,7 @@ static int workdir_reader_read(
|
|
97
98
|
git_oid id;
|
98
99
|
int error;
|
99
100
|
|
100
|
-
if ((error =
|
101
|
-
git_repository_workdir(reader->repo), filename)) < 0)
|
101
|
+
if ((error = git_repository_workdir_path(&path, reader->repo, filename)) < 0)
|
102
102
|
goto done;
|
103
103
|
|
104
104
|
if ((error = p_lstat(path.ptr, &st)) < 0) {
|
@@ -158,7 +158,8 @@ int git_reader_for_workdir(
|
|
158
158
|
workdir_reader *reader;
|
159
159
|
int error;
|
160
160
|
|
161
|
-
|
161
|
+
GIT_ASSERT_ARG(out);
|
162
|
+
GIT_ASSERT_ARG(repo);
|
162
163
|
|
163
164
|
reader = git__calloc(1, sizeof(workdir_reader));
|
164
165
|
GIT_ERROR_CHECK_ALLOC(reader);
|
@@ -223,7 +224,8 @@ int git_reader_for_index(
|
|
223
224
|
index_reader *reader;
|
224
225
|
int error;
|
225
226
|
|
226
|
-
|
227
|
+
GIT_ASSERT_ARG(out);
|
228
|
+
GIT_ASSERT_ARG(repo);
|
227
229
|
|
228
230
|
reader = git__calloc(1, sizeof(index_reader));
|
229
231
|
GIT_ERROR_CHECK_ALLOC(reader);
|
@@ -251,7 +253,9 @@ int git_reader_read(
|
|
251
253
|
git_reader *reader,
|
252
254
|
const char *filename)
|
253
255
|
{
|
254
|
-
|
256
|
+
GIT_ASSERT_ARG(out);
|
257
|
+
GIT_ASSERT_ARG(reader);
|
258
|
+
GIT_ASSERT_ARG(filename);
|
255
259
|
|
256
260
|
return reader->read(out, out_id, out_filemode, reader, filename);
|
257
261
|
}
|
data/vendor/libgit2/src/rebase.c
CHANGED
@@ -186,8 +186,8 @@ static git_rebase_operation *rebase_operation_alloc(
|
|
186
186
|
{
|
187
187
|
git_rebase_operation *operation;
|
188
188
|
|
189
|
-
|
190
|
-
|
189
|
+
GIT_ASSERT_WITH_RETVAL((type == GIT_REBASE_OPERATION_EXEC) == !id, NULL);
|
190
|
+
GIT_ASSERT_WITH_RETVAL((type == GIT_REBASE_OPERATION_EXEC) == !!exec, NULL);
|
191
191
|
|
192
192
|
if ((operation = git_array_alloc(rebase->operations)) == NULL)
|
193
193
|
return NULL;
|
@@ -301,7 +301,7 @@ int git_rebase_open(
|
|
301
301
|
size_t state_path_len;
|
302
302
|
int error;
|
303
303
|
|
304
|
-
|
304
|
+
GIT_ASSERT_ARG(repo);
|
305
305
|
|
306
306
|
if ((error = rebase_check_versions(given_opts)) < 0)
|
307
307
|
return error;
|
@@ -701,7 +701,8 @@ int git_rebase_init(
|
|
701
701
|
bool inmemory = (given_opts && given_opts->inmemory);
|
702
702
|
int error;
|
703
703
|
|
704
|
-
|
704
|
+
GIT_ASSERT_ARG(repo);
|
705
|
+
GIT_ASSERT_ARG(upstream || onto);
|
705
706
|
|
706
707
|
*out = NULL;
|
707
708
|
|
@@ -912,7 +913,8 @@ int git_rebase_next(
|
|
912
913
|
{
|
913
914
|
int error;
|
914
915
|
|
915
|
-
|
916
|
+
GIT_ASSERT_ARG(out);
|
917
|
+
GIT_ASSERT_ARG(rebase);
|
916
918
|
|
917
919
|
if ((error = rebase_movenext(rebase)) < 0)
|
918
920
|
return error;
|
@@ -931,7 +933,9 @@ int git_rebase_inmemory_index(
|
|
931
933
|
git_index **out,
|
932
934
|
git_rebase *rebase)
|
933
935
|
{
|
934
|
-
|
936
|
+
GIT_ASSERT_ARG(out);
|
937
|
+
GIT_ASSERT_ARG(rebase);
|
938
|
+
GIT_ASSERT_ARG(rebase->index);
|
935
939
|
|
936
940
|
GIT_REFCOUNT_INC(rebase->index);
|
937
941
|
*out = rebase->index;
|
@@ -939,6 +943,54 @@ int git_rebase_inmemory_index(
|
|
939
943
|
return 0;
|
940
944
|
}
|
941
945
|
|
946
|
+
#ifndef GIT_DEPRECATE_HARD
|
947
|
+
static int create_signed(
|
948
|
+
git_oid *out,
|
949
|
+
git_rebase *rebase,
|
950
|
+
const git_signature *author,
|
951
|
+
const git_signature *committer,
|
952
|
+
const char *message_encoding,
|
953
|
+
const char *message,
|
954
|
+
git_tree *tree,
|
955
|
+
size_t parent_count,
|
956
|
+
const git_commit **parents)
|
957
|
+
{
|
958
|
+
git_buf commit_content = GIT_BUF_INIT,
|
959
|
+
commit_signature = GIT_BUF_INIT,
|
960
|
+
signature_field = GIT_BUF_INIT;
|
961
|
+
int error;
|
962
|
+
|
963
|
+
git_error_clear();
|
964
|
+
|
965
|
+
if ((error = git_commit_create_buffer(&commit_content,
|
966
|
+
rebase->repo, author, committer, message_encoding,
|
967
|
+
message, tree, parent_count, parents)) < 0)
|
968
|
+
goto done;
|
969
|
+
|
970
|
+
error = rebase->options.signing_cb(&commit_signature,
|
971
|
+
&signature_field, commit_content.ptr,
|
972
|
+
rebase->options.payload);
|
973
|
+
|
974
|
+
if (error) {
|
975
|
+
if (error != GIT_PASSTHROUGH)
|
976
|
+
git_error_set_after_callback_function(error, "signing_cb");
|
977
|
+
|
978
|
+
goto done;
|
979
|
+
}
|
980
|
+
|
981
|
+
error = git_commit_create_with_signature(out, rebase->repo,
|
982
|
+
commit_content.ptr,
|
983
|
+
commit_signature.size > 0 ? commit_signature.ptr : NULL,
|
984
|
+
signature_field.size > 0 ? signature_field.ptr : NULL);
|
985
|
+
|
986
|
+
done:
|
987
|
+
git_buf_dispose(&commit_signature);
|
988
|
+
git_buf_dispose(&signature_field);
|
989
|
+
git_buf_dispose(&commit_content);
|
990
|
+
return error;
|
991
|
+
}
|
992
|
+
#endif
|
993
|
+
|
942
994
|
static int rebase_commit__create(
|
943
995
|
git_commit **out,
|
944
996
|
git_rebase *rebase,
|
@@ -953,10 +1005,6 @@ static int rebase_commit__create(
|
|
953
1005
|
git_commit *current_commit = NULL, *commit = NULL;
|
954
1006
|
git_tree *parent_tree = NULL, *tree = NULL;
|
955
1007
|
git_oid tree_id, commit_id;
|
956
|
-
git_buf commit_content = GIT_BUF_INIT, commit_signature = GIT_BUF_INIT,
|
957
|
-
signature_field = GIT_BUF_INIT;
|
958
|
-
const char *signature_field_string = NULL,
|
959
|
-
*commit_signature_string = NULL;
|
960
1008
|
int error;
|
961
1009
|
|
962
1010
|
operation = git_array_get(rebase->operations, rebase->current);
|
@@ -987,37 +1035,32 @@ static int rebase_commit__create(
|
|
987
1035
|
message = git_commit_message(current_commit);
|
988
1036
|
}
|
989
1037
|
|
990
|
-
|
991
|
-
|
992
|
-
goto done;
|
1038
|
+
git_error_clear();
|
1039
|
+
error = GIT_PASSTHROUGH;
|
993
1040
|
|
994
|
-
if (rebase->options.
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
rebase->options.payload)
|
999
|
-
if (error == GIT_PASSTHROUGH) {
|
1000
|
-
git_buf_dispose(&commit_signature);
|
1001
|
-
git_buf_dispose(&signature_field);
|
1002
|
-
git_error_clear();
|
1003
|
-
error = GIT_OK;
|
1004
|
-
} else if (error < 0)
|
1005
|
-
goto done;
|
1006
|
-
}
|
1041
|
+
if (rebase->options.commit_create_cb) {
|
1042
|
+
error = rebase->options.commit_create_cb(&commit_id,
|
1043
|
+
author, committer, message_encoding, message,
|
1044
|
+
tree, 1, (const git_commit **)&parent_commit,
|
1045
|
+
rebase->options.payload);
|
1007
1046
|
|
1008
|
-
|
1009
|
-
|
1010
|
-
commit_signature_string = git_buf_cstr(&commit_signature);
|
1047
|
+
git_error_set_after_callback_function(error,
|
1048
|
+
"commit_create_cb");
|
1011
1049
|
}
|
1012
|
-
|
1013
|
-
if (
|
1014
|
-
|
1015
|
-
|
1050
|
+
#ifndef GIT_DEPRECATE_HARD
|
1051
|
+
else if (rebase->options.signing_cb) {
|
1052
|
+
error = create_signed(&commit_id, rebase, author,
|
1053
|
+
committer, message_encoding, message, tree,
|
1054
|
+
1, (const git_commit **)&parent_commit);
|
1016
1055
|
}
|
1056
|
+
#endif
|
1017
1057
|
|
1018
|
-
if (
|
1019
|
-
|
1020
|
-
|
1058
|
+
if (error == GIT_PASSTHROUGH)
|
1059
|
+
error = git_commit_create(&commit_id, rebase->repo, NULL,
|
1060
|
+
author, committer, message_encoding, message,
|
1061
|
+
tree, 1, (const git_commit **)&parent_commit);
|
1062
|
+
|
1063
|
+
if (error)
|
1021
1064
|
goto done;
|
1022
1065
|
|
1023
1066
|
if ((error = git_commit_lookup(&commit, rebase->repo, &commit_id)) < 0)
|
@@ -1029,9 +1072,6 @@ done:
|
|
1029
1072
|
if (error < 0)
|
1030
1073
|
git_commit_free(commit);
|
1031
1074
|
|
1032
|
-
git_buf_dispose(&commit_signature);
|
1033
|
-
git_buf_dispose(&signature_field);
|
1034
|
-
git_buf_dispose(&commit_content);
|
1035
1075
|
git_commit_free(current_commit);
|
1036
1076
|
git_tree_free(parent_tree);
|
1037
1077
|
git_tree_free(tree);
|
@@ -1055,7 +1095,7 @@ static int rebase_commit_merge(
|
|
1055
1095
|
int error;
|
1056
1096
|
|
1057
1097
|
operation = git_array_get(rebase->operations, rebase->current);
|
1058
|
-
|
1098
|
+
GIT_ASSERT(operation);
|
1059
1099
|
|
1060
1100
|
if ((error = rebase_ensure_not_dirty(rebase->repo, false, true, GIT_EUNMERGED)) < 0 ||
|
1061
1101
|
(error = git_repository_head(&head, rebase->repo)) < 0 ||
|
@@ -1095,9 +1135,9 @@ static int rebase_commit_inmemory(
|
|
1095
1135
|
git_commit *commit = NULL;
|
1096
1136
|
int error = 0;
|
1097
1137
|
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1138
|
+
GIT_ASSERT_ARG(rebase->index);
|
1139
|
+
GIT_ASSERT_ARG(rebase->last_commit);
|
1140
|
+
GIT_ASSERT_ARG(rebase->current < rebase->operations.size);
|
1101
1141
|
|
1102
1142
|
if ((error = rebase_commit__create(&commit, rebase, rebase->index,
|
1103
1143
|
rebase->last_commit, author, committer, message_encoding, message)) < 0)
|
@@ -1125,7 +1165,8 @@ int git_rebase_commit(
|
|
1125
1165
|
{
|
1126
1166
|
int error;
|
1127
1167
|
|
1128
|
-
|
1168
|
+
GIT_ASSERT_ARG(rebase);
|
1169
|
+
GIT_ASSERT_ARG(committer);
|
1129
1170
|
|
1130
1171
|
if (rebase->inmemory)
|
1131
1172
|
error = rebase_commit_inmemory(
|
@@ -1145,7 +1186,7 @@ int git_rebase_abort(git_rebase *rebase)
|
|
1145
1186
|
git_commit *orig_head_commit = NULL;
|
1146
1187
|
int error;
|
1147
1188
|
|
1148
|
-
|
1189
|
+
GIT_ASSERT_ARG(rebase);
|
1149
1190
|
|
1150
1191
|
if (rebase->inmemory)
|
1151
1192
|
return 0;
|
@@ -1358,7 +1399,7 @@ int git_rebase_finish(
|
|
1358
1399
|
{
|
1359
1400
|
int error = 0;
|
1360
1401
|
|
1361
|
-
|
1402
|
+
GIT_ASSERT_ARG(rebase);
|
1362
1403
|
|
1363
1404
|
if (rebase->inmemory)
|
1364
1405
|
return 0;
|
@@ -1373,14 +1414,17 @@ int git_rebase_finish(
|
|
1373
1414
|
}
|
1374
1415
|
|
1375
1416
|
const char *git_rebase_orig_head_name(git_rebase *rebase) {
|
1417
|
+
GIT_ASSERT_ARG_WITH_RETVAL(rebase, NULL);
|
1376
1418
|
return rebase->orig_head_name;
|
1377
1419
|
}
|
1378
1420
|
|
1379
1421
|
const git_oid *git_rebase_orig_head_id(git_rebase *rebase) {
|
1422
|
+
GIT_ASSERT_ARG_WITH_RETVAL(rebase, NULL);
|
1380
1423
|
return &rebase->orig_head_id;
|
1381
1424
|
}
|
1382
1425
|
|
1383
1426
|
const char *git_rebase_onto_name(git_rebase *rebase) {
|
1427
|
+
GIT_ASSERT_ARG_WITH_RETVAL(rebase, NULL);
|
1384
1428
|
return rebase->onto_name;
|
1385
1429
|
}
|
1386
1430
|
|
@@ -1390,21 +1434,21 @@ const git_oid *git_rebase_onto_id(git_rebase *rebase) {
|
|
1390
1434
|
|
1391
1435
|
size_t git_rebase_operation_entrycount(git_rebase *rebase)
|
1392
1436
|
{
|
1393
|
-
|
1437
|
+
GIT_ASSERT_ARG_WITH_RETVAL(rebase, 0);
|
1394
1438
|
|
1395
1439
|
return git_array_size(rebase->operations);
|
1396
1440
|
}
|
1397
1441
|
|
1398
1442
|
size_t git_rebase_operation_current(git_rebase *rebase)
|
1399
1443
|
{
|
1400
|
-
|
1444
|
+
GIT_ASSERT_ARG_WITH_RETVAL(rebase, 0);
|
1401
1445
|
|
1402
1446
|
return rebase->started ? rebase->current : GIT_REBASE_NO_OPERATION;
|
1403
1447
|
}
|
1404
1448
|
|
1405
1449
|
git_rebase_operation *git_rebase_operation_byindex(git_rebase *rebase, size_t idx)
|
1406
1450
|
{
|
1407
|
-
|
1451
|
+
GIT_ASSERT_ARG_WITH_RETVAL(rebase, NULL);
|
1408
1452
|
|
1409
1453
|
return git_array_get(rebase->operations, idx);
|
1410
1454
|
}
|