rugged 0.27.7 → 0.27.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +1 -0
- data/vendor/libgit2/CMakeLists.txt +99 -51
- data/vendor/libgit2/COPYING +28 -0
- data/vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake +15 -1
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.c.in +29 -0
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.cmake +96 -0
- data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +9 -8
- data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +2 -2
- data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +1 -1
- data/vendor/libgit2/cmake/Modules/FindGSSFramework.cmake +28 -0
- data/vendor/libgit2/cmake/Modules/FindIconv.cmake +11 -6
- data/vendor/libgit2/cmake/Modules/FindPCRE.cmake +38 -0
- data/vendor/libgit2/cmake/Modules/FindPCRE2.cmake +37 -0
- data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +2 -2
- data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +6 -0
- data/vendor/libgit2/cmake/Modules/PkgBuildConfig.cmake +110 -0
- data/vendor/libgit2/cmake/Modules/SelectGSSAPI.cmake +53 -0
- data/vendor/libgit2/cmake/Modules/SelectHTTPSBackend.cmake +124 -0
- data/vendor/libgit2/cmake/Modules/SelectHashes.cmake +66 -0
- data/vendor/libgit2/deps/http-parser/http_parser.c +11 -6
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +21 -0
- data/vendor/libgit2/deps/ntlmclient/compat.h +33 -0
- data/vendor/libgit2/deps/ntlmclient/crypt.h +64 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +120 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +18 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +145 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +18 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +130 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +21 -0
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +1420 -0
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +174 -0
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +320 -0
- data/vendor/libgit2/deps/ntlmclient/unicode.h +36 -0
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +445 -0
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +201 -0
- data/vendor/libgit2/deps/ntlmclient/utf8.h +1257 -0
- data/vendor/libgit2/deps/ntlmclient/util.c +21 -0
- data/vendor/libgit2/deps/ntlmclient/util.h +14 -0
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +140 -0
- data/vendor/libgit2/deps/pcre/COPYING +5 -0
- data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +22 -0
- data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +17 -0
- data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +58 -0
- data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +29 -0
- data/vendor/libgit2/deps/pcre/config.h.in +57 -0
- data/vendor/libgit2/deps/pcre/pcre.h +641 -0
- data/vendor/libgit2/deps/pcre/pcre_byte_order.c +319 -0
- data/vendor/libgit2/deps/pcre/pcre_chartables.c +198 -0
- data/vendor/libgit2/deps/pcre/pcre_compile.c +9800 -0
- data/vendor/libgit2/deps/pcre/pcre_config.c +190 -0
- data/vendor/libgit2/deps/pcre/pcre_dfa_exec.c +3676 -0
- data/vendor/libgit2/deps/pcre/pcre_exec.c +7173 -0
- data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +245 -0
- data/vendor/libgit2/deps/pcre/pcre_get.c +669 -0
- data/vendor/libgit2/deps/pcre/pcre_globals.c +86 -0
- data/vendor/libgit2/deps/pcre/pcre_internal.h +2787 -0
- data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +11913 -0
- data/vendor/libgit2/deps/pcre/pcre_maketables.c +156 -0
- data/vendor/libgit2/deps/pcre/pcre_newline.c +210 -0
- data/vendor/libgit2/deps/pcre/pcre_ord2utf8.c +94 -0
- data/vendor/libgit2/deps/pcre/pcre_printint.c +834 -0
- data/vendor/libgit2/deps/pcre/pcre_refcount.c +92 -0
- data/vendor/libgit2/deps/pcre/pcre_string_utils.c +211 -0
- data/vendor/libgit2/deps/pcre/pcre_study.c +1686 -0
- data/vendor/libgit2/deps/pcre/pcre_tables.c +727 -0
- data/vendor/libgit2/deps/pcre/pcre_ucd.c +3644 -0
- data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +301 -0
- data/vendor/libgit2/deps/pcre/pcre_version.c +98 -0
- data/vendor/libgit2/deps/pcre/pcre_xclass.c +268 -0
- data/vendor/libgit2/deps/pcre/pcreposix.c +421 -0
- data/vendor/libgit2/deps/pcre/pcreposix.h +117 -0
- data/vendor/libgit2/deps/pcre/ucp.h +224 -0
- data/vendor/libgit2/deps/winhttp/COPYING.GPL +993 -0
- data/vendor/libgit2/deps/winhttp/COPYING.LGPL +502 -0
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +1 -0
- data/vendor/libgit2/deps/zlib/COPYING +27 -0
- data/vendor/libgit2/deps/zlib/adler32.c +0 -7
- data/vendor/libgit2/deps/zlib/crc32.c +0 -7
- data/vendor/libgit2/include/git2/annotated_commit.h +9 -0
- data/vendor/libgit2/include/git2/apply.h +149 -0
- data/vendor/libgit2/include/git2/attr.h +20 -13
- data/vendor/libgit2/include/git2/blame.h +4 -4
- data/vendor/libgit2/include/git2/blob.h +44 -12
- data/vendor/libgit2/include/git2/buffer.h +20 -26
- data/vendor/libgit2/include/git2/cert.h +135 -0
- data/vendor/libgit2/include/git2/checkout.h +53 -21
- data/vendor/libgit2/include/git2/cherrypick.h +3 -3
- data/vendor/libgit2/include/git2/clone.h +5 -5
- data/vendor/libgit2/include/git2/commit.h +25 -3
- data/vendor/libgit2/include/git2/common.h +35 -10
- data/vendor/libgit2/include/git2/config.h +29 -19
- data/vendor/libgit2/include/git2/cred.h +308 -0
- data/vendor/libgit2/include/git2/deprecated.h +493 -0
- data/vendor/libgit2/include/git2/describe.h +4 -4
- data/vendor/libgit2/include/git2/diff.h +177 -135
- data/vendor/libgit2/include/git2/errors.h +53 -46
- data/vendor/libgit2/include/git2/filter.h +8 -0
- data/vendor/libgit2/include/git2/index.h +74 -52
- data/vendor/libgit2/include/git2/indexer.h +76 -6
- data/vendor/libgit2/include/git2/merge.h +25 -10
- data/vendor/libgit2/include/git2/net.h +0 -5
- data/vendor/libgit2/include/git2/notes.h +1 -1
- data/vendor/libgit2/include/git2/object.h +17 -29
- data/vendor/libgit2/include/git2/odb.h +12 -11
- data/vendor/libgit2/include/git2/odb_backend.h +10 -9
- data/vendor/libgit2/include/git2/oid.h +2 -2
- data/vendor/libgit2/include/git2/pack.h +14 -3
- data/vendor/libgit2/include/git2/proxy.h +5 -3
- data/vendor/libgit2/include/git2/rebase.h +46 -2
- data/vendor/libgit2/include/git2/refs.h +34 -16
- data/vendor/libgit2/include/git2/remote.h +111 -14
- data/vendor/libgit2/include/git2/repository.h +69 -34
- data/vendor/libgit2/include/git2/revert.h +1 -1
- data/vendor/libgit2/include/git2/revwalk.h +7 -7
- data/vendor/libgit2/include/git2/signature.h +2 -2
- data/vendor/libgit2/include/git2/stash.h +5 -5
- data/vendor/libgit2/include/git2/status.h +26 -17
- data/vendor/libgit2/include/git2/submodule.h +23 -6
- data/vendor/libgit2/include/git2/sys/alloc.h +18 -18
- data/vendor/libgit2/include/git2/sys/commit.h +1 -1
- data/vendor/libgit2/include/git2/sys/config.h +13 -13
- data/vendor/libgit2/include/git2/sys/cred.h +90 -0
- data/vendor/libgit2/include/git2/sys/filter.h +6 -6
- data/vendor/libgit2/include/git2/sys/merge.h +3 -3
- data/vendor/libgit2/include/git2/sys/odb_backend.h +66 -22
- data/vendor/libgit2/include/git2/sys/path.h +14 -5
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +76 -40
- data/vendor/libgit2/include/git2/sys/repository.h +5 -1
- data/vendor/libgit2/include/git2/sys/stream.h +92 -12
- data/vendor/libgit2/include/git2/sys/transport.h +129 -83
- data/vendor/libgit2/include/git2/tag.h +13 -4
- data/vendor/libgit2/include/git2/trace.h +2 -2
- data/vendor/libgit2/include/git2/transport.h +11 -311
- data/vendor/libgit2/include/git2/tree.h +4 -4
- data/vendor/libgit2/include/git2/types.h +25 -106
- data/vendor/libgit2/include/git2/version.h +3 -3
- data/vendor/libgit2/include/git2/worktree.h +5 -5
- data/vendor/libgit2/include/git2.h +4 -0
- data/vendor/libgit2/src/CMakeLists.txt +104 -235
- data/vendor/libgit2/src/alloc.c +14 -18
- data/vendor/libgit2/src/{stdalloc.c → allocators/stdalloc.c} +7 -8
- data/vendor/libgit2/src/{stdalloc.h → allocators/stdalloc.h} +4 -4
- data/vendor/libgit2/src/allocators/win32_crtdbg.c +118 -0
- data/vendor/libgit2/src/{transports/cred.h → allocators/win32_crtdbg.h} +5 -4
- data/vendor/libgit2/src/annotated_commit.c +18 -11
- data/vendor/libgit2/src/apply.c +535 -28
- data/vendor/libgit2/src/apply.h +3 -1
- data/vendor/libgit2/src/array.h +2 -2
- data/vendor/libgit2/src/attr.c +77 -71
- data/vendor/libgit2/src/attr_file.c +203 -117
- data/vendor/libgit2/src/attr_file.h +9 -9
- data/vendor/libgit2/src/attrcache.c +49 -51
- data/vendor/libgit2/src/attrcache.h +2 -1
- data/vendor/libgit2/src/blame.c +38 -18
- data/vendor/libgit2/src/blame.h +1 -1
- data/vendor/libgit2/src/blame_git.c +29 -15
- data/vendor/libgit2/src/blob.c +123 -37
- data/vendor/libgit2/src/blob.h +19 -2
- data/vendor/libgit2/src/branch.c +47 -23
- data/vendor/libgit2/src/buf_text.c +7 -6
- data/vendor/libgit2/src/buffer.c +60 -53
- data/vendor/libgit2/src/cache.c +38 -45
- data/vendor/libgit2/src/cache.h +3 -3
- data/vendor/libgit2/src/cc-compat.h +20 -3
- data/vendor/libgit2/src/checkout.c +77 -67
- data/vendor/libgit2/src/cherrypick.c +12 -6
- data/vendor/libgit2/src/clone.c +36 -14
- data/vendor/libgit2/src/clone.h +4 -0
- data/vendor/libgit2/src/commit.c +103 -48
- data/vendor/libgit2/src/commit.h +7 -0
- data/vendor/libgit2/src/commit_list.c +36 -78
- data/vendor/libgit2/src/commit_list.h +2 -2
- data/vendor/libgit2/src/common.h +24 -90
- data/vendor/libgit2/src/config.c +203 -176
- data/vendor/libgit2/src/config.h +8 -20
- data/vendor/libgit2/src/config_backend.h +96 -0
- data/vendor/libgit2/src/config_cache.c +41 -35
- data/vendor/libgit2/src/config_entries.c +229 -0
- data/vendor/libgit2/src/config_entries.h +24 -0
- data/vendor/libgit2/src/config_file.c +422 -680
- data/vendor/libgit2/src/config_mem.c +220 -0
- data/vendor/libgit2/src/config_parse.c +96 -68
- data/vendor/libgit2/src/config_parse.h +15 -14
- data/vendor/libgit2/src/config_snapshot.c +206 -0
- data/vendor/libgit2/src/crlf.c +219 -196
- data/vendor/libgit2/src/delta.c +25 -18
- data/vendor/libgit2/src/describe.c +42 -41
- data/vendor/libgit2/src/diff.c +52 -67
- data/vendor/libgit2/src/diff.h +2 -1
- data/vendor/libgit2/src/diff_driver.c +44 -46
- data/vendor/libgit2/src/diff_file.c +16 -14
- data/vendor/libgit2/src/diff_file.h +1 -1
- data/vendor/libgit2/src/diff_generate.c +158 -103
- data/vendor/libgit2/src/diff_generate.h +3 -3
- data/vendor/libgit2/src/diff_parse.c +4 -4
- data/vendor/libgit2/src/diff_print.c +34 -22
- data/vendor/libgit2/src/diff_stats.c +22 -7
- data/vendor/libgit2/src/diff_tform.c +18 -16
- data/vendor/libgit2/src/diff_xdiff.c +3 -3
- data/vendor/libgit2/src/errors.c +51 -39
- data/vendor/libgit2/src/errors.h +81 -0
- data/vendor/libgit2/src/features.h.in +9 -3
- data/vendor/libgit2/src/fetch.c +8 -3
- data/vendor/libgit2/src/fetchhead.c +12 -12
- data/vendor/libgit2/src/filebuf.c +28 -32
- data/vendor/libgit2/src/filebuf.h +2 -2
- data/vendor/libgit2/src/filter.c +47 -33
- data/vendor/libgit2/src/filter.h +0 -10
- data/vendor/libgit2/src/{fileops.c → futils.c} +70 -63
- data/vendor/libgit2/src/{fileops.h → futils.h} +6 -6
- data/vendor/libgit2/src/global.c +35 -55
- data/vendor/libgit2/src/global.h +0 -2
- data/vendor/libgit2/src/hash/sha1/collisiondetect.c +48 -0
- data/vendor/libgit2/src/hash/sha1/collisiondetect.h +19 -0
- data/vendor/libgit2/src/hash/{hash_common_crypto.h → sha1/common_crypto.c} +17 -17
- data/vendor/libgit2/src/hash/sha1/common_crypto.h +19 -0
- data/vendor/libgit2/src/hash/{hash_generic.c → sha1/generic.c} +22 -10
- data/vendor/libgit2/src/hash/{hash_generic.h → sha1/generic.h} +4 -10
- data/vendor/libgit2/src/hash/{hash_mbedtls.c → sha1/mbedtls.c} +15 -7
- data/vendor/libgit2/src/hash/{hash_mbedtls.h → sha1/mbedtls.h} +6 -7
- data/vendor/libgit2/src/hash/sha1/openssl.c +59 -0
- data/vendor/libgit2/src/hash/sha1/openssl.h +19 -0
- data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/sha1.c +14 -3
- data/vendor/libgit2/src/hash/{hash_win32.c → sha1/win32.c} +47 -37
- data/vendor/libgit2/src/hash/{hash_win32.h → sha1/win32.h} +6 -19
- data/vendor/libgit2/src/hash/sha1.h +38 -0
- data/vendor/libgit2/src/hash.c +61 -0
- data/vendor/libgit2/src/hash.h +20 -21
- data/vendor/libgit2/src/hashsig.c +5 -5
- data/vendor/libgit2/src/idxmap.c +107 -61
- data/vendor/libgit2/src/idxmap.h +153 -31
- data/vendor/libgit2/src/ignore.c +38 -42
- data/vendor/libgit2/src/index.c +264 -199
- data/vendor/libgit2/src/index.h +7 -1
- data/vendor/libgit2/src/indexer.c +338 -167
- data/vendor/libgit2/src/integer.h +71 -26
- data/vendor/libgit2/src/iterator.c +134 -62
- data/vendor/libgit2/src/iterator.h +15 -0
- data/vendor/libgit2/src/mailmap.c +8 -8
- data/vendor/libgit2/src/map.h +1 -1
- data/vendor/libgit2/src/merge.c +137 -93
- data/vendor/libgit2/src/merge_driver.c +11 -11
- data/vendor/libgit2/src/merge_file.c +2 -2
- data/vendor/libgit2/src/mwindow.c +24 -29
- data/vendor/libgit2/src/mwindow.h +4 -4
- data/vendor/libgit2/src/net.c +184 -0
- data/vendor/libgit2/src/net.h +36 -0
- data/vendor/libgit2/src/netops.c +55 -156
- data/vendor/libgit2/src/netops.h +3 -23
- data/vendor/libgit2/src/notes.c +14 -9
- data/vendor/libgit2/src/object.c +120 -69
- data/vendor/libgit2/src/object.h +22 -9
- data/vendor/libgit2/src/object_api.c +8 -8
- data/vendor/libgit2/src/odb.c +111 -88
- data/vendor/libgit2/src/odb.h +8 -7
- data/vendor/libgit2/src/odb_loose.c +58 -47
- data/vendor/libgit2/src/odb_mempack.c +21 -34
- data/vendor/libgit2/src/odb_pack.c +17 -13
- data/vendor/libgit2/src/offmap.c +53 -35
- data/vendor/libgit2/src/offmap.h +108 -21
- data/vendor/libgit2/src/oid.c +12 -7
- data/vendor/libgit2/src/oidmap.c +49 -47
- data/vendor/libgit2/src/oidmap.h +101 -24
- data/vendor/libgit2/src/pack-objects.c +87 -86
- data/vendor/libgit2/src/pack-objects.h +2 -8
- data/vendor/libgit2/src/pack.c +94 -96
- data/vendor/libgit2/src/pack.h +16 -18
- data/vendor/libgit2/src/parse.c +17 -4
- data/vendor/libgit2/src/parse.h +3 -3
- data/vendor/libgit2/src/patch.c +3 -3
- data/vendor/libgit2/src/patch_generate.c +18 -18
- data/vendor/libgit2/src/patch_parse.c +147 -79
- data/vendor/libgit2/src/path.c +207 -62
- data/vendor/libgit2/src/path.h +14 -0
- data/vendor/libgit2/src/pathspec.c +18 -18
- data/vendor/libgit2/src/pool.c +26 -22
- data/vendor/libgit2/src/pool.h +7 -7
- data/vendor/libgit2/src/posix.c +10 -10
- data/vendor/libgit2/src/posix.h +12 -1
- data/vendor/libgit2/src/proxy.c +8 -3
- data/vendor/libgit2/src/push.c +35 -29
- data/vendor/libgit2/src/push.h +2 -1
- data/vendor/libgit2/src/reader.c +265 -0
- data/vendor/libgit2/src/reader.h +107 -0
- data/vendor/libgit2/src/rebase.c +97 -38
- data/vendor/libgit2/src/refdb.c +15 -3
- data/vendor/libgit2/src/refdb_fs.c +318 -222
- data/vendor/libgit2/src/reflog.c +13 -15
- data/vendor/libgit2/src/refs.c +122 -89
- data/vendor/libgit2/src/refs.h +5 -3
- data/vendor/libgit2/src/refspec.c +27 -33
- data/vendor/libgit2/src/regexp.c +221 -0
- data/vendor/libgit2/src/regexp.h +97 -0
- data/vendor/libgit2/src/remote.c +229 -178
- data/vendor/libgit2/src/remote.h +11 -2
- data/vendor/libgit2/src/repository.c +227 -172
- data/vendor/libgit2/src/repository.h +52 -40
- data/vendor/libgit2/src/reset.c +7 -7
- data/vendor/libgit2/src/revert.c +11 -6
- data/vendor/libgit2/src/revparse.c +46 -46
- data/vendor/libgit2/src/revwalk.c +89 -54
- data/vendor/libgit2/src/revwalk.h +20 -0
- data/vendor/libgit2/src/settings.c +22 -9
- data/vendor/libgit2/src/signature.c +15 -13
- data/vendor/libgit2/src/sortedcache.c +22 -36
- data/vendor/libgit2/src/sortedcache.h +1 -1
- data/vendor/libgit2/src/stash.c +56 -76
- data/vendor/libgit2/src/status.c +27 -21
- data/vendor/libgit2/src/stream.h +17 -2
- data/vendor/libgit2/src/streams/mbedtls.c +100 -80
- data/vendor/libgit2/src/streams/mbedtls.h +5 -2
- data/vendor/libgit2/src/streams/openssl.c +93 -81
- data/vendor/libgit2/src/streams/openssl.h +5 -2
- data/vendor/libgit2/src/streams/registry.c +118 -0
- data/vendor/libgit2/src/streams/registry.h +19 -0
- data/vendor/libgit2/src/streams/socket.c +55 -30
- data/vendor/libgit2/src/streams/stransport.c +57 -32
- data/vendor/libgit2/src/streams/stransport.h +5 -0
- data/vendor/libgit2/src/streams/tls.c +48 -20
- data/vendor/libgit2/src/streams/tls.h +12 -4
- data/vendor/libgit2/src/strmap.c +47 -74
- data/vendor/libgit2/src/strmap.h +108 -33
- data/vendor/libgit2/src/submodule.c +190 -169
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/sysdir.c +25 -15
- data/vendor/libgit2/src/tag.c +39 -26
- data/vendor/libgit2/src/tag.h +2 -1
- data/vendor/libgit2/src/trace.c +2 -2
- data/vendor/libgit2/src/trace.h +2 -2
- data/vendor/libgit2/src/trailer.c +46 -32
- data/vendor/libgit2/src/transaction.c +30 -29
- data/vendor/libgit2/src/transport.c +3 -3
- data/vendor/libgit2/src/transports/auth.c +14 -10
- data/vendor/libgit2/src/transports/auth.h +10 -3
- data/vendor/libgit2/src/transports/auth_negotiate.c +31 -16
- data/vendor/libgit2/src/transports/auth_negotiate.h +2 -2
- data/vendor/libgit2/src/transports/auth_ntlm.c +223 -0
- data/vendor/libgit2/src/transports/auth_ntlm.h +35 -0
- data/vendor/libgit2/src/transports/cred.c +24 -24
- data/vendor/libgit2/src/transports/git.c +25 -30
- data/vendor/libgit2/src/transports/http.c +871 -335
- data/vendor/libgit2/src/transports/http.h +2 -0
- data/vendor/libgit2/src/transports/local.c +28 -28
- data/vendor/libgit2/src/transports/smart.c +64 -46
- data/vendor/libgit2/src/transports/smart.h +5 -6
- data/vendor/libgit2/src/transports/smart_pkt.c +162 -151
- data/vendor/libgit2/src/transports/smart_protocol.c +64 -94
- data/vendor/libgit2/src/transports/ssh.c +76 -65
- data/vendor/libgit2/src/transports/winhttp.c +328 -319
- data/vendor/libgit2/src/tree-cache.c +21 -14
- data/vendor/libgit2/src/tree.c +119 -112
- data/vendor/libgit2/src/tree.h +1 -0
- data/vendor/libgit2/src/unix/map.c +3 -3
- data/vendor/libgit2/src/unix/posix.h +1 -11
- data/vendor/libgit2/src/userdiff.h +3 -1
- data/vendor/libgit2/src/util.c +154 -93
- data/vendor/libgit2/src/util.h +19 -23
- data/vendor/libgit2/src/vector.c +15 -10
- data/vendor/libgit2/src/wildmatch.c +320 -0
- data/vendor/libgit2/src/wildmatch.h +23 -0
- data/vendor/libgit2/src/win32/dir.c +3 -3
- data/vendor/libgit2/src/win32/findfile.c +1 -1
- data/vendor/libgit2/src/win32/map.c +9 -11
- data/vendor/libgit2/src/win32/msvc-compat.h +6 -0
- data/vendor/libgit2/src/win32/path_w32.c +113 -9
- data/vendor/libgit2/src/win32/path_w32.h +18 -29
- data/vendor/libgit2/src/win32/posix.h +1 -4
- data/vendor/libgit2/src/win32/posix_w32.c +69 -44
- data/vendor/libgit2/src/win32/precompiled.h +0 -2
- data/vendor/libgit2/src/win32/thread.c +5 -10
- data/vendor/libgit2/src/win32/w32_buffer.c +9 -5
- data/vendor/libgit2/src/win32/w32_common.h +39 -0
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +2 -95
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +0 -2
- data/vendor/libgit2/src/win32/w32_stack.c +6 -11
- data/vendor/libgit2/src/win32/w32_stack.h +3 -3
- data/vendor/libgit2/src/win32/w32_util.c +27 -64
- data/vendor/libgit2/src/win32/w32_util.h +5 -49
- data/vendor/libgit2/src/worktree.c +44 -30
- data/vendor/libgit2/src/xdiff/xdiffi.c +5 -5
- data/vendor/libgit2/src/xdiff/xhistogram.c +1 -1
- data/vendor/libgit2/src/xdiff/xmerge.c +27 -15
- data/vendor/libgit2/src/xdiff/xpatience.c +3 -0
- data/vendor/libgit2/src/zstream.c +4 -4
- metadata +115 -38
- data/vendor/libgit2/deps/regex/CMakeLists.txt +0 -2
- data/vendor/libgit2/deps/regex/config.h +0 -7
- data/vendor/libgit2/deps/regex/regcomp.c +0 -3857
- data/vendor/libgit2/deps/regex/regex.c +0 -92
- data/vendor/libgit2/deps/regex/regex.h +0 -582
- data/vendor/libgit2/deps/regex/regex_internal.c +0 -1744
- data/vendor/libgit2/deps/regex/regex_internal.h +0 -819
- data/vendor/libgit2/deps/regex/regexec.c +0 -4369
- data/vendor/libgit2/include/git2/inttypes.h +0 -309
- data/vendor/libgit2/include/git2/sys/time.h +0 -31
- data/vendor/libgit2/libgit2.pc.in +0 -13
- data/vendor/libgit2/src/config_file.h +0 -73
- data/vendor/libgit2/src/fnmatch.c +0 -248
- data/vendor/libgit2/src/fnmatch.h +0 -48
- data/vendor/libgit2/src/hash/hash_collisiondetect.h +0 -47
- data/vendor/libgit2/src/hash/hash_openssl.h +0 -59
- data/vendor/libgit2/src/streams/curl.c +0 -385
- data/vendor/libgit2/src/streams/curl.h +0 -17
- /data/vendor/libgit2/deps/http-parser/{LICENSE-MIT → COPYING} +0 -0
- /data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/sha1.h +0 -0
- /data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/ubc_check.c +0 -0
- /data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/ubc_check.h +0 -0
|
@@ -0,0 +1,320 @@
|
|
|
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
|
+
* Do shell-style pattern matching for ?, \, [], and * characters.
|
|
8
|
+
* It is 8bit clean.
|
|
9
|
+
*
|
|
10
|
+
* Written by Rich $alz, mirror!rs, Wed Nov 26 19:03:17 EST 1986.
|
|
11
|
+
* Rich $alz is now <rsalz@bbn.com>.
|
|
12
|
+
*
|
|
13
|
+
* Modified by Wayne Davison to special-case '/' matching, to make '**'
|
|
14
|
+
* work differently than '*', and to fix the character-class code.
|
|
15
|
+
*
|
|
16
|
+
* Imported from git.git.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
#include "wildmatch.h"
|
|
20
|
+
|
|
21
|
+
#define GIT_SPACE 0x01
|
|
22
|
+
#define GIT_DIGIT 0x02
|
|
23
|
+
#define GIT_ALPHA 0x04
|
|
24
|
+
#define GIT_GLOB_SPECIAL 0x08
|
|
25
|
+
#define GIT_REGEX_SPECIAL 0x10
|
|
26
|
+
#define GIT_PATHSPEC_MAGIC 0x20
|
|
27
|
+
#define GIT_CNTRL 0x40
|
|
28
|
+
#define GIT_PUNCT 0x80
|
|
29
|
+
|
|
30
|
+
enum {
|
|
31
|
+
S = GIT_SPACE,
|
|
32
|
+
A = GIT_ALPHA,
|
|
33
|
+
D = GIT_DIGIT,
|
|
34
|
+
G = GIT_GLOB_SPECIAL, /* *, ?, [, \\ */
|
|
35
|
+
R = GIT_REGEX_SPECIAL, /* $, (, ), +, ., ^, {, | */
|
|
36
|
+
P = GIT_PATHSPEC_MAGIC, /* other non-alnum, except for ] and } */
|
|
37
|
+
X = GIT_CNTRL,
|
|
38
|
+
U = GIT_PUNCT,
|
|
39
|
+
Z = GIT_CNTRL | GIT_SPACE
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
static const unsigned char sane_ctype[256] = {
|
|
43
|
+
X, X, X, X, X, X, X, X, X, Z, Z, X, X, Z, X, X, /* 0.. 15 */
|
|
44
|
+
X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, /* 16.. 31 */
|
|
45
|
+
S, P, P, P, R, P, P, P, R, R, G, R, P, P, R, P, /* 32.. 47 */
|
|
46
|
+
D, D, D, D, D, D, D, D, D, D, P, P, P, P, P, G, /* 48.. 63 */
|
|
47
|
+
P, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* 64.. 79 */
|
|
48
|
+
A, A, A, A, A, A, A, A, A, A, A, G, G, U, R, P, /* 80.. 95 */
|
|
49
|
+
P, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* 96..111 */
|
|
50
|
+
A, A, A, A, A, A, A, A, A, A, A, R, R, U, P, X, /* 112..127 */
|
|
51
|
+
/* Nothing in the 128.. range */
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
#define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
|
|
55
|
+
#define is_glob_special(x) sane_istest(x,GIT_GLOB_SPECIAL)
|
|
56
|
+
|
|
57
|
+
typedef unsigned char uchar;
|
|
58
|
+
|
|
59
|
+
/* What character marks an inverted character class? */
|
|
60
|
+
#define NEGATE_CLASS '!'
|
|
61
|
+
#define NEGATE_CLASS2 '^'
|
|
62
|
+
|
|
63
|
+
#define CC_EQ(class, len, litmatch) ((len) == sizeof (litmatch)-1 \
|
|
64
|
+
&& *(class) == *(litmatch) \
|
|
65
|
+
&& strncmp((char*)class, litmatch, len) == 0)
|
|
66
|
+
|
|
67
|
+
#if defined STDC_HEADERS || !defined isascii
|
|
68
|
+
# define ISASCII(c) 1
|
|
69
|
+
#else
|
|
70
|
+
# define ISASCII(c) isascii(c)
|
|
71
|
+
#endif
|
|
72
|
+
|
|
73
|
+
#ifdef isblank
|
|
74
|
+
# define ISBLANK(c) (ISASCII(c) && isblank(c))
|
|
75
|
+
#else
|
|
76
|
+
# define ISBLANK(c) ((c) == ' ' || (c) == '\t')
|
|
77
|
+
#endif
|
|
78
|
+
|
|
79
|
+
#ifdef isgraph
|
|
80
|
+
# define ISGRAPH(c) (ISASCII(c) && isgraph(c))
|
|
81
|
+
#else
|
|
82
|
+
# define ISGRAPH(c) (ISASCII(c) && isprint(c) && !isspace(c))
|
|
83
|
+
#endif
|
|
84
|
+
|
|
85
|
+
#define ISPRINT(c) (ISASCII(c) && isprint(c))
|
|
86
|
+
#define ISDIGIT(c) (ISASCII(c) && isdigit(c))
|
|
87
|
+
#define ISALNUM(c) (ISASCII(c) && isalnum(c))
|
|
88
|
+
#define ISALPHA(c) (ISASCII(c) && isalpha(c))
|
|
89
|
+
#define ISCNTRL(c) (ISASCII(c) && iscntrl(c))
|
|
90
|
+
#define ISLOWER(c) (ISASCII(c) && islower(c))
|
|
91
|
+
#define ISPUNCT(c) (ISASCII(c) && ispunct(c))
|
|
92
|
+
#define ISSPACE(c) (ISASCII(c) && isspace(c))
|
|
93
|
+
#define ISUPPER(c) (ISASCII(c) && isupper(c))
|
|
94
|
+
#define ISXDIGIT(c) (ISASCII(c) && isxdigit(c))
|
|
95
|
+
|
|
96
|
+
/* Match pattern "p" against "text" */
|
|
97
|
+
static int dowild(const uchar *p, const uchar *text, unsigned int flags)
|
|
98
|
+
{
|
|
99
|
+
uchar p_ch;
|
|
100
|
+
const uchar *pattern = p;
|
|
101
|
+
|
|
102
|
+
for ( ; (p_ch = *p) != '\0'; text++, p++) {
|
|
103
|
+
int matched, match_slash, negated;
|
|
104
|
+
uchar t_ch, prev_ch;
|
|
105
|
+
if ((t_ch = *text) == '\0' && p_ch != '*')
|
|
106
|
+
return WM_ABORT_ALL;
|
|
107
|
+
if ((flags & WM_CASEFOLD) && ISUPPER(t_ch))
|
|
108
|
+
t_ch = tolower(t_ch);
|
|
109
|
+
if ((flags & WM_CASEFOLD) && ISUPPER(p_ch))
|
|
110
|
+
p_ch = tolower(p_ch);
|
|
111
|
+
switch (p_ch) {
|
|
112
|
+
case '\\':
|
|
113
|
+
/* Literal match with following character. Note that the test
|
|
114
|
+
* in "default" handles the p[1] == '\0' failure case. */
|
|
115
|
+
p_ch = *++p;
|
|
116
|
+
/* FALLTHROUGH */
|
|
117
|
+
default:
|
|
118
|
+
if (t_ch != p_ch)
|
|
119
|
+
return WM_NOMATCH;
|
|
120
|
+
continue;
|
|
121
|
+
case '?':
|
|
122
|
+
/* Match anything but '/'. */
|
|
123
|
+
if ((flags & WM_PATHNAME) && t_ch == '/')
|
|
124
|
+
return WM_NOMATCH;
|
|
125
|
+
continue;
|
|
126
|
+
case '*':
|
|
127
|
+
if (*++p == '*') {
|
|
128
|
+
const uchar *prev_p = p - 2;
|
|
129
|
+
while (*++p == '*') {}
|
|
130
|
+
if (!(flags & WM_PATHNAME))
|
|
131
|
+
/* without WM_PATHNAME, '*' == '**' */
|
|
132
|
+
match_slash = 1;
|
|
133
|
+
else if ((prev_p < pattern || *prev_p == '/') &&
|
|
134
|
+
(*p == '\0' || *p == '/' ||
|
|
135
|
+
(p[0] == '\\' && p[1] == '/'))) {
|
|
136
|
+
/*
|
|
137
|
+
* Assuming we already match 'foo/' and are at
|
|
138
|
+
* <star star slash>, just assume it matches
|
|
139
|
+
* nothing and go ahead match the rest of the
|
|
140
|
+
* pattern with the remaining string. This
|
|
141
|
+
* helps make foo/<*><*>/bar (<> because
|
|
142
|
+
* otherwise it breaks C comment syntax) match
|
|
143
|
+
* both foo/bar and foo/a/bar.
|
|
144
|
+
*/
|
|
145
|
+
if (p[0] == '/' &&
|
|
146
|
+
dowild(p + 1, text, flags) == WM_MATCH)
|
|
147
|
+
return WM_MATCH;
|
|
148
|
+
match_slash = 1;
|
|
149
|
+
} else /* WM_PATHNAME is set */
|
|
150
|
+
match_slash = 0;
|
|
151
|
+
} else
|
|
152
|
+
/* without WM_PATHNAME, '*' == '**' */
|
|
153
|
+
match_slash = flags & WM_PATHNAME ? 0 : 1;
|
|
154
|
+
if (*p == '\0') {
|
|
155
|
+
/* Trailing "**" matches everything. Trailing "*" matches
|
|
156
|
+
* only if there are no more slash characters. */
|
|
157
|
+
if (!match_slash) {
|
|
158
|
+
if (strchr((char*)text, '/') != NULL)
|
|
159
|
+
return WM_NOMATCH;
|
|
160
|
+
}
|
|
161
|
+
return WM_MATCH;
|
|
162
|
+
} else if (!match_slash && *p == '/') {
|
|
163
|
+
/*
|
|
164
|
+
* _one_ asterisk followed by a slash
|
|
165
|
+
* with WM_PATHNAME matches the next
|
|
166
|
+
* directory
|
|
167
|
+
*/
|
|
168
|
+
const char *slash = strchr((char*)text, '/');
|
|
169
|
+
if (!slash)
|
|
170
|
+
return WM_NOMATCH;
|
|
171
|
+
text = (const uchar*)slash;
|
|
172
|
+
/* the slash is consumed by the top-level for loop */
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
while (1) {
|
|
176
|
+
if (t_ch == '\0')
|
|
177
|
+
break;
|
|
178
|
+
/*
|
|
179
|
+
* Try to advance faster when an asterisk is
|
|
180
|
+
* followed by a literal. We know in this case
|
|
181
|
+
* that the string before the literal
|
|
182
|
+
* must belong to "*".
|
|
183
|
+
* If match_slash is false, do not look past
|
|
184
|
+
* the first slash as it cannot belong to '*'.
|
|
185
|
+
*/
|
|
186
|
+
if (!is_glob_special(*p)) {
|
|
187
|
+
p_ch = *p;
|
|
188
|
+
if ((flags & WM_CASEFOLD) && ISUPPER(p_ch))
|
|
189
|
+
p_ch = tolower(p_ch);
|
|
190
|
+
while ((t_ch = *text) != '\0' &&
|
|
191
|
+
(match_slash || t_ch != '/')) {
|
|
192
|
+
if ((flags & WM_CASEFOLD) && ISUPPER(t_ch))
|
|
193
|
+
t_ch = tolower(t_ch);
|
|
194
|
+
if (t_ch == p_ch)
|
|
195
|
+
break;
|
|
196
|
+
text++;
|
|
197
|
+
}
|
|
198
|
+
if (t_ch != p_ch)
|
|
199
|
+
return WM_NOMATCH;
|
|
200
|
+
}
|
|
201
|
+
if ((matched = dowild(p, text, flags)) != WM_NOMATCH) {
|
|
202
|
+
if (!match_slash || matched != WM_ABORT_TO_STARSTAR)
|
|
203
|
+
return matched;
|
|
204
|
+
} else if (!match_slash && t_ch == '/')
|
|
205
|
+
return WM_ABORT_TO_STARSTAR;
|
|
206
|
+
t_ch = *++text;
|
|
207
|
+
}
|
|
208
|
+
return WM_ABORT_ALL;
|
|
209
|
+
case '[':
|
|
210
|
+
p_ch = *++p;
|
|
211
|
+
#ifdef NEGATE_CLASS2
|
|
212
|
+
if (p_ch == NEGATE_CLASS2)
|
|
213
|
+
p_ch = NEGATE_CLASS;
|
|
214
|
+
#endif
|
|
215
|
+
/* Assign literal 1/0 because of "matched" comparison. */
|
|
216
|
+
negated = p_ch == NEGATE_CLASS ? 1 : 0;
|
|
217
|
+
if (negated) {
|
|
218
|
+
/* Inverted character class. */
|
|
219
|
+
p_ch = *++p;
|
|
220
|
+
}
|
|
221
|
+
prev_ch = 0;
|
|
222
|
+
matched = 0;
|
|
223
|
+
do {
|
|
224
|
+
if (!p_ch)
|
|
225
|
+
return WM_ABORT_ALL;
|
|
226
|
+
if (p_ch == '\\') {
|
|
227
|
+
p_ch = *++p;
|
|
228
|
+
if (!p_ch)
|
|
229
|
+
return WM_ABORT_ALL;
|
|
230
|
+
if (t_ch == p_ch)
|
|
231
|
+
matched = 1;
|
|
232
|
+
} else if (p_ch == '-' && prev_ch && p[1] && p[1] != ']') {
|
|
233
|
+
p_ch = *++p;
|
|
234
|
+
if (p_ch == '\\') {
|
|
235
|
+
p_ch = *++p;
|
|
236
|
+
if (!p_ch)
|
|
237
|
+
return WM_ABORT_ALL;
|
|
238
|
+
}
|
|
239
|
+
if (t_ch <= p_ch && t_ch >= prev_ch)
|
|
240
|
+
matched = 1;
|
|
241
|
+
else if ((flags & WM_CASEFOLD) && ISLOWER(t_ch)) {
|
|
242
|
+
uchar t_ch_upper = toupper(t_ch);
|
|
243
|
+
if (t_ch_upper <= p_ch && t_ch_upper >= prev_ch)
|
|
244
|
+
matched = 1;
|
|
245
|
+
}
|
|
246
|
+
p_ch = 0; /* This makes "prev_ch" get set to 0. */
|
|
247
|
+
} else if (p_ch == '[' && p[1] == ':') {
|
|
248
|
+
const uchar *s;
|
|
249
|
+
int i;
|
|
250
|
+
for (s = p += 2; (p_ch = *p) && p_ch != ']'; p++) {} /*SHARED ITERATOR*/
|
|
251
|
+
if (!p_ch)
|
|
252
|
+
return WM_ABORT_ALL;
|
|
253
|
+
i = (int)(p - s - 1);
|
|
254
|
+
if (i < 0 || p[-1] != ':') {
|
|
255
|
+
/* Didn't find ":]", so treat like a normal set. */
|
|
256
|
+
p = s - 2;
|
|
257
|
+
p_ch = '[';
|
|
258
|
+
if (t_ch == p_ch)
|
|
259
|
+
matched = 1;
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
if (CC_EQ(s,i, "alnum")) {
|
|
263
|
+
if (ISALNUM(t_ch))
|
|
264
|
+
matched = 1;
|
|
265
|
+
} else if (CC_EQ(s,i, "alpha")) {
|
|
266
|
+
if (ISALPHA(t_ch))
|
|
267
|
+
matched = 1;
|
|
268
|
+
} else if (CC_EQ(s,i, "blank")) {
|
|
269
|
+
if (ISBLANK(t_ch))
|
|
270
|
+
matched = 1;
|
|
271
|
+
} else if (CC_EQ(s,i, "cntrl")) {
|
|
272
|
+
if (ISCNTRL(t_ch))
|
|
273
|
+
matched = 1;
|
|
274
|
+
} else if (CC_EQ(s,i, "digit")) {
|
|
275
|
+
if (ISDIGIT(t_ch))
|
|
276
|
+
matched = 1;
|
|
277
|
+
} else if (CC_EQ(s,i, "graph")) {
|
|
278
|
+
if (ISGRAPH(t_ch))
|
|
279
|
+
matched = 1;
|
|
280
|
+
} else if (CC_EQ(s,i, "lower")) {
|
|
281
|
+
if (ISLOWER(t_ch))
|
|
282
|
+
matched = 1;
|
|
283
|
+
} else if (CC_EQ(s,i, "print")) {
|
|
284
|
+
if (ISPRINT(t_ch))
|
|
285
|
+
matched = 1;
|
|
286
|
+
} else if (CC_EQ(s,i, "punct")) {
|
|
287
|
+
if (ISPUNCT(t_ch))
|
|
288
|
+
matched = 1;
|
|
289
|
+
} else if (CC_EQ(s,i, "space")) {
|
|
290
|
+
if (ISSPACE(t_ch))
|
|
291
|
+
matched = 1;
|
|
292
|
+
} else if (CC_EQ(s,i, "upper")) {
|
|
293
|
+
if (ISUPPER(t_ch))
|
|
294
|
+
matched = 1;
|
|
295
|
+
else if ((flags & WM_CASEFOLD) && ISLOWER(t_ch))
|
|
296
|
+
matched = 1;
|
|
297
|
+
} else if (CC_EQ(s,i, "xdigit")) {
|
|
298
|
+
if (ISXDIGIT(t_ch))
|
|
299
|
+
matched = 1;
|
|
300
|
+
} else /* malformed [:class:] string */
|
|
301
|
+
return WM_ABORT_ALL;
|
|
302
|
+
p_ch = 0; /* This makes "prev_ch" get set to 0. */
|
|
303
|
+
} else if (t_ch == p_ch)
|
|
304
|
+
matched = 1;
|
|
305
|
+
} while (prev_ch = p_ch, (p_ch = *++p) != ']');
|
|
306
|
+
if (matched == negated ||
|
|
307
|
+
((flags & WM_PATHNAME) && t_ch == '/'))
|
|
308
|
+
return WM_NOMATCH;
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
return *text ? WM_NOMATCH : WM_MATCH;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/* Match the "pattern" against the "text" string. */
|
|
317
|
+
int wildmatch(const char *pattern, const char *text, unsigned int flags)
|
|
318
|
+
{
|
|
319
|
+
return dowild((const uchar*)pattern, (const uchar*)text, flags);
|
|
320
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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_wildmatch_h__
|
|
9
|
+
#define INCLUDE_wildmatch_h__
|
|
10
|
+
|
|
11
|
+
#include "common.h"
|
|
12
|
+
|
|
13
|
+
#define WM_CASEFOLD 1
|
|
14
|
+
#define WM_PATHNAME 2
|
|
15
|
+
|
|
16
|
+
#define WM_NOMATCH 1
|
|
17
|
+
#define WM_MATCH 0
|
|
18
|
+
#define WM_ABORT_ALL -1
|
|
19
|
+
#define WM_ABORT_TO_STARSTAR -2
|
|
20
|
+
|
|
21
|
+
int wildmatch(const char *pattern, const char *text, unsigned int flags);
|
|
22
|
+
|
|
23
|
+
#endif
|
|
@@ -31,7 +31,7 @@ git__DIR *git__opendir(const char *dir)
|
|
|
31
31
|
new->h = FindFirstFileW(filter_w, &new->f);
|
|
32
32
|
|
|
33
33
|
if (new->h == INVALID_HANDLE_VALUE) {
|
|
34
|
-
|
|
34
|
+
git_error_set(GIT_ERROR_OS, "could not open directory '%s'", dir);
|
|
35
35
|
git__free(new);
|
|
36
36
|
return NULL;
|
|
37
37
|
}
|
|
@@ -56,7 +56,7 @@ int git__readdir_ext(
|
|
|
56
56
|
else if (!FindNextFileW(d->h, &d->f)) {
|
|
57
57
|
if (GetLastError() == ERROR_NO_MORE_FILES)
|
|
58
58
|
return 0;
|
|
59
|
-
|
|
59
|
+
git_error_set(GIT_ERROR_OS, "could not read from directory '%s'", d->dir);
|
|
60
60
|
return -1;
|
|
61
61
|
}
|
|
62
62
|
|
|
@@ -101,7 +101,7 @@ void git__rewinddir(git__DIR *d)
|
|
|
101
101
|
d->h = FindFirstFileW(filter_w, &d->f);
|
|
102
102
|
|
|
103
103
|
if (d->h == INVALID_HANDLE_VALUE)
|
|
104
|
-
|
|
104
|
+
git_error_set(GIT_ERROR_OS, "could not open directory '%s'", d->dir);
|
|
105
105
|
else
|
|
106
106
|
d->first = 1;
|
|
107
107
|
}
|
|
@@ -39,7 +39,7 @@ static int win32_path_to_8(git_buf *dest, const wchar_t *src)
|
|
|
39
39
|
git_win32_utf8_path utf8_path;
|
|
40
40
|
|
|
41
41
|
if (git_win32_path_to_utf8(utf8_path, src) < 0) {
|
|
42
|
-
|
|
42
|
+
git_error_set(GIT_ERROR_OS, "unable to convert path to UTF-8");
|
|
43
43
|
return -1;
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -50,7 +50,7 @@ int git__mmap_alignment(size_t *page_size)
|
|
|
50
50
|
return 0;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
int p_mmap(git_map *out, size_t len, int prot, int flags, int fd,
|
|
53
|
+
int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, off64_t offset)
|
|
54
54
|
{
|
|
55
55
|
HANDLE fh = (HANDLE)_get_osfhandle(fd);
|
|
56
56
|
DWORD alignment = get_allocation_granularity();
|
|
@@ -58,8 +58,8 @@ int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offs
|
|
|
58
58
|
DWORD view_prot = 0;
|
|
59
59
|
DWORD off_low = 0;
|
|
60
60
|
DWORD off_hi = 0;
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
off64_t page_start;
|
|
62
|
+
off64_t page_offset;
|
|
63
63
|
|
|
64
64
|
GIT_MMAP_VALIDATE(out, len, prot, flags);
|
|
65
65
|
|
|
@@ -69,7 +69,7 @@ int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offs
|
|
|
69
69
|
|
|
70
70
|
if (fh == INVALID_HANDLE_VALUE) {
|
|
71
71
|
errno = EBADF;
|
|
72
|
-
|
|
72
|
+
git_error_set(GIT_ERROR_OS, "failed to mmap. Invalid handle value");
|
|
73
73
|
return -1;
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -88,24 +88,22 @@ int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offs
|
|
|
88
88
|
|
|
89
89
|
if (page_offset != 0) { /* offset must be multiple of the allocation granularity */
|
|
90
90
|
errno = EINVAL;
|
|
91
|
-
|
|
91
|
+
git_error_set(GIT_ERROR_OS, "failed to mmap. Offset must be multiple of allocation granularity");
|
|
92
92
|
return -1;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
out->fmh = CreateFileMapping(fh, NULL, fmap_prot, 0, 0, NULL);
|
|
96
96
|
if (!out->fmh || out->fmh == INVALID_HANDLE_VALUE) {
|
|
97
|
-
|
|
97
|
+
git_error_set(GIT_ERROR_OS, "failed to mmap. Invalid handle value");
|
|
98
98
|
out->fmh = NULL;
|
|
99
99
|
return -1;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
assert(sizeof(git_off_t) == 8);
|
|
103
|
-
|
|
104
102
|
off_low = (DWORD)(page_start);
|
|
105
103
|
off_hi = (DWORD)(page_start >> 32);
|
|
106
104
|
out->data = MapViewOfFile(out->fmh, view_prot, off_hi, off_low, len);
|
|
107
105
|
if (!out->data) {
|
|
108
|
-
|
|
106
|
+
git_error_set(GIT_ERROR_OS, "failed to mmap. No data written");
|
|
109
107
|
CloseHandle(out->fmh);
|
|
110
108
|
out->fmh = NULL;
|
|
111
109
|
return -1;
|
|
@@ -123,7 +121,7 @@ int p_munmap(git_map *map)
|
|
|
123
121
|
|
|
124
122
|
if (map->data) {
|
|
125
123
|
if (!UnmapViewOfFile(map->data)) {
|
|
126
|
-
|
|
124
|
+
git_error_set(GIT_ERROR_OS, "failed to munmap. Could not unmap view of file");
|
|
127
125
|
error = -1;
|
|
128
126
|
}
|
|
129
127
|
map->data = NULL;
|
|
@@ -131,7 +129,7 @@ int p_munmap(git_map *map)
|
|
|
131
129
|
|
|
132
130
|
if (map->fmh) {
|
|
133
131
|
if (!CloseHandle(map->fmh)) {
|
|
134
|
-
|
|
132
|
+
git_error_set(GIT_ERROR_OS, "failed to munmap. Could not close handle");
|
|
135
133
|
error = -1;
|
|
136
134
|
}
|
|
137
135
|
map->fmh = NULL;
|
|
@@ -12,6 +12,12 @@
|
|
|
12
12
|
typedef unsigned short mode_t;
|
|
13
13
|
typedef SSIZE_T ssize_t;
|
|
14
14
|
|
|
15
|
+
#ifdef _WIN64
|
|
16
|
+
# define SSIZE_MAX _I64_MAX
|
|
17
|
+
#else
|
|
18
|
+
# define SSIZE_MAX LONG_MAX
|
|
19
|
+
#endif
|
|
20
|
+
|
|
15
21
|
#define strcasecmp(s1, s2) _stricmp(s1, s2)
|
|
16
22
|
#define strncasecmp(s1, s2, c) _strnicmp(s1, s2, c)
|
|
17
23
|
|
|
@@ -140,14 +140,24 @@ int git_win32_path_canonicalize(git_win32_path path)
|
|
|
140
140
|
|
|
141
141
|
*to = L'\0';
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
if ((to - path) > INT_MAX) {
|
|
144
|
+
SetLastError(ERROR_FILENAME_EXCED_RANGE);
|
|
145
|
+
return -1;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return (int)(to - path);
|
|
144
149
|
}
|
|
145
150
|
|
|
146
151
|
int git_win32_path__cwd(wchar_t *out, size_t len)
|
|
147
152
|
{
|
|
148
153
|
int cwd_len;
|
|
149
154
|
|
|
150
|
-
if (
|
|
155
|
+
if (len > INT_MAX) {
|
|
156
|
+
errno = ENAMETOOLONG;
|
|
157
|
+
return -1;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if ((cwd_len = path__cwd(out, (int)len)) < 0)
|
|
151
161
|
return -1;
|
|
152
162
|
|
|
153
163
|
/* UNC paths */
|
|
@@ -220,7 +230,7 @@ int git_win32_path_from_utf8(git_win32_path out, const char *src)
|
|
|
220
230
|
goto on_error;
|
|
221
231
|
}
|
|
222
232
|
|
|
223
|
-
/* Skip the drive letter specification ("C:") */
|
|
233
|
+
/* Skip the drive letter specification ("C:") */
|
|
224
234
|
if (git__utf8_to_16(dest + 2, MAX_PATH - 2, src) < 0)
|
|
225
235
|
goto on_error;
|
|
226
236
|
}
|
|
@@ -315,7 +325,7 @@ static bool path_is_volume(wchar_t *target, size_t target_len)
|
|
|
315
325
|
}
|
|
316
326
|
|
|
317
327
|
/* On success, returns the length, in characters, of the path stored in dest.
|
|
318
|
-
* On failure, returns a negative value. */
|
|
328
|
+
* On failure, returns a negative value. */
|
|
319
329
|
int git_win32_path_readlink_w(git_win32_path dest, const git_win32_path path)
|
|
320
330
|
{
|
|
321
331
|
BYTE buf[MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
|
|
@@ -360,16 +370,16 @@ int git_win32_path_readlink_w(git_win32_path dest, const git_win32_path path)
|
|
|
360
370
|
|
|
361
371
|
if (path_is_volume(target, target_len)) {
|
|
362
372
|
/* This path is a reparse point that represents another volume mounted
|
|
363
|
-
|
|
364
|
-
|
|
373
|
+
* at this location, it is not a symbolic link our input was canonical.
|
|
374
|
+
*/
|
|
365
375
|
errno = EINVAL;
|
|
366
376
|
error = -1;
|
|
367
377
|
} else if (target_len) {
|
|
368
|
-
/* The path may need to have a prefix removed. */
|
|
369
|
-
target_len =
|
|
378
|
+
/* The path may need to have a namespace prefix removed. */
|
|
379
|
+
target_len = git_win32_path_remove_namespace(target, target_len);
|
|
370
380
|
|
|
371
381
|
/* Need one additional character in the target buffer
|
|
372
|
-
|
|
382
|
+
* for the terminating NULL. */
|
|
373
383
|
if (GIT_WIN_PATH_UTF16 > target_len) {
|
|
374
384
|
wcscpy(dest, target);
|
|
375
385
|
error = (int)target_len;
|
|
@@ -380,3 +390,97 @@ on_error:
|
|
|
380
390
|
CloseHandle(handle);
|
|
381
391
|
return error;
|
|
382
392
|
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Removes any trailing backslashes from a path, except in the case of a drive
|
|
396
|
+
* letter path (C:\, D:\, etc.). This function cannot fail.
|
|
397
|
+
*
|
|
398
|
+
* @param path The path which should be trimmed.
|
|
399
|
+
* @return The length of the modified string (<= the input length)
|
|
400
|
+
*/
|
|
401
|
+
size_t git_win32_path_trim_end(wchar_t *str, size_t len)
|
|
402
|
+
{
|
|
403
|
+
while (1) {
|
|
404
|
+
if (!len || str[len - 1] != L'\\')
|
|
405
|
+
break;
|
|
406
|
+
|
|
407
|
+
/*
|
|
408
|
+
* Don't trim backslashes from drive letter paths, which
|
|
409
|
+
* are 3 characters long and of the form C:\, D:\, etc.
|
|
410
|
+
*/
|
|
411
|
+
if (len == 3 && git_win32__isalpha(str[0]) && str[1] == ':')
|
|
412
|
+
break;
|
|
413
|
+
|
|
414
|
+
len--;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
str[len] = L'\0';
|
|
418
|
+
|
|
419
|
+
return len;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Removes any of the following namespace prefixes from a path,
|
|
424
|
+
* if found: "\??\", "\\?\", "\\?\UNC\". This function cannot fail.
|
|
425
|
+
*
|
|
426
|
+
* @param path The path which should be converted.
|
|
427
|
+
* @return The length of the modified string (<= the input length)
|
|
428
|
+
*/
|
|
429
|
+
size_t git_win32_path_remove_namespace(wchar_t *str, size_t len)
|
|
430
|
+
{
|
|
431
|
+
static const wchar_t dosdevices_namespace[] = L"\\\?\?\\";
|
|
432
|
+
static const wchar_t nt_namespace[] = L"\\\\?\\";
|
|
433
|
+
static const wchar_t unc_namespace_remainder[] = L"UNC\\";
|
|
434
|
+
static const wchar_t unc_prefix[] = L"\\\\";
|
|
435
|
+
|
|
436
|
+
const wchar_t *prefix = NULL, *remainder = NULL;
|
|
437
|
+
size_t prefix_len = 0, remainder_len = 0;
|
|
438
|
+
|
|
439
|
+
/* "\??\" -- DOS Devices prefix */
|
|
440
|
+
if (len >= CONST_STRLEN(dosdevices_namespace) &&
|
|
441
|
+
!wcsncmp(str, dosdevices_namespace, CONST_STRLEN(dosdevices_namespace))) {
|
|
442
|
+
remainder = str + CONST_STRLEN(dosdevices_namespace);
|
|
443
|
+
remainder_len = len - CONST_STRLEN(dosdevices_namespace);
|
|
444
|
+
}
|
|
445
|
+
/* "\\?\" -- NT namespace prefix */
|
|
446
|
+
else if (len >= CONST_STRLEN(nt_namespace) &&
|
|
447
|
+
!wcsncmp(str, nt_namespace, CONST_STRLEN(nt_namespace))) {
|
|
448
|
+
remainder = str + CONST_STRLEN(nt_namespace);
|
|
449
|
+
remainder_len = len - CONST_STRLEN(nt_namespace);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/* "\??\UNC\", "\\?\UNC\" -- UNC prefix */
|
|
453
|
+
if (remainder_len >= CONST_STRLEN(unc_namespace_remainder) &&
|
|
454
|
+
!wcsncmp(remainder, unc_namespace_remainder, CONST_STRLEN(unc_namespace_remainder))) {
|
|
455
|
+
|
|
456
|
+
/*
|
|
457
|
+
* The proper Win32 path for a UNC share has "\\" at beginning of it
|
|
458
|
+
* and looks like "\\server\share\<folderStructure>". So remove the
|
|
459
|
+
* UNC namespace and add a prefix of "\\" in its place.
|
|
460
|
+
*/
|
|
461
|
+
remainder += CONST_STRLEN(unc_namespace_remainder);
|
|
462
|
+
remainder_len -= CONST_STRLEN(unc_namespace_remainder);
|
|
463
|
+
|
|
464
|
+
prefix = unc_prefix;
|
|
465
|
+
prefix_len = CONST_STRLEN(unc_prefix);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
if (remainder) {
|
|
469
|
+
/*
|
|
470
|
+
* Sanity check that the new string isn't longer than the old one.
|
|
471
|
+
* (This could only happen due to programmer error introducing a
|
|
472
|
+
* prefix longer than the namespace it replaces.)
|
|
473
|
+
*/
|
|
474
|
+
assert(len >= remainder_len + prefix_len);
|
|
475
|
+
|
|
476
|
+
if (prefix)
|
|
477
|
+
memmove(str, prefix, prefix_len * sizeof(wchar_t));
|
|
478
|
+
|
|
479
|
+
memmove(str + prefix_len, remainder, remainder_len * sizeof(wchar_t));
|
|
480
|
+
|
|
481
|
+
len = remainder_len + prefix_len;
|
|
482
|
+
str[len] = L'\0';
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
return git_win32_path_trim_end(str, len);
|
|
486
|
+
}
|
|
@@ -8,37 +8,8 @@
|
|
|
8
8
|
#define INCLUDE_win32_path_w32_h__
|
|
9
9
|
|
|
10
10
|
#include "common.h"
|
|
11
|
-
|
|
12
11
|
#include "vector.h"
|
|
13
12
|
|
|
14
|
-
/*
|
|
15
|
-
* Provides a large enough buffer to support Windows paths: MAX_PATH is
|
|
16
|
-
* 260, corresponding to a maximum path length of 259 characters plus a
|
|
17
|
-
* NULL terminator. Prefixing with "\\?\" adds 4 characters, but if the
|
|
18
|
-
* original was a UNC path, then we turn "\\server\share" into
|
|
19
|
-
* "\\?\UNC\server\share". So we replace the first two characters with
|
|
20
|
-
* 8 characters, a net gain of 6, so the maximum length is MAX_PATH+6.
|
|
21
|
-
*/
|
|
22
|
-
#define GIT_WIN_PATH_UTF16 MAX_PATH+6
|
|
23
|
-
|
|
24
|
-
/* Maximum size of a UTF-8 Win32 path. We remove the "\\?\" or "\\?\UNC\"
|
|
25
|
-
* prefixes for presentation, bringing us back to 259 (non-NULL)
|
|
26
|
-
* characters. UTF-8 does have 4-byte sequences, but they are encoded in
|
|
27
|
-
* UTF-16 using surrogate pairs, which takes up the space of two characters.
|
|
28
|
-
* Two characters in the range U+0800 -> U+FFFF take up more space in UTF-8
|
|
29
|
-
* (6 bytes) than one surrogate pair (4 bytes).
|
|
30
|
-
*/
|
|
31
|
-
#define GIT_WIN_PATH_UTF8 (259 * 3 + 1)
|
|
32
|
-
|
|
33
|
-
/*
|
|
34
|
-
* The length of a Windows "shortname", for 8.3 compatibility.
|
|
35
|
-
*/
|
|
36
|
-
#define GIT_WIN_PATH_SHORTNAME 13
|
|
37
|
-
|
|
38
|
-
/* Win32 path types */
|
|
39
|
-
typedef wchar_t git_win32_path[GIT_WIN_PATH_UTF16];
|
|
40
|
-
typedef char git_win32_utf8_path[GIT_WIN_PATH_UTF8];
|
|
41
|
-
|
|
42
13
|
/**
|
|
43
14
|
* Create a Win32 path (in UCS-2 format) from a UTF-8 string.
|
|
44
15
|
*
|
|
@@ -83,4 +54,22 @@ extern char *git_win32_path_8dot3_name(const char *path);
|
|
|
83
54
|
|
|
84
55
|
extern int git_win32_path_readlink_w(git_win32_path dest, const git_win32_path path);
|
|
85
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Removes any trailing backslashes from a path, except in the case of a drive
|
|
59
|
+
* letter path (C:\, D:\, etc.). This function cannot fail.
|
|
60
|
+
*
|
|
61
|
+
* @param path The path which should be trimmed.
|
|
62
|
+
* @return The length of the modified string (<= the input length)
|
|
63
|
+
*/
|
|
64
|
+
size_t git_win32_path_trim_end(wchar_t *str, size_t len);
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Removes any of the following namespace prefixes from a path,
|
|
68
|
+
* if found: "\??\", "\\?\", "\\?\UNC\". This function cannot fail.
|
|
69
|
+
*
|
|
70
|
+
* @param path The path which should be converted.
|
|
71
|
+
* @return The length of the modified string (<= the input length)
|
|
72
|
+
*/
|
|
73
|
+
size_t git_win32_path_remove_namespace(wchar_t *str, size_t len);
|
|
74
|
+
|
|
86
75
|
#endif
|