rugged 1.0.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -0
- data/README.md +3 -3
- data/ext/rugged/rugged.c +7 -4
- data/ext/rugged/rugged_commit.c +1 -1
- data/ext/rugged/rugged_config.c +1 -1
- data/ext/rugged/rugged_object.c +1 -1
- data/ext/rugged/rugged_remote.c +32 -2
- data/ext/rugged/rugged_repo.c +13 -3
- data/lib/rugged/commit.rb +17 -4
- data/lib/rugged/repository.rb +7 -8
- data/lib/rugged/submodule_collection.rb +4 -4
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +41 -74
- data/vendor/libgit2/COPYING +109 -1
- data/vendor/libgit2/cmake/{Modules/AddCFlagIfSupported.cmake → AddCFlagIfSupported.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/EnableWarnings.cmake → EnableWarnings.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindCoreFoundation.cmake → FindCoreFoundation.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindGSSAPI.cmake → FindGSSAPI.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindGSSFramework.cmake → FindGSSFramework.cmake} +0 -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/{Modules/FindPCRE.cmake → FindPCRE.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindPCRE2.cmake → FindPCRE2.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindPkgLibraries.cmake → FindPkgLibraries.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindSecurity.cmake → FindSecurity.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindStatNsec.cmake → FindStatNsec.cmake} +0 -0
- data/vendor/libgit2/cmake/Findfutimens.cmake +14 -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/{Modules/PkgBuildConfig.cmake → PkgBuildConfig.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/SanitizeBool.cmake → SanitizeBool.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/SelectGSSAPI.cmake → SelectGSSAPI.cmake} +18 -26
- data/vendor/libgit2/cmake/{Modules/SelectHTTPSBackend.cmake → SelectHTTPSBackend.cmake} +29 -32
- data/vendor/libgit2/cmake/{Modules/SelectHashes.cmake → SelectHashes.cmake} +21 -28
- data/vendor/libgit2/deps/chromium-zlib/CMakeLists.txt +101 -0
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +4 -3
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +24 -10
- data/vendor/libgit2/deps/ntlmclient/compat.h +0 -27
- 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 +164 -135
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +13 -9
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +16 -3
- data/vendor/libgit2/deps/ntlmclient/unicode.h +10 -4
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +16 -27
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.h +20 -0
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +28 -52
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.h +22 -0
- data/vendor/libgit2/deps/ntlmclient/util.c +15 -1
- data/vendor/libgit2/deps/ntlmclient/util.h +2 -1
- data/vendor/libgit2/deps/pcre/LICENCE +93 -0
- data/vendor/libgit2/deps/pcre/pcre.h +2 -2
- data/vendor/libgit2/deps/pcre/pcre_compile.c +29 -17
- data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +4 -4
- data/vendor/libgit2/deps/pcre/pcreposix.c +2 -3
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +6 -5
- data/vendor/libgit2/deps/zlib/deflate.c +1 -0
- data/vendor/libgit2/include/git2/annotated_commit.h +1 -1
- data/vendor/libgit2/include/git2/apply.h +2 -0
- data/vendor/libgit2/include/git2/attr.h +89 -0
- data/vendor/libgit2/include/git2/blame.h +95 -42
- data/vendor/libgit2/include/git2/blob.h +31 -3
- data/vendor/libgit2/include/git2/branch.h +25 -0
- data/vendor/libgit2/include/git2/cert.h +42 -5
- data/vendor/libgit2/include/git2/checkout.h +28 -12
- data/vendor/libgit2/include/git2/commit.h +35 -19
- data/vendor/libgit2/include/git2/common.h +33 -6
- data/vendor/libgit2/include/git2/config.h +1 -1
- data/vendor/libgit2/include/git2/deprecated.h +248 -8
- data/vendor/libgit2/include/git2/diff.h +35 -20
- data/vendor/libgit2/include/git2/errors.h +8 -7
- data/vendor/libgit2/include/git2/filter.h +57 -17
- data/vendor/libgit2/include/git2/graph.h +20 -2
- data/vendor/libgit2/include/git2/index.h +4 -5
- data/vendor/libgit2/include/git2/indexer.h +2 -1
- data/vendor/libgit2/include/git2/odb.h +44 -20
- data/vendor/libgit2/include/git2/pack.h +1 -1
- data/vendor/libgit2/include/git2/patch.h +8 -0
- data/vendor/libgit2/include/git2/rebase.h +25 -1
- data/vendor/libgit2/include/git2/refs.h +9 -5
- data/vendor/libgit2/include/git2/remote.h +59 -6
- data/vendor/libgit2/include/git2/repository.h +95 -52
- data/vendor/libgit2/include/git2/revparse.h +5 -5
- data/vendor/libgit2/include/git2/status.h +115 -59
- data/vendor/libgit2/include/git2/strarray.h +6 -10
- data/vendor/libgit2/include/git2/submodule.h +9 -0
- data/vendor/libgit2/include/git2/sys/commit_graph.h +174 -0
- data/vendor/libgit2/include/git2/sys/filter.h +49 -28
- data/vendor/libgit2/include/git2/sys/midx.h +74 -0
- data/vendor/libgit2/include/git2/sys/odb_backend.h +7 -0
- data/vendor/libgit2/include/git2/sys/transport.h +1 -0
- data/vendor/libgit2/include/git2/tag.h +12 -0
- data/vendor/libgit2/include/git2/transport.h +1 -1
- data/vendor/libgit2/include/git2/tree.h +2 -14
- data/vendor/libgit2/include/git2/types.h +9 -0
- data/vendor/libgit2/include/git2/version.h +3 -3
- data/vendor/libgit2/include/git2/worktree.h +1 -0
- data/vendor/libgit2/src/CMakeLists.txt +77 -44
- data/vendor/libgit2/src/alloc.c +21 -8
- data/vendor/libgit2/src/allocators/failalloc.c +92 -0
- data/vendor/libgit2/src/allocators/failalloc.h +23 -0
- data/vendor/libgit2/src/allocators/stdalloc.c +41 -10
- data/vendor/libgit2/src/allocators/win32_leakcheck.c +118 -0
- data/vendor/libgit2/src/allocators/{win32_crtdbg.h → win32_leakcheck.h} +3 -3
- data/vendor/libgit2/src/annotated_commit.c +21 -9
- data/vendor/libgit2/src/apply.c +21 -8
- data/vendor/libgit2/src/array.h +11 -11
- data/vendor/libgit2/src/assert_safe.h +58 -0
- data/vendor/libgit2/src/attr.c +181 -74
- data/vendor/libgit2/src/attr_file.c +92 -42
- data/vendor/libgit2/src/attr_file.h +32 -11
- data/vendor/libgit2/src/attrcache.c +44 -40
- data/vendor/libgit2/src/attrcache.h +4 -5
- data/vendor/libgit2/src/blame.c +28 -15
- data/vendor/libgit2/src/blame_git.c +6 -3
- data/vendor/libgit2/src/blob.c +46 -24
- data/vendor/libgit2/src/branch.c +87 -37
- data/vendor/libgit2/src/buffer.c +339 -27
- data/vendor/libgit2/src/buffer.h +153 -2
- data/vendor/libgit2/src/cache.c +3 -24
- data/vendor/libgit2/src/cache.h +7 -7
- data/vendor/libgit2/src/cc-compat.h +10 -2
- data/vendor/libgit2/src/checkout.c +97 -98
- data/vendor/libgit2/src/cherrypick.c +8 -2
- data/vendor/libgit2/src/clone.c +104 -29
- data/vendor/libgit2/src/commit.c +41 -28
- data/vendor/libgit2/src/commit_graph.c +1209 -0
- data/vendor/libgit2/src/commit_graph.h +162 -0
- data/vendor/libgit2/src/commit_list.c +46 -0
- data/vendor/libgit2/src/commit_list.h +2 -0
- data/vendor/libgit2/src/common.h +26 -2
- data/vendor/libgit2/src/config.c +40 -22
- data/vendor/libgit2/src/config_cache.c +9 -4
- data/vendor/libgit2/src/config_entries.c +35 -27
- data/vendor/libgit2/src/config_file.c +25 -8
- data/vendor/libgit2/src/config_parse.c +5 -7
- data/vendor/libgit2/src/config_snapshot.c +2 -1
- data/vendor/libgit2/src/crlf.c +16 -6
- data/vendor/libgit2/src/date.c +4 -3
- data/vendor/libgit2/src/delta.c +1 -1
- data/vendor/libgit2/src/describe.c +11 -4
- data/vendor/libgit2/src/diff.c +23 -19
- data/vendor/libgit2/src/diff_driver.c +21 -17
- data/vendor/libgit2/src/diff_file.c +5 -7
- data/vendor/libgit2/src/diff_generate.c +56 -28
- data/vendor/libgit2/src/diff_parse.c +2 -3
- data/vendor/libgit2/src/diff_print.c +81 -65
- data/vendor/libgit2/src/diff_stats.c +19 -16
- data/vendor/libgit2/src/diff_tform.c +13 -13
- data/vendor/libgit2/src/diff_xdiff.c +4 -2
- data/vendor/libgit2/src/diff_xdiff.h +1 -1
- data/vendor/libgit2/src/errors.c +26 -19
- data/vendor/libgit2/src/features.h.in +5 -1
- data/vendor/libgit2/src/fetch.c +7 -2
- data/vendor/libgit2/src/fetchhead.c +8 -4
- data/vendor/libgit2/src/filebuf.c +9 -7
- data/vendor/libgit2/src/filter.c +209 -113
- data/vendor/libgit2/src/filter.h +24 -5
- data/vendor/libgit2/src/futils.c +8 -8
- data/vendor/libgit2/src/futils.h +4 -4
- data/vendor/libgit2/src/graph.c +64 -9
- data/vendor/libgit2/src/hash/sha1/collisiondetect.c +3 -3
- data/vendor/libgit2/src/hash/sha1/common_crypto.c +3 -3
- data/vendor/libgit2/src/hash/sha1/generic.h +1 -1
- data/vendor/libgit2/src/hash/sha1/mbedtls.c +12 -12
- data/vendor/libgit2/src/hash/sha1/openssl.c +3 -3
- data/vendor/libgit2/src/hash/sha1/sha1dc/sha1.c +0 -2
- data/vendor/libgit2/src/hash/sha1/win32.c +15 -11
- data/vendor/libgit2/src/hash.c +16 -13
- data/vendor/libgit2/src/hash.h +1 -1
- data/vendor/libgit2/src/hashsig.c +23 -10
- data/vendor/libgit2/src/ident.c +13 -3
- data/vendor/libgit2/src/idxmap.c +0 -22
- data/vendor/libgit2/src/ignore.c +35 -19
- data/vendor/libgit2/src/index.c +126 -84
- data/vendor/libgit2/src/index.h +1 -1
- data/vendor/libgit2/src/indexer.c +60 -36
- data/vendor/libgit2/src/integer.h +79 -2
- data/vendor/libgit2/src/iterator.c +40 -28
- data/vendor/libgit2/src/iterator.h +1 -1
- data/vendor/libgit2/src/khash.h +2 -11
- data/vendor/libgit2/src/{settings.c → libgit2.c} +125 -49
- data/vendor/libgit2/src/libgit2.h +15 -0
- data/vendor/libgit2/src/mailmap.c +23 -10
- data/vendor/libgit2/src/map.h +3 -3
- data/vendor/libgit2/src/merge.c +108 -46
- data/vendor/libgit2/src/merge.h +2 -1
- data/vendor/libgit2/src/merge_driver.c +19 -13
- data/vendor/libgit2/src/merge_file.c +15 -9
- data/vendor/libgit2/src/message.c +3 -1
- data/vendor/libgit2/src/midx.c +879 -0
- data/vendor/libgit2/src/midx.h +110 -0
- data/vendor/libgit2/src/mwindow.c +214 -95
- data/vendor/libgit2/src/mwindow.h +3 -3
- data/vendor/libgit2/src/net.c +133 -4
- data/vendor/libgit2/src/net.h +16 -2
- data/vendor/libgit2/src/netops.c +6 -4
- data/vendor/libgit2/src/netops.h +2 -2
- data/vendor/libgit2/src/notes.c +10 -10
- data/vendor/libgit2/src/object.c +24 -15
- data/vendor/libgit2/src/odb.c +298 -57
- data/vendor/libgit2/src/odb.h +16 -2
- data/vendor/libgit2/src/odb_loose.c +31 -21
- data/vendor/libgit2/src/odb_mempack.c +3 -1
- data/vendor/libgit2/src/odb_pack.c +391 -114
- data/vendor/libgit2/src/oid.c +7 -4
- data/vendor/libgit2/src/pack-objects.c +83 -69
- data/vendor/libgit2/src/pack.c +383 -150
- data/vendor/libgit2/src/pack.h +44 -9
- data/vendor/libgit2/src/patch.c +14 -7
- data/vendor/libgit2/src/patch_generate.c +3 -5
- data/vendor/libgit2/src/patch_parse.c +6 -3
- data/vendor/libgit2/src/path.c +102 -57
- data/vendor/libgit2/src/path.h +79 -6
- data/vendor/libgit2/src/pathspec.c +12 -11
- data/vendor/libgit2/src/pool.c +34 -22
- data/vendor/libgit2/src/pool.h +9 -1
- data/vendor/libgit2/src/posix.c +43 -12
- data/vendor/libgit2/src/posix.h +9 -0
- data/vendor/libgit2/src/proxy.c +2 -0
- data/vendor/libgit2/src/push.c +2 -0
- data/vendor/libgit2/src/reader.c +10 -6
- data/vendor/libgit2/src/rebase.c +95 -49
- data/vendor/libgit2/src/refdb.c +165 -13
- data/vendor/libgit2/src/refdb.h +69 -0
- data/vendor/libgit2/src/refdb_fs.c +144 -152
- data/vendor/libgit2/src/reflog.c +21 -20
- data/vendor/libgit2/src/refs.c +151 -231
- data/vendor/libgit2/src/refs.h +2 -20
- data/vendor/libgit2/src/refspec.c +80 -44
- data/vendor/libgit2/src/regexp.c +2 -2
- data/vendor/libgit2/src/remote.c +312 -121
- data/vendor/libgit2/src/remote.h +2 -1
- data/vendor/libgit2/src/repository.c +351 -189
- data/vendor/libgit2/src/repository.h +23 -29
- data/vendor/libgit2/src/reset.c +7 -6
- data/vendor/libgit2/src/revert.c +8 -2
- data/vendor/libgit2/src/revparse.c +19 -13
- data/vendor/libgit2/src/revwalk.c +35 -20
- data/vendor/libgit2/src/runtime.c +162 -0
- data/vendor/libgit2/src/runtime.h +62 -0
- data/vendor/libgit2/src/{refdb_fs.h → settings.h} +3 -11
- data/vendor/libgit2/src/signature.c +6 -5
- data/vendor/libgit2/src/sortedcache.c +2 -3
- data/vendor/libgit2/src/sortedcache.h +10 -8
- data/vendor/libgit2/src/stash.c +7 -3
- data/vendor/libgit2/src/status.c +9 -4
- data/vendor/libgit2/src/strarray.c +64 -0
- data/vendor/libgit2/src/streams/mbedtls.c +14 -17
- data/vendor/libgit2/src/streams/mbedtls.h +1 -1
- data/vendor/libgit2/src/streams/openssl.c +113 -207
- 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 +10 -9
- 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 +134 -66
- data/vendor/libgit2/src/submodule.h +9 -9
- data/vendor/libgit2/src/sysdir.c +8 -26
- data/vendor/libgit2/src/sysdir.h +0 -11
- data/vendor/libgit2/src/tag.c +49 -11
- data/vendor/libgit2/src/thread.c +140 -0
- data/vendor/libgit2/src/thread.h +479 -0
- data/vendor/libgit2/src/threadstate.c +83 -0
- data/vendor/libgit2/src/threadstate.h +24 -0
- data/vendor/libgit2/src/trace.c +2 -2
- data/vendor/libgit2/src/trace.h +17 -13
- data/vendor/libgit2/src/transaction.c +21 -9
- data/vendor/libgit2/src/transport.c +3 -3
- data/vendor/libgit2/src/transports/auth.c +1 -1
- data/vendor/libgit2/src/transports/auth_negotiate.c +11 -4
- data/vendor/libgit2/src/transports/auth_ntlm.c +10 -6
- data/vendor/libgit2/src/transports/credential.c +17 -7
- data/vendor/libgit2/src/transports/credential_helpers.c +2 -0
- data/vendor/libgit2/src/transports/git.c +1 -3
- data/vendor/libgit2/src/transports/http.c +19 -17
- data/vendor/libgit2/src/transports/http.h +1 -0
- data/vendor/libgit2/src/transports/httpclient.c +84 -42
- data/vendor/libgit2/src/transports/httpclient.h +1 -1
- data/vendor/libgit2/src/transports/local.c +5 -5
- data/vendor/libgit2/src/transports/smart.c +14 -9
- data/vendor/libgit2/src/transports/smart.h +1 -1
- data/vendor/libgit2/src/transports/smart_protocol.c +11 -5
- data/vendor/libgit2/src/transports/ssh.c +51 -17
- data/vendor/libgit2/src/transports/winhttp.c +156 -88
- data/vendor/libgit2/src/tree.c +100 -77
- data/vendor/libgit2/src/tree.h +1 -0
- data/vendor/libgit2/src/tsort.c +0 -2
- data/vendor/libgit2/src/unix/map.c +3 -1
- data/vendor/libgit2/src/unix/posix.h +16 -1
- data/vendor/libgit2/src/unix/pthread.h +2 -1
- data/vendor/libgit2/src/utf8.c +150 -0
- data/vendor/libgit2/src/utf8.h +52 -0
- data/vendor/libgit2/src/util.c +74 -183
- data/vendor/libgit2/src/util.h +33 -39
- data/vendor/libgit2/src/vector.c +23 -19
- data/vendor/libgit2/src/vector.h +4 -2
- data/vendor/libgit2/src/win32/findfile.c +4 -2
- data/vendor/libgit2/src/win32/git2.rc +18 -3
- 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 +23 -25
- data/vendor/libgit2/src/win32/path_w32.h +0 -1
- data/vendor/libgit2/src/win32/posix_w32.c +77 -1
- data/vendor/libgit2/src/win32/precompiled.h +0 -1
- data/vendor/libgit2/src/win32/reparse.h +4 -4
- data/vendor/libgit2/src/win32/thread.c +24 -15
- data/vendor/libgit2/src/win32/thread.h +1 -1
- data/vendor/libgit2/src/win32/w32_buffer.c +3 -3
- data/vendor/libgit2/src/win32/w32_common.h +18 -9
- data/vendor/libgit2/src/win32/{w32_crtdbg_stacktrace.c → w32_leakcheck.c} +269 -33
- data/vendor/libgit2/src/win32/w32_leakcheck.h +222 -0
- data/vendor/libgit2/src/win32/w32_util.h +6 -6
- data/vendor/libgit2/src/worktree.c +37 -15
- data/vendor/libgit2/src/zstream.c +1 -1
- metadata +56 -38
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.c.in +0 -29
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.cmake +0 -96
- data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
- data/vendor/libgit2/src/buf_text.c +0 -316
- data/vendor/libgit2/src/buf_text.h +0 -122
- data/vendor/libgit2/src/global.c +0 -361
- 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 -246
- 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/proxy.c
CHANGED
@@ -16,10 +16,12 @@ int git_proxy_options_init(git_proxy_options *opts, unsigned int version)
|
|
16
16
|
return 0;
|
17
17
|
}
|
18
18
|
|
19
|
+
#ifndef GIT_DEPRECATE_HARD
|
19
20
|
int git_proxy_init_options(git_proxy_options *opts, unsigned int version)
|
20
21
|
{
|
21
22
|
return git_proxy_options_init(opts, version);
|
22
23
|
}
|
24
|
+
#endif
|
23
25
|
|
24
26
|
int git_proxy_options_dup(git_proxy_options *tgt, const git_proxy_options *src)
|
25
27
|
{
|
data/vendor/libgit2/src/push.c
CHANGED
@@ -555,7 +555,9 @@ int git_push_options_init(git_push_options *opts, unsigned int version)
|
|
555
555
|
return 0;
|
556
556
|
}
|
557
557
|
|
558
|
+
#ifndef GIT_DEPRECATE_HARD
|
558
559
|
int git_push_init_options(git_push_options *opts, unsigned int version)
|
559
560
|
{
|
560
561
|
return git_push_options_init(opts, version);
|
561
562
|
}
|
563
|
+
#endif
|
data/vendor/libgit2/src/reader.c
CHANGED
@@ -61,7 +61,8 @@ int git_reader_for_tree(git_reader **out, git_tree *tree)
|
|
61
61
|
{
|
62
62
|
tree_reader *reader;
|
63
63
|
|
64
|
-
|
64
|
+
GIT_ASSERT_ARG(out);
|
65
|
+
GIT_ASSERT_ARG(tree);
|
65
66
|
|
66
67
|
reader = git__calloc(1, sizeof(tree_reader));
|
67
68
|
GIT_ERROR_CHECK_ALLOC(reader);
|
@@ -97,8 +98,7 @@ static int workdir_reader_read(
|
|
97
98
|
git_oid id;
|
98
99
|
int error;
|
99
100
|
|
100
|
-
if ((error =
|
101
|
-
git_repository_workdir(reader->repo), filename)) < 0)
|
101
|
+
if ((error = git_repository_workdir_path(&path, reader->repo, filename)) < 0)
|
102
102
|
goto done;
|
103
103
|
|
104
104
|
if ((error = p_lstat(path.ptr, &st)) < 0) {
|
@@ -158,7 +158,8 @@ int git_reader_for_workdir(
|
|
158
158
|
workdir_reader *reader;
|
159
159
|
int error;
|
160
160
|
|
161
|
-
|
161
|
+
GIT_ASSERT_ARG(out);
|
162
|
+
GIT_ASSERT_ARG(repo);
|
162
163
|
|
163
164
|
reader = git__calloc(1, sizeof(workdir_reader));
|
164
165
|
GIT_ERROR_CHECK_ALLOC(reader);
|
@@ -223,7 +224,8 @@ int git_reader_for_index(
|
|
223
224
|
index_reader *reader;
|
224
225
|
int error;
|
225
226
|
|
226
|
-
|
227
|
+
GIT_ASSERT_ARG(out);
|
228
|
+
GIT_ASSERT_ARG(repo);
|
227
229
|
|
228
230
|
reader = git__calloc(1, sizeof(index_reader));
|
229
231
|
GIT_ERROR_CHECK_ALLOC(reader);
|
@@ -251,7 +253,9 @@ int git_reader_read(
|
|
251
253
|
git_reader *reader,
|
252
254
|
const char *filename)
|
253
255
|
{
|
254
|
-
|
256
|
+
GIT_ASSERT_ARG(out);
|
257
|
+
GIT_ASSERT_ARG(reader);
|
258
|
+
GIT_ASSERT_ARG(filename);
|
255
259
|
|
256
260
|
return reader->read(out, out_id, out_filemode, reader, filename);
|
257
261
|
}
|
data/vendor/libgit2/src/rebase.c
CHANGED
@@ -186,8 +186,8 @@ static git_rebase_operation *rebase_operation_alloc(
|
|
186
186
|
{
|
187
187
|
git_rebase_operation *operation;
|
188
188
|
|
189
|
-
|
190
|
-
|
189
|
+
GIT_ASSERT_WITH_RETVAL((type == GIT_REBASE_OPERATION_EXEC) == !id, NULL);
|
190
|
+
GIT_ASSERT_WITH_RETVAL((type == GIT_REBASE_OPERATION_EXEC) == !!exec, NULL);
|
191
191
|
|
192
192
|
if ((operation = git_array_alloc(rebase->operations)) == NULL)
|
193
193
|
return NULL;
|
@@ -301,7 +301,7 @@ int git_rebase_open(
|
|
301
301
|
size_t state_path_len;
|
302
302
|
int error;
|
303
303
|
|
304
|
-
|
304
|
+
GIT_ASSERT_ARG(repo);
|
305
305
|
|
306
306
|
if ((error = rebase_check_versions(given_opts)) < 0)
|
307
307
|
return error;
|
@@ -501,10 +501,12 @@ int git_rebase_options_init(git_rebase_options *opts, unsigned int version)
|
|
501
501
|
return 0;
|
502
502
|
}
|
503
503
|
|
504
|
+
#ifndef GIT_DEPRECATE_HARD
|
504
505
|
int git_rebase_init_options(git_rebase_options *opts, unsigned int version)
|
505
506
|
{
|
506
507
|
return git_rebase_options_init(opts, version);
|
507
508
|
}
|
509
|
+
#endif
|
508
510
|
|
509
511
|
static int rebase_ensure_not_in_progress(git_repository *repo)
|
510
512
|
{
|
@@ -699,7 +701,8 @@ int git_rebase_init(
|
|
699
701
|
bool inmemory = (given_opts && given_opts->inmemory);
|
700
702
|
int error;
|
701
703
|
|
702
|
-
|
704
|
+
GIT_ASSERT_ARG(repo);
|
705
|
+
GIT_ASSERT_ARG(upstream || onto);
|
703
706
|
|
704
707
|
*out = NULL;
|
705
708
|
|
@@ -910,7 +913,8 @@ int git_rebase_next(
|
|
910
913
|
{
|
911
914
|
int error;
|
912
915
|
|
913
|
-
|
916
|
+
GIT_ASSERT_ARG(out);
|
917
|
+
GIT_ASSERT_ARG(rebase);
|
914
918
|
|
915
919
|
if ((error = rebase_movenext(rebase)) < 0)
|
916
920
|
return error;
|
@@ -929,7 +933,9 @@ int git_rebase_inmemory_index(
|
|
929
933
|
git_index **out,
|
930
934
|
git_rebase *rebase)
|
931
935
|
{
|
932
|
-
|
936
|
+
GIT_ASSERT_ARG(out);
|
937
|
+
GIT_ASSERT_ARG(rebase);
|
938
|
+
GIT_ASSERT_ARG(rebase->index);
|
933
939
|
|
934
940
|
GIT_REFCOUNT_INC(rebase->index);
|
935
941
|
*out = rebase->index;
|
@@ -937,6 +943,54 @@ int git_rebase_inmemory_index(
|
|
937
943
|
return 0;
|
938
944
|
}
|
939
945
|
|
946
|
+
#ifndef GIT_DEPRECATE_HARD
|
947
|
+
static int create_signed(
|
948
|
+
git_oid *out,
|
949
|
+
git_rebase *rebase,
|
950
|
+
const git_signature *author,
|
951
|
+
const git_signature *committer,
|
952
|
+
const char *message_encoding,
|
953
|
+
const char *message,
|
954
|
+
git_tree *tree,
|
955
|
+
size_t parent_count,
|
956
|
+
const git_commit **parents)
|
957
|
+
{
|
958
|
+
git_buf commit_content = GIT_BUF_INIT,
|
959
|
+
commit_signature = GIT_BUF_INIT,
|
960
|
+
signature_field = GIT_BUF_INIT;
|
961
|
+
int error;
|
962
|
+
|
963
|
+
git_error_clear();
|
964
|
+
|
965
|
+
if ((error = git_commit_create_buffer(&commit_content,
|
966
|
+
rebase->repo, author, committer, message_encoding,
|
967
|
+
message, tree, parent_count, parents)) < 0)
|
968
|
+
goto done;
|
969
|
+
|
970
|
+
error = rebase->options.signing_cb(&commit_signature,
|
971
|
+
&signature_field, commit_content.ptr,
|
972
|
+
rebase->options.payload);
|
973
|
+
|
974
|
+
if (error) {
|
975
|
+
if (error != GIT_PASSTHROUGH)
|
976
|
+
git_error_set_after_callback_function(error, "signing_cb");
|
977
|
+
|
978
|
+
goto done;
|
979
|
+
}
|
980
|
+
|
981
|
+
error = git_commit_create_with_signature(out, rebase->repo,
|
982
|
+
commit_content.ptr,
|
983
|
+
commit_signature.size > 0 ? commit_signature.ptr : NULL,
|
984
|
+
signature_field.size > 0 ? signature_field.ptr : NULL);
|
985
|
+
|
986
|
+
done:
|
987
|
+
git_buf_dispose(&commit_signature);
|
988
|
+
git_buf_dispose(&signature_field);
|
989
|
+
git_buf_dispose(&commit_content);
|
990
|
+
return error;
|
991
|
+
}
|
992
|
+
#endif
|
993
|
+
|
940
994
|
static int rebase_commit__create(
|
941
995
|
git_commit **out,
|
942
996
|
git_rebase *rebase,
|
@@ -951,10 +1005,6 @@ static int rebase_commit__create(
|
|
951
1005
|
git_commit *current_commit = NULL, *commit = NULL;
|
952
1006
|
git_tree *parent_tree = NULL, *tree = NULL;
|
953
1007
|
git_oid tree_id, commit_id;
|
954
|
-
git_buf commit_content = GIT_BUF_INIT, commit_signature = GIT_BUF_INIT,
|
955
|
-
signature_field = GIT_BUF_INIT;
|
956
|
-
const char *signature_field_string = NULL,
|
957
|
-
*commit_signature_string = NULL;
|
958
1008
|
int error;
|
959
1009
|
|
960
1010
|
operation = git_array_get(rebase->operations, rebase->current);
|
@@ -985,37 +1035,32 @@ static int rebase_commit__create(
|
|
985
1035
|
message = git_commit_message(current_commit);
|
986
1036
|
}
|
987
1037
|
|
988
|
-
|
989
|
-
|
990
|
-
goto done;
|
1038
|
+
git_error_clear();
|
1039
|
+
error = GIT_PASSTHROUGH;
|
991
1040
|
|
992
|
-
if (rebase->options.
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
rebase->options.payload)
|
997
|
-
if (error == GIT_PASSTHROUGH) {
|
998
|
-
git_buf_dispose(&commit_signature);
|
999
|
-
git_buf_dispose(&signature_field);
|
1000
|
-
git_error_clear();
|
1001
|
-
error = GIT_OK;
|
1002
|
-
} else if (error < 0)
|
1003
|
-
goto done;
|
1004
|
-
}
|
1041
|
+
if (rebase->options.commit_create_cb) {
|
1042
|
+
error = rebase->options.commit_create_cb(&commit_id,
|
1043
|
+
author, committer, message_encoding, message,
|
1044
|
+
tree, 1, (const git_commit **)&parent_commit,
|
1045
|
+
rebase->options.payload);
|
1005
1046
|
|
1006
|
-
|
1007
|
-
|
1008
|
-
commit_signature_string = git_buf_cstr(&commit_signature);
|
1047
|
+
git_error_set_after_callback_function(error,
|
1048
|
+
"commit_create_cb");
|
1009
1049
|
}
|
1010
|
-
|
1011
|
-
if (
|
1012
|
-
|
1013
|
-
|
1050
|
+
#ifndef GIT_DEPRECATE_HARD
|
1051
|
+
else if (rebase->options.signing_cb) {
|
1052
|
+
error = create_signed(&commit_id, rebase, author,
|
1053
|
+
committer, message_encoding, message, tree,
|
1054
|
+
1, (const git_commit **)&parent_commit);
|
1014
1055
|
}
|
1056
|
+
#endif
|
1015
1057
|
|
1016
|
-
if (
|
1017
|
-
|
1018
|
-
|
1058
|
+
if (error == GIT_PASSTHROUGH)
|
1059
|
+
error = git_commit_create(&commit_id, rebase->repo, NULL,
|
1060
|
+
author, committer, message_encoding, message,
|
1061
|
+
tree, 1, (const git_commit **)&parent_commit);
|
1062
|
+
|
1063
|
+
if (error)
|
1019
1064
|
goto done;
|
1020
1065
|
|
1021
1066
|
if ((error = git_commit_lookup(&commit, rebase->repo, &commit_id)) < 0)
|
@@ -1027,9 +1072,6 @@ done:
|
|
1027
1072
|
if (error < 0)
|
1028
1073
|
git_commit_free(commit);
|
1029
1074
|
|
1030
|
-
git_buf_dispose(&commit_signature);
|
1031
|
-
git_buf_dispose(&signature_field);
|
1032
|
-
git_buf_dispose(&commit_content);
|
1033
1075
|
git_commit_free(current_commit);
|
1034
1076
|
git_tree_free(parent_tree);
|
1035
1077
|
git_tree_free(tree);
|
@@ -1053,7 +1095,7 @@ static int rebase_commit_merge(
|
|
1053
1095
|
int error;
|
1054
1096
|
|
1055
1097
|
operation = git_array_get(rebase->operations, rebase->current);
|
1056
|
-
|
1098
|
+
GIT_ASSERT(operation);
|
1057
1099
|
|
1058
1100
|
if ((error = rebase_ensure_not_dirty(rebase->repo, false, true, GIT_EUNMERGED)) < 0 ||
|
1059
1101
|
(error = git_repository_head(&head, rebase->repo)) < 0 ||
|
@@ -1093,9 +1135,9 @@ static int rebase_commit_inmemory(
|
|
1093
1135
|
git_commit *commit = NULL;
|
1094
1136
|
int error = 0;
|
1095
1137
|
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1138
|
+
GIT_ASSERT_ARG(rebase->index);
|
1139
|
+
GIT_ASSERT_ARG(rebase->last_commit);
|
1140
|
+
GIT_ASSERT_ARG(rebase->current < rebase->operations.size);
|
1099
1141
|
|
1100
1142
|
if ((error = rebase_commit__create(&commit, rebase, rebase->index,
|
1101
1143
|
rebase->last_commit, author, committer, message_encoding, message)) < 0)
|
@@ -1123,7 +1165,8 @@ int git_rebase_commit(
|
|
1123
1165
|
{
|
1124
1166
|
int error;
|
1125
1167
|
|
1126
|
-
|
1168
|
+
GIT_ASSERT_ARG(rebase);
|
1169
|
+
GIT_ASSERT_ARG(committer);
|
1127
1170
|
|
1128
1171
|
if (rebase->inmemory)
|
1129
1172
|
error = rebase_commit_inmemory(
|
@@ -1143,7 +1186,7 @@ int git_rebase_abort(git_rebase *rebase)
|
|
1143
1186
|
git_commit *orig_head_commit = NULL;
|
1144
1187
|
int error;
|
1145
1188
|
|
1146
|
-
|
1189
|
+
GIT_ASSERT_ARG(rebase);
|
1147
1190
|
|
1148
1191
|
if (rebase->inmemory)
|
1149
1192
|
return 0;
|
@@ -1356,7 +1399,7 @@ int git_rebase_finish(
|
|
1356
1399
|
{
|
1357
1400
|
int error = 0;
|
1358
1401
|
|
1359
|
-
|
1402
|
+
GIT_ASSERT_ARG(rebase);
|
1360
1403
|
|
1361
1404
|
if (rebase->inmemory)
|
1362
1405
|
return 0;
|
@@ -1371,14 +1414,17 @@ int git_rebase_finish(
|
|
1371
1414
|
}
|
1372
1415
|
|
1373
1416
|
const char *git_rebase_orig_head_name(git_rebase *rebase) {
|
1417
|
+
GIT_ASSERT_ARG_WITH_RETVAL(rebase, NULL);
|
1374
1418
|
return rebase->orig_head_name;
|
1375
1419
|
}
|
1376
1420
|
|
1377
1421
|
const git_oid *git_rebase_orig_head_id(git_rebase *rebase) {
|
1422
|
+
GIT_ASSERT_ARG_WITH_RETVAL(rebase, NULL);
|
1378
1423
|
return &rebase->orig_head_id;
|
1379
1424
|
}
|
1380
1425
|
|
1381
1426
|
const char *git_rebase_onto_name(git_rebase *rebase) {
|
1427
|
+
GIT_ASSERT_ARG_WITH_RETVAL(rebase, NULL);
|
1382
1428
|
return rebase->onto_name;
|
1383
1429
|
}
|
1384
1430
|
|
@@ -1388,21 +1434,21 @@ const git_oid *git_rebase_onto_id(git_rebase *rebase) {
|
|
1388
1434
|
|
1389
1435
|
size_t git_rebase_operation_entrycount(git_rebase *rebase)
|
1390
1436
|
{
|
1391
|
-
|
1437
|
+
GIT_ASSERT_ARG_WITH_RETVAL(rebase, 0);
|
1392
1438
|
|
1393
1439
|
return git_array_size(rebase->operations);
|
1394
1440
|
}
|
1395
1441
|
|
1396
1442
|
size_t git_rebase_operation_current(git_rebase *rebase)
|
1397
1443
|
{
|
1398
|
-
|
1444
|
+
GIT_ASSERT_ARG_WITH_RETVAL(rebase, 0);
|
1399
1445
|
|
1400
1446
|
return rebase->started ? rebase->current : GIT_REBASE_NO_OPERATION;
|
1401
1447
|
}
|
1402
1448
|
|
1403
1449
|
git_rebase_operation *git_rebase_operation_byindex(git_rebase *rebase, size_t idx)
|
1404
1450
|
{
|
1405
|
-
|
1451
|
+
GIT_ASSERT_ARG_WITH_RETVAL(rebase, NULL);
|
1406
1452
|
|
1407
1453
|
return git_array_get(rebase->operations, idx);
|
1408
1454
|
}
|
data/vendor/libgit2/src/refdb.c
CHANGED
@@ -17,11 +17,15 @@
|
|
17
17
|
#include "reflog.h"
|
18
18
|
#include "posix.h"
|
19
19
|
|
20
|
+
#define DEFAULT_NESTING_LEVEL 5
|
21
|
+
#define MAX_NESTING_LEVEL 10
|
22
|
+
|
20
23
|
int git_refdb_new(git_refdb **out, git_repository *repo)
|
21
24
|
{
|
22
25
|
git_refdb *db;
|
23
26
|
|
24
|
-
|
27
|
+
GIT_ASSERT_ARG(out);
|
28
|
+
GIT_ASSERT_ARG(repo);
|
25
29
|
|
26
30
|
db = git__calloc(1, sizeof(*db));
|
27
31
|
GIT_ERROR_CHECK_ALLOC(db);
|
@@ -38,7 +42,8 @@ int git_refdb_open(git_refdb **out, git_repository *repo)
|
|
38
42
|
git_refdb *db;
|
39
43
|
git_refdb_backend *dir;
|
40
44
|
|
41
|
-
|
45
|
+
GIT_ASSERT_ARG(out);
|
46
|
+
GIT_ASSERT_ARG(repo);
|
42
47
|
|
43
48
|
*out = NULL;
|
44
49
|
|
@@ -86,7 +91,7 @@ int git_refdb_set_backend(git_refdb *db, git_refdb_backend *backend)
|
|
86
91
|
|
87
92
|
int git_refdb_compress(git_refdb *db)
|
88
93
|
{
|
89
|
-
|
94
|
+
GIT_ASSERT_ARG(db);
|
90
95
|
|
91
96
|
if (db->backend->compress)
|
92
97
|
return db->backend->compress(db->backend);
|
@@ -111,7 +116,9 @@ void git_refdb_free(git_refdb *db)
|
|
111
116
|
|
112
117
|
int git_refdb_exists(int *exists, git_refdb *refdb, const char *ref_name)
|
113
118
|
{
|
114
|
-
|
119
|
+
GIT_ASSERT_ARG(exists);
|
120
|
+
GIT_ASSERT_ARG(refdb);
|
121
|
+
GIT_ASSERT_ARG(refdb->backend);
|
115
122
|
|
116
123
|
return refdb->backend->exists(exists, refdb->backend, ref_name);
|
117
124
|
}
|
@@ -121,7 +128,10 @@ int git_refdb_lookup(git_reference **out, git_refdb *db, const char *ref_name)
|
|
121
128
|
git_reference *ref;
|
122
129
|
int error;
|
123
130
|
|
124
|
-
|
131
|
+
GIT_ASSERT_ARG(db);
|
132
|
+
GIT_ASSERT_ARG(db->backend);
|
133
|
+
GIT_ASSERT_ARG(out);
|
134
|
+
GIT_ASSERT_ARG(ref_name);
|
125
135
|
|
126
136
|
error = db->backend->lookup(&ref, db->backend, ref_name);
|
127
137
|
if (error < 0)
|
@@ -134,6 +144,59 @@ int git_refdb_lookup(git_reference **out, git_refdb *db, const char *ref_name)
|
|
134
144
|
return 0;
|
135
145
|
}
|
136
146
|
|
147
|
+
int git_refdb_resolve(
|
148
|
+
git_reference **out,
|
149
|
+
git_refdb *db,
|
150
|
+
const char *ref_name,
|
151
|
+
int max_nesting)
|
152
|
+
{
|
153
|
+
git_reference *ref = NULL;
|
154
|
+
int error = 0, nesting;
|
155
|
+
|
156
|
+
*out = NULL;
|
157
|
+
|
158
|
+
if (max_nesting > MAX_NESTING_LEVEL)
|
159
|
+
max_nesting = MAX_NESTING_LEVEL;
|
160
|
+
else if (max_nesting < 0)
|
161
|
+
max_nesting = DEFAULT_NESTING_LEVEL;
|
162
|
+
|
163
|
+
if ((error = git_refdb_lookup(&ref, db, ref_name)) < 0)
|
164
|
+
goto out;
|
165
|
+
|
166
|
+
for (nesting = 0; nesting < max_nesting; nesting++) {
|
167
|
+
git_reference *resolved;
|
168
|
+
|
169
|
+
if (ref->type == GIT_REFERENCE_DIRECT)
|
170
|
+
break;
|
171
|
+
|
172
|
+
if ((error = git_refdb_lookup(&resolved, db, git_reference_symbolic_target(ref))) < 0) {
|
173
|
+
/* If we found a symbolic reference with a nonexistent target, return it. */
|
174
|
+
if (error == GIT_ENOTFOUND) {
|
175
|
+
error = 0;
|
176
|
+
*out = ref;
|
177
|
+
ref = NULL;
|
178
|
+
}
|
179
|
+
goto out;
|
180
|
+
}
|
181
|
+
|
182
|
+
git_reference_free(ref);
|
183
|
+
ref = resolved;
|
184
|
+
}
|
185
|
+
|
186
|
+
if (ref->type != GIT_REFERENCE_DIRECT && max_nesting != 0) {
|
187
|
+
git_error_set(GIT_ERROR_REFERENCE,
|
188
|
+
"cannot resolve reference (>%u levels deep)", max_nesting);
|
189
|
+
error = -1;
|
190
|
+
goto out;
|
191
|
+
}
|
192
|
+
|
193
|
+
*out = ref;
|
194
|
+
ref = NULL;
|
195
|
+
out:
|
196
|
+
git_reference_free(ref);
|
197
|
+
return error;
|
198
|
+
}
|
199
|
+
|
137
200
|
int git_refdb_iterator(git_reference_iterator **out, git_refdb *db, const char *glob)
|
138
201
|
{
|
139
202
|
int error;
|
@@ -178,7 +241,8 @@ void git_refdb_iterator_free(git_reference_iterator *iter)
|
|
178
241
|
|
179
242
|
int git_refdb_write(git_refdb *db, git_reference *ref, int force, const git_signature *who, const char *message, const git_oid *old_id, const char *old_target)
|
180
243
|
{
|
181
|
-
|
244
|
+
GIT_ASSERT_ARG(db);
|
245
|
+
GIT_ASSERT_ARG(db->backend);
|
182
246
|
|
183
247
|
GIT_REFCOUNT_INC(db);
|
184
248
|
ref->db = db;
|
@@ -197,7 +261,9 @@ int git_refdb_rename(
|
|
197
261
|
{
|
198
262
|
int error;
|
199
263
|
|
200
|
-
|
264
|
+
GIT_ASSERT_ARG(db);
|
265
|
+
GIT_ASSERT_ARG(db->backend);
|
266
|
+
|
201
267
|
error = db->backend->rename(out, db->backend, old_name, new_name, force, who, message);
|
202
268
|
if (error < 0)
|
203
269
|
return error;
|
@@ -212,7 +278,9 @@ int git_refdb_rename(
|
|
212
278
|
|
213
279
|
int git_refdb_delete(struct git_refdb *db, const char *ref_name, const git_oid *old_id, const char *old_target)
|
214
280
|
{
|
215
|
-
|
281
|
+
GIT_ASSERT_ARG(db);
|
282
|
+
GIT_ASSERT_ARG(db->backend);
|
283
|
+
|
216
284
|
return db->backend->del(db->backend, ref_name, old_id, old_target);
|
217
285
|
}
|
218
286
|
|
@@ -220,7 +288,8 @@ int git_refdb_reflog_read(git_reflog **out, git_refdb *db, const char *name)
|
|
220
288
|
{
|
221
289
|
int error;
|
222
290
|
|
223
|
-
|
291
|
+
GIT_ASSERT_ARG(db);
|
292
|
+
GIT_ASSERT_ARG(db->backend);
|
224
293
|
|
225
294
|
if ((error = db->backend->reflog_read(out, db->backend, name)) < 0)
|
226
295
|
return error;
|
@@ -231,16 +300,97 @@ int git_refdb_reflog_read(git_reflog **out, git_refdb *db, const char *name)
|
|
231
300
|
return 0;
|
232
301
|
}
|
233
302
|
|
303
|
+
int git_refdb_should_write_reflog(int *out, git_refdb *db, const git_reference *ref)
|
304
|
+
{
|
305
|
+
int error, logall;
|
306
|
+
|
307
|
+
error = git_repository__configmap_lookup(&logall, db->repo, GIT_CONFIGMAP_LOGALLREFUPDATES);
|
308
|
+
if (error < 0)
|
309
|
+
return error;
|
310
|
+
|
311
|
+
/* Defaults to the opposite of the repo being bare */
|
312
|
+
if (logall == GIT_LOGALLREFUPDATES_UNSET)
|
313
|
+
logall = !git_repository_is_bare(db->repo);
|
314
|
+
|
315
|
+
*out = 0;
|
316
|
+
switch (logall) {
|
317
|
+
case GIT_LOGALLREFUPDATES_FALSE:
|
318
|
+
*out = 0;
|
319
|
+
break;
|
320
|
+
|
321
|
+
case GIT_LOGALLREFUPDATES_TRUE:
|
322
|
+
/* Only write if it already has a log,
|
323
|
+
* or if it's under heads/, remotes/ or notes/
|
324
|
+
*/
|
325
|
+
*out = git_refdb_has_log(db, ref->name) ||
|
326
|
+
!git__prefixcmp(ref->name, GIT_REFS_HEADS_DIR) ||
|
327
|
+
!git__strcmp(ref->name, GIT_HEAD_FILE) ||
|
328
|
+
!git__prefixcmp(ref->name, GIT_REFS_REMOTES_DIR) ||
|
329
|
+
!git__prefixcmp(ref->name, GIT_REFS_NOTES_DIR);
|
330
|
+
break;
|
331
|
+
|
332
|
+
case GIT_LOGALLREFUPDATES_ALWAYS:
|
333
|
+
*out = 1;
|
334
|
+
break;
|
335
|
+
}
|
336
|
+
|
337
|
+
return 0;
|
338
|
+
}
|
339
|
+
|
340
|
+
int git_refdb_should_write_head_reflog(int *out, git_refdb *db, const git_reference *ref)
|
341
|
+
{
|
342
|
+
git_reference *head = NULL, *resolved = NULL;
|
343
|
+
const char *name;
|
344
|
+
int error;
|
345
|
+
|
346
|
+
*out = 0;
|
347
|
+
|
348
|
+
if (ref->type == GIT_REFERENCE_SYMBOLIC) {
|
349
|
+
error = 0;
|
350
|
+
goto out;
|
351
|
+
}
|
352
|
+
|
353
|
+
if ((error = git_refdb_lookup(&head, db, GIT_HEAD_FILE)) < 0)
|
354
|
+
goto out;
|
355
|
+
|
356
|
+
if (git_reference_type(head) == GIT_REFERENCE_DIRECT)
|
357
|
+
goto out;
|
358
|
+
|
359
|
+
/* Go down the symref chain until we find the branch */
|
360
|
+
if ((error = git_refdb_resolve(&resolved, db, git_reference_symbolic_target(head), -1)) < 0) {
|
361
|
+
if (error != GIT_ENOTFOUND)
|
362
|
+
goto out;
|
363
|
+
error = 0;
|
364
|
+
name = git_reference_symbolic_target(head);
|
365
|
+
} else if (git_reference_type(resolved) == GIT_REFERENCE_SYMBOLIC) {
|
366
|
+
name = git_reference_symbolic_target(resolved);
|
367
|
+
} else {
|
368
|
+
name = git_reference_name(resolved);
|
369
|
+
}
|
370
|
+
|
371
|
+
if (strcmp(name, ref->name))
|
372
|
+
goto out;
|
373
|
+
|
374
|
+
*out = 1;
|
375
|
+
|
376
|
+
out:
|
377
|
+
git_reference_free(resolved);
|
378
|
+
git_reference_free(head);
|
379
|
+
return error;
|
380
|
+
}
|
381
|
+
|
234
382
|
int git_refdb_has_log(git_refdb *db, const char *refname)
|
235
383
|
{
|
236
|
-
|
384
|
+
GIT_ASSERT_ARG(db);
|
385
|
+
GIT_ASSERT_ARG(refname);
|
237
386
|
|
238
387
|
return db->backend->has_log(db->backend, refname);
|
239
388
|
}
|
240
389
|
|
241
390
|
int git_refdb_ensure_log(git_refdb *db, const char *refname)
|
242
391
|
{
|
243
|
-
|
392
|
+
GIT_ASSERT_ARG(db);
|
393
|
+
GIT_ASSERT_ARG(refname);
|
244
394
|
|
245
395
|
return db->backend->ensure_log(db->backend, refname);
|
246
396
|
}
|
@@ -254,7 +404,9 @@ int git_refdb_init_backend(git_refdb_backend *backend, unsigned int version)
|
|
254
404
|
|
255
405
|
int git_refdb_lock(void **payload, git_refdb *db, const char *refname)
|
256
406
|
{
|
257
|
-
|
407
|
+
GIT_ASSERT_ARG(payload);
|
408
|
+
GIT_ASSERT_ARG(db);
|
409
|
+
GIT_ASSERT_ARG(refname);
|
258
410
|
|
259
411
|
if (!db->backend->lock) {
|
260
412
|
git_error_set(GIT_ERROR_REFERENCE, "backend does not support locking");
|
@@ -266,7 +418,7 @@ int git_refdb_lock(void **payload, git_refdb *db, const char *refname)
|
|
266
418
|
|
267
419
|
int git_refdb_unlock(git_refdb *db, void *payload, int success, int update_reflog, const git_reference *ref, const git_signature *sig, const char *message)
|
268
420
|
{
|
269
|
-
|
421
|
+
GIT_ASSERT_ARG(db);
|
270
422
|
|
271
423
|
return db->backend->unlock(db->backend, payload, success, update_reflog, ref, sig, message);
|
272
424
|
}
|