rugged 0.28.5 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/ext/rugged/extconf.rb +3 -1
- data/ext/rugged/rugged.c +35 -31
- data/ext/rugged/rugged.h +13 -0
- data/ext/rugged/rugged_blob.c +11 -9
- data/ext/rugged/rugged_commit.c +18 -16
- data/ext/rugged/rugged_config.c +1 -1
- data/ext/rugged/rugged_diff.c +4 -26
- data/ext/rugged/rugged_index.c +4 -2
- data/ext/rugged/rugged_note.c +5 -3
- data/ext/rugged/rugged_object.c +57 -10
- data/ext/rugged/rugged_rebase.c +3 -1
- data/ext/rugged/rugged_remote.c +32 -8
- data/ext/rugged/rugged_repo.c +232 -17
- data/ext/rugged/rugged_tag.c +8 -6
- data/ext/rugged/rugged_tree.c +18 -16
- data/lib/rugged/commit.rb +17 -4
- data/lib/rugged/repository.rb +5 -6
- data/lib/rugged/submodule_collection.rb +4 -4
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +57 -75
- data/vendor/libgit2/COPYING +28 -0
- data/vendor/libgit2/cmake/{Modules/AddCFlagIfSupported.cmake → AddCFlagIfSupported.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/EnableWarnings.cmake → EnableWarnings.cmake} +5 -1
- data/vendor/libgit2/cmake/{Modules/FindCoreFoundation.cmake → FindCoreFoundation.cmake} +2 -2
- data/vendor/libgit2/cmake/{Modules/FindGSSAPI.cmake → FindGSSAPI.cmake} +1 -1
- data/vendor/libgit2/cmake/FindGSSFramework.cmake +28 -0
- data/vendor/libgit2/cmake/{Modules/FindHTTP_Parser.cmake → FindHTTP_Parser.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindIconv.cmake → FindIconv.cmake} +0 -0
- data/vendor/libgit2/cmake/FindPCRE.cmake +38 -0
- data/vendor/libgit2/cmake/FindPCRE2.cmake +37 -0
- data/vendor/libgit2/cmake/{Modules/FindPkgLibraries.cmake → FindPkgLibraries.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindSecurity.cmake → FindSecurity.cmake} +2 -2
- data/vendor/libgit2/cmake/{Modules/FindStatNsec.cmake → FindStatNsec.cmake} +6 -0
- data/vendor/libgit2/cmake/{Modules/FindmbedTLS.cmake → FindmbedTLS.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/IdeSplitSources.cmake → IdeSplitSources.cmake} +0 -0
- data/vendor/libgit2/cmake/PkgBuildConfig.cmake +77 -0
- data/vendor/libgit2/cmake/SanitizeBool.cmake +20 -0
- data/vendor/libgit2/cmake/SelectGSSAPI.cmake +48 -0
- data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +120 -0
- data/vendor/libgit2/cmake/SelectHashes.cmake +61 -0
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +4 -3
- data/vendor/libgit2/deps/http-parser/http_parser.c +11 -6
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +25 -0
- data/vendor/libgit2/deps/ntlmclient/compat.h +28 -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 +1419 -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 +35 -0
- data/vendor/libgit2/deps/ntlmclient/util.h +15 -0
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +140 -0
- data/vendor/libgit2/deps/pcre/COPYING +5 -0
- data/vendor/libgit2/deps/pcre/LICENCE +93 -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 +9812 -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 +420 -0
- data/vendor/libgit2/deps/pcre/pcreposix.h +117 -0
- data/vendor/libgit2/deps/pcre/ucp.h +224 -0
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +6 -5
- data/vendor/libgit2/deps/zlib/adler32.c +0 -7
- data/vendor/libgit2/deps/zlib/crc32.c +0 -7
- data/vendor/libgit2/deps/zlib/deflate.c +1 -0
- data/vendor/libgit2/include/git2.h +2 -0
- data/vendor/libgit2/include/git2/annotated_commit.h +1 -1
- data/vendor/libgit2/include/git2/apply.h +24 -2
- data/vendor/libgit2/include/git2/attr.h +23 -13
- data/vendor/libgit2/include/git2/blame.h +4 -2
- data/vendor/libgit2/include/git2/blob.h +61 -13
- data/vendor/libgit2/include/git2/branch.h +74 -57
- data/vendor/libgit2/include/git2/buffer.h +20 -14
- data/vendor/libgit2/include/git2/cert.h +135 -0
- data/vendor/libgit2/include/git2/checkout.h +46 -14
- data/vendor/libgit2/include/git2/cherrypick.h +3 -3
- data/vendor/libgit2/include/git2/clone.h +2 -2
- data/vendor/libgit2/include/git2/commit.h +23 -1
- data/vendor/libgit2/include/git2/common.h +34 -8
- data/vendor/libgit2/include/git2/config.h +13 -13
- data/vendor/libgit2/include/git2/cred_helpers.h +4 -42
- data/vendor/libgit2/include/git2/credential.h +314 -0
- data/vendor/libgit2/include/git2/credential_helpers.h +52 -0
- data/vendor/libgit2/include/git2/deprecated.h +362 -4
- data/vendor/libgit2/include/git2/describe.h +4 -4
- data/vendor/libgit2/include/git2/diff.h +17 -15
- data/vendor/libgit2/include/git2/errors.h +5 -2
- data/vendor/libgit2/include/git2/filter.h +8 -0
- data/vendor/libgit2/include/git2/index.h +5 -5
- data/vendor/libgit2/include/git2/indexer.h +49 -4
- data/vendor/libgit2/include/git2/merge.h +6 -10
- data/vendor/libgit2/include/git2/net.h +0 -5
- data/vendor/libgit2/include/git2/object.h +2 -14
- data/vendor/libgit2/include/git2/odb.h +18 -22
- data/vendor/libgit2/include/git2/odb_backend.h +5 -4
- data/vendor/libgit2/include/git2/oid.h +11 -6
- data/vendor/libgit2/include/git2/pack.h +13 -2
- data/vendor/libgit2/include/git2/proxy.h +6 -4
- data/vendor/libgit2/include/git2/rebase.h +46 -2
- data/vendor/libgit2/include/git2/refs.h +22 -3
- data/vendor/libgit2/include/git2/remote.h +40 -15
- data/vendor/libgit2/include/git2/repository.h +124 -58
- data/vendor/libgit2/include/git2/revert.h +1 -1
- data/vendor/libgit2/include/git2/revwalk.h +7 -3
- data/vendor/libgit2/include/git2/stash.h +4 -4
- data/vendor/libgit2/include/git2/status.h +25 -16
- data/vendor/libgit2/include/git2/strarray.h +6 -10
- data/vendor/libgit2/include/git2/submodule.h +20 -3
- data/vendor/libgit2/include/git2/sys/alloc.h +9 -9
- data/vendor/libgit2/include/git2/sys/cred.h +15 -0
- data/vendor/libgit2/include/git2/sys/credential.h +90 -0
- data/vendor/libgit2/include/git2/sys/index.h +4 -2
- data/vendor/libgit2/include/git2/sys/mempack.h +2 -1
- data/vendor/libgit2/include/git2/sys/merge.h +1 -1
- data/vendor/libgit2/include/git2/sys/odb_backend.h +48 -4
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +164 -21
- data/vendor/libgit2/include/git2/sys/repository.h +17 -6
- data/vendor/libgit2/include/git2/sys/transport.h +4 -4
- data/vendor/libgit2/include/git2/tag.h +11 -2
- data/vendor/libgit2/include/git2/trace.h +2 -2
- data/vendor/libgit2/include/git2/transport.h +11 -340
- data/vendor/libgit2/include/git2/tree.h +7 -3
- data/vendor/libgit2/include/git2/types.h +4 -89
- data/vendor/libgit2/include/git2/version.h +5 -5
- data/vendor/libgit2/include/git2/worktree.h +5 -5
- data/vendor/libgit2/src/CMakeLists.txt +147 -272
- data/vendor/libgit2/src/alloc.c +2 -14
- data/vendor/libgit2/src/{stdalloc.c → allocators/stdalloc.c} +3 -4
- 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/apply.c +36 -16
- data/vendor/libgit2/src/assert_safe.h +58 -0
- data/vendor/libgit2/src/attr.c +70 -64
- data/vendor/libgit2/src/attr_file.c +197 -99
- data/vendor/libgit2/src/attr_file.h +9 -9
- data/vendor/libgit2/src/attrcache.c +48 -49
- data/vendor/libgit2/src/attrcache.h +2 -1
- data/vendor/libgit2/src/blame.c +34 -15
- data/vendor/libgit2/src/blame.h +1 -1
- data/vendor/libgit2/src/blame_git.c +27 -10
- data/vendor/libgit2/src/blob.c +92 -17
- data/vendor/libgit2/src/blob.h +2 -2
- data/vendor/libgit2/src/branch.c +68 -42
- data/vendor/libgit2/src/buffer.c +11 -3
- data/vendor/libgit2/src/buffer.h +1 -0
- data/vendor/libgit2/src/cache.c +34 -58
- data/vendor/libgit2/src/cache.h +1 -1
- data/vendor/libgit2/src/cc-compat.h +5 -0
- data/vendor/libgit2/src/checkout.c +73 -86
- data/vendor/libgit2/src/cherrypick.c +9 -1
- data/vendor/libgit2/src/clone.c +130 -27
- data/vendor/libgit2/src/clone.h +4 -0
- data/vendor/libgit2/src/commit.c +70 -22
- data/vendor/libgit2/src/commit.h +6 -0
- data/vendor/libgit2/src/commit_list.c +28 -76
- data/vendor/libgit2/src/commit_list.h +2 -2
- data/vendor/libgit2/src/common.h +4 -75
- data/vendor/libgit2/src/config.c +34 -47
- data/vendor/libgit2/src/config.h +7 -6
- data/vendor/libgit2/src/config_backend.h +12 -0
- data/vendor/libgit2/src/config_cache.c +42 -39
- data/vendor/libgit2/src/config_entries.c +76 -98
- data/vendor/libgit2/src/config_entries.h +1 -0
- data/vendor/libgit2/src/config_file.c +346 -380
- data/vendor/libgit2/src/config_mem.c +12 -16
- data/vendor/libgit2/src/config_parse.c +50 -30
- data/vendor/libgit2/src/config_parse.h +13 -12
- data/vendor/libgit2/src/config_snapshot.c +207 -0
- data/vendor/libgit2/src/crlf.c +14 -14
- data/vendor/libgit2/src/describe.c +26 -21
- data/vendor/libgit2/src/diff.c +53 -75
- data/vendor/libgit2/src/diff.h +4 -3
- data/vendor/libgit2/src/diff_driver.c +37 -38
- data/vendor/libgit2/src/diff_file.c +15 -11
- data/vendor/libgit2/src/diff_file.h +2 -2
- data/vendor/libgit2/src/diff_generate.c +36 -37
- data/vendor/libgit2/src/diff_generate.h +2 -2
- data/vendor/libgit2/src/diff_parse.c +3 -4
- data/vendor/libgit2/src/diff_print.c +86 -71
- data/vendor/libgit2/src/diff_stats.c +13 -12
- data/vendor/libgit2/src/diff_tform.c +15 -16
- data/vendor/libgit2/src/errors.c +23 -25
- data/vendor/libgit2/src/errors.h +81 -0
- data/vendor/libgit2/src/features.h.in +9 -2
- data/vendor/libgit2/src/fetch.c +9 -2
- data/vendor/libgit2/src/fetchhead.c +9 -9
- data/vendor/libgit2/src/filebuf.c +1 -1
- data/vendor/libgit2/src/filebuf.h +1 -1
- data/vendor/libgit2/src/filter.c +19 -11
- data/vendor/libgit2/src/{fileops.c → futils.c} +23 -20
- data/vendor/libgit2/src/{fileops.h → futils.h} +8 -8
- data/vendor/libgit2/src/global.c +3 -1
- data/vendor/libgit2/src/hash.c +61 -0
- data/vendor/libgit2/src/hash.h +19 -21
- data/vendor/libgit2/src/hash/sha1.h +38 -0
- data/vendor/libgit2/src/hash/{hash_collisiondetect.h → sha1/collisiondetect.c} +14 -17
- data/vendor/libgit2/src/{sha1_lookup.h → hash/sha1/collisiondetect.h} +8 -8
- data/vendor/libgit2/src/hash/{hash_common_crypto.h → sha1/common_crypto.c} +15 -19
- 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 -14
- 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 -11
- data/vendor/libgit2/src/hash/{hash_openssl.h → sha1/openssl.c} +14 -18
- data/vendor/libgit2/src/{refdb_fs.h → hash/sha1/openssl.h} +8 -8
- 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} +34 -24
- data/vendor/libgit2/src/hash/{hash_win32.h → sha1/win32.h} +6 -19
- data/vendor/libgit2/src/hashsig.c +1 -1
- data/vendor/libgit2/src/idxmap.c +73 -69
- data/vendor/libgit2/src/idxmap.h +151 -15
- data/vendor/libgit2/src/ignore.c +26 -35
- data/vendor/libgit2/src/index.c +123 -95
- data/vendor/libgit2/src/index.h +1 -1
- data/vendor/libgit2/src/indexer.c +99 -78
- data/vendor/libgit2/src/integer.h +26 -4
- data/vendor/libgit2/src/iterator.c +36 -32
- data/vendor/libgit2/src/iterator.h +8 -8
- data/vendor/libgit2/src/map.h +1 -1
- data/vendor/libgit2/src/merge.c +93 -57
- data/vendor/libgit2/src/merge.h +2 -2
- data/vendor/libgit2/src/merge_driver.c +5 -5
- data/vendor/libgit2/src/merge_file.c +5 -7
- data/vendor/libgit2/src/midx.c +418 -0
- data/vendor/libgit2/src/midx.h +83 -0
- data/vendor/libgit2/src/mwindow.c +144 -74
- data/vendor/libgit2/src/mwindow.h +4 -4
- data/vendor/libgit2/src/net.c +416 -0
- data/vendor/libgit2/src/net.h +57 -0
- data/vendor/libgit2/src/netops.c +6 -222
- data/vendor/libgit2/src/netops.h +1 -37
- data/vendor/libgit2/src/notes.c +8 -5
- data/vendor/libgit2/src/object.c +5 -4
- data/vendor/libgit2/src/object.h +2 -0
- data/vendor/libgit2/src/odb.c +54 -32
- data/vendor/libgit2/src/odb.h +3 -2
- data/vendor/libgit2/src/odb_loose.c +20 -13
- data/vendor/libgit2/src/odb_mempack.c +15 -24
- data/vendor/libgit2/src/odb_pack.c +4 -5
- data/vendor/libgit2/src/offmap.c +43 -55
- data/vendor/libgit2/src/offmap.h +102 -24
- data/vendor/libgit2/src/oid.c +21 -8
- data/vendor/libgit2/src/oidmap.c +39 -57
- data/vendor/libgit2/src/oidmap.h +99 -19
- data/vendor/libgit2/src/pack-objects.c +55 -52
- data/vendor/libgit2/src/pack-objects.h +1 -1
- data/vendor/libgit2/src/pack.c +160 -149
- data/vendor/libgit2/src/pack.h +32 -18
- data/vendor/libgit2/src/parse.c +10 -0
- data/vendor/libgit2/src/parse.h +3 -3
- data/vendor/libgit2/src/patch.c +1 -1
- data/vendor/libgit2/src/patch_generate.c +2 -4
- data/vendor/libgit2/src/patch_parse.c +34 -11
- data/vendor/libgit2/src/path.c +47 -10
- data/vendor/libgit2/src/path.h +2 -0
- data/vendor/libgit2/src/pathspec.c +18 -17
- data/vendor/libgit2/src/pool.c +42 -32
- data/vendor/libgit2/src/pool.h +15 -7
- data/vendor/libgit2/src/posix.c +39 -16
- data/vendor/libgit2/src/posix.h +21 -1
- data/vendor/libgit2/src/proxy.c +9 -2
- data/vendor/libgit2/src/push.c +15 -7
- data/vendor/libgit2/src/reader.c +2 -2
- data/vendor/libgit2/src/rebase.c +89 -28
- data/vendor/libgit2/src/refdb.c +147 -0
- data/vendor/libgit2/src/refdb.h +69 -0
- data/vendor/libgit2/src/refdb_fs.c +230 -241
- data/vendor/libgit2/src/reflog.c +13 -19
- data/vendor/libgit2/src/refs.c +113 -217
- data/vendor/libgit2/src/refs.h +10 -21
- data/vendor/libgit2/src/refspec.c +57 -48
- data/vendor/libgit2/src/regexp.c +221 -0
- data/vendor/libgit2/src/regexp.h +97 -0
- data/vendor/libgit2/src/remote.c +102 -79
- data/vendor/libgit2/src/remote.h +2 -2
- data/vendor/libgit2/src/repository.c +322 -203
- data/vendor/libgit2/src/repository.h +49 -57
- data/vendor/libgit2/src/revert.c +8 -1
- data/vendor/libgit2/src/revparse.c +23 -23
- data/vendor/libgit2/src/revwalk.c +73 -37
- data/vendor/libgit2/src/revwalk.h +20 -0
- data/vendor/libgit2/src/settings.c +22 -1
- data/vendor/libgit2/src/sortedcache.c +14 -29
- data/vendor/libgit2/src/sortedcache.h +1 -1
- data/vendor/libgit2/src/stash.c +49 -67
- data/vendor/libgit2/src/status.c +19 -11
- data/vendor/libgit2/src/strarray.c +63 -0
- data/vendor/libgit2/src/streams/openssl.c +66 -8
- data/vendor/libgit2/src/streams/registry.c +5 -3
- data/vendor/libgit2/src/streams/socket.c +2 -2
- data/vendor/libgit2/src/strmap.c +37 -84
- data/vendor/libgit2/src/strmap.h +105 -33
- data/vendor/libgit2/src/submodule.c +157 -130
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/sysdir.c +4 -20
- data/vendor/libgit2/src/sysdir.h +0 -11
- data/vendor/libgit2/src/tag.c +12 -2
- data/vendor/libgit2/src/thread-utils.h +163 -40
- data/vendor/libgit2/src/trace.c +1 -1
- data/vendor/libgit2/src/trace.h +3 -3
- data/vendor/libgit2/src/trailer.c +46 -32
- data/vendor/libgit2/src/transaction.c +5 -9
- data/vendor/libgit2/src/transports/auth.c +16 -15
- data/vendor/libgit2/src/transports/auth.h +18 -11
- data/vendor/libgit2/src/transports/auth_negotiate.c +64 -33
- 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 +38 -0
- data/vendor/libgit2/src/transports/credential.c +478 -0
- data/vendor/libgit2/src/transports/{cred_helpers.c → credential_helpers.c} +23 -8
- data/vendor/libgit2/src/transports/git.c +11 -16
- data/vendor/libgit2/src/transports/http.c +488 -1248
- data/vendor/libgit2/src/transports/http.h +4 -1
- data/vendor/libgit2/src/transports/httpclient.c +1552 -0
- data/vendor/libgit2/src/transports/httpclient.h +190 -0
- data/vendor/libgit2/src/transports/local.c +12 -12
- data/vendor/libgit2/src/transports/smart.c +21 -21
- data/vendor/libgit2/src/transports/smart.h +3 -3
- data/vendor/libgit2/src/transports/smart_protocol.c +40 -64
- data/vendor/libgit2/src/transports/ssh.c +77 -59
- data/vendor/libgit2/src/transports/winhttp.c +368 -285
- data/vendor/libgit2/src/tree-cache.c +14 -7
- data/vendor/libgit2/src/tree.c +16 -26
- data/vendor/libgit2/src/unix/map.c +1 -1
- data/vendor/libgit2/src/unix/posix.h +16 -11
- data/vendor/libgit2/src/userdiff.h +3 -1
- data/vendor/libgit2/src/util.c +75 -110
- data/vendor/libgit2/src/util.h +18 -23
- data/vendor/libgit2/src/wildmatch.c +320 -0
- data/vendor/libgit2/src/wildmatch.h +23 -0
- data/vendor/libgit2/src/win32/git2.rc +18 -3
- data/vendor/libgit2/src/win32/map.c +3 -5
- data/vendor/libgit2/src/win32/path_w32.c +42 -5
- data/vendor/libgit2/src/win32/path_w32.h +15 -29
- data/vendor/libgit2/src/win32/posix.h +1 -4
- data/vendor/libgit2/src/win32/posix_w32.c +117 -5
- data/vendor/libgit2/src/win32/precompiled.h +0 -2
- data/vendor/libgit2/src/win32/thread.c +5 -5
- data/vendor/libgit2/src/win32/w32_buffer.c +7 -3
- data/vendor/libgit2/src/win32/w32_common.h +39 -0
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +0 -93
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +0 -2
- data/vendor/libgit2/src/win32/w32_stack.c +4 -9
- data/vendor/libgit2/src/win32/w32_stack.h +3 -3
- data/vendor/libgit2/src/win32/w32_util.c +31 -0
- data/vendor/libgit2/src/win32/w32_util.h +6 -32
- data/vendor/libgit2/src/worktree.c +91 -50
- data/vendor/libgit2/src/xdiff/xdiffi.c +1 -1
- data/vendor/libgit2/src/xdiff/xmerge.c +12 -0
- data/vendor/libgit2/src/xdiff/xpatience.c +3 -0
- data/vendor/libgit2/src/zstream.c +5 -0
- data/vendor/libgit2/src/zstream.h +1 -0
- metadata +123 -53
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.c.in +0 -29
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.cmake +0 -96
- data/vendor/libgit2/deps/regex/CMakeLists.txt +0 -2
- data/vendor/libgit2/deps/regex/COPYING +0 -502
- 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/fnmatch.c +0 -248
- data/vendor/libgit2/src/fnmatch.h +0 -48
- data/vendor/libgit2/src/sha1_lookup.c +0 -35
- data/vendor/libgit2/src/transports/cred.c +0 -390
@@ -221,10 +221,18 @@ done:
|
|
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
|
+
#ifndef GIT_DEPRECATE_HARD
|
233
|
+
int git_cherrypick_init_options(
|
234
|
+
git_cherrypick_options *opts, unsigned int version)
|
235
|
+
{
|
236
|
+
return git_cherrypick_options_init(opts, version);
|
237
|
+
}
|
238
|
+
#endif
|
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"
|
@@ -139,6 +137,98 @@ static int update_head_to_new_branch(
|
|
139
137
|
return error;
|
140
138
|
}
|
141
139
|
|
140
|
+
static int update_head_to_default(git_repository *repo)
|
141
|
+
{
|
142
|
+
git_buf initialbranch = GIT_BUF_INIT;
|
143
|
+
const char *branch_name;
|
144
|
+
int error = 0;
|
145
|
+
|
146
|
+
if ((error = git_repository_initialbranch(&initialbranch, repo)) < 0)
|
147
|
+
goto done;
|
148
|
+
|
149
|
+
if (git__prefixcmp(initialbranch.ptr, GIT_REFS_HEADS_DIR) != 0) {
|
150
|
+
git_error_set(GIT_ERROR_INVALID, "invalid initial branch '%s'", initialbranch.ptr);
|
151
|
+
error = -1;
|
152
|
+
goto done;
|
153
|
+
}
|
154
|
+
|
155
|
+
branch_name = initialbranch.ptr + strlen(GIT_REFS_HEADS_DIR);
|
156
|
+
|
157
|
+
error = setup_tracking_config(repo, branch_name, GIT_REMOTE_ORIGIN,
|
158
|
+
initialbranch.ptr);
|
159
|
+
|
160
|
+
done:
|
161
|
+
git_buf_dispose(&initialbranch);
|
162
|
+
return error;
|
163
|
+
}
|
164
|
+
|
165
|
+
static int update_remote_head_byname(
|
166
|
+
git_repository *repo,
|
167
|
+
const char *remote_name,
|
168
|
+
const char *tracking_branch_name,
|
169
|
+
const char *reflog_message)
|
170
|
+
{
|
171
|
+
git_buf tracking_head_name = GIT_BUF_INIT;
|
172
|
+
git_reference *remote_head = NULL;
|
173
|
+
int error;
|
174
|
+
|
175
|
+
if ((error = git_buf_printf(&tracking_head_name,
|
176
|
+
"%s%s/%s",
|
177
|
+
GIT_REFS_REMOTES_DIR,
|
178
|
+
remote_name,
|
179
|
+
GIT_HEAD_FILE)) < 0)
|
180
|
+
goto cleanup;
|
181
|
+
|
182
|
+
error = git_reference_symbolic_create(
|
183
|
+
&remote_head,
|
184
|
+
repo,
|
185
|
+
git_buf_cstr(&tracking_head_name),
|
186
|
+
tracking_branch_name,
|
187
|
+
true,
|
188
|
+
reflog_message);
|
189
|
+
|
190
|
+
cleanup:
|
191
|
+
git_reference_free(remote_head);
|
192
|
+
git_buf_dispose(&tracking_head_name);
|
193
|
+
return error;
|
194
|
+
}
|
195
|
+
|
196
|
+
static int update_remote_head(
|
197
|
+
git_repository *repo,
|
198
|
+
git_remote *remote,
|
199
|
+
git_buf *target,
|
200
|
+
const char *reflog_message)
|
201
|
+
{
|
202
|
+
git_refspec *refspec;
|
203
|
+
git_buf tracking_branch_name = GIT_BUF_INIT;
|
204
|
+
int error;
|
205
|
+
|
206
|
+
/* Determine the remote tracking ref name from the local branch */
|
207
|
+
refspec = git_remote__matching_refspec(remote, git_buf_cstr(target));
|
208
|
+
|
209
|
+
if (refspec == NULL) {
|
210
|
+
git_error_set(GIT_ERROR_NET, "the remote's default branch does not fit the refspec configuration");
|
211
|
+
error = GIT_EINVALIDSPEC;
|
212
|
+
goto cleanup;
|
213
|
+
}
|
214
|
+
|
215
|
+
if ((error = git_refspec_transform(
|
216
|
+
&tracking_branch_name,
|
217
|
+
refspec,
|
218
|
+
git_buf_cstr(target))) < 0)
|
219
|
+
goto cleanup;
|
220
|
+
|
221
|
+
error = update_remote_head_byname(
|
222
|
+
repo,
|
223
|
+
git_remote_name(remote),
|
224
|
+
git_buf_cstr(&tracking_branch_name),
|
225
|
+
reflog_message);
|
226
|
+
|
227
|
+
cleanup:
|
228
|
+
git_buf_dispose(&tracking_branch_name);
|
229
|
+
return error;
|
230
|
+
}
|
231
|
+
|
142
232
|
static int update_head_to_remote(
|
143
233
|
git_repository *repo,
|
144
234
|
git_remote *remote,
|
@@ -146,10 +236,8 @@ static int update_head_to_remote(
|
|
146
236
|
{
|
147
237
|
int error = 0;
|
148
238
|
size_t refs_len;
|
149
|
-
git_refspec *refspec;
|
150
239
|
const git_remote_head *remote_head, **refs;
|
151
240
|
const git_oid *remote_head_id;
|
152
|
-
git_buf remote_master_name = GIT_BUF_INIT;
|
153
241
|
git_buf branch = GIT_BUF_INIT;
|
154
242
|
|
155
243
|
if ((error = git_remote_ls(&refs, &refs_len, remote)) < 0)
|
@@ -157,8 +245,7 @@ static int update_head_to_remote(
|
|
157
245
|
|
158
246
|
/* We cloned an empty repository or one with an unborn HEAD */
|
159
247
|
if (refs_len == 0 || strcmp(refs[0]->name, GIT_HEAD_FILE))
|
160
|
-
return
|
161
|
-
repo, "master", GIT_REMOTE_ORIGIN, GIT_REFS_HEADS_MASTER_FILE);
|
248
|
+
return update_head_to_default(repo);
|
162
249
|
|
163
250
|
/* We know we have HEAD, let's see where it points */
|
164
251
|
remote_head = refs[0];
|
@@ -173,19 +260,7 @@ static int update_head_to_remote(
|
|
173
260
|
goto cleanup;
|
174
261
|
}
|
175
262
|
|
176
|
-
|
177
|
-
|
178
|
-
if (refspec == NULL) {
|
179
|
-
git_error_set(GIT_ERROR_NET, "the remote's default branch does not fit the refspec configuration");
|
180
|
-
error = GIT_EINVALIDSPEC;
|
181
|
-
goto cleanup;
|
182
|
-
}
|
183
|
-
|
184
|
-
/* Determine the remote tracking reference name from the local master */
|
185
|
-
if ((error = git_refspec_transform(
|
186
|
-
&remote_master_name,
|
187
|
-
refspec,
|
188
|
-
git_buf_cstr(&branch))) < 0)
|
263
|
+
if ((error = update_remote_head(repo, remote, &branch, reflog_message)) < 0)
|
189
264
|
goto cleanup;
|
190
265
|
|
191
266
|
error = update_head_to_new_branch(
|
@@ -195,7 +270,6 @@ static int update_head_to_remote(
|
|
195
270
|
reflog_message);
|
196
271
|
|
197
272
|
cleanup:
|
198
|
-
git_buf_dispose(&remote_master_name);
|
199
273
|
git_buf_dispose(&branch);
|
200
274
|
|
201
275
|
return error;
|
@@ -220,8 +294,11 @@ static int update_head_to_branch(
|
|
220
294
|
if ((retcode = git_reference_lookup(&remote_ref, repo, git_buf_cstr(&remote_branch_name))) < 0)
|
221
295
|
goto cleanup;
|
222
296
|
|
223
|
-
retcode = update_head_to_new_branch(repo, git_reference_target(remote_ref), branch,
|
224
|
-
reflog_message)
|
297
|
+
if ((retcode = update_head_to_new_branch(repo, git_reference_target(remote_ref), branch,
|
298
|
+
reflog_message)) < 0)
|
299
|
+
goto cleanup;
|
300
|
+
|
301
|
+
retcode = update_remote_head_byname(repo, remote_name, remote_branch_name.ptr, reflog_message);
|
225
302
|
|
226
303
|
cleanup:
|
227
304
|
git_reference_free(remote_ref);
|
@@ -382,11 +459,12 @@ done:
|
|
382
459
|
return is_local;
|
383
460
|
}
|
384
461
|
|
385
|
-
int
|
462
|
+
static int git__clone(
|
386
463
|
git_repository **out,
|
387
464
|
const char *url,
|
388
465
|
const char *local_path,
|
389
|
-
const git_clone_options *_options
|
466
|
+
const git_clone_options *_options,
|
467
|
+
int use_existing)
|
390
468
|
{
|
391
469
|
int error = 0;
|
392
470
|
git_repository *repo = NULL;
|
@@ -403,7 +481,7 @@ int git_clone(
|
|
403
481
|
GIT_ERROR_CHECK_VERSION(&options, GIT_CLONE_OPTIONS_VERSION, "git_clone_options");
|
404
482
|
|
405
483
|
/* Only clone to a new directory or an empty directory */
|
406
|
-
if (git_path_exists(local_path) && !git_path_is_empty_dir(local_path)) {
|
484
|
+
if (git_path_exists(local_path) && !use_existing && !git_path_is_empty_dir(local_path)) {
|
407
485
|
git_error_set(GIT_ERROR_INVALID,
|
408
486
|
"'%s' exists and is not an empty directory", local_path);
|
409
487
|
return GIT_EEXISTS;
|
@@ -455,13 +533,38 @@ int git_clone(
|
|
455
533
|
return error;
|
456
534
|
}
|
457
535
|
|
458
|
-
int
|
536
|
+
int git_clone(
|
537
|
+
git_repository **out,
|
538
|
+
const char *url,
|
539
|
+
const char *local_path,
|
540
|
+
const git_clone_options *_options)
|
541
|
+
{
|
542
|
+
return git__clone(out, url, local_path, _options, 0);
|
543
|
+
}
|
544
|
+
|
545
|
+
int git_clone__submodule(
|
546
|
+
git_repository **out,
|
547
|
+
const char *url,
|
548
|
+
const char *local_path,
|
549
|
+
const git_clone_options *_options)
|
550
|
+
{
|
551
|
+
return git__clone(out, url, local_path, _options, 1);
|
552
|
+
}
|
553
|
+
|
554
|
+
int git_clone_options_init(git_clone_options *opts, unsigned int version)
|
459
555
|
{
|
460
556
|
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
|
461
557
|
opts, version, git_clone_options, GIT_CLONE_OPTIONS_INIT);
|
462
558
|
return 0;
|
463
559
|
}
|
464
560
|
|
561
|
+
#ifndef GIT_DEPRECATE_HARD
|
562
|
+
int git_clone_init_options(git_clone_options *opts, unsigned int version)
|
563
|
+
{
|
564
|
+
return git_clone_options_init(opts, version);
|
565
|
+
}
|
566
|
+
#endif
|
567
|
+
|
465
568
|
static bool can_link(const char *src, const char *dst, int link)
|
466
569
|
{
|
467
570
|
#ifdef GIT_WIN32
|
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
@@ -20,6 +20,7 @@
|
|
20
20
|
#include "message.h"
|
21
21
|
#include "refs.h"
|
22
22
|
#include "object.h"
|
23
|
+
#include "array.h"
|
23
24
|
#include "oidarray.h"
|
24
25
|
|
25
26
|
void git_commit__free(void *_commit)
|
@@ -80,8 +81,8 @@ on_error:
|
|
80
81
|
}
|
81
82
|
|
82
83
|
static int validate_tree_and_parents(git_array_oid_t *parents, git_repository *repo, const git_oid *tree,
|
83
|
-
|
84
|
-
|
84
|
+
git_commit_parent_callback parent_cb, void *parent_payload,
|
85
|
+
const git_oid *current_id, bool validate)
|
85
86
|
{
|
86
87
|
size_t i;
|
87
88
|
int error;
|
@@ -152,8 +153,8 @@ static int git_commit__create_internal(
|
|
152
153
|
goto cleanup;
|
153
154
|
|
154
155
|
error = git_commit__create_buffer_internal(&buf, author, committer,
|
155
|
-
|
156
|
-
|
156
|
+
message_encoding, message, tree,
|
157
|
+
&parents);
|
157
158
|
|
158
159
|
if (error < 0)
|
159
160
|
goto cleanup;
|
@@ -383,15 +384,16 @@ int git_commit_amend(
|
|
383
384
|
return error;
|
384
385
|
}
|
385
386
|
|
386
|
-
int
|
387
|
+
static int commit_parse(git_commit *commit, const char *data, size_t size, unsigned int flags)
|
387
388
|
{
|
388
|
-
git_commit *commit = _commit;
|
389
389
|
const char *buffer_start = data, *buffer;
|
390
390
|
const char *buffer_end = buffer_start + size;
|
391
391
|
git_oid parent_id;
|
392
392
|
size_t header_len;
|
393
393
|
git_signature dummy_sig;
|
394
394
|
|
395
|
+
assert(commit && data);
|
396
|
+
|
395
397
|
buffer = buffer_start;
|
396
398
|
|
397
399
|
/* Allocate for one, which will allow not to realloc 90% of the time */
|
@@ -399,8 +401,15 @@ int git_commit__parse_raw(void *_commit, const char *data, size_t size)
|
|
399
401
|
GIT_ERROR_CHECK_ARRAY(commit->parent_ids);
|
400
402
|
|
401
403
|
/* The tree is always the first field */
|
402
|
-
if (
|
403
|
-
|
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
|
+
}
|
404
413
|
|
405
414
|
/*
|
406
415
|
* TODO: commit grafts!
|
@@ -413,11 +422,13 @@ int git_commit__parse_raw(void *_commit, const char *data, size_t size)
|
|
413
422
|
git_oid_cpy(new_id, &parent_id);
|
414
423
|
}
|
415
424
|
|
416
|
-
|
417
|
-
|
425
|
+
if (!(flags & GIT_COMMIT_PARSE_QUICK)) {
|
426
|
+
commit->author = git__malloc(sizeof(git_signature));
|
427
|
+
GIT_ERROR_CHECK_ALLOC(commit->author);
|
418
428
|
|
419
|
-
|
420
|
-
|
429
|
+
if (git_signature__parse(commit->author, &buffer, buffer_end, "author ", '\n') < 0)
|
430
|
+
return -1;
|
431
|
+
}
|
421
432
|
|
422
433
|
/* Some tools create multiple author fields, ignore the extra ones */
|
423
434
|
while (!git__prefixncmp(buffer, buffer_end - buffer, "author ")) {
|
@@ -435,6 +446,9 @@ int git_commit__parse_raw(void *_commit, const char *data, size_t size)
|
|
435
446
|
if (git_signature__parse(commit->committer, &buffer, buffer_end, "committer ", '\n') < 0)
|
436
447
|
return -1;
|
437
448
|
|
449
|
+
if (flags & GIT_COMMIT_PARSE_QUICK)
|
450
|
+
return 0;
|
451
|
+
|
438
452
|
/* Parse add'l header entries */
|
439
453
|
while (buffer < buffer_end) {
|
440
454
|
const char *eoln = buffer;
|
@@ -477,11 +491,19 @@ bad_buffer:
|
|
477
491
|
return -1;
|
478
492
|
}
|
479
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
|
+
|
480
504
|
int git_commit__parse(void *_commit, git_odb_object *odb_obj)
|
481
505
|
{
|
482
|
-
return
|
483
|
-
git_odb_object_data(odb_obj),
|
484
|
-
git_odb_object_size(odb_obj));
|
506
|
+
return git_commit__parse_ext(_commit, odb_obj, 0);
|
485
507
|
}
|
486
508
|
|
487
509
|
#define GIT_COMMIT_GETTER(_rvalue, _name, _return) \
|
@@ -582,7 +604,7 @@ const char *git_commit_body(git_commit *commit)
|
|
582
604
|
break;
|
583
605
|
|
584
606
|
if (*msg)
|
585
|
-
|
607
|
+
commit->body = git__strndup(msg, end - msg + 1);
|
586
608
|
}
|
587
609
|
|
588
610
|
return commit->body;
|
@@ -731,7 +753,7 @@ int git_commit_extract_signature(git_buf *signature, git_buf *signed_data, git_r
|
|
731
753
|
return error;
|
732
754
|
|
733
755
|
if (obj->cached.type != GIT_OBJECT_COMMIT) {
|
734
|
-
git_error_set(GIT_ERROR_INVALID, "the requested type does not match the type in ODB");
|
756
|
+
git_error_set(GIT_ERROR_INVALID, "the requested type does not match the type in the ODB");
|
735
757
|
error = GIT_ENOTFOUND;
|
736
758
|
goto cleanup;
|
737
759
|
}
|
@@ -856,6 +878,14 @@ static void format_header_field(git_buf *out, const char *field, const char *con
|
|
856
878
|
git_buf_putc(out, '\n');
|
857
879
|
}
|
858
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
|
+
|
859
889
|
int git_commit_create_with_signature(
|
860
890
|
git_oid *out,
|
861
891
|
git_repository *repo,
|
@@ -868,20 +898,37 @@ int git_commit_create_with_signature(
|
|
868
898
|
const char *field;
|
869
899
|
const char *header_end;
|
870
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;
|
871
912
|
|
872
|
-
|
913
|
+
git_array_clear(parents);
|
914
|
+
|
915
|
+
/* Then we start appending by identifying the end of the commit header */
|
873
916
|
header_end = strstr(commit_content, "\n\n");
|
874
917
|
if (!header_end) {
|
875
918
|
git_error_set(GIT_ERROR_INVALID, "malformed commit contents");
|
876
|
-
|
919
|
+
error = -1;
|
920
|
+
goto cleanup;
|
877
921
|
}
|
878
922
|
|
879
|
-
field = signature_field ? signature_field : "gpgsig";
|
880
|
-
|
881
923
|
/* The header ends after the first LF */
|
882
924
|
header_end++;
|
883
925
|
git_buf_put(&commit, commit_content, header_end - commit_content);
|
884
|
-
|
926
|
+
|
927
|
+
if (signature != NULL) {
|
928
|
+
field = signature_field ? signature_field : "gpgsig";
|
929
|
+
format_header_field(&commit, field, signature);
|
930
|
+
}
|
931
|
+
|
885
932
|
git_buf_puts(&commit, header_end);
|
886
933
|
|
887
934
|
if (git_buf_oom(&commit))
|
@@ -894,6 +941,7 @@ int git_commit_create_with_signature(
|
|
894
941
|
goto cleanup;
|
895
942
|
|
896
943
|
cleanup:
|
944
|
+
git_commit__free(parsed);
|
897
945
|
git_buf_dispose(&commit);
|
898
946
|
return error;
|
899
947
|
}
|