rugged 1.1.1 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -0
- data/README.md +1 -1
- data/ext/rugged/extconf.rb +2 -2
- data/ext/rugged/rugged.c +7 -4
- data/ext/rugged/rugged_config.c +7 -2
- data/ext/rugged/rugged_object.c +1 -1
- data/ext/rugged/rugged_remote.c +17 -0
- data/ext/rugged/rugged_repo.c +3 -3
- data/lib/rugged/repository.rb +2 -2
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +103 -271
- data/vendor/libgit2/COPYING +149 -24
- data/vendor/libgit2/cmake/AddCFlagIfSupported.cmake +21 -21
- data/vendor/libgit2/cmake/DefaultCFlags.cmake +154 -0
- data/vendor/libgit2/cmake/EnableWarnings.cmake +13 -13
- data/vendor/libgit2/cmake/FindCoreFoundation.cmake +13 -13
- data/vendor/libgit2/cmake/FindGSSAPI.cmake +171 -287
- data/vendor/libgit2/cmake/FindGSSFramework.cmake +13 -13
- data/vendor/libgit2/cmake/{FindHTTP_Parser.cmake → FindHTTPParser.cmake} +17 -17
- data/vendor/libgit2/cmake/FindIconv.cmake +27 -27
- data/vendor/libgit2/cmake/FindLibSSH2.cmake +13 -0
- data/vendor/libgit2/cmake/FindPCRE.cmake +13 -13
- data/vendor/libgit2/cmake/FindPCRE2.cmake +12 -12
- data/vendor/libgit2/cmake/FindPkgLibraries.cmake +19 -19
- data/vendor/libgit2/cmake/FindSecurity.cmake +14 -14
- data/vendor/libgit2/cmake/FindStatNsec.cmake +12 -18
- data/vendor/libgit2/cmake/Findfutimens.cmake +14 -0
- data/vendor/libgit2/cmake/FindmbedTLS.cmake +63 -70
- data/vendor/libgit2/cmake/IdeSplitSources.cmake +18 -18
- data/vendor/libgit2/cmake/PkgBuildConfig.cmake +60 -60
- data/vendor/libgit2/cmake/SanitizeBool.cmake +20 -20
- data/vendor/libgit2/cmake/SelectGSSAPI.cmake +37 -37
- data/vendor/libgit2/cmake/SelectHTTPParser.cmake +19 -0
- data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +100 -96
- data/vendor/libgit2/cmake/SelectHashes.cmake +39 -48
- data/vendor/libgit2/cmake/SelectRegex.cmake +51 -0
- data/vendor/libgit2/cmake/SelectSSH.cmake +41 -0
- data/vendor/libgit2/cmake/SelectWinHTTP.cmake +17 -0
- data/vendor/libgit2/cmake/SelectZlib.cmake +34 -0
- data/vendor/libgit2/deps/chromium-zlib/CMakeLists.txt +101 -0
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +32 -20
- data/vendor/libgit2/deps/ntlmclient/crypt.h +14 -9
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +20 -20
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +3 -3
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +37 -36
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +4 -3
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +178 -51
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +74 -5
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +154 -122
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +17 -13
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +17 -4
- data/vendor/libgit2/deps/ntlmclient/unicode.h +10 -4
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +16 -27
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.h +20 -0
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +28 -52
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.h +22 -0
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +88 -88
- data/vendor/libgit2/deps/winhttp/CMakeLists.txt +14 -16
- data/vendor/libgit2/include/git2/apply.h +16 -2
- data/vendor/libgit2/include/git2/attr.h +106 -2
- data/vendor/libgit2/include/git2/blame.h +97 -43
- data/vendor/libgit2/include/git2/blob.h +33 -2
- data/vendor/libgit2/include/git2/branch.h +27 -0
- data/vendor/libgit2/include/git2/buffer.h +18 -78
- data/vendor/libgit2/include/git2/cert.h +43 -6
- data/vendor/libgit2/include/git2/checkout.h +32 -13
- data/vendor/libgit2/include/git2/clone.h +4 -4
- data/vendor/libgit2/include/git2/commit.h +37 -19
- data/vendor/libgit2/include/git2/common.h +46 -5
- data/vendor/libgit2/include/git2/config.h +19 -3
- data/vendor/libgit2/include/git2/credential.h +2 -1
- data/vendor/libgit2/include/git2/credential_helpers.h +1 -0
- data/vendor/libgit2/include/git2/deprecated.h +326 -6
- data/vendor/libgit2/include/git2/describe.h +7 -2
- data/vendor/libgit2/include/git2/diff.h +50 -121
- data/vendor/libgit2/include/git2/email.h +127 -0
- data/vendor/libgit2/include/git2/errors.h +7 -6
- data/vendor/libgit2/include/git2/filter.h +69 -18
- data/vendor/libgit2/include/git2/graph.h +21 -2
- data/vendor/libgit2/include/git2/ignore.h +1 -1
- data/vendor/libgit2/include/git2/index.h +13 -7
- data/vendor/libgit2/include/git2/indexer.h +19 -0
- data/vendor/libgit2/include/git2/merge.h +23 -3
- data/vendor/libgit2/include/git2/message.h +2 -0
- data/vendor/libgit2/include/git2/notes.h +2 -2
- data/vendor/libgit2/include/git2/object.h +23 -0
- data/vendor/libgit2/include/git2/odb.h +65 -6
- data/vendor/libgit2/include/git2/odb_backend.h +1 -1
- data/vendor/libgit2/include/git2/oidarray.h +5 -8
- data/vendor/libgit2/include/git2/pack.h +24 -8
- data/vendor/libgit2/include/git2/patch.h +16 -0
- data/vendor/libgit2/include/git2/pathspec.h +1 -1
- data/vendor/libgit2/include/git2/proxy.h +1 -1
- data/vendor/libgit2/include/git2/rebase.h +34 -2
- data/vendor/libgit2/include/git2/refdb.h +3 -0
- data/vendor/libgit2/include/git2/reflog.h +1 -1
- data/vendor/libgit2/include/git2/refs.h +8 -4
- data/vendor/libgit2/include/git2/remote.h +246 -46
- data/vendor/libgit2/include/git2/repository.h +25 -18
- data/vendor/libgit2/include/git2/reset.h +2 -2
- data/vendor/libgit2/include/git2/revparse.h +5 -5
- data/vendor/libgit2/include/git2/revwalk.h +4 -1
- data/vendor/libgit2/include/git2/signature.h +1 -1
- data/vendor/libgit2/include/git2/stash.h +4 -4
- data/vendor/libgit2/include/git2/status.h +124 -62
- data/vendor/libgit2/include/git2/stdint.h +3 -3
- data/vendor/libgit2/include/git2/submodule.h +16 -2
- data/vendor/libgit2/include/git2/sys/commit_graph.h +174 -0
- data/vendor/libgit2/include/git2/sys/email.h +45 -0
- data/vendor/libgit2/include/git2/sys/filter.h +49 -28
- data/vendor/libgit2/include/git2/sys/midx.h +74 -0
- data/vendor/libgit2/include/git2/sys/odb_backend.h +9 -5
- data/vendor/libgit2/include/git2/sys/remote.h +31 -0
- data/vendor/libgit2/include/git2/sys/stream.h +1 -1
- data/vendor/libgit2/include/git2/sys/transport.h +26 -34
- data/vendor/libgit2/include/git2/tag.h +13 -0
- data/vendor/libgit2/include/git2/tree.h +4 -17
- data/vendor/libgit2/include/git2/types.h +16 -7
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2/worktree.h +13 -2
- data/vendor/libgit2/include/git2.h +1 -0
- data/vendor/libgit2/src/CMakeLists.txt +192 -290
- data/vendor/libgit2/src/alloc.c +21 -8
- data/vendor/libgit2/src/allocators/failalloc.c +92 -0
- data/vendor/libgit2/src/allocators/failalloc.h +23 -0
- data/vendor/libgit2/src/allocators/stdalloc.c +41 -10
- data/vendor/libgit2/src/allocators/win32_leakcheck.c +118 -0
- data/vendor/libgit2/src/allocators/{win32_crtdbg.h → win32_leakcheck.h} +3 -3
- data/vendor/libgit2/src/annotated_commit.c +21 -9
- data/vendor/libgit2/src/annotated_commit.h +1 -1
- data/vendor/libgit2/src/apply.c +34 -25
- data/vendor/libgit2/src/apply.h +2 -2
- data/vendor/libgit2/src/array.h +11 -11
- data/vendor/libgit2/src/attr.c +204 -82
- data/vendor/libgit2/src/attr_file.c +105 -52
- data/vendor/libgit2/src/attr_file.h +36 -15
- data/vendor/libgit2/src/attrcache.c +55 -45
- data/vendor/libgit2/src/attrcache.h +4 -5
- data/vendor/libgit2/src/blame.c +15 -9
- data/vendor/libgit2/src/blame_git.c +2 -2
- data/vendor/libgit2/src/blob.c +76 -52
- data/vendor/libgit2/src/blob.h +1 -1
- data/vendor/libgit2/src/branch.c +203 -110
- data/vendor/libgit2/src/branch.h +15 -3
- data/vendor/libgit2/src/buf.c +126 -0
- data/vendor/libgit2/src/buf.h +50 -0
- data/vendor/libgit2/src/cache.c +2 -2
- data/vendor/libgit2/src/cache.h +7 -7
- data/vendor/libgit2/src/cc-compat.h +11 -9
- data/vendor/libgit2/src/checkout.c +118 -91
- data/vendor/libgit2/src/cherrypick.c +16 -12
- data/vendor/libgit2/src/clone.c +97 -103
- data/vendor/libgit2/src/commit.c +167 -84
- data/vendor/libgit2/src/commit.h +24 -1
- data/vendor/libgit2/src/commit_graph.c +1224 -0
- data/vendor/libgit2/src/commit_graph.h +169 -0
- data/vendor/libgit2/src/commit_list.c +48 -3
- data/vendor/libgit2/src/commit_list.h +2 -0
- data/vendor/libgit2/src/common.h +35 -5
- data/vendor/libgit2/src/config.c +119 -64
- data/vendor/libgit2/src/config.h +15 -2
- data/vendor/libgit2/src/config_cache.c +5 -3
- data/vendor/libgit2/src/config_file.c +120 -100
- data/vendor/libgit2/src/config_mem.c +9 -9
- data/vendor/libgit2/src/config_parse.c +29 -27
- data/vendor/libgit2/src/crlf.c +36 -23
- data/vendor/libgit2/src/date.c +13 -19
- data/vendor/libgit2/src/date.h +33 -0
- data/vendor/libgit2/src/delta.c +1 -1
- data/vendor/libgit2/src/describe.c +32 -21
- data/vendor/libgit2/src/diff.c +71 -183
- data/vendor/libgit2/src/diff.h +2 -4
- data/vendor/libgit2/src/diff_driver.c +53 -51
- data/vendor/libgit2/src/diff_driver.h +3 -3
- data/vendor/libgit2/src/diff_file.c +31 -26
- data/vendor/libgit2/src/diff_generate.c +76 -23
- data/vendor/libgit2/src/diff_generate.h +5 -3
- data/vendor/libgit2/src/diff_print.c +120 -95
- data/vendor/libgit2/src/diff_stats.c +47 -34
- data/vendor/libgit2/src/{message.h → diff_stats.h} +7 -6
- data/vendor/libgit2/src/diff_tform.c +18 -16
- data/vendor/libgit2/src/diff_xdiff.c +7 -10
- data/vendor/libgit2/src/diff_xdiff.h +1 -1
- data/vendor/libgit2/src/email.c +315 -0
- data/vendor/libgit2/src/email.h +25 -0
- data/vendor/libgit2/src/errors.c +37 -32
- data/vendor/libgit2/src/features.h.in +11 -2
- data/vendor/libgit2/src/fetch.c +77 -26
- data/vendor/libgit2/src/fetch.h +1 -1
- data/vendor/libgit2/src/fetchhead.c +27 -23
- data/vendor/libgit2/src/filebuf.c +36 -34
- data/vendor/libgit2/src/filebuf.h +1 -1
- data/vendor/libgit2/src/filter.c +278 -132
- data/vendor/libgit2/src/filter.h +46 -6
- data/vendor/libgit2/src/fs_path.c +2071 -0
- data/vendor/libgit2/src/fs_path.h +772 -0
- data/vendor/libgit2/src/futils.c +96 -90
- data/vendor/libgit2/src/futils.h +27 -15
- data/vendor/libgit2/src/graph.c +64 -9
- data/vendor/libgit2/src/hash/sha1/collisiondetect.c +5 -5
- data/vendor/libgit2/src/hash/sha1/common_crypto.c +5 -5
- data/vendor/libgit2/src/hash/sha1/generic.c +2 -2
- data/vendor/libgit2/src/hash/sha1/generic.h +1 -1
- data/vendor/libgit2/src/hash/sha1/mbedtls.c +13 -13
- data/vendor/libgit2/src/hash/sha1/openssl.c +5 -5
- data/vendor/libgit2/src/hash/sha1/sha1dc/sha1.c +9 -11
- data/vendor/libgit2/src/hash/sha1/win32.c +21 -17
- data/vendor/libgit2/src/hash/sha1.h +3 -1
- data/vendor/libgit2/src/hash.c +71 -36
- data/vendor/libgit2/src/hash.h +13 -13
- data/vendor/libgit2/src/hashsig.c +23 -10
- data/vendor/libgit2/src/ident.c +30 -20
- data/vendor/libgit2/src/ignore.c +63 -46
- data/vendor/libgit2/src/ignore.h +2 -2
- data/vendor/libgit2/src/index.c +184 -149
- data/vendor/libgit2/src/index.h +7 -4
- data/vendor/libgit2/src/indexer.c +143 -89
- data/vendor/libgit2/src/integer.h +64 -2
- data/vendor/libgit2/src/iterator.c +93 -73
- data/vendor/libgit2/src/iterator.h +6 -6
- data/vendor/libgit2/src/khash.h +3 -12
- data/vendor/libgit2/src/{settings.c → libgit2.c} +165 -56
- data/vendor/libgit2/src/libgit2.h +15 -0
- data/vendor/libgit2/src/mailmap.c +60 -45
- data/vendor/libgit2/src/map.h +3 -3
- data/vendor/libgit2/src/merge.c +104 -61
- data/vendor/libgit2/src/merge.h +3 -15
- data/vendor/libgit2/src/merge_driver.c +21 -15
- data/vendor/libgit2/src/merge_file.c +24 -6
- data/vendor/libgit2/src/message.c +21 -8
- data/vendor/libgit2/src/midx.c +501 -18
- data/vendor/libgit2/src/midx.h +29 -2
- data/vendor/libgit2/src/mwindow.c +103 -59
- data/vendor/libgit2/src/mwindow.h +3 -3
- data/vendor/libgit2/src/net.c +405 -71
- data/vendor/libgit2/src/net.h +26 -5
- data/vendor/libgit2/src/netops.c +7 -5
- data/vendor/libgit2/src/netops.h +3 -3
- data/vendor/libgit2/src/notes.c +40 -49
- data/vendor/libgit2/src/object.c +68 -20
- data/vendor/libgit2/src/object.h +1 -1
- data/vendor/libgit2/src/odb.c +320 -80
- data/vendor/libgit2/src/odb.h +17 -3
- data/vendor/libgit2/src/odb_loose.c +96 -86
- data/vendor/libgit2/src/odb_mempack.c +19 -6
- data/vendor/libgit2/src/odb_pack.c +402 -125
- data/vendor/libgit2/src/oid.c +16 -8
- data/vendor/libgit2/src/oid.h +15 -0
- data/vendor/libgit2/src/oidarray.c +10 -1
- data/vendor/libgit2/src/pack-objects.c +90 -69
- data/vendor/libgit2/src/pack-objects.h +11 -6
- data/vendor/libgit2/src/pack.c +337 -127
- data/vendor/libgit2/src/pack.h +25 -7
- data/vendor/libgit2/src/patch.c +17 -10
- data/vendor/libgit2/src/patch.h +1 -0
- data/vendor/libgit2/src/patch_generate.c +29 -13
- data/vendor/libgit2/src/patch_generate.h +5 -5
- data/vendor/libgit2/src/patch_parse.c +26 -25
- data/vendor/libgit2/src/path.c +86 -1768
- data/vendor/libgit2/src/path.h +39 -635
- data/vendor/libgit2/src/pathspec.c +12 -12
- data/vendor/libgit2/src/pathspec.h +2 -2
- data/vendor/libgit2/src/pool.c +13 -7
- data/vendor/libgit2/src/posix.c +14 -6
- data/vendor/libgit2/src/posix.h +1 -0
- data/vendor/libgit2/src/pqueue.h +1 -1
- data/vendor/libgit2/src/proxy.c +4 -1
- data/vendor/libgit2/src/proxy.h +1 -1
- data/vendor/libgit2/src/push.c +30 -35
- data/vendor/libgit2/src/push.h +4 -16
- data/vendor/libgit2/src/rand.c +226 -0
- data/vendor/libgit2/src/rand.h +37 -0
- data/vendor/libgit2/src/reader.c +18 -14
- data/vendor/libgit2/src/reader.h +2 -2
- data/vendor/libgit2/src/rebase.c +177 -132
- data/vendor/libgit2/src/refdb.c +30 -13
- data/vendor/libgit2/src/refdb_fs.c +548 -222
- data/vendor/libgit2/src/reflog.c +19 -14
- data/vendor/libgit2/src/refs.c +107 -72
- data/vendor/libgit2/src/refs.h +2 -2
- data/vendor/libgit2/src/refspec.c +53 -38
- data/vendor/libgit2/src/refspec.h +5 -2
- data/vendor/libgit2/src/regexp.c +1 -1
- data/vendor/libgit2/src/remote.c +960 -486
- data/vendor/libgit2/src/remote.h +16 -10
- data/vendor/libgit2/src/repository.c +702 -422
- data/vendor/libgit2/src/repository.h +26 -8
- data/vendor/libgit2/src/reset.c +16 -12
- data/vendor/libgit2/src/revert.c +16 -12
- data/vendor/libgit2/src/revparse.c +66 -48
- data/vendor/libgit2/src/revwalk.c +39 -22
- data/vendor/libgit2/src/runtime.c +162 -0
- data/vendor/libgit2/src/runtime.h +62 -0
- data/vendor/libgit2/src/settings.h +11 -0
- data/vendor/libgit2/src/signature.c +18 -11
- data/vendor/libgit2/src/signature.h +1 -1
- data/vendor/libgit2/src/sortedcache.c +1 -1
- data/vendor/libgit2/src/sortedcache.h +10 -8
- data/vendor/libgit2/src/stash.c +39 -38
- data/vendor/libgit2/src/status.c +11 -5
- data/vendor/libgit2/src/{buffer.c → str.c} +459 -136
- data/vendor/libgit2/src/str.h +357 -0
- data/vendor/libgit2/src/strarray.c +2 -1
- data/vendor/libgit2/src/streams/mbedtls.c +22 -23
- data/vendor/libgit2/src/streams/mbedtls.h +1 -1
- data/vendor/libgit2/src/streams/openssl.c +101 -201
- data/vendor/libgit2/src/streams/openssl.h +9 -1
- data/vendor/libgit2/src/streams/openssl_dynamic.c +309 -0
- data/vendor/libgit2/src/streams/openssl_dynamic.h +348 -0
- data/vendor/libgit2/src/streams/openssl_legacy.c +203 -0
- data/vendor/libgit2/src/streams/openssl_legacy.h +63 -0
- data/vendor/libgit2/src/streams/registry.c +5 -6
- data/vendor/libgit2/src/streams/socket.c +6 -2
- data/vendor/libgit2/src/streams/stransport.c +6 -3
- data/vendor/libgit2/src/streams/tls.c +5 -3
- data/vendor/libgit2/src/submodule.c +290 -212
- data/vendor/libgit2/src/submodule.h +10 -10
- data/vendor/libgit2/src/sysdir.c +70 -56
- data/vendor/libgit2/src/sysdir.h +15 -10
- data/vendor/libgit2/src/tag.c +72 -34
- data/vendor/libgit2/src/thread.c +140 -0
- data/vendor/libgit2/src/thread.h +479 -0
- data/vendor/libgit2/src/threadstate.c +84 -0
- data/vendor/libgit2/src/threadstate.h +24 -0
- data/vendor/libgit2/src/trace.c +3 -16
- data/vendor/libgit2/src/trace.h +17 -30
- data/vendor/libgit2/src/trailer.c +2 -2
- data/vendor/libgit2/src/transaction.c +20 -9
- data/vendor/libgit2/src/transport.c +13 -13
- data/vendor/libgit2/src/transports/auth.c +8 -10
- data/vendor/libgit2/src/transports/auth.h +2 -3
- data/vendor/libgit2/src/transports/auth_negotiate.c +23 -17
- data/vendor/libgit2/src/transports/auth_ntlm.c +20 -16
- data/vendor/libgit2/src/transports/auth_ntlm.h +0 -1
- data/vendor/libgit2/src/transports/credential.c +15 -7
- data/vendor/libgit2/src/transports/git.c +10 -14
- data/vendor/libgit2/src/transports/http.c +56 -34
- data/vendor/libgit2/src/transports/http.h +3 -3
- data/vendor/libgit2/src/transports/httpclient.c +106 -79
- data/vendor/libgit2/src/transports/httpclient.h +1 -1
- data/vendor/libgit2/src/transports/local.c +127 -119
- data/vendor/libgit2/src/transports/smart.c +61 -144
- data/vendor/libgit2/src/transports/smart.h +26 -32
- data/vendor/libgit2/src/transports/smart_pkt.c +33 -33
- data/vendor/libgit2/src/transports/smart_protocol.c +68 -44
- data/vendor/libgit2/src/transports/ssh.c +100 -131
- data/vendor/libgit2/src/transports/winhttp.c +86 -82
- data/vendor/libgit2/src/tree-cache.c +5 -5
- data/vendor/libgit2/src/tree-cache.h +2 -2
- data/vendor/libgit2/src/tree.c +150 -116
- data/vendor/libgit2/src/tree.h +1 -0
- data/vendor/libgit2/src/tsort.c +0 -2
- data/vendor/libgit2/src/unix/map.c +3 -3
- data/vendor/libgit2/src/unix/posix.h +1 -4
- data/vendor/libgit2/src/unix/pthread.h +2 -1
- data/vendor/libgit2/src/unix/realpath.c +0 -2
- data/vendor/libgit2/src/utf8.c +150 -0
- data/vendor/libgit2/src/utf8.h +52 -0
- data/vendor/libgit2/src/util.c +68 -144
- data/vendor/libgit2/src/util.h +36 -68
- data/vendor/libgit2/src/vector.c +23 -19
- data/vendor/libgit2/src/vector.h +5 -3
- data/vendor/libgit2/src/win32/findfile.c +172 -114
- data/vendor/libgit2/src/win32/findfile.h +7 -4
- data/vendor/libgit2/src/win32/map.c +1 -1
- data/vendor/libgit2/src/win32/msvc-compat.h +9 -1
- data/vendor/libgit2/src/win32/path_w32.c +162 -33
- data/vendor/libgit2/src/win32/path_w32.h +2 -1
- data/vendor/libgit2/src/win32/posix.h +6 -7
- data/vendor/libgit2/src/win32/posix_w32.c +26 -33
- data/vendor/libgit2/src/win32/precompiled.h +0 -1
- data/vendor/libgit2/src/win32/reparse.h +4 -4
- data/vendor/libgit2/src/win32/thread.c +24 -15
- data/vendor/libgit2/src/win32/thread.h +1 -1
- data/vendor/libgit2/src/win32/w32_buffer.c +5 -6
- data/vendor/libgit2/src/win32/w32_buffer.h +2 -3
- data/vendor/libgit2/src/win32/w32_common.h +18 -9
- data/vendor/libgit2/src/win32/{w32_crtdbg_stacktrace.c → w32_leakcheck.c} +269 -33
- data/vendor/libgit2/src/win32/w32_leakcheck.h +222 -0
- data/vendor/libgit2/src/win32/w32_util.h +6 -6
- data/vendor/libgit2/src/worktree.c +138 -105
- data/vendor/libgit2/src/worktree.h +1 -1
- data/vendor/libgit2/src/xdiff/git-xdiff.h +53 -0
- data/vendor/libgit2/src/xdiff/xdiff.h +15 -15
- data/vendor/libgit2/src/xdiff/xdiffi.c +134 -108
- data/vendor/libgit2/src/xdiff/xemit.c +23 -7
- data/vendor/libgit2/src/xdiff/xhistogram.c +87 -78
- data/vendor/libgit2/src/xdiff/xinclude.h +1 -12
- data/vendor/libgit2/src/xdiff/xmerge.c +104 -117
- data/vendor/libgit2/src/xdiff/xpatience.c +6 -17
- data/vendor/libgit2/src/xdiff/xprepare.c +15 -20
- data/vendor/libgit2/src/xdiff/xutils.c +18 -7
- data/vendor/libgit2/src/zstream.c +6 -6
- data/vendor/libgit2/src/zstream.h +4 -4
- metadata +60 -24
- data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
- data/vendor/libgit2/src/buf_text.c +0 -316
- data/vendor/libgit2/src/buf_text.h +0 -122
- data/vendor/libgit2/src/buffer.h +0 -222
- data/vendor/libgit2/src/global.c +0 -363
- data/vendor/libgit2/src/global.h +0 -41
- data/vendor/libgit2/src/thread-utils.c +0 -58
- data/vendor/libgit2/src/thread-utils.h +0 -369
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +0 -127
- data/vendor/libgit2/src/win32/w32_stack.c +0 -188
- data/vendor/libgit2/src/win32/w32_stack.h +0 -140
data/vendor/libgit2/src/commit.c
CHANGED
@@ -14,10 +14,10 @@
|
|
14
14
|
#include "git2/mailmap.h"
|
15
15
|
#include "git2/sys/commit.h"
|
16
16
|
|
17
|
+
#include "buf.h"
|
17
18
|
#include "odb.h"
|
18
19
|
#include "commit.h"
|
19
20
|
#include "signature.h"
|
20
|
-
#include "message.h"
|
21
21
|
#include "refs.h"
|
22
22
|
#include "object.h"
|
23
23
|
#include "array.h"
|
@@ -42,7 +42,7 @@ void git_commit__free(void *_commit)
|
|
42
42
|
}
|
43
43
|
|
44
44
|
static int git_commit__create_buffer_internal(
|
45
|
-
|
45
|
+
git_str *out,
|
46
46
|
const git_signature *author,
|
47
47
|
const git_signature *committer,
|
48
48
|
const char *message_encoding,
|
@@ -53,7 +53,8 @@ static int git_commit__create_buffer_internal(
|
|
53
53
|
size_t i = 0;
|
54
54
|
const git_oid *parent;
|
55
55
|
|
56
|
-
|
56
|
+
GIT_ASSERT_ARG(out);
|
57
|
+
GIT_ASSERT_ARG(tree);
|
57
58
|
|
58
59
|
git_oid__writebuf(out, "tree ", tree);
|
59
60
|
|
@@ -66,17 +67,17 @@ static int git_commit__create_buffer_internal(
|
|
66
67
|
git_signature__writebuf(out, "committer ", committer);
|
67
68
|
|
68
69
|
if (message_encoding != NULL)
|
69
|
-
|
70
|
+
git_str_printf(out, "encoding %s\n", message_encoding);
|
70
71
|
|
71
|
-
|
72
|
+
git_str_putc(out, '\n');
|
72
73
|
|
73
|
-
if (
|
74
|
+
if (git_str_puts(out, message) < 0)
|
74
75
|
goto on_error;
|
75
76
|
|
76
77
|
return 0;
|
77
78
|
|
78
79
|
on_error:
|
79
|
-
|
80
|
+
git_str_dispose(out);
|
80
81
|
return -1;
|
81
82
|
}
|
82
83
|
|
@@ -135,7 +136,7 @@ static int git_commit__create_internal(
|
|
135
136
|
int error;
|
136
137
|
git_odb *odb;
|
137
138
|
git_reference *ref = NULL;
|
138
|
-
|
139
|
+
git_str buf = GIT_STR_INIT;
|
139
140
|
const git_oid *current_id = NULL;
|
140
141
|
git_array_oid_t parents = GIT_ARRAY_INIT;
|
141
142
|
|
@@ -178,7 +179,7 @@ static int git_commit__create_internal(
|
|
178
179
|
cleanup:
|
179
180
|
git_array_clear(parents);
|
180
181
|
git_reference_free(ref);
|
181
|
-
|
182
|
+
git_str_dispose(&buf);
|
182
183
|
return error;
|
183
184
|
}
|
184
185
|
|
@@ -229,7 +230,8 @@ int git_commit_create_v(
|
|
229
230
|
int error = 0;
|
230
231
|
commit_parent_varargs data;
|
231
232
|
|
232
|
-
|
233
|
+
GIT_ASSERT_ARG(tree);
|
234
|
+
GIT_ASSERT_ARG(git_tree_owner(tree) == repo);
|
233
235
|
|
234
236
|
data.total = parent_count;
|
235
237
|
va_start(data.args, parent_count);
|
@@ -306,7 +308,8 @@ int git_commit_create(
|
|
306
308
|
{
|
307
309
|
commit_parent_data data = { parent_count, parents, repo };
|
308
310
|
|
309
|
-
|
311
|
+
GIT_ASSERT_ARG(tree);
|
312
|
+
GIT_ASSERT_ARG(git_tree_owner(tree) == repo);
|
310
313
|
|
311
314
|
return git_commit__create_internal(
|
312
315
|
id, repo, update_ref, author, committer,
|
@@ -337,7 +340,8 @@ int git_commit_amend(
|
|
337
340
|
git_reference *ref;
|
338
341
|
int error;
|
339
342
|
|
340
|
-
|
343
|
+
GIT_ASSERT_ARG(id);
|
344
|
+
GIT_ASSERT_ARG(commit_to_amend);
|
341
345
|
|
342
346
|
repo = git_commit_owner(commit_to_amend);
|
343
347
|
|
@@ -356,7 +360,7 @@ int git_commit_amend(
|
|
356
360
|
git_oid_cpy(&tree_id, git_tree_id(old_tree));
|
357
361
|
git_tree_free(old_tree);
|
358
362
|
} else {
|
359
|
-
|
363
|
+
GIT_ASSERT_ARG(git_tree_owner(tree) == repo);
|
360
364
|
git_oid_cpy(&tree_id, git_tree_id(tree));
|
361
365
|
}
|
362
366
|
|
@@ -391,8 +395,10 @@ static int commit_parse(git_commit *commit, const char *data, size_t size, unsig
|
|
391
395
|
git_oid parent_id;
|
392
396
|
size_t header_len;
|
393
397
|
git_signature dummy_sig;
|
398
|
+
int error;
|
394
399
|
|
395
|
-
|
400
|
+
GIT_ASSERT_ARG(commit);
|
401
|
+
GIT_ASSERT_ARG(data);
|
396
402
|
|
397
403
|
buffer = buffer_start;
|
398
404
|
|
@@ -426,14 +432,14 @@ static int commit_parse(git_commit *commit, const char *data, size_t size, unsig
|
|
426
432
|
commit->author = git__malloc(sizeof(git_signature));
|
427
433
|
GIT_ERROR_CHECK_ALLOC(commit->author);
|
428
434
|
|
429
|
-
if (git_signature__parse(commit->author, &buffer, buffer_end, "author ", '\n') < 0)
|
430
|
-
return
|
435
|
+
if ((error = git_signature__parse(commit->author, &buffer, buffer_end, "author ", '\n')) < 0)
|
436
|
+
return error;
|
431
437
|
}
|
432
438
|
|
433
439
|
/* Some tools create multiple author fields, ignore the extra ones */
|
434
440
|
while (!git__prefixncmp(buffer, buffer_end - buffer, "author ")) {
|
435
|
-
if (git_signature__parse(&dummy_sig, &buffer, buffer_end, "author ", '\n') < 0)
|
436
|
-
return
|
441
|
+
if ((error = git_signature__parse(&dummy_sig, &buffer, buffer_end, "author ", '\n')) < 0)
|
442
|
+
return error;
|
437
443
|
|
438
444
|
git__free(dummy_sig.name);
|
439
445
|
git__free(dummy_sig.email);
|
@@ -443,8 +449,8 @@ static int commit_parse(git_commit *commit, const char *data, size_t size, unsig
|
|
443
449
|
commit->committer = git__malloc(sizeof(git_signature));
|
444
450
|
GIT_ERROR_CHECK_ALLOC(commit->committer);
|
445
451
|
|
446
|
-
if (git_signature__parse(commit->committer, &buffer, buffer_end, "committer ", '\n') < 0)
|
447
|
-
return
|
452
|
+
if ((error = git_signature__parse(commit->committer, &buffer, buffer_end, "committer ", '\n')) < 0)
|
453
|
+
return error;
|
448
454
|
|
449
455
|
if (flags & GIT_COMMIT_PARSE_QUICK)
|
450
456
|
return 0;
|
@@ -488,7 +494,7 @@ static int commit_parse(git_commit *commit, const char *data, size_t size, unsig
|
|
488
494
|
|
489
495
|
bad_buffer:
|
490
496
|
git_error_set(GIT_ERROR_OBJECT, "failed to parse bad commit object");
|
491
|
-
return
|
497
|
+
return GIT_EINVALID;
|
492
498
|
}
|
493
499
|
|
494
500
|
int git_commit__parse_raw(void *commit, const char *data, size_t size)
|
@@ -506,28 +512,28 @@ int git_commit__parse(void *_commit, git_odb_object *odb_obj)
|
|
506
512
|
return git_commit__parse_ext(_commit, odb_obj, 0);
|
507
513
|
}
|
508
514
|
|
509
|
-
#define GIT_COMMIT_GETTER(_rvalue, _name, _return) \
|
515
|
+
#define GIT_COMMIT_GETTER(_rvalue, _name, _return, _invalid) \
|
510
516
|
_rvalue git_commit_##_name(const git_commit *commit) \
|
511
517
|
{\
|
512
|
-
|
518
|
+
GIT_ASSERT_ARG_WITH_RETVAL(commit, _invalid); \
|
513
519
|
return _return; \
|
514
520
|
}
|
515
521
|
|
516
|
-
GIT_COMMIT_GETTER(const git_signature *, author, commit->author)
|
517
|
-
GIT_COMMIT_GETTER(const git_signature *, committer, commit->committer)
|
518
|
-
GIT_COMMIT_GETTER(const char *, message_raw, commit->raw_message)
|
519
|
-
GIT_COMMIT_GETTER(const char *, message_encoding, commit->message_encoding)
|
520
|
-
GIT_COMMIT_GETTER(const char *, raw_header, commit->raw_header)
|
521
|
-
GIT_COMMIT_GETTER(git_time_t, time, commit->committer->when.time)
|
522
|
-
GIT_COMMIT_GETTER(int, time_offset, commit->committer->when.offset)
|
523
|
-
GIT_COMMIT_GETTER(unsigned int, parentcount, (unsigned int)git_array_size(commit->parent_ids))
|
524
|
-
GIT_COMMIT_GETTER(const git_oid *, tree_id, &commit->tree_id)
|
522
|
+
GIT_COMMIT_GETTER(const git_signature *, author, commit->author, NULL)
|
523
|
+
GIT_COMMIT_GETTER(const git_signature *, committer, commit->committer, NULL)
|
524
|
+
GIT_COMMIT_GETTER(const char *, message_raw, commit->raw_message, NULL)
|
525
|
+
GIT_COMMIT_GETTER(const char *, message_encoding, commit->message_encoding, NULL)
|
526
|
+
GIT_COMMIT_GETTER(const char *, raw_header, commit->raw_header, NULL)
|
527
|
+
GIT_COMMIT_GETTER(git_time_t, time, commit->committer->when.time, INT64_MIN)
|
528
|
+
GIT_COMMIT_GETTER(int, time_offset, commit->committer->when.offset, -1)
|
529
|
+
GIT_COMMIT_GETTER(unsigned int, parentcount, (unsigned int)git_array_size(commit->parent_ids), 0)
|
530
|
+
GIT_COMMIT_GETTER(const git_oid *, tree_id, &commit->tree_id, NULL)
|
525
531
|
|
526
532
|
const char *git_commit_message(const git_commit *commit)
|
527
533
|
{
|
528
534
|
const char *message;
|
529
535
|
|
530
|
-
|
536
|
+
GIT_ASSERT_ARG_WITH_RETVAL(commit, NULL);
|
531
537
|
|
532
538
|
message = commit->raw_message;
|
533
539
|
|
@@ -540,20 +546,31 @@ const char *git_commit_message(const git_commit *commit)
|
|
540
546
|
|
541
547
|
const char *git_commit_summary(git_commit *commit)
|
542
548
|
{
|
543
|
-
|
544
|
-
const char *msg, *space;
|
549
|
+
git_str summary = GIT_STR_INIT;
|
550
|
+
const char *msg, *space, *next;
|
545
551
|
bool space_contains_newline = false;
|
546
552
|
|
547
|
-
|
553
|
+
GIT_ASSERT_ARG_WITH_RETVAL(commit, NULL);
|
548
554
|
|
549
555
|
if (!commit->summary) {
|
550
556
|
for (msg = git_commit_message(commit), space = NULL; *msg; ++msg) {
|
551
557
|
char next_character = msg[0];
|
552
558
|
/* stop processing at the end of the first paragraph */
|
553
|
-
if (next_character == '\n'
|
554
|
-
|
559
|
+
if (next_character == '\n') {
|
560
|
+
if (!msg[1])
|
561
|
+
break;
|
562
|
+
if (msg[1] == '\n')
|
563
|
+
break;
|
564
|
+
/* stop processing if next line contains only whitespace */
|
565
|
+
next = msg + 1;
|
566
|
+
while (*next && git__isspace_nonlf(*next)) {
|
567
|
+
++next;
|
568
|
+
}
|
569
|
+
if (!*next || *next == '\n')
|
570
|
+
break;
|
571
|
+
}
|
555
572
|
/* record the beginning of contiguous whitespace runs */
|
556
|
-
|
573
|
+
if (git__isspace(next_character)) {
|
557
574
|
if(space == NULL) {
|
558
575
|
space = msg;
|
559
576
|
space_contains_newline = false;
|
@@ -565,17 +582,17 @@ const char *git_commit_summary(git_commit *commit)
|
|
565
582
|
/* process any recorded whitespace */
|
566
583
|
if (space) {
|
567
584
|
if(space_contains_newline)
|
568
|
-
|
585
|
+
git_str_putc(&summary, ' '); /* if the space contains a newline, collapse to ' ' */
|
569
586
|
else
|
570
|
-
|
587
|
+
git_str_put(&summary, space, (msg - space)); /* otherwise copy it */
|
571
588
|
space = NULL;
|
572
589
|
}
|
573
590
|
/* copy the next character */
|
574
|
-
|
591
|
+
git_str_putc(&summary, next_character);
|
575
592
|
}
|
576
593
|
}
|
577
594
|
|
578
|
-
commit->summary =
|
595
|
+
commit->summary = git_str_detach(&summary);
|
579
596
|
if (!commit->summary)
|
580
597
|
commit->summary = git__strdup("");
|
581
598
|
}
|
@@ -587,7 +604,7 @@ const char *git_commit_body(git_commit *commit)
|
|
587
604
|
{
|
588
605
|
const char *msg, *end;
|
589
606
|
|
590
|
-
|
607
|
+
GIT_ASSERT_ARG_WITH_RETVAL(commit, NULL);
|
591
608
|
|
592
609
|
if (!commit->body) {
|
593
610
|
/* search for end of summary */
|
@@ -612,14 +629,14 @@ const char *git_commit_body(git_commit *commit)
|
|
612
629
|
|
613
630
|
int git_commit_tree(git_tree **tree_out, const git_commit *commit)
|
614
631
|
{
|
615
|
-
|
632
|
+
GIT_ASSERT_ARG(commit);
|
616
633
|
return git_tree_lookup(tree_out, commit->object.repo, &commit->tree_id);
|
617
634
|
}
|
618
635
|
|
619
636
|
const git_oid *git_commit_parent_id(
|
620
637
|
const git_commit *commit, unsigned int n)
|
621
638
|
{
|
622
|
-
|
639
|
+
GIT_ASSERT_ARG_WITH_RETVAL(commit, NULL);
|
623
640
|
|
624
641
|
return git_array_get(commit->parent_ids, n);
|
625
642
|
}
|
@@ -628,7 +645,7 @@ int git_commit_parent(
|
|
628
645
|
git_commit **parent, const git_commit *commit, unsigned int n)
|
629
646
|
{
|
630
647
|
const git_oid *parent_id;
|
631
|
-
|
648
|
+
GIT_ASSERT_ARG(commit);
|
632
649
|
|
633
650
|
parent_id = git_commit_parent_id(commit, n);
|
634
651
|
if (parent_id == NULL) {
|
@@ -647,7 +664,8 @@ int git_commit_nth_gen_ancestor(
|
|
647
664
|
git_commit *current, *parent = NULL;
|
648
665
|
int error;
|
649
666
|
|
650
|
-
|
667
|
+
GIT_ASSERT_ARG(ancestor);
|
668
|
+
GIT_ASSERT_ARG(commit);
|
651
669
|
|
652
670
|
if (git_commit_dup(¤t, (git_commit *)commit) < 0)
|
653
671
|
return -1;
|
@@ -672,11 +690,22 @@ int git_commit_nth_gen_ancestor(
|
|
672
690
|
return 0;
|
673
691
|
}
|
674
692
|
|
675
|
-
int git_commit_header_field(
|
693
|
+
int git_commit_header_field(
|
694
|
+
git_buf *out,
|
695
|
+
const git_commit *commit,
|
696
|
+
const char *field)
|
697
|
+
{
|
698
|
+
GIT_BUF_WRAP_PRIVATE(out, git_commit__header_field, commit, field);
|
699
|
+
}
|
700
|
+
|
701
|
+
int git_commit__header_field(
|
702
|
+
git_str *out,
|
703
|
+
const git_commit *commit,
|
704
|
+
const char *field)
|
676
705
|
{
|
677
706
|
const char *eol, *buf = commit->raw_header;
|
678
707
|
|
679
|
-
|
708
|
+
git_str_clear(out);
|
680
709
|
|
681
710
|
while ((eol = strchr(buf, '\n'))) {
|
682
711
|
/* We can skip continuations here */
|
@@ -700,22 +729,22 @@ int git_commit_header_field(git_buf *out, const git_commit *commit, const char *
|
|
700
729
|
|
701
730
|
buf++; /* skip the SP */
|
702
731
|
|
703
|
-
|
704
|
-
if (
|
732
|
+
git_str_put(out, buf, eol - buf);
|
733
|
+
if (git_str_oom(out))
|
705
734
|
goto oom;
|
706
735
|
|
707
736
|
/* If the next line starts with SP, it's multi-line, we must continue */
|
708
737
|
while (eol[1] == ' ') {
|
709
|
-
|
738
|
+
git_str_putc(out, '\n');
|
710
739
|
buf = eol + 2;
|
711
740
|
eol = strchr(buf, '\n');
|
712
741
|
if (!eol)
|
713
742
|
goto malformed;
|
714
743
|
|
715
|
-
|
744
|
+
git_str_put(out, buf, eol - buf);
|
716
745
|
}
|
717
746
|
|
718
|
-
if (
|
747
|
+
if (git_str_oom(out))
|
719
748
|
goto oom;
|
720
749
|
|
721
750
|
return 0;
|
@@ -732,7 +761,35 @@ oom:
|
|
732
761
|
return -1;
|
733
762
|
}
|
734
763
|
|
735
|
-
int git_commit_extract_signature(
|
764
|
+
int git_commit_extract_signature(
|
765
|
+
git_buf *signature_out,
|
766
|
+
git_buf *signed_data_out,
|
767
|
+
git_repository *repo,
|
768
|
+
git_oid *commit_id,
|
769
|
+
const char *field)
|
770
|
+
{
|
771
|
+
git_str signature = GIT_STR_INIT, signed_data = GIT_STR_INIT;
|
772
|
+
int error;
|
773
|
+
|
774
|
+
if ((error = git_buf_tostr(&signature, signature_out)) < 0 ||
|
775
|
+
(error = git_buf_tostr(&signed_data, signed_data_out)) < 0 ||
|
776
|
+
(error = git_commit__extract_signature(&signature, &signed_data, repo, commit_id, field)) < 0 ||
|
777
|
+
(error = git_buf_fromstr(signature_out, &signature)) < 0 ||
|
778
|
+
(error = git_buf_fromstr(signed_data_out, &signed_data)) < 0)
|
779
|
+
goto done;
|
780
|
+
|
781
|
+
done:
|
782
|
+
git_str_dispose(&signature);
|
783
|
+
git_str_dispose(&signed_data);
|
784
|
+
return error;
|
785
|
+
}
|
786
|
+
|
787
|
+
int git_commit__extract_signature(
|
788
|
+
git_str *signature,
|
789
|
+
git_str *signed_data,
|
790
|
+
git_repository *repo,
|
791
|
+
git_oid *commit_id,
|
792
|
+
const char *field)
|
736
793
|
{
|
737
794
|
git_odb_object *obj;
|
738
795
|
git_odb *odb;
|
@@ -740,8 +797,8 @@ int git_commit_extract_signature(git_buf *signature, git_buf *signed_data, git_r
|
|
740
797
|
const char *h, *eol;
|
741
798
|
int error;
|
742
799
|
|
743
|
-
|
744
|
-
|
800
|
+
git_str_clear(signature);
|
801
|
+
git_str_clear(signed_data);
|
745
802
|
|
746
803
|
if (!field)
|
747
804
|
field = "gpgsig";
|
@@ -763,7 +820,7 @@ int git_commit_extract_signature(git_buf *signature, git_buf *signed_data, git_r
|
|
763
820
|
while ((h = strchr(buf, '\n')) && h[1] != '\0') {
|
764
821
|
h++;
|
765
822
|
if (git__prefixcmp(buf, field)) {
|
766
|
-
if (
|
823
|
+
if (git_str_put(signed_data, buf, h - buf) < 0)
|
767
824
|
return -1;
|
768
825
|
|
769
826
|
buf = h;
|
@@ -782,25 +839,25 @@ int git_commit_extract_signature(git_buf *signature, git_buf *signed_data, git_r
|
|
782
839
|
|
783
840
|
h++; /* skip the SP */
|
784
841
|
|
785
|
-
|
786
|
-
if (
|
842
|
+
git_str_put(signature, h, eol - h);
|
843
|
+
if (git_str_oom(signature))
|
787
844
|
goto oom;
|
788
845
|
|
789
846
|
/* If the next line starts with SP, it's multi-line, we must continue */
|
790
847
|
while (eol[1] == ' ') {
|
791
|
-
|
848
|
+
git_str_putc(signature, '\n');
|
792
849
|
h = eol + 2;
|
793
850
|
eol = strchr(h, '\n');
|
794
851
|
if (!eol)
|
795
852
|
goto malformed;
|
796
853
|
|
797
|
-
|
854
|
+
git_str_put(signature, h, eol - h);
|
798
855
|
}
|
799
856
|
|
800
|
-
if (
|
857
|
+
if (git_str_oom(signature))
|
801
858
|
goto oom;
|
802
859
|
|
803
|
-
error =
|
860
|
+
error = git_str_puts(signed_data, eol+1);
|
804
861
|
git_odb_object_free(obj);
|
805
862
|
return error;
|
806
863
|
}
|
@@ -820,12 +877,29 @@ oom:
|
|
820
877
|
|
821
878
|
cleanup:
|
822
879
|
git_odb_object_free(obj);
|
823
|
-
|
824
|
-
|
880
|
+
git_str_clear(signature);
|
881
|
+
git_str_clear(signed_data);
|
825
882
|
return error;
|
826
883
|
}
|
827
884
|
|
828
|
-
int git_commit_create_buffer(
|
885
|
+
int git_commit_create_buffer(
|
886
|
+
git_buf *out,
|
887
|
+
git_repository *repo,
|
888
|
+
const git_signature *author,
|
889
|
+
const git_signature *committer,
|
890
|
+
const char *message_encoding,
|
891
|
+
const char *message,
|
892
|
+
const git_tree *tree,
|
893
|
+
size_t parent_count,
|
894
|
+
const git_commit *parents[])
|
895
|
+
{
|
896
|
+
GIT_BUF_WRAP_PRIVATE(out, git_commit__create_buffer, repo,
|
897
|
+
author, committer, message_encoding, message,
|
898
|
+
tree, parent_count, parents);
|
899
|
+
}
|
900
|
+
|
901
|
+
int git_commit__create_buffer(
|
902
|
+
git_str *out,
|
829
903
|
git_repository *repo,
|
830
904
|
const git_signature *author,
|
831
905
|
const git_signature *committer,
|
@@ -840,7 +914,8 @@ int git_commit_create_buffer(git_buf *out,
|
|
840
914
|
git_array_oid_t parents_arr = GIT_ARRAY_INIT;
|
841
915
|
const git_oid *tree_id;
|
842
916
|
|
843
|
-
|
917
|
+
GIT_ASSERT_ARG(tree);
|
918
|
+
GIT_ASSERT_ARG(git_tree_owner(tree) == repo);
|
844
919
|
|
845
920
|
tree_id = git_tree_id(tree);
|
846
921
|
|
@@ -859,23 +934,27 @@ int git_commit_create_buffer(git_buf *out,
|
|
859
934
|
/**
|
860
935
|
* Append to 'out' properly marking continuations when there's a newline in 'content'
|
861
936
|
*/
|
862
|
-
static
|
937
|
+
static int format_header_field(git_str *out, const char *field, const char *content)
|
863
938
|
{
|
864
939
|
const char *lf;
|
865
940
|
|
866
|
-
|
941
|
+
GIT_ASSERT_ARG(out);
|
942
|
+
GIT_ASSERT_ARG(field);
|
943
|
+
GIT_ASSERT_ARG(content);
|
867
944
|
|
868
|
-
|
869
|
-
|
945
|
+
git_str_puts(out, field);
|
946
|
+
git_str_putc(out, ' ');
|
870
947
|
|
871
948
|
while ((lf = strchr(content, '\n')) != NULL) {
|
872
|
-
|
873
|
-
|
949
|
+
git_str_put(out, content, lf - content);
|
950
|
+
git_str_puts(out, "\n ");
|
874
951
|
content = lf + 1;
|
875
952
|
}
|
876
953
|
|
877
|
-
|
878
|
-
|
954
|
+
git_str_puts(out, content);
|
955
|
+
git_str_putc(out, '\n');
|
956
|
+
|
957
|
+
return git_str_oom(out) ? -1 : 0;
|
879
958
|
}
|
880
959
|
|
881
960
|
static const git_oid *commit_parent_from_commit(size_t n, void *payload)
|
@@ -897,15 +976,17 @@ int git_commit_create_with_signature(
|
|
897
976
|
int error = 0;
|
898
977
|
const char *field;
|
899
978
|
const char *header_end;
|
900
|
-
|
979
|
+
git_str commit = GIT_STR_INIT;
|
901
980
|
git_commit *parsed;
|
902
981
|
git_array_oid_t parents = GIT_ARRAY_INIT;
|
903
982
|
|
904
983
|
/* The first step is to verify that all the tree and parents exist */
|
905
984
|
parsed = git__calloc(1, sizeof(git_commit));
|
906
985
|
GIT_ERROR_CHECK_ALLOC(parsed);
|
907
|
-
if (
|
986
|
+
if (commit_parse(parsed, commit_content, strlen(commit_content), 0) < 0) {
|
987
|
+
error = -1;
|
908
988
|
goto cleanup;
|
989
|
+
}
|
909
990
|
|
910
991
|
if ((error = validate_tree_and_parents(&parents, repo, &parsed->tree_id, commit_parent_from_commit, parsed, NULL, true)) < 0)
|
911
992
|
goto cleanup;
|
@@ -922,16 +1003,18 @@ int git_commit_create_with_signature(
|
|
922
1003
|
|
923
1004
|
/* The header ends after the first LF */
|
924
1005
|
header_end++;
|
925
|
-
|
1006
|
+
git_str_put(&commit, commit_content, header_end - commit_content);
|
926
1007
|
|
927
1008
|
if (signature != NULL) {
|
928
1009
|
field = signature_field ? signature_field : "gpgsig";
|
929
|
-
|
1010
|
+
|
1011
|
+
if ((error = format_header_field(&commit, field, signature)) < 0)
|
1012
|
+
goto cleanup;
|
930
1013
|
}
|
931
1014
|
|
932
|
-
|
1015
|
+
git_str_puts(&commit, header_end);
|
933
1016
|
|
934
|
-
if (
|
1017
|
+
if (git_str_oom(&commit))
|
935
1018
|
return -1;
|
936
1019
|
|
937
1020
|
if ((error = git_repository_odb__weakptr(&odb, repo)) < 0)
|
@@ -942,7 +1025,7 @@ int git_commit_create_with_signature(
|
|
942
1025
|
|
943
1026
|
cleanup:
|
944
1027
|
git_commit__free(parsed);
|
945
|
-
|
1028
|
+
git_str_dispose(&commit);
|
946
1029
|
return error;
|
947
1030
|
}
|
948
1031
|
|
data/vendor/libgit2/src/commit.h
CHANGED
@@ -33,12 +33,35 @@ struct git_commit {
|
|
33
33
|
char *body;
|
34
34
|
};
|
35
35
|
|
36
|
+
int git_commit__header_field(
|
37
|
+
git_str *out,
|
38
|
+
const git_commit *commit,
|
39
|
+
const char *field);
|
40
|
+
|
41
|
+
int git_commit__extract_signature(
|
42
|
+
git_str *signature,
|
43
|
+
git_str *signed_data,
|
44
|
+
git_repository *repo,
|
45
|
+
git_oid *commit_id,
|
46
|
+
const char *field);
|
47
|
+
|
48
|
+
int git_commit__create_buffer(
|
49
|
+
git_str *out,
|
50
|
+
git_repository *repo,
|
51
|
+
const git_signature *author,
|
52
|
+
const git_signature *committer,
|
53
|
+
const char *message_encoding,
|
54
|
+
const char *message,
|
55
|
+
const git_tree *tree,
|
56
|
+
size_t parent_count,
|
57
|
+
const git_commit *parents[]);
|
58
|
+
|
36
59
|
void git_commit__free(void *commit);
|
37
60
|
int git_commit__parse(void *commit, git_odb_object *obj);
|
38
61
|
int git_commit__parse_raw(void *commit, const char *data, size_t size);
|
39
62
|
|
40
63
|
typedef enum {
|
41
|
-
GIT_COMMIT_PARSE_QUICK = (1 << 0)
|
64
|
+
GIT_COMMIT_PARSE_QUICK = (1 << 0) /**< Only parse parents and committer info */
|
42
65
|
} git_commit__parse_flags;
|
43
66
|
|
44
67
|
int git_commit__parse_ext(git_commit *commit, git_odb_object *odb_obj, unsigned int flags);
|