rugged 0.27.9 → 0.27.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +1 -0
- data/vendor/libgit2/CMakeLists.txt +98 -54
- data/vendor/libgit2/COPYING +28 -0
- data/vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake +15 -1
- 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/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/FindmbedTLS.cmake +93 -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/CMakeLists.txt +2 -0
- data/vendor/libgit2/deps/http-parser/{LICENSE-MIT → COPYING} +0 -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.h +5 -0
- 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 +38 -20
- data/vendor/libgit2/include/git2/blame.h +42 -25
- data/vendor/libgit2/include/git2/blob.h +45 -13
- data/vendor/libgit2/include/git2/branch.h +1 -1
- data/vendor/libgit2/include/git2/buffer.h +22 -16
- data/vendor/libgit2/include/git2/cert.h +135 -0
- data/vendor/libgit2/include/git2/checkout.h +65 -32
- data/vendor/libgit2/include/git2/cherrypick.h +9 -7
- data/vendor/libgit2/include/git2/clone.h +12 -10
- data/vendor/libgit2/include/git2/commit.h +53 -3
- data/vendor/libgit2/include/git2/common.h +60 -8
- data/vendor/libgit2/include/git2/config.h +30 -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 +32 -9
- data/vendor/libgit2/include/git2/diff.h +208 -156
- data/vendor/libgit2/include/git2/errors.h +54 -46
- data/vendor/libgit2/include/git2/filter.h +8 -0
- data/vendor/libgit2/include/git2/ignore.h +2 -2
- data/vendor/libgit2/include/git2/index.h +74 -52
- data/vendor/libgit2/include/git2/indexer.h +76 -6
- data/vendor/libgit2/include/git2/mailmap.h +115 -0
- data/vendor/libgit2/include/git2/merge.h +35 -18
- 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 +14 -8
- data/vendor/libgit2/include/git2/rebase.h +53 -6
- data/vendor/libgit2/include/git2/refs.h +33 -15
- data/vendor/libgit2/include/git2/refspec.h +17 -0
- data/vendor/libgit2/include/git2/remote.h +123 -24
- data/vendor/libgit2/include/git2/repository.h +76 -39
- data/vendor/libgit2/include/git2/revert.h +6 -4
- 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 +15 -12
- data/vendor/libgit2/include/git2/status.h +33 -20
- data/vendor/libgit2/include/git2/submodule.h +30 -12
- data/vendor/libgit2/include/git2/sys/alloc.h +101 -0
- 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/index.h +3 -0
- data/vendor/libgit2/include/git2/sys/mempack.h +35 -35
- data/vendor/libgit2/include/git2/sys/merge.h +9 -4
- data/vendor/libgit2/include/git2/sys/odb_backend.h +66 -22
- data/vendor/libgit2/include/git2/sys/path.h +64 -0
- 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/transaction.h +1 -0
- 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 +33 -111
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2/worktree.h +48 -13
- data/vendor/libgit2/src/CMakeLists.txt +96 -164
- data/vendor/libgit2/src/alloc.c +43 -0
- data/vendor/libgit2/src/alloc.h +40 -0
- data/vendor/libgit2/src/allocators/stdalloc.c +119 -0
- data/vendor/libgit2/src/{streams/curl.h → allocators/stdalloc.h} +5 -5
- 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 +15 -8
- data/vendor/libgit2/src/apply.c +537 -31
- data/vendor/libgit2/src/apply.h +3 -1
- data/vendor/libgit2/src/array.h +2 -2
- data/vendor/libgit2/src/attr.c +81 -75
- data/vendor/libgit2/src/attr_file.c +207 -121
- data/vendor/libgit2/src/attr_file.h +9 -9
- data/vendor/libgit2/src/attrcache.c +51 -53
- data/vendor/libgit2/src/attrcache.h +2 -1
- data/vendor/libgit2/src/blame.c +47 -20
- data/vendor/libgit2/src/blame.h +2 -1
- data/vendor/libgit2/src/blame_git.c +37 -20
- data/vendor/libgit2/src/blob.c +128 -42
- data/vendor/libgit2/src/blob.h +19 -2
- data/vendor/libgit2/src/branch.c +67 -43
- data/vendor/libgit2/src/buf_text.c +7 -6
- data/vendor/libgit2/src/buffer.c +69 -57
- data/vendor/libgit2/src/buffer.h +1 -1
- 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 +109 -90
- data/vendor/libgit2/src/cherrypick.c +15 -9
- data/vendor/libgit2/src/clone.c +49 -27
- data/vendor/libgit2/src/clone.h +4 -0
- data/vendor/libgit2/src/commit.c +117 -49
- data/vendor/libgit2/src/commit.h +7 -0
- data/vendor/libgit2/src/commit_list.c +30 -78
- data/vendor/libgit2/src/commit_list.h +2 -2
- data/vendor/libgit2/src/common.h +27 -91
- data/vendor/libgit2/src/config.c +194 -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 +439 -753
- data/vendor/libgit2/src/config_mem.c +220 -0
- data/vendor/libgit2/src/config_parse.c +114 -63
- data/vendor/libgit2/src/config_parse.h +17 -16
- data/vendor/libgit2/src/config_snapshot.c +206 -0
- data/vendor/libgit2/src/crlf.c +219 -190
- data/vendor/libgit2/src/delta.c +25 -18
- data/vendor/libgit2/src/describe.c +42 -41
- data/vendor/libgit2/src/diff.c +53 -68
- data/vendor/libgit2/src/diff.h +2 -1
- data/vendor/libgit2/src/diff_driver.c +47 -49
- data/vendor/libgit2/src/diff_file.c +19 -17
- data/vendor/libgit2/src/diff_file.h +1 -1
- data/vendor/libgit2/src/diff_generate.c +162 -106
- 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 +42 -30
- data/vendor/libgit2/src/diff_stats.c +22 -7
- data/vendor/libgit2/src/diff_tform.c +16 -16
- data/vendor/libgit2/src/diff_xdiff.c +15 -3
- data/vendor/libgit2/src/errors.c +51 -39
- data/vendor/libgit2/src/errors.h +81 -0
- data/vendor/libgit2/src/features.h.in +11 -3
- data/vendor/libgit2/src/fetch.c +10 -5
- data/vendor/libgit2/src/fetchhead.c +17 -17
- data/vendor/libgit2/src/filebuf.c +32 -36
- data/vendor/libgit2/src/filebuf.h +2 -2
- data/vendor/libgit2/src/filter.c +46 -38
- data/vendor/libgit2/src/filter.h +0 -10
- data/vendor/libgit2/src/{fileops.c → futils.c} +80 -73
- data/vendor/libgit2/src/{fileops.h → futils.h} +6 -6
- data/vendor/libgit2/src/global.c +48 -63
- data/vendor/libgit2/src/global.h +0 -2
- data/vendor/libgit2/src/hash.c +61 -0
- data/vendor/libgit2/src/hash.h +20 -19
- data/vendor/libgit2/src/hash/sha1.h +38 -0
- 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/sha1/mbedtls.c +46 -0
- data/vendor/libgit2/src/hash/sha1/mbedtls.h +19 -0
- 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/{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
- 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/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 +43 -47
- data/vendor/libgit2/src/index.c +337 -232
- data/vendor/libgit2/src/index.h +17 -1
- data/vendor/libgit2/src/indexer.c +346 -175
- data/vendor/libgit2/src/integer.h +71 -26
- data/vendor/libgit2/src/iterator.c +142 -70
- data/vendor/libgit2/src/iterator.h +15 -0
- data/vendor/libgit2/src/khash.h +3 -1
- data/vendor/libgit2/src/mailmap.c +485 -0
- data/vendor/libgit2/src/mailmap.h +35 -0
- data/vendor/libgit2/src/map.h +1 -1
- data/vendor/libgit2/src/merge.c +144 -100
- 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 +16 -11
- 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 +116 -93
- data/vendor/libgit2/src/odb.h +8 -7
- data/vendor/libgit2/src/odb_loose.c +62 -55
- data/vendor/libgit2/src/odb_mempack.c +21 -34
- data/vendor/libgit2/src/odb_pack.c +18 -14
- 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 +88 -87
- data/vendor/libgit2/src/pack-objects.h +2 -8
- data/vendor/libgit2/src/pack.c +99 -101
- data/vendor/libgit2/src/pack.h +17 -19
- data/vendor/libgit2/src/parse.c +10 -0
- data/vendor/libgit2/src/parse.h +3 -3
- data/vendor/libgit2/src/patch.c +4 -4
- data/vendor/libgit2/src/patch_generate.c +20 -20
- data/vendor/libgit2/src/patch_parse.c +151 -63
- data/vendor/libgit2/src/path.c +169 -125
- data/vendor/libgit2/src/path.h +3 -71
- data/vendor/libgit2/src/pathspec.c +19 -19
- 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 +37 -31
- 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 +115 -59
- data/vendor/libgit2/src/refdb.c +15 -3
- data/vendor/libgit2/src/refdb_fs.c +381 -254
- data/vendor/libgit2/src/reflog.c +13 -15
- data/vendor/libgit2/src/refs.c +118 -88
- data/vendor/libgit2/src/refs.h +5 -3
- data/vendor/libgit2/src/refspec.c +56 -37
- data/vendor/libgit2/src/refspec.h +1 -1
- data/vendor/libgit2/src/regexp.c +221 -0
- data/vendor/libgit2/src/regexp.h +97 -0
- data/vendor/libgit2/src/remote.c +266 -215
- data/vendor/libgit2/src/remote.h +11 -2
- data/vendor/libgit2/src/repository.c +280 -225
- data/vendor/libgit2/src/repository.h +52 -40
- data/vendor/libgit2/src/reset.c +8 -8
- data/vendor/libgit2/src/revert.c +14 -9
- data/vendor/libgit2/src/revparse.c +47 -48
- data/vendor/libgit2/src/revwalk.c +120 -57
- data/vendor/libgit2/src/revwalk.h +22 -1
- data/vendor/libgit2/src/settings.c +47 -10
- data/vendor/libgit2/src/signature.c +11 -11
- data/vendor/libgit2/src/sortedcache.c +22 -36
- data/vendor/libgit2/src/sortedcache.h +1 -1
- data/vendor/libgit2/src/stash.c +125 -99
- data/vendor/libgit2/src/status.c +28 -22
- data/vendor/libgit2/src/stream.h +17 -2
- data/vendor/libgit2/src/streams/mbedtls.c +483 -0
- data/vendor/libgit2/src/streams/mbedtls.h +23 -0
- data/vendor/libgit2/src/streams/openssl.c +224 -114
- data/vendor/libgit2/src/streams/openssl.h +4 -108
- 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 +50 -19
- 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 +272 -216
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/sysdir.c +29 -19
- data/vendor/libgit2/src/tag.c +41 -28
- data/vendor/libgit2/src/tag.h +2 -1
- data/vendor/libgit2/src/trace.c +2 -2
- data/vendor/libgit2/src/trace.h +3 -3
- data/vendor/libgit2/src/trailer.c +52 -38
- data/vendor/libgit2/src/transaction.c +30 -29
- data/vendor/libgit2/src/transport.c +5 -5
- data/vendor/libgit2/src/transports/auth.c +15 -11
- data/vendor/libgit2/src/transports/auth.h +10 -3
- data/vendor/libgit2/src/transports/auth_negotiate.c +33 -18
- 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 +26 -31
- data/vendor/libgit2/src/transports/http.c +881 -348
- data/vendor/libgit2/src/transports/http.h +2 -0
- data/vendor/libgit2/src/transports/local.c +35 -35
- data/vendor/libgit2/src/transports/smart.c +70 -47
- data/vendor/libgit2/src/transports/smart.h +3 -4
- data/vendor/libgit2/src/transports/smart_pkt.c +43 -40
- data/vendor/libgit2/src/transports/smart_protocol.c +96 -116
- data/vendor/libgit2/src/transports/ssh.c +77 -66
- data/vendor/libgit2/src/transports/winhttp.c +318 -314
- data/vendor/libgit2/src/tree-cache.c +19 -12
- data/vendor/libgit2/src/tree.c +103 -142
- data/vendor/libgit2/src/tree.h +1 -12
- 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 +70 -56
- data/vendor/libgit2/src/util.h +28 -156
- data/vendor/libgit2/src/vector.c +4 -4
- 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 +3 -3
- 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 +70 -45
- 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 +3 -2
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +26 -75
- 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 +95 -60
- data/vendor/libgit2/src/worktree.h +2 -0
- data/vendor/libgit2/src/xdiff/xdiffi.c +7 -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 +122 -33
- 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
@@ -30,14 +30,14 @@ static int write_cherrypick_head(
|
|
30
30
|
int error = 0;
|
31
31
|
|
32
32
|
if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_CHERRYPICK_HEAD_FILE)) >= 0 &&
|
33
|
-
(error = git_filebuf_open(&file, file_path.ptr,
|
33
|
+
(error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_CREATE_LEADING_DIRS, GIT_CHERRYPICK_FILE_MODE)) >= 0 &&
|
34
34
|
(error = git_filebuf_printf(&file, "%s\n", commit_oidstr)) >= 0)
|
35
35
|
error = git_filebuf_commit(&file);
|
36
36
|
|
37
37
|
if (error < 0)
|
38
38
|
git_filebuf_cleanup(&file);
|
39
39
|
|
40
|
-
|
40
|
+
git_buf_dispose(&file_path);
|
41
41
|
|
42
42
|
return error;
|
43
43
|
}
|
@@ -51,7 +51,7 @@ static int write_merge_msg(
|
|
51
51
|
int error = 0;
|
52
52
|
|
53
53
|
if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_MERGE_MSG_FILE)) < 0 ||
|
54
|
-
(error = git_filebuf_open(&file, file_path.ptr,
|
54
|
+
(error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_CREATE_LEADING_DIRS, GIT_CHERRYPICK_FILE_MODE)) < 0 ||
|
55
55
|
(error = git_filebuf_printf(&file, "%s", commit_msg)) < 0)
|
56
56
|
goto cleanup;
|
57
57
|
|
@@ -61,7 +61,7 @@ cleanup:
|
|
61
61
|
if (error < 0)
|
62
62
|
git_filebuf_cleanup(&file);
|
63
63
|
|
64
|
-
|
64
|
+
git_buf_dispose(&file_path);
|
65
65
|
|
66
66
|
return error;
|
67
67
|
}
|
@@ -108,7 +108,7 @@ static int cherrypick_seterr(git_commit *commit, const char *fmt)
|
|
108
108
|
{
|
109
109
|
char commit_oidstr[GIT_OID_HEXSZ + 1];
|
110
110
|
|
111
|
-
|
111
|
+
git_error_set(GIT_ERROR_CHERRYPICK, fmt,
|
112
112
|
git_oid_tostr(commit_oidstr, GIT_OID_HEXSZ + 1, git_commit_id(commit)));
|
113
113
|
|
114
114
|
return -1;
|
@@ -179,7 +179,7 @@ int git_cherrypick(
|
|
179
179
|
|
180
180
|
assert(repo && commit);
|
181
181
|
|
182
|
-
|
182
|
+
GIT_ERROR_CHECK_VERSION(given_opts, GIT_CHERRYPICK_OPTIONS_VERSION, "git_cherrypick_options");
|
183
183
|
|
184
184
|
if ((error = git_repository__ensure_not_bare(repo, "cherry-pick")) < 0)
|
185
185
|
return error;
|
@@ -198,7 +198,7 @@ int git_cherrypick(
|
|
198
198
|
(error = git_indexwriter_init_for_operation(&indexwriter, repo, &opts.checkout_opts.checkout_strategy)) < 0 ||
|
199
199
|
(error = write_cherrypick_head(repo, commit_oidstr)) < 0 ||
|
200
200
|
(error = git_repository_head(&our_ref, repo)) < 0 ||
|
201
|
-
(error = git_reference_peel((git_object **)&our_commit, our_ref,
|
201
|
+
(error = git_reference_peel((git_object **)&our_commit, our_ref, GIT_OBJECT_COMMIT)) < 0 ||
|
202
202
|
(error = git_cherrypick_commit(&index, repo, commit, our_commit, opts.mainline, &opts.merge_opts)) < 0 ||
|
203
203
|
(error = git_merge__check_result(repo, index)) < 0 ||
|
204
204
|
(error = git_merge__append_conflicts_to_merge_msg(repo, index)) < 0 ||
|
@@ -216,15 +216,21 @@ done:
|
|
216
216
|
git_index_free(index);
|
217
217
|
git_commit_free(our_commit);
|
218
218
|
git_reference_free(our_ref);
|
219
|
-
|
219
|
+
git_buf_dispose(&their_label);
|
220
220
|
|
221
221
|
return error;
|
222
222
|
}
|
223
223
|
|
224
|
-
int
|
224
|
+
int git_cherrypick_options_init(
|
225
225
|
git_cherrypick_options *opts, unsigned int version)
|
226
226
|
{
|
227
227
|
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
|
228
228
|
opts, version, git_cherrypick_options, GIT_CHERRYPICK_OPTIONS_INIT);
|
229
229
|
return 0;
|
230
230
|
}
|
231
|
+
|
232
|
+
int git_cherrypick_init_options(
|
233
|
+
git_cherrypick_options *opts, unsigned int version)
|
234
|
+
{
|
235
|
+
return git_cherrypick_options_init(opts, version);
|
236
|
+
}
|
data/vendor/libgit2/src/clone.c
CHANGED
@@ -7,8 +7,6 @@
|
|
7
7
|
|
8
8
|
#include "clone.h"
|
9
9
|
|
10
|
-
#include <assert.h>
|
11
|
-
|
12
10
|
#include "git2/clone.h"
|
13
11
|
#include "git2/remote.h"
|
14
12
|
#include "git2/revparse.h"
|
@@ -19,7 +17,7 @@
|
|
19
17
|
#include "git2/tree.h"
|
20
18
|
|
21
19
|
#include "remote.h"
|
22
|
-
#include "
|
20
|
+
#include "futils.h"
|
23
21
|
#include "refs.h"
|
24
22
|
#include "path.h"
|
25
23
|
#include "repository.h"
|
@@ -48,7 +46,7 @@ static int create_branch(
|
|
48
46
|
return error;
|
49
47
|
|
50
48
|
error = git_reference_create(&branch_ref, repo, git_buf_cstr(&refname), target, 0, log_message);
|
51
|
-
|
49
|
+
git_buf_dispose(&refname);
|
52
50
|
git_commit_free(head_obj);
|
53
51
|
|
54
52
|
if (!error)
|
@@ -87,8 +85,8 @@ static int setup_tracking_config(
|
|
87
85
|
error = 0;
|
88
86
|
|
89
87
|
cleanup:
|
90
|
-
|
91
|
-
|
88
|
+
git_buf_dispose(&remote_key);
|
89
|
+
git_buf_dispose(&merge_key);
|
92
90
|
return error;
|
93
91
|
}
|
94
92
|
|
@@ -176,7 +174,7 @@ static int update_head_to_remote(
|
|
176
174
|
refspec = git_remote__matching_refspec(remote, git_buf_cstr(&branch));
|
177
175
|
|
178
176
|
if (refspec == NULL) {
|
179
|
-
|
177
|
+
git_error_set(GIT_ERROR_NET, "the remote's default branch does not fit the refspec configuration");
|
180
178
|
error = GIT_EINVALIDSPEC;
|
181
179
|
goto cleanup;
|
182
180
|
}
|
@@ -195,8 +193,8 @@ static int update_head_to_remote(
|
|
195
193
|
reflog_message);
|
196
194
|
|
197
195
|
cleanup:
|
198
|
-
|
199
|
-
|
196
|
+
git_buf_dispose(&remote_master_name);
|
197
|
+
git_buf_dispose(&branch);
|
200
198
|
|
201
199
|
return error;
|
202
200
|
}
|
@@ -225,7 +223,7 @@ static int update_head_to_branch(
|
|
225
223
|
|
226
224
|
cleanup:
|
227
225
|
git_reference_free(remote_ref);
|
228
|
-
|
226
|
+
git_buf_dispose(&remote_branch_name);
|
229
227
|
return retcode;
|
230
228
|
}
|
231
229
|
|
@@ -332,7 +330,7 @@ static int clone_into(git_repository *repo, git_remote *_remote, const git_fetch
|
|
332
330
|
assert(repo && _remote);
|
333
331
|
|
334
332
|
if (!git_repository_is_empty(repo)) {
|
335
|
-
|
333
|
+
git_error_set(GIT_ERROR_INVALID, "the repository is not empty");
|
336
334
|
return -1;
|
337
335
|
}
|
338
336
|
|
@@ -351,7 +349,7 @@ static int clone_into(git_repository *repo, git_remote *_remote, const git_fetch
|
|
351
349
|
|
352
350
|
cleanup:
|
353
351
|
git_remote_free(remote);
|
354
|
-
|
352
|
+
git_buf_dispose(&reflog_message);
|
355
353
|
|
356
354
|
return error;
|
357
355
|
}
|
@@ -378,15 +376,16 @@ int git_clone__should_clone_local(const char *url_or_path, git_clone_local_t loc
|
|
378
376
|
git_path_isdir(path);
|
379
377
|
|
380
378
|
done:
|
381
|
-
|
379
|
+
git_buf_dispose(&fromurl);
|
382
380
|
return is_local;
|
383
381
|
}
|
384
382
|
|
385
|
-
int
|
383
|
+
static int git__clone(
|
386
384
|
git_repository **out,
|
387
385
|
const char *url,
|
388
386
|
const char *local_path,
|
389
|
-
const git_clone_options *_options
|
387
|
+
const git_clone_options *_options,
|
388
|
+
int use_existing)
|
390
389
|
{
|
391
390
|
int error = 0;
|
392
391
|
git_repository *repo = NULL;
|
@@ -400,11 +399,11 @@ int git_clone(
|
|
400
399
|
if (_options)
|
401
400
|
memcpy(&options, _options, sizeof(git_clone_options));
|
402
401
|
|
403
|
-
|
402
|
+
GIT_ERROR_CHECK_VERSION(&options, GIT_CLONE_OPTIONS_VERSION, "git_clone_options");
|
404
403
|
|
405
404
|
/* Only clone to a new directory or an empty directory */
|
406
|
-
if (git_path_exists(local_path) && !git_path_is_empty_dir(local_path)) {
|
407
|
-
|
405
|
+
if (git_path_exists(local_path) && !use_existing && !git_path_is_empty_dir(local_path)) {
|
406
|
+
git_error_set(GIT_ERROR_INVALID,
|
408
407
|
"'%s' exists and is not an empty directory", local_path);
|
409
408
|
return GIT_EEXISTS;
|
410
409
|
}
|
@@ -441,27 +440,50 @@ int git_clone(
|
|
441
440
|
|
442
441
|
if (error != 0) {
|
443
442
|
git_error_state last_error = {0};
|
444
|
-
|
443
|
+
git_error_state_capture(&last_error, error);
|
445
444
|
|
446
445
|
git_repository_free(repo);
|
447
446
|
repo = NULL;
|
448
447
|
|
449
448
|
(void)git_futils_rmdir_r(local_path, NULL, rmdir_flags);
|
450
449
|
|
451
|
-
|
450
|
+
git_error_state_restore(&last_error);
|
452
451
|
}
|
453
452
|
|
454
453
|
*out = repo;
|
455
454
|
return error;
|
456
455
|
}
|
457
456
|
|
458
|
-
int
|
457
|
+
int git_clone(
|
458
|
+
git_repository **out,
|
459
|
+
const char *url,
|
460
|
+
const char *local_path,
|
461
|
+
const git_clone_options *_options)
|
462
|
+
{
|
463
|
+
return git__clone(out, url, local_path, _options, 0);
|
464
|
+
}
|
465
|
+
|
466
|
+
int git_clone__submodule(
|
467
|
+
git_repository **out,
|
468
|
+
const char *url,
|
469
|
+
const char *local_path,
|
470
|
+
const git_clone_options *_options)
|
471
|
+
{
|
472
|
+
return git__clone(out, url, local_path, _options, 1);
|
473
|
+
}
|
474
|
+
|
475
|
+
int git_clone_options_init(git_clone_options *opts, unsigned int version)
|
459
476
|
{
|
460
477
|
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
|
461
478
|
opts, version, git_clone_options, GIT_CLONE_OPTIONS_INIT);
|
462
479
|
return 0;
|
463
480
|
}
|
464
481
|
|
482
|
+
int git_clone_init_options(git_clone_options *opts, unsigned int version)
|
483
|
+
{
|
484
|
+
return git_clone_options_init(opts, version);
|
485
|
+
}
|
486
|
+
|
465
487
|
static bool can_link(const char *src, const char *dst, int link)
|
466
488
|
{
|
467
489
|
#ifdef GIT_WIN32
|
@@ -496,7 +518,7 @@ static int clone_local_into(git_repository *repo, git_remote *remote, const git_
|
|
496
518
|
assert(repo && remote);
|
497
519
|
|
498
520
|
if (!git_repository_is_empty(repo)) {
|
499
|
-
|
521
|
+
git_error_set(GIT_ERROR_INVALID, "the repository is not empty");
|
500
522
|
return -1;
|
501
523
|
}
|
502
524
|
|
@@ -510,7 +532,7 @@ static int clone_local_into(git_repository *repo, git_remote *remote, const git_
|
|
510
532
|
|
511
533
|
/* Copy .git/objects/ from the source to the target */
|
512
534
|
if ((error = git_repository_open(&src, git_buf_cstr(&src_path))) < 0) {
|
513
|
-
|
535
|
+
git_buf_dispose(&src_path);
|
514
536
|
return error;
|
515
537
|
}
|
516
538
|
|
@@ -549,10 +571,10 @@ static int clone_local_into(git_repository *repo, git_remote *remote, const git_
|
|
549
571
|
error = checkout_branch(repo, remote, co_opts, branch, git_buf_cstr(&reflog_message));
|
550
572
|
|
551
573
|
cleanup:
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
574
|
+
git_buf_dispose(&reflog_message);
|
575
|
+
git_buf_dispose(&src_path);
|
576
|
+
git_buf_dispose(&src_odb);
|
577
|
+
git_buf_dispose(&dst_odb);
|
556
578
|
git_repository_free(src);
|
557
579
|
return error;
|
558
580
|
}
|
data/vendor/libgit2/src/clone.h
CHANGED
@@ -11,6 +11,10 @@
|
|
11
11
|
|
12
12
|
#include "git2/clone.h"
|
13
13
|
|
14
|
+
extern int git_clone__submodule(git_repository **out,
|
15
|
+
const char *url, const char *local_path,
|
16
|
+
const git_clone_options *_options);
|
17
|
+
|
14
18
|
extern int git_clone__should_clone_local(const char *url, git_clone_local_t local);
|
15
19
|
|
16
20
|
#endif
|
data/vendor/libgit2/src/commit.c
CHANGED
@@ -11,6 +11,7 @@
|
|
11
11
|
#include "git2/object.h"
|
12
12
|
#include "git2/repository.h"
|
13
13
|
#include "git2/signature.h"
|
14
|
+
#include "git2/mailmap.h"
|
14
15
|
#include "git2/sys/commit.h"
|
15
16
|
|
16
17
|
#include "odb.h"
|
@@ -19,6 +20,7 @@
|
|
19
20
|
#include "message.h"
|
20
21
|
#include "refs.h"
|
21
22
|
#include "object.h"
|
23
|
+
#include "array.h"
|
22
24
|
#include "oidarray.h"
|
23
25
|
|
24
26
|
void git_commit__free(void *_commit)
|
@@ -74,38 +76,38 @@ static int git_commit__create_buffer_internal(
|
|
74
76
|
return 0;
|
75
77
|
|
76
78
|
on_error:
|
77
|
-
|
79
|
+
git_buf_dispose(out);
|
78
80
|
return -1;
|
79
81
|
}
|
80
82
|
|
81
83
|
static int validate_tree_and_parents(git_array_oid_t *parents, git_repository *repo, const git_oid *tree,
|
82
|
-
|
83
|
-
|
84
|
+
git_commit_parent_callback parent_cb, void *parent_payload,
|
85
|
+
const git_oid *current_id, bool validate)
|
84
86
|
{
|
85
87
|
size_t i;
|
86
88
|
int error;
|
87
89
|
git_oid *parent_cpy;
|
88
90
|
const git_oid *parent;
|
89
91
|
|
90
|
-
if (validate && !git_object__is_valid(repo, tree,
|
92
|
+
if (validate && !git_object__is_valid(repo, tree, GIT_OBJECT_TREE))
|
91
93
|
return -1;
|
92
94
|
|
93
95
|
i = 0;
|
94
96
|
while ((parent = parent_cb(i, parent_payload)) != NULL) {
|
95
|
-
if (validate && !git_object__is_valid(repo, parent,
|
97
|
+
if (validate && !git_object__is_valid(repo, parent, GIT_OBJECT_COMMIT)) {
|
96
98
|
error = -1;
|
97
99
|
goto on_error;
|
98
100
|
}
|
99
101
|
|
100
102
|
parent_cpy = git_array_alloc(*parents);
|
101
|
-
|
103
|
+
GIT_ERROR_CHECK_ALLOC(parent_cpy);
|
102
104
|
|
103
105
|
git_oid_cpy(parent_cpy, parent);
|
104
106
|
i++;
|
105
107
|
}
|
106
108
|
|
107
109
|
if (current_id && (parents->size == 0 || git_oid_cmp(current_id, git_array_get(*parents, 0)))) {
|
108
|
-
|
110
|
+
git_error_set(GIT_ERROR_OBJECT, "failed to create commit: current tip is not the first parent");
|
109
111
|
error = GIT_EMODIFIED;
|
110
112
|
goto on_error;
|
111
113
|
}
|
@@ -142,7 +144,7 @@ static int git_commit__create_internal(
|
|
142
144
|
if (error < 0 && error != GIT_ENOTFOUND)
|
143
145
|
return error;
|
144
146
|
}
|
145
|
-
|
147
|
+
git_error_clear();
|
146
148
|
|
147
149
|
if (ref)
|
148
150
|
current_id = git_reference_target(ref);
|
@@ -151,8 +153,8 @@ static int git_commit__create_internal(
|
|
151
153
|
goto cleanup;
|
152
154
|
|
153
155
|
error = git_commit__create_buffer_internal(&buf, author, committer,
|
154
|
-
|
155
|
-
|
156
|
+
message_encoding, message, tree,
|
157
|
+
&parents);
|
156
158
|
|
157
159
|
if (error < 0)
|
158
160
|
goto cleanup;
|
@@ -163,7 +165,7 @@ static int git_commit__create_internal(
|
|
163
165
|
if (git_odb__freshen(odb, tree) < 0)
|
164
166
|
goto cleanup;
|
165
167
|
|
166
|
-
if (git_odb_write(id, odb, buf.ptr, buf.size,
|
168
|
+
if (git_odb_write(id, odb, buf.ptr, buf.size, GIT_OBJECT_COMMIT) < 0)
|
167
169
|
goto cleanup;
|
168
170
|
|
169
171
|
|
@@ -176,7 +178,7 @@ static int git_commit__create_internal(
|
|
176
178
|
cleanup:
|
177
179
|
git_array_clear(parents);
|
178
180
|
git_reference_free(ref);
|
179
|
-
|
181
|
+
git_buf_dispose(&buf);
|
180
182
|
return error;
|
181
183
|
}
|
182
184
|
|
@@ -350,7 +352,7 @@ int git_commit_amend(
|
|
350
352
|
|
351
353
|
if (!tree) {
|
352
354
|
git_tree *old_tree;
|
353
|
-
|
355
|
+
GIT_ERROR_CHECK_ERROR( git_commit_tree(&old_tree, commit_to_amend) );
|
354
356
|
git_oid_cpy(&tree_id, git_tree_id(old_tree));
|
355
357
|
git_tree_free(old_tree);
|
356
358
|
} else {
|
@@ -364,7 +366,7 @@ int git_commit_amend(
|
|
364
366
|
|
365
367
|
if (git_oid_cmp(git_commit_id(commit_to_amend), git_reference_target(ref))) {
|
366
368
|
git_reference_free(ref);
|
367
|
-
|
369
|
+
git_error_set(GIT_ERROR_REFERENCE, "commit to amend is not the tip of the given branch");
|
368
370
|
return -1;
|
369
371
|
}
|
370
372
|
}
|
@@ -382,24 +384,32 @@ int git_commit_amend(
|
|
382
384
|
return error;
|
383
385
|
}
|
384
386
|
|
385
|
-
int
|
387
|
+
static int commit_parse(git_commit *commit, const char *data, size_t size, unsigned int flags)
|
386
388
|
{
|
387
|
-
|
388
|
-
const char *
|
389
|
-
const char *buffer_end = buffer_start + git_odb_object_size(odb_obj);
|
389
|
+
const char *buffer_start = data, *buffer;
|
390
|
+
const char *buffer_end = buffer_start + size;
|
390
391
|
git_oid parent_id;
|
391
392
|
size_t header_len;
|
392
393
|
git_signature dummy_sig;
|
393
394
|
|
395
|
+
assert(commit && data);
|
396
|
+
|
394
397
|
buffer = buffer_start;
|
395
398
|
|
396
399
|
/* Allocate for one, which will allow not to realloc 90% of the time */
|
397
400
|
git_array_init_to_size(commit->parent_ids, 1);
|
398
|
-
|
401
|
+
GIT_ERROR_CHECK_ARRAY(commit->parent_ids);
|
399
402
|
|
400
403
|
/* The tree is always the first field */
|
401
|
-
if (
|
402
|
-
|
404
|
+
if (!(flags & GIT_COMMIT_PARSE_QUICK)) {
|
405
|
+
if (git_oid__parse(&commit->tree_id, &buffer, buffer_end, "tree ") < 0)
|
406
|
+
goto bad_buffer;
|
407
|
+
} else {
|
408
|
+
size_t tree_len = strlen("tree ") + GIT_OID_HEXSZ + 1;
|
409
|
+
if (buffer + tree_len > buffer_end)
|
410
|
+
goto bad_buffer;
|
411
|
+
buffer += tree_len;
|
412
|
+
}
|
403
413
|
|
404
414
|
/*
|
405
415
|
* TODO: commit grafts!
|
@@ -407,16 +417,18 @@ int git_commit__parse(void *_commit, git_odb_object *odb_obj)
|
|
407
417
|
|
408
418
|
while (git_oid__parse(&parent_id, &buffer, buffer_end, "parent ") == 0) {
|
409
419
|
git_oid *new_id = git_array_alloc(commit->parent_ids);
|
410
|
-
|
420
|
+
GIT_ERROR_CHECK_ALLOC(new_id);
|
411
421
|
|
412
422
|
git_oid_cpy(new_id, &parent_id);
|
413
423
|
}
|
414
424
|
|
415
|
-
|
416
|
-
|
425
|
+
if (!(flags & GIT_COMMIT_PARSE_QUICK)) {
|
426
|
+
commit->author = git__malloc(sizeof(git_signature));
|
427
|
+
GIT_ERROR_CHECK_ALLOC(commit->author);
|
417
428
|
|
418
|
-
|
419
|
-
|
429
|
+
if (git_signature__parse(commit->author, &buffer, buffer_end, "author ", '\n') < 0)
|
430
|
+
return -1;
|
431
|
+
}
|
420
432
|
|
421
433
|
/* Some tools create multiple author fields, ignore the extra ones */
|
422
434
|
while (!git__prefixncmp(buffer, buffer_end - buffer, "author ")) {
|
@@ -429,11 +441,14 @@ int git_commit__parse(void *_commit, git_odb_object *odb_obj)
|
|
429
441
|
|
430
442
|
/* Always parse the committer; we need the commit time */
|
431
443
|
commit->committer = git__malloc(sizeof(git_signature));
|
432
|
-
|
444
|
+
GIT_ERROR_CHECK_ALLOC(commit->committer);
|
433
445
|
|
434
446
|
if (git_signature__parse(commit->committer, &buffer, buffer_end, "committer ", '\n') < 0)
|
435
447
|
return -1;
|
436
448
|
|
449
|
+
if (flags & GIT_COMMIT_PARSE_QUICK)
|
450
|
+
return 0;
|
451
|
+
|
437
452
|
/* Parse add'l header entries */
|
438
453
|
while (buffer < buffer_end) {
|
439
454
|
const char *eoln = buffer;
|
@@ -447,7 +462,7 @@ int git_commit__parse(void *_commit, git_odb_object *odb_obj)
|
|
447
462
|
buffer += strlen("encoding ");
|
448
463
|
|
449
464
|
commit->message_encoding = git__strndup(buffer, eoln - buffer);
|
450
|
-
|
465
|
+
GIT_ERROR_CHECK_ALLOC(commit->message_encoding);
|
451
466
|
}
|
452
467
|
|
453
468
|
if (eoln < buffer_end && *eoln == '\n')
|
@@ -457,7 +472,7 @@ int git_commit__parse(void *_commit, git_odb_object *odb_obj)
|
|
457
472
|
|
458
473
|
header_len = buffer - buffer_start;
|
459
474
|
commit->raw_header = git__strndup(buffer_start, header_len);
|
460
|
-
|
475
|
+
GIT_ERROR_CHECK_ALLOC(commit->raw_header);
|
461
476
|
|
462
477
|
/* point "buffer" to data after header, +1 for the final LF */
|
463
478
|
buffer = buffer_start + header_len + 1;
|
@@ -467,15 +482,30 @@ int git_commit__parse(void *_commit, git_odb_object *odb_obj)
|
|
467
482
|
commit->raw_message = git__strndup(buffer, buffer_end - buffer);
|
468
483
|
else
|
469
484
|
commit->raw_message = git__strdup("");
|
470
|
-
|
485
|
+
GIT_ERROR_CHECK_ALLOC(commit->raw_message);
|
471
486
|
|
472
487
|
return 0;
|
473
488
|
|
474
489
|
bad_buffer:
|
475
|
-
|
490
|
+
git_error_set(GIT_ERROR_OBJECT, "failed to parse bad commit object");
|
476
491
|
return -1;
|
477
492
|
}
|
478
493
|
|
494
|
+
int git_commit__parse_raw(void *commit, const char *data, size_t size)
|
495
|
+
{
|
496
|
+
return commit_parse(commit, data, size, 0);
|
497
|
+
}
|
498
|
+
|
499
|
+
int git_commit__parse_ext(git_commit *commit, git_odb_object *odb_obj, unsigned int flags)
|
500
|
+
{
|
501
|
+
return commit_parse(commit, git_odb_object_data(odb_obj), git_odb_object_size(odb_obj), flags);
|
502
|
+
}
|
503
|
+
|
504
|
+
int git_commit__parse(void *_commit, git_odb_object *odb_obj)
|
505
|
+
{
|
506
|
+
return git_commit__parse_ext(_commit, odb_obj, 0);
|
507
|
+
}
|
508
|
+
|
479
509
|
#define GIT_COMMIT_GETTER(_rvalue, _name, _return) \
|
480
510
|
_rvalue git_commit_##_name(const git_commit *commit) \
|
481
511
|
{\
|
@@ -574,7 +604,7 @@ const char *git_commit_body(git_commit *commit)
|
|
574
604
|
break;
|
575
605
|
|
576
606
|
if (*msg)
|
577
|
-
|
607
|
+
commit->body = git__strndup(msg, end - msg + 1);
|
578
608
|
}
|
579
609
|
|
580
610
|
return commit->body;
|
@@ -602,7 +632,7 @@ int git_commit_parent(
|
|
602
632
|
|
603
633
|
parent_id = git_commit_parent_id(commit, n);
|
604
634
|
if (parent_id == NULL) {
|
605
|
-
|
635
|
+
git_error_set(GIT_ERROR_INVALID, "parent %u does not exist", n);
|
606
636
|
return GIT_ENOTFOUND;
|
607
637
|
}
|
608
638
|
|
@@ -691,14 +721,14 @@ int git_commit_header_field(git_buf *out, const git_commit *commit, const char *
|
|
691
721
|
return 0;
|
692
722
|
}
|
693
723
|
|
694
|
-
|
724
|
+
git_error_set(GIT_ERROR_OBJECT, "no such field '%s'", field);
|
695
725
|
return GIT_ENOTFOUND;
|
696
726
|
|
697
727
|
malformed:
|
698
|
-
|
728
|
+
git_error_set(GIT_ERROR_OBJECT, "malformed header");
|
699
729
|
return -1;
|
700
730
|
oom:
|
701
|
-
|
731
|
+
git_error_set_oom();
|
702
732
|
return -1;
|
703
733
|
}
|
704
734
|
|
@@ -722,8 +752,8 @@ int git_commit_extract_signature(git_buf *signature, git_buf *signed_data, git_r
|
|
722
752
|
if ((error = git_odb_read(&obj, odb, commit_id)) < 0)
|
723
753
|
return error;
|
724
754
|
|
725
|
-
if (obj->cached.type !=
|
726
|
-
|
755
|
+
if (obj->cached.type != GIT_OBJECT_COMMIT) {
|
756
|
+
git_error_set(GIT_ERROR_INVALID, "the requested type does not match the type in ODB");
|
727
757
|
error = GIT_ENOTFOUND;
|
728
758
|
goto cleanup;
|
729
759
|
}
|
@@ -775,16 +805,16 @@ int git_commit_extract_signature(git_buf *signature, git_buf *signed_data, git_r
|
|
775
805
|
return error;
|
776
806
|
}
|
777
807
|
|
778
|
-
|
808
|
+
git_error_set(GIT_ERROR_OBJECT, "this commit is not signed");
|
779
809
|
error = GIT_ENOTFOUND;
|
780
810
|
goto cleanup;
|
781
811
|
|
782
812
|
malformed:
|
783
|
-
|
813
|
+
git_error_set(GIT_ERROR_OBJECT, "malformed header");
|
784
814
|
error = -1;
|
785
815
|
goto cleanup;
|
786
816
|
oom:
|
787
|
-
|
817
|
+
git_error_set_oom();
|
788
818
|
error = -1;
|
789
819
|
goto cleanup;
|
790
820
|
|
@@ -848,6 +878,14 @@ static void format_header_field(git_buf *out, const char *field, const char *con
|
|
848
878
|
git_buf_putc(out, '\n');
|
849
879
|
}
|
850
880
|
|
881
|
+
static const git_oid *commit_parent_from_commit(size_t n, void *payload)
|
882
|
+
{
|
883
|
+
const git_commit *commit = (const git_commit *) payload;
|
884
|
+
|
885
|
+
return git_array_get(commit->parent_ids, n);
|
886
|
+
|
887
|
+
}
|
888
|
+
|
851
889
|
int git_commit_create_with_signature(
|
852
890
|
git_oid *out,
|
853
891
|
git_repository *repo,
|
@@ -860,20 +898,37 @@ int git_commit_create_with_signature(
|
|
860
898
|
const char *field;
|
861
899
|
const char *header_end;
|
862
900
|
git_buf commit = GIT_BUF_INIT;
|
901
|
+
git_commit *parsed;
|
902
|
+
git_array_oid_t parents = GIT_ARRAY_INIT;
|
903
|
+
|
904
|
+
/* The first step is to verify that all the tree and parents exist */
|
905
|
+
parsed = git__calloc(1, sizeof(git_commit));
|
906
|
+
GIT_ERROR_CHECK_ALLOC(parsed);
|
907
|
+
if ((error = commit_parse(parsed, commit_content, strlen(commit_content), 0)) < 0)
|
908
|
+
goto cleanup;
|
909
|
+
|
910
|
+
if ((error = validate_tree_and_parents(&parents, repo, &parsed->tree_id, commit_parent_from_commit, parsed, NULL, true)) < 0)
|
911
|
+
goto cleanup;
|
863
912
|
|
864
|
-
|
913
|
+
git_array_clear(parents);
|
914
|
+
|
915
|
+
/* Then we start appending by identifying the end of the commit header */
|
865
916
|
header_end = strstr(commit_content, "\n\n");
|
866
917
|
if (!header_end) {
|
867
|
-
|
868
|
-
|
918
|
+
git_error_set(GIT_ERROR_INVALID, "malformed commit contents");
|
919
|
+
error = -1;
|
920
|
+
goto cleanup;
|
869
921
|
}
|
870
922
|
|
871
|
-
field = signature_field ? signature_field : "gpgsig";
|
872
|
-
|
873
923
|
/* The header ends after the first LF */
|
874
924
|
header_end++;
|
875
925
|
git_buf_put(&commit, commit_content, header_end - commit_content);
|
876
|
-
|
926
|
+
|
927
|
+
if (signature != NULL) {
|
928
|
+
field = signature_field ? signature_field : "gpgsig";
|
929
|
+
format_header_field(&commit, field, signature);
|
930
|
+
}
|
931
|
+
|
877
932
|
git_buf_puts(&commit, header_end);
|
878
933
|
|
879
934
|
if (git_buf_oom(&commit))
|
@@ -882,10 +937,23 @@ int git_commit_create_with_signature(
|
|
882
937
|
if ((error = git_repository_odb__weakptr(&odb, repo)) < 0)
|
883
938
|
goto cleanup;
|
884
939
|
|
885
|
-
if ((error = git_odb_write(out, odb, commit.ptr, commit.size,
|
940
|
+
if ((error = git_odb_write(out, odb, commit.ptr, commit.size, GIT_OBJECT_COMMIT)) < 0)
|
886
941
|
goto cleanup;
|
887
942
|
|
888
943
|
cleanup:
|
889
|
-
|
944
|
+
git_commit__free(parsed);
|
945
|
+
git_buf_dispose(&commit);
|
890
946
|
return error;
|
891
947
|
}
|
948
|
+
|
949
|
+
int git_commit_committer_with_mailmap(
|
950
|
+
git_signature **out, const git_commit *commit, const git_mailmap *mailmap)
|
951
|
+
{
|
952
|
+
return git_mailmap_resolve_signature(out, mailmap, commit->committer);
|
953
|
+
}
|
954
|
+
|
955
|
+
int git_commit_author_with_mailmap(
|
956
|
+
git_signature **out, const git_commit *commit, const git_mailmap *mailmap)
|
957
|
+
{
|
958
|
+
return git_mailmap_resolve_signature(out, mailmap, commit->author);
|
959
|
+
}
|