rugged 0.28.4.1 → 1.0.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 +17 -15
- 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 +1 -2
- 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/AUTHORS +1 -0
- data/vendor/libgit2/CMakeLists.txt +39 -19
- data/vendor/libgit2/COPYING +28 -0
- data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +5 -1
- data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +2 -2
- data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +1 -1
- data/vendor/libgit2/cmake/Modules/FindGSSFramework.cmake +28 -0
- data/vendor/libgit2/cmake/Modules/FindPCRE.cmake +38 -0
- data/vendor/libgit2/cmake/Modules/FindPCRE2.cmake +37 -0
- data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +2 -2
- data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +6 -0
- data/vendor/libgit2/cmake/Modules/PkgBuildConfig.cmake +77 -0
- data/vendor/libgit2/cmake/Modules/SanitizeBool.cmake +20 -0
- data/vendor/libgit2/cmake/Modules/SelectGSSAPI.cmake +56 -0
- data/vendor/libgit2/cmake/Modules/SelectHTTPSBackend.cmake +127 -0
- data/vendor/libgit2/cmake/Modules/SelectHashes.cmake +69 -0
- data/vendor/libgit2/deps/http-parser/http_parser.c +11 -6
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +23 -0
- data/vendor/libgit2/deps/ntlmclient/compat.h +55 -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 +1422 -0
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +174 -0
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +320 -0
- data/vendor/libgit2/deps/ntlmclient/unicode.h +36 -0
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +445 -0
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +201 -0
- data/vendor/libgit2/deps/ntlmclient/utf8.h +1257 -0
- data/vendor/libgit2/deps/ntlmclient/util.c +21 -0
- data/vendor/libgit2/deps/ntlmclient/util.h +14 -0
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +140 -0
- data/vendor/libgit2/deps/pcre/COPYING +5 -0
- data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +22 -0
- data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +17 -0
- data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +58 -0
- data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +29 -0
- data/vendor/libgit2/deps/pcre/config.h.in +57 -0
- data/vendor/libgit2/deps/pcre/pcre.h +641 -0
- data/vendor/libgit2/deps/pcre/pcre_byte_order.c +319 -0
- data/vendor/libgit2/deps/pcre/pcre_chartables.c +198 -0
- data/vendor/libgit2/deps/pcre/pcre_compile.c +9800 -0
- data/vendor/libgit2/deps/pcre/pcre_config.c +190 -0
- data/vendor/libgit2/deps/pcre/pcre_dfa_exec.c +3676 -0
- data/vendor/libgit2/deps/pcre/pcre_exec.c +7173 -0
- data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +245 -0
- data/vendor/libgit2/deps/pcre/pcre_get.c +669 -0
- data/vendor/libgit2/deps/pcre/pcre_globals.c +86 -0
- data/vendor/libgit2/deps/pcre/pcre_internal.h +2787 -0
- data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +11913 -0
- data/vendor/libgit2/deps/pcre/pcre_maketables.c +156 -0
- data/vendor/libgit2/deps/pcre/pcre_newline.c +210 -0
- data/vendor/libgit2/deps/pcre/pcre_ord2utf8.c +94 -0
- data/vendor/libgit2/deps/pcre/pcre_printint.c +834 -0
- data/vendor/libgit2/deps/pcre/pcre_refcount.c +92 -0
- data/vendor/libgit2/deps/pcre/pcre_string_utils.c +211 -0
- data/vendor/libgit2/deps/pcre/pcre_study.c +1686 -0
- data/vendor/libgit2/deps/pcre/pcre_tables.c +727 -0
- data/vendor/libgit2/deps/pcre/pcre_ucd.c +3644 -0
- data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +301 -0
- data/vendor/libgit2/deps/pcre/pcre_version.c +98 -0
- data/vendor/libgit2/deps/pcre/pcre_xclass.c +268 -0
- data/vendor/libgit2/deps/pcre/pcreposix.c +421 -0
- data/vendor/libgit2/deps/pcre/pcreposix.h +117 -0
- data/vendor/libgit2/deps/pcre/ucp.h +224 -0
- data/vendor/libgit2/deps/zlib/adler32.c +0 -7
- data/vendor/libgit2/deps/zlib/crc32.c +0 -7
- data/vendor/libgit2/include/git2.h +2 -0
- data/vendor/libgit2/include/git2/apply.h +22 -2
- data/vendor/libgit2/include/git2/attr.h +23 -13
- data/vendor/libgit2/include/git2/blame.h +2 -2
- data/vendor/libgit2/include/git2/blob.h +44 -12
- 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 +15 -6
- data/vendor/libgit2/include/git2/config.h +12 -12
- 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 +321 -3
- data/vendor/libgit2/include/git2/describe.h +4 -4
- data/vendor/libgit2/include/git2/diff.h +16 -14
- data/vendor/libgit2/include/git2/errors.h +4 -2
- data/vendor/libgit2/include/git2/filter.h +8 -0
- data/vendor/libgit2/include/git2/index.h +2 -1
- data/vendor/libgit2/include/git2/indexer.h +48 -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 +3 -2
- 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 +12 -1
- 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 +19 -0
- data/vendor/libgit2/include/git2/remote.h +40 -15
- data/vendor/libgit2/include/git2/repository.h +29 -6
- 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/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 +5 -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 +99 -236
- 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 +60 -30
- data/vendor/libgit2/src/attr.c +70 -64
- data/vendor/libgit2/src/attr_file.c +189 -96
- data/vendor/libgit2/src/attr_file.h +9 -9
- data/vendor/libgit2/src/attrcache.c +48 -48
- data/vendor/libgit2/src/attrcache.h +2 -1
- data/vendor/libgit2/src/blame.c +17 -5
- data/vendor/libgit2/src/blame.h +1 -1
- data/vendor/libgit2/src/blame_git.c +21 -7
- data/vendor/libgit2/src/blob.c +81 -17
- data/vendor/libgit2/src/blob.h +2 -2
- data/vendor/libgit2/src/branch.c +60 -32
- data/vendor/libgit2/src/buffer.c +19 -7
- data/vendor/libgit2/src/buffer.h +1 -0
- data/vendor/libgit2/src/cache.c +33 -36
- data/vendor/libgit2/src/cache.h +1 -1
- data/vendor/libgit2/src/cc-compat.h +5 -0
- data/vendor/libgit2/src/checkout.c +26 -16
- data/vendor/libgit2/src/cherrypick.c +9 -3
- data/vendor/libgit2/src/clone.c +29 -7
- 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 +3 -75
- data/vendor/libgit2/src/config.c +31 -40
- data/vendor/libgit2/src/config.h +7 -6
- data/vendor/libgit2/src/config_backend.h +12 -0
- data/vendor/libgit2/src/config_cache.c +39 -39
- data/vendor/libgit2/src/config_entries.c +69 -99
- 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 +49 -29
- data/vendor/libgit2/src/config_parse.h +13 -12
- data/vendor/libgit2/src/config_snapshot.c +206 -0
- data/vendor/libgit2/src/crlf.c +14 -14
- data/vendor/libgit2/src/describe.c +21 -20
- data/vendor/libgit2/src/diff.c +43 -58
- data/vendor/libgit2/src/diff.h +4 -3
- data/vendor/libgit2/src/diff_driver.c +37 -38
- data/vendor/libgit2/src/diff_file.c +12 -10
- data/vendor/libgit2/src/diff_file.h +2 -2
- data/vendor/libgit2/src/diff_generate.c +148 -98
- data/vendor/libgit2/src/diff_generate.h +2 -2
- data/vendor/libgit2/src/diff_parse.c +1 -1
- data/vendor/libgit2/src/diff_print.c +25 -13
- data/vendor/libgit2/src/diff_stats.c +1 -1
- data/vendor/libgit2/src/diff_tform.c +11 -11
- data/vendor/libgit2/src/errors.c +21 -25
- data/vendor/libgit2/src/errors.h +81 -0
- data/vendor/libgit2/src/features.h.in +9 -2
- data/vendor/libgit2/src/fetch.c +7 -2
- data/vendor/libgit2/src/fetchhead.c +36 -4
- data/vendor/libgit2/src/filebuf.c +6 -10
- data/vendor/libgit2/src/filebuf.h +2 -2
- data/vendor/libgit2/src/filter.c +16 -8
- data/vendor/libgit2/src/{fileops.c → futils.c} +21 -17
- data/vendor/libgit2/src/{fileops.h → futils.h} +5 -5
- data/vendor/libgit2/src/global.c +12 -40
- data/vendor/libgit2/src/global.h +0 -2
- 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/hash/sha1/openssl.h +19 -0
- data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/sha1.c +14 -3
- data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/sha1.h +0 -0
- data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/ubc_check.c +0 -0
- data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/ubc_check.h +0 -0
- data/vendor/libgit2/src/hash/{hash_win32.c → sha1/win32.c} +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 +91 -65
- data/vendor/libgit2/src/idxmap.h +151 -15
- data/vendor/libgit2/src/ignore.c +32 -38
- data/vendor/libgit2/src/index.c +105 -83
- data/vendor/libgit2/src/index.h +1 -1
- data/vendor/libgit2/src/indexer.c +71 -72
- data/vendor/libgit2/src/integer.h +39 -4
- data/vendor/libgit2/src/iterator.c +40 -35
- data/vendor/libgit2/src/iterator.h +8 -8
- data/vendor/libgit2/src/map.h +1 -1
- data/vendor/libgit2/src/merge.c +78 -51
- data/vendor/libgit2/src/merge.h +2 -2
- data/vendor/libgit2/src/merge_driver.c +5 -5
- data/vendor/libgit2/src/merge_file.c +1 -1
- data/vendor/libgit2/src/mwindow.c +18 -23
- data/vendor/libgit2/src/mwindow.h +4 -4
- data/vendor/libgit2/src/net.c +411 -0
- data/vendor/libgit2/src/net.h +57 -0
- data/vendor/libgit2/src/netops.c +6 -193
- data/vendor/libgit2/src/netops.h +1 -34
- data/vendor/libgit2/src/notes.c +8 -5
- data/vendor/libgit2/src/object.c +3 -3
- data/vendor/libgit2/src/object.h +2 -0
- data/vendor/libgit2/src/odb.c +41 -23
- data/vendor/libgit2/src/odb.h +3 -2
- data/vendor/libgit2/src/odb_loose.c +17 -10
- data/vendor/libgit2/src/odb_mempack.c +13 -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 +19 -8
- data/vendor/libgit2/src/oidmap.c +39 -57
- data/vendor/libgit2/src/oidmap.h +99 -19
- data/vendor/libgit2/src/pack-objects.c +28 -33
- data/vendor/libgit2/src/pack-objects.h +1 -1
- data/vendor/libgit2/src/pack.c +117 -129
- data/vendor/libgit2/src/pack.h +15 -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 -2
- data/vendor/libgit2/src/patch_parse.c +130 -33
- data/vendor/libgit2/src/path.c +43 -6
- data/vendor/libgit2/src/path.h +2 -0
- data/vendor/libgit2/src/pathspec.c +14 -14
- data/vendor/libgit2/src/pool.c +26 -22
- data/vendor/libgit2/src/pool.h +7 -7
- data/vendor/libgit2/src/posix.c +7 -7
- data/vendor/libgit2/src/posix.h +12 -1
- data/vendor/libgit2/src/proxy.c +7 -2
- data/vendor/libgit2/src/push.c +13 -7
- data/vendor/libgit2/src/reader.c +2 -2
- data/vendor/libgit2/src/rebase.c +87 -28
- data/vendor/libgit2/src/refdb.c +12 -0
- data/vendor/libgit2/src/refdb_fs.c +219 -167
- data/vendor/libgit2/src/reflog.c +11 -13
- data/vendor/libgit2/src/refs.c +39 -23
- data/vendor/libgit2/src/refs.h +8 -1
- data/vendor/libgit2/src/refspec.c +9 -16
- data/vendor/libgit2/src/regexp.c +221 -0
- data/vendor/libgit2/src/regexp.h +97 -0
- data/vendor/libgit2/src/remote.c +57 -55
- data/vendor/libgit2/src/remote.h +2 -2
- data/vendor/libgit2/src/repository.c +187 -154
- data/vendor/libgit2/src/repository.h +49 -40
- data/vendor/libgit2/src/revert.c +8 -3
- data/vendor/libgit2/src/revparse.c +18 -19
- data/vendor/libgit2/src/revwalk.c +72 -34
- data/vendor/libgit2/src/revwalk.h +20 -0
- data/vendor/libgit2/src/settings.c +13 -1
- data/vendor/libgit2/src/sortedcache.c +12 -26
- data/vendor/libgit2/src/sortedcache.h +1 -1
- data/vendor/libgit2/src/stash.c +47 -67
- data/vendor/libgit2/src/status.c +17 -11
- data/vendor/libgit2/src/streams/openssl.c +54 -2
- 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 +151 -126
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/sysdir.c +11 -1
- data/vendor/libgit2/src/tag.c +10 -2
- 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 +10 -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 +476 -0
- data/vendor/libgit2/src/transports/{cred_helpers.c → credential_helpers.c} +21 -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 +1549 -0
- data/vendor/libgit2/src/transports/httpclient.h +190 -0
- data/vendor/libgit2/src/transports/local.c +10 -10
- data/vendor/libgit2/src/transports/smart.c +19 -19
- data/vendor/libgit2/src/transports/smart.h +3 -3
- data/vendor/libgit2/src/transports/smart_pkt.c +1 -1
- 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 +272 -242
- 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 +2 -12
- data/vendor/libgit2/src/userdiff.h +3 -1
- data/vendor/libgit2/src/util.c +51 -53
- data/vendor/libgit2/src/util.h +16 -21
- data/vendor/libgit2/src/wildmatch.c +320 -0
- data/vendor/libgit2/src/wildmatch.h +23 -0
- data/vendor/libgit2/src/win32/map.c +3 -5
- data/vendor/libgit2/src/win32/path_w32.c +40 -3
- 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 +47 -5
- data/vendor/libgit2/src/win32/precompiled.h +0 -2
- data/vendor/libgit2/src/win32/thread.c +5 -10
- data/vendor/libgit2/src/win32/w32_buffer.c +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 +79 -49
- 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 +108 -41
- 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
data/vendor/libgit2/src/proxy.c
CHANGED
@@ -9,17 +9,22 @@
|
|
9
9
|
|
10
10
|
#include "git2/proxy.h"
|
11
11
|
|
12
|
-
int
|
12
|
+
int git_proxy_options_init(git_proxy_options *opts, unsigned int version)
|
13
13
|
{
|
14
14
|
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
|
15
15
|
opts, version, git_proxy_options, GIT_PROXY_OPTIONS_INIT);
|
16
16
|
return 0;
|
17
17
|
}
|
18
18
|
|
19
|
+
int git_proxy_init_options(git_proxy_options *opts, unsigned int version)
|
20
|
+
{
|
21
|
+
return git_proxy_options_init(opts, version);
|
22
|
+
}
|
23
|
+
|
19
24
|
int git_proxy_options_dup(git_proxy_options *tgt, const git_proxy_options *src)
|
20
25
|
{
|
21
26
|
if (!src) {
|
22
|
-
|
27
|
+
git_proxy_options_init(tgt, GIT_PROXY_OPTIONS_VERSION);
|
23
28
|
return 0;
|
24
29
|
}
|
25
30
|
|
data/vendor/libgit2/src/push.c
CHANGED
@@ -196,7 +196,7 @@ int git_push_update_tips(git_push *push, const git_remote_callbacks *callbacks)
|
|
196
196
|
continue;
|
197
197
|
|
198
198
|
/* Update the remote ref */
|
199
|
-
if (
|
199
|
+
if (git_oid_is_zero(&push_spec->loid)) {
|
200
200
|
error = git_reference_lookup(&remote_ref, push->remote->repo, git_buf_cstr(&remote_ref_name));
|
201
201
|
|
202
202
|
if (error >= 0) {
|
@@ -281,7 +281,7 @@ static int queue_objects(git_push *push)
|
|
281
281
|
git_object_t type;
|
282
282
|
size_t size;
|
283
283
|
|
284
|
-
if (
|
284
|
+
if (git_oid_is_zero(&spec->loid))
|
285
285
|
/*
|
286
286
|
* Delete reference on remote side;
|
287
287
|
* nothing to do here.
|
@@ -319,7 +319,7 @@ static int queue_objects(git_push *push)
|
|
319
319
|
if (!spec->refspec.force) {
|
320
320
|
git_oid base;
|
321
321
|
|
322
|
-
if (
|
322
|
+
if (git_oid_is_zero(&spec->roid))
|
323
323
|
continue;
|
324
324
|
|
325
325
|
if (!git_odb_exists(push->repo->_odb, &spec->roid)) {
|
@@ -346,11 +346,12 @@ static int queue_objects(git_push *push)
|
|
346
346
|
}
|
347
347
|
|
348
348
|
git_vector_foreach(&push->remote->refs, i, head) {
|
349
|
-
if (
|
349
|
+
if (git_oid_is_zero(&head->oid))
|
350
350
|
continue;
|
351
351
|
|
352
|
-
|
353
|
-
|
352
|
+
if ((error = git_revwalk_hide(rw, &head->oid)) < 0 &&
|
353
|
+
error != GIT_ENOTFOUND && error != GIT_EINVALIDSPEC && error != GIT_EPEEL)
|
354
|
+
goto on_error;
|
354
355
|
}
|
355
356
|
|
356
357
|
error = git_packbuilder_insert_walk(push->pb, rw);
|
@@ -547,9 +548,14 @@ void git_push_free(git_push *push)
|
|
547
548
|
git__free(push);
|
548
549
|
}
|
549
550
|
|
550
|
-
int
|
551
|
+
int git_push_options_init(git_push_options *opts, unsigned int version)
|
551
552
|
{
|
552
553
|
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
|
553
554
|
opts, version, git_push_options, GIT_PUSH_OPTIONS_INIT);
|
554
555
|
return 0;
|
555
556
|
}
|
557
|
+
|
558
|
+
int git_push_init_options(git_push_options *opts, unsigned int version)
|
559
|
+
{
|
560
|
+
return git_push_options_init(opts, version);
|
561
|
+
}
|
data/vendor/libgit2/src/reader.c
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
#include "reader.h"
|
9
9
|
|
10
|
-
#include "
|
10
|
+
#include "futils.h"
|
11
11
|
#include "blob.h"
|
12
12
|
|
13
13
|
#include "git2/tree.h"
|
@@ -32,7 +32,7 @@ static int tree_reader_read(
|
|
32
32
|
tree_reader *reader = (tree_reader *)_reader;
|
33
33
|
git_tree_entry *tree_entry = NULL;
|
34
34
|
git_blob *blob = NULL;
|
35
|
-
|
35
|
+
git_object_size_t blobsize;
|
36
36
|
int error;
|
37
37
|
|
38
38
|
if ((error = git_tree_entry_bypath(&tree_entry, reader->tree, filename)) < 0 ||
|
data/vendor/libgit2/src/rebase.c
CHANGED
@@ -49,18 +49,18 @@
|
|
49
49
|
#define REBASE_FILE_MODE 0666
|
50
50
|
|
51
51
|
typedef enum {
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
}
|
52
|
+
GIT_REBASE_NONE = 0,
|
53
|
+
GIT_REBASE_APPLY = 1,
|
54
|
+
GIT_REBASE_MERGE = 2,
|
55
|
+
GIT_REBASE_INTERACTIVE = 3,
|
56
|
+
} git_rebase_t;
|
57
57
|
|
58
58
|
struct git_rebase {
|
59
59
|
git_repository *repo;
|
60
60
|
|
61
61
|
git_rebase_options options;
|
62
62
|
|
63
|
-
|
63
|
+
git_rebase_t type;
|
64
64
|
char *state_path;
|
65
65
|
|
66
66
|
int head_detached : 1,
|
@@ -86,18 +86,18 @@ struct git_rebase {
|
|
86
86
|
#define GIT_REBASE_STATE_INIT {0}
|
87
87
|
|
88
88
|
static int rebase_state_type(
|
89
|
-
|
89
|
+
git_rebase_t *type_out,
|
90
90
|
char **path_out,
|
91
91
|
git_repository *repo)
|
92
92
|
{
|
93
93
|
git_buf path = GIT_BUF_INIT;
|
94
|
-
|
94
|
+
git_rebase_t type = GIT_REBASE_NONE;
|
95
95
|
|
96
96
|
if (git_buf_joinpath(&path, repo->gitdir, REBASE_APPLY_DIR) < 0)
|
97
97
|
return -1;
|
98
98
|
|
99
99
|
if (git_path_isdir(git_buf_cstr(&path))) {
|
100
|
-
type =
|
100
|
+
type = GIT_REBASE_APPLY;
|
101
101
|
goto done;
|
102
102
|
}
|
103
103
|
|
@@ -106,14 +106,14 @@ static int rebase_state_type(
|
|
106
106
|
return -1;
|
107
107
|
|
108
108
|
if (git_path_isdir(git_buf_cstr(&path))) {
|
109
|
-
type =
|
109
|
+
type = GIT_REBASE_MERGE;
|
110
110
|
goto done;
|
111
111
|
}
|
112
112
|
|
113
113
|
done:
|
114
114
|
*type_out = type;
|
115
115
|
|
116
|
-
if (type !=
|
116
|
+
if (type != GIT_REBASE_NONE && path_out)
|
117
117
|
*path_out = git_buf_detach(&path);
|
118
118
|
|
119
119
|
git_buf_dispose(&path);
|
@@ -268,7 +268,7 @@ static int rebase_alloc(git_rebase **out, const git_rebase_options *rebase_opts)
|
|
268
268
|
if (rebase_opts)
|
269
269
|
memcpy(&rebase->options, rebase_opts, sizeof(git_rebase_options));
|
270
270
|
else
|
271
|
-
|
271
|
+
git_rebase_options_init(&rebase->options, GIT_REBASE_OPTIONS_VERSION);
|
272
272
|
|
273
273
|
if (rebase_opts && rebase_opts->rewrite_notes_ref) {
|
274
274
|
rebase->options.rewrite_notes_ref = git__strdup(rebase_opts->rewrite_notes_ref);
|
@@ -298,7 +298,8 @@ int git_rebase_open(
|
|
298
298
|
git_rebase *rebase;
|
299
299
|
git_buf path = GIT_BUF_INIT, orig_head_name = GIT_BUF_INIT,
|
300
300
|
orig_head_id = GIT_BUF_INIT, onto_id = GIT_BUF_INIT;
|
301
|
-
|
301
|
+
size_t state_path_len;
|
302
|
+
int error;
|
302
303
|
|
303
304
|
assert(repo);
|
304
305
|
|
@@ -313,7 +314,7 @@ int git_rebase_open(
|
|
313
314
|
if ((error = rebase_state_type(&rebase->type, &rebase->state_path, repo)) < 0)
|
314
315
|
goto done;
|
315
316
|
|
316
|
-
if (rebase->type ==
|
317
|
+
if (rebase->type == GIT_REBASE_NONE) {
|
317
318
|
git_error_set(GIT_ERROR_REBASE, "there is no rebase in progress");
|
318
319
|
error = GIT_ENOTFOUND;
|
319
320
|
goto done;
|
@@ -369,14 +370,14 @@ int git_rebase_open(
|
|
369
370
|
rebase->orig_head_name = git_buf_detach(&orig_head_name);
|
370
371
|
|
371
372
|
switch (rebase->type) {
|
372
|
-
case
|
373
|
+
case GIT_REBASE_INTERACTIVE:
|
373
374
|
git_error_set(GIT_ERROR_REBASE, "interactive rebase is not supported");
|
374
375
|
error = -1;
|
375
376
|
break;
|
376
|
-
case
|
377
|
+
case GIT_REBASE_MERGE:
|
377
378
|
error = rebase_open_merge(rebase);
|
378
379
|
break;
|
379
|
-
case
|
380
|
+
case GIT_REBASE_APPLY:
|
380
381
|
git_error_set(GIT_ERROR_REBASE, "patch application rebase is not supported");
|
381
382
|
error = -1;
|
382
383
|
break;
|
@@ -493,22 +494,27 @@ static int rebase_setupfiles(git_rebase *rebase)
|
|
493
494
|
return rebase_setupfiles_merge(rebase);
|
494
495
|
}
|
495
496
|
|
496
|
-
int
|
497
|
+
int git_rebase_options_init(git_rebase_options *opts, unsigned int version)
|
497
498
|
{
|
498
499
|
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
|
499
500
|
opts, version, git_rebase_options, GIT_REBASE_OPTIONS_INIT);
|
500
501
|
return 0;
|
501
502
|
}
|
502
503
|
|
504
|
+
int git_rebase_init_options(git_rebase_options *opts, unsigned int version)
|
505
|
+
{
|
506
|
+
return git_rebase_options_init(opts, version);
|
507
|
+
}
|
508
|
+
|
503
509
|
static int rebase_ensure_not_in_progress(git_repository *repo)
|
504
510
|
{
|
505
511
|
int error;
|
506
|
-
|
512
|
+
git_rebase_t type;
|
507
513
|
|
508
514
|
if ((error = rebase_state_type(&type, NULL, repo)) < 0)
|
509
515
|
return error;
|
510
516
|
|
511
|
-
if (type !=
|
517
|
+
if (type != GIT_REBASE_NONE) {
|
512
518
|
git_error_set(GIT_ERROR_REBASE, "there is an existing rebase in progress");
|
513
519
|
return -1;
|
514
520
|
}
|
@@ -723,7 +729,7 @@ int git_rebase_init(
|
|
723
729
|
|
724
730
|
rebase->repo = repo;
|
725
731
|
rebase->inmemory = inmemory;
|
726
|
-
rebase->type =
|
732
|
+
rebase->type = GIT_REBASE_MERGE;
|
727
733
|
|
728
734
|
if ((error = rebase_init_operations(rebase, repo, branch, upstream, onto)) < 0)
|
729
735
|
goto done;
|
@@ -758,7 +764,7 @@ static void normalize_checkout_options_for_apply(
|
|
758
764
|
if (!checkout_opts->ancestor_label)
|
759
765
|
checkout_opts->ancestor_label = "ancestor";
|
760
766
|
|
761
|
-
if (rebase->type ==
|
767
|
+
if (rebase->type == GIT_REBASE_MERGE) {
|
762
768
|
if (!checkout_opts->our_label)
|
763
769
|
checkout_opts->our_label = rebase->onto_name;
|
764
770
|
|
@@ -911,7 +917,7 @@ int git_rebase_next(
|
|
911
917
|
|
912
918
|
if (rebase->inmemory)
|
913
919
|
error = rebase_next_inmemory(out, rebase);
|
914
|
-
else if (rebase->type ==
|
920
|
+
else if (rebase->type == GIT_REBASE_MERGE)
|
915
921
|
error = rebase_next_merge(out, rebase);
|
916
922
|
else
|
917
923
|
abort();
|
@@ -945,6 +951,10 @@ static int rebase_commit__create(
|
|
945
951
|
git_commit *current_commit = NULL, *commit = NULL;
|
946
952
|
git_tree *parent_tree = NULL, *tree = NULL;
|
947
953
|
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;
|
948
958
|
int error;
|
949
959
|
|
950
960
|
operation = git_array_get(rebase->operations, rebase->current);
|
@@ -975,10 +985,40 @@ static int rebase_commit__create(
|
|
975
985
|
message = git_commit_message(current_commit);
|
976
986
|
}
|
977
987
|
|
978
|
-
if ((error =
|
979
|
-
|
980
|
-
|
981
|
-
|
988
|
+
if ((error = git_commit_create_buffer(&commit_content, rebase->repo, author, committer,
|
989
|
+
message_encoding, message, tree, 1, (const git_commit **)&parent_commit)) < 0)
|
990
|
+
goto done;
|
991
|
+
|
992
|
+
if (rebase->options.signing_cb) {
|
993
|
+
git_error_clear();
|
994
|
+
error = git_error_set_after_callback_function(rebase->options.signing_cb(
|
995
|
+
&commit_signature, &signature_field, git_buf_cstr(&commit_content),
|
996
|
+
rebase->options.payload), "commit signing_cb failed");
|
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
|
+
}
|
1005
|
+
|
1006
|
+
if (git_buf_is_allocated(&commit_signature)) {
|
1007
|
+
assert(git_buf_contains_nul(&commit_signature));
|
1008
|
+
commit_signature_string = git_buf_cstr(&commit_signature);
|
1009
|
+
}
|
1010
|
+
|
1011
|
+
if (git_buf_is_allocated(&signature_field)) {
|
1012
|
+
assert(git_buf_contains_nul(&signature_field));
|
1013
|
+
signature_field_string = git_buf_cstr(&signature_field);
|
1014
|
+
}
|
1015
|
+
|
1016
|
+
if ((error = git_commit_create_with_signature(&commit_id, rebase->repo,
|
1017
|
+
git_buf_cstr(&commit_content), commit_signature_string,
|
1018
|
+
signature_field_string)))
|
1019
|
+
goto done;
|
1020
|
+
|
1021
|
+
if ((error = git_commit_lookup(&commit, rebase->repo, &commit_id)) < 0)
|
982
1022
|
goto done;
|
983
1023
|
|
984
1024
|
*out = commit;
|
@@ -987,6 +1027,9 @@ done:
|
|
987
1027
|
if (error < 0)
|
988
1028
|
git_commit_free(commit);
|
989
1029
|
|
1030
|
+
git_buf_dispose(&commit_signature);
|
1031
|
+
git_buf_dispose(&signature_field);
|
1032
|
+
git_buf_dispose(&commit_content);
|
990
1033
|
git_commit_free(current_commit);
|
991
1034
|
git_tree_free(parent_tree);
|
992
1035
|
git_tree_free(tree);
|
@@ -1085,7 +1128,7 @@ int git_rebase_commit(
|
|
1085
1128
|
if (rebase->inmemory)
|
1086
1129
|
error = rebase_commit_inmemory(
|
1087
1130
|
id, rebase, author, committer, message_encoding, message);
|
1088
|
-
else if (rebase->type ==
|
1131
|
+
else if (rebase->type == GIT_REBASE_MERGE)
|
1089
1132
|
error = rebase_commit_merge(
|
1090
1133
|
id, rebase, author, committer, message_encoding, message);
|
1091
1134
|
else
|
@@ -1327,6 +1370,22 @@ int git_rebase_finish(
|
|
1327
1370
|
return error;
|
1328
1371
|
}
|
1329
1372
|
|
1373
|
+
const char *git_rebase_orig_head_name(git_rebase *rebase) {
|
1374
|
+
return rebase->orig_head_name;
|
1375
|
+
}
|
1376
|
+
|
1377
|
+
const git_oid *git_rebase_orig_head_id(git_rebase *rebase) {
|
1378
|
+
return &rebase->orig_head_id;
|
1379
|
+
}
|
1380
|
+
|
1381
|
+
const char *git_rebase_onto_name(git_rebase *rebase) {
|
1382
|
+
return rebase->onto_name;
|
1383
|
+
}
|
1384
|
+
|
1385
|
+
const git_oid *git_rebase_onto_id(git_rebase *rebase) {
|
1386
|
+
return &rebase->onto_id;
|
1387
|
+
}
|
1388
|
+
|
1330
1389
|
size_t git_rebase_operation_entrycount(git_rebase *rebase)
|
1331
1390
|
{
|
1332
1391
|
assert(rebase);
|
data/vendor/libgit2/src/refdb.c
CHANGED
@@ -66,6 +66,18 @@ static void refdb_free_backend(git_refdb *db)
|
|
66
66
|
|
67
67
|
int git_refdb_set_backend(git_refdb *db, git_refdb_backend *backend)
|
68
68
|
{
|
69
|
+
GIT_ERROR_CHECK_VERSION(backend, GIT_REFDB_BACKEND_VERSION, "git_refdb_backend");
|
70
|
+
|
71
|
+
if (!backend->exists || !backend->lookup || !backend->iterator ||
|
72
|
+
!backend->write || !backend->rename || !backend->del ||
|
73
|
+
!backend->has_log || !backend->ensure_log || !backend->free ||
|
74
|
+
!backend->reflog_read || !backend->reflog_write ||
|
75
|
+
!backend->reflog_rename || !backend->reflog_delete ||
|
76
|
+
(backend->lock && !backend->unlock)) {
|
77
|
+
git_error_set(GIT_ERROR_REFERENCE, "incomplete refdb backend implementation");
|
78
|
+
return GIT_EINVALID;
|
79
|
+
}
|
80
|
+
|
69
81
|
refdb_free_backend(db);
|
70
82
|
db->backend = backend;
|
71
83
|
|
@@ -10,14 +10,16 @@
|
|
10
10
|
#include "refs.h"
|
11
11
|
#include "hash.h"
|
12
12
|
#include "repository.h"
|
13
|
-
#include "
|
13
|
+
#include "futils.h"
|
14
14
|
#include "filebuf.h"
|
15
15
|
#include "pack.h"
|
16
|
+
#include "parse.h"
|
16
17
|
#include "reflog.h"
|
17
18
|
#include "refdb.h"
|
18
19
|
#include "iterator.h"
|
19
20
|
#include "sortedcache.h"
|
20
21
|
#include "signature.h"
|
22
|
+
#include "wildmatch.h"
|
21
23
|
|
22
24
|
#include <git2/tag.h>
|
23
25
|
#include <git2/object.h>
|
@@ -327,21 +329,33 @@ static int refdb_fs_backend__exists(
|
|
327
329
|
git_refdb_backend *_backend,
|
328
330
|
const char *ref_name)
|
329
331
|
{
|
330
|
-
refdb_fs_backend *backend = (refdb_fs_backend
|
332
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
331
333
|
git_buf ref_path = GIT_BUF_INIT;
|
332
334
|
int error;
|
333
335
|
|
334
336
|
assert(backend);
|
335
337
|
|
336
|
-
|
337
|
-
|
338
|
-
|
338
|
+
*exists = 0;
|
339
|
+
|
340
|
+
if ((error = git_buf_joinpath(&ref_path, backend->gitpath, ref_name)) < 0)
|
341
|
+
goto out;
|
342
|
+
|
343
|
+
if (git_path_isfile(ref_path.ptr)) {
|
344
|
+
*exists = 1;
|
345
|
+
goto out;
|
346
|
+
}
|
347
|
+
|
348
|
+
if ((error = packed_reload(backend)) < 0)
|
349
|
+
goto out;
|
339
350
|
|
340
|
-
|
341
|
-
|
351
|
+
if (git_sortedcache_lookup(backend->refcache, ref_name) != NULL) {
|
352
|
+
*exists = 1;
|
353
|
+
goto out;
|
354
|
+
}
|
342
355
|
|
356
|
+
out:
|
343
357
|
git_buf_dispose(&ref_path);
|
344
|
-
return
|
358
|
+
return error;
|
345
359
|
}
|
346
360
|
|
347
361
|
static const char *loose_parse_symbolic(git_buf *file_content)
|
@@ -457,7 +471,7 @@ static int refdb_fs_backend__lookup(
|
|
457
471
|
git_refdb_backend *_backend,
|
458
472
|
const char *ref_name)
|
459
473
|
{
|
460
|
-
refdb_fs_backend *backend = (refdb_fs_backend
|
474
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
461
475
|
int error;
|
462
476
|
|
463
477
|
assert(backend);
|
@@ -490,7 +504,7 @@ typedef struct {
|
|
490
504
|
|
491
505
|
static void refdb_fs_backend__iterator_free(git_reference_iterator *_iter)
|
492
506
|
{
|
493
|
-
refdb_fs_iter *iter = (refdb_fs_iter
|
507
|
+
refdb_fs_iter *iter = GIT_CONTAINER_OF(_iter, refdb_fs_iter, parent);
|
494
508
|
|
495
509
|
git_vector_free(&iter->loose);
|
496
510
|
git_pool_clear(&iter->pool);
|
@@ -552,7 +566,6 @@ static int iter_load_loose_paths(refdb_fs_backend *backend, refdb_fs_iter *iter)
|
|
552
566
|
|
553
567
|
while (!error && !git_iterator_advance(&entry, fsit)) {
|
554
568
|
const char *ref_name;
|
555
|
-
struct packref *ref;
|
556
569
|
char *ref_dup;
|
557
570
|
|
558
571
|
git_buf_truncate(&path, ref_prefix_len);
|
@@ -560,15 +573,9 @@ static int iter_load_loose_paths(refdb_fs_backend *backend, refdb_fs_iter *iter)
|
|
560
573
|
ref_name = git_buf_cstr(&path);
|
561
574
|
|
562
575
|
if (git__suffixcmp(ref_name, ".lock") == 0 ||
|
563
|
-
(iter->glob &&
|
576
|
+
(iter->glob && wildmatch(iter->glob, ref_name, 0) != 0))
|
564
577
|
continue;
|
565
578
|
|
566
|
-
git_sortedcache_rlock(backend->refcache);
|
567
|
-
ref = git_sortedcache_lookup(backend->refcache, ref_name);
|
568
|
-
if (ref)
|
569
|
-
ref->flags |= PACKREF_SHADOWED;
|
570
|
-
git_sortedcache_runlock(backend->refcache);
|
571
|
-
|
572
579
|
ref_dup = git_pool_strdup(&iter->pool, ref_name);
|
573
580
|
if (!ref_dup)
|
574
581
|
error = -1;
|
@@ -586,24 +593,24 @@ static int refdb_fs_backend__iterator_next(
|
|
586
593
|
git_reference **out, git_reference_iterator *_iter)
|
587
594
|
{
|
588
595
|
int error = GIT_ITEROVER;
|
589
|
-
refdb_fs_iter *iter = (refdb_fs_iter
|
590
|
-
refdb_fs_backend *backend = (
|
596
|
+
refdb_fs_iter *iter = GIT_CONTAINER_OF(_iter, refdb_fs_iter, parent);
|
597
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(iter->parent.db->backend, refdb_fs_backend, parent);
|
591
598
|
struct packref *ref;
|
592
599
|
|
593
600
|
while (iter->loose_pos < iter->loose.length) {
|
594
601
|
const char *path = git_vector_get(&iter->loose, iter->loose_pos++);
|
595
602
|
|
596
|
-
if (loose_lookup(out, backend, path) == 0)
|
603
|
+
if (loose_lookup(out, backend, path) == 0) {
|
604
|
+
ref = git_sortedcache_lookup(iter->cache, path);
|
605
|
+
if (ref)
|
606
|
+
ref->flags |= PACKREF_SHADOWED;
|
607
|
+
|
597
608
|
return 0;
|
609
|
+
}
|
598
610
|
|
599
611
|
git_error_clear();
|
600
612
|
}
|
601
613
|
|
602
|
-
if (!iter->cache) {
|
603
|
-
if ((error = git_sortedcache_copy(&iter->cache, backend->refcache, 1, NULL, NULL)) < 0)
|
604
|
-
return error;
|
605
|
-
}
|
606
|
-
|
607
614
|
error = GIT_ITEROVER;
|
608
615
|
while (iter->packed_pos < git_sortedcache_entrycount(iter->cache)) {
|
609
616
|
ref = git_sortedcache_entry(iter->cache, iter->packed_pos++);
|
@@ -612,7 +619,7 @@ static int refdb_fs_backend__iterator_next(
|
|
612
619
|
|
613
620
|
if (ref->flags & PACKREF_SHADOWED)
|
614
621
|
continue;
|
615
|
-
if (iter->glob &&
|
622
|
+
if (iter->glob && wildmatch(iter->glob, ref->name, 0) != 0)
|
616
623
|
continue;
|
617
624
|
|
618
625
|
*out = git_reference__alloc(ref->name, &ref->oid, &ref->peel);
|
@@ -627,14 +634,19 @@ static int refdb_fs_backend__iterator_next_name(
|
|
627
634
|
const char **out, git_reference_iterator *_iter)
|
628
635
|
{
|
629
636
|
int error = GIT_ITEROVER;
|
630
|
-
refdb_fs_iter *iter = (refdb_fs_iter
|
631
|
-
refdb_fs_backend *backend = (
|
637
|
+
refdb_fs_iter *iter = GIT_CONTAINER_OF(_iter, refdb_fs_iter, parent);
|
638
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(iter->parent.db->backend, refdb_fs_backend, parent);
|
632
639
|
struct packref *ref;
|
633
640
|
|
634
641
|
while (iter->loose_pos < iter->loose.length) {
|
635
642
|
const char *path = git_vector_get(&iter->loose, iter->loose_pos++);
|
643
|
+
struct packref *ref;
|
636
644
|
|
637
645
|
if (loose_lookup(NULL, backend, path) == 0) {
|
646
|
+
ref = git_sortedcache_lookup(iter->cache, path);
|
647
|
+
if (ref)
|
648
|
+
ref->flags |= PACKREF_SHADOWED;
|
649
|
+
|
638
650
|
*out = path;
|
639
651
|
return 0;
|
640
652
|
}
|
@@ -642,11 +654,6 @@ static int refdb_fs_backend__iterator_next_name(
|
|
642
654
|
git_error_clear();
|
643
655
|
}
|
644
656
|
|
645
|
-
if (!iter->cache) {
|
646
|
-
if ((error = git_sortedcache_copy(&iter->cache, backend->refcache, 1, NULL, NULL)) < 0)
|
647
|
-
return error;
|
648
|
-
}
|
649
|
-
|
650
657
|
error = GIT_ITEROVER;
|
651
658
|
while (iter->packed_pos < git_sortedcache_entrycount(iter->cache)) {
|
652
659
|
ref = git_sortedcache_entry(iter->cache, iter->packed_pos++);
|
@@ -655,7 +662,7 @@ static int refdb_fs_backend__iterator_next_name(
|
|
655
662
|
|
656
663
|
if (ref->flags & PACKREF_SHADOWED)
|
657
664
|
continue;
|
658
|
-
if (iter->glob &&
|
665
|
+
if (iter->glob && wildmatch(iter->glob, ref->name, 0) != 0)
|
659
666
|
continue;
|
660
667
|
|
661
668
|
*out = ref->name;
|
@@ -669,40 +676,44 @@ static int refdb_fs_backend__iterator_next_name(
|
|
669
676
|
static int refdb_fs_backend__iterator(
|
670
677
|
git_reference_iterator **out, git_refdb_backend *_backend, const char *glob)
|
671
678
|
{
|
679
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
680
|
+
refdb_fs_iter *iter = NULL;
|
672
681
|
int error;
|
673
|
-
refdb_fs_iter *iter;
|
674
|
-
refdb_fs_backend *backend = (refdb_fs_backend *)_backend;
|
675
682
|
|
676
683
|
assert(backend);
|
677
684
|
|
678
|
-
if ((error = packed_reload(backend)) < 0)
|
679
|
-
return error;
|
680
|
-
|
681
685
|
iter = git__calloc(1, sizeof(refdb_fs_iter));
|
682
686
|
GIT_ERROR_CHECK_ALLOC(iter);
|
683
687
|
|
684
688
|
git_pool_init(&iter->pool, 1);
|
685
689
|
|
686
|
-
if (git_vector_init(&iter->loose, 8, NULL) < 0)
|
687
|
-
goto
|
690
|
+
if ((error = git_vector_init(&iter->loose, 8, NULL)) < 0)
|
691
|
+
goto out;
|
688
692
|
|
689
693
|
if (glob != NULL &&
|
690
|
-
|
691
|
-
|
694
|
+
(iter->glob = git_pool_strdup(&iter->pool, glob)) == NULL) {
|
695
|
+
error = GIT_ERROR_NOMEMORY;
|
696
|
+
goto out;
|
697
|
+
}
|
698
|
+
|
699
|
+
if ((error = iter_load_loose_paths(backend, iter)) < 0)
|
700
|
+
goto out;
|
701
|
+
|
702
|
+
if ((error = packed_reload(backend)) < 0)
|
703
|
+
goto out;
|
704
|
+
|
705
|
+
if ((error = git_sortedcache_copy(&iter->cache, backend->refcache, 1, NULL, NULL)) < 0)
|
706
|
+
goto out;
|
692
707
|
|
693
708
|
iter->parent.next = refdb_fs_backend__iterator_next;
|
694
709
|
iter->parent.next_name = refdb_fs_backend__iterator_next_name;
|
695
710
|
iter->parent.free = refdb_fs_backend__iterator_free;
|
696
711
|
|
697
|
-
if (iter_load_loose_paths(backend, iter) < 0)
|
698
|
-
goto fail;
|
699
|
-
|
700
712
|
*out = (git_reference_iterator *)iter;
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
return -1;
|
713
|
+
out:
|
714
|
+
if (error)
|
715
|
+
refdb_fs_backend__iterator_free((git_reference_iterator *)iter);
|
716
|
+
return error;
|
706
717
|
}
|
707
718
|
|
708
719
|
static bool ref_is_available(
|
@@ -794,7 +805,7 @@ static int loose_lock(git_filebuf *file, refdb_fs_backend *backend, const char *
|
|
794
805
|
if (git_buf_joinpath(&ref_path, basedir, name) < 0)
|
795
806
|
return -1;
|
796
807
|
|
797
|
-
filebuf_flags =
|
808
|
+
filebuf_flags = GIT_FILEBUF_CREATE_LEADING_DIRS;
|
798
809
|
if (backend->fsync)
|
799
810
|
filebuf_flags |= GIT_FILEBUF_FSYNC;
|
800
811
|
|
@@ -829,7 +840,7 @@ static int refdb_fs_backend__lock(void **out, git_refdb_backend *_backend, const
|
|
829
840
|
{
|
830
841
|
int error;
|
831
842
|
git_filebuf *lock;
|
832
|
-
refdb_fs_backend *backend = (refdb_fs_backend
|
843
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
833
844
|
|
834
845
|
lock = git__calloc(1, sizeof(git_filebuf));
|
835
846
|
GIT_ERROR_CHECK_ALLOC(lock);
|
@@ -848,16 +859,17 @@ static int refdb_fs_backend__write_tail(
|
|
848
859
|
const git_reference *ref,
|
849
860
|
git_filebuf *file,
|
850
861
|
int update_reflog,
|
851
|
-
const git_signature *who,
|
852
|
-
const char *message,
|
853
862
|
const git_oid *old_id,
|
854
|
-
const char *old_target
|
863
|
+
const char *old_target,
|
864
|
+
const git_signature *who,
|
865
|
+
const char *message);
|
855
866
|
|
856
867
|
static int refdb_fs_backend__delete_tail(
|
857
868
|
git_refdb_backend *_backend,
|
858
869
|
git_filebuf *file,
|
859
870
|
const char *ref_name,
|
860
|
-
const git_oid *old_id,
|
871
|
+
const git_oid *old_id,
|
872
|
+
const char *old_target);
|
861
873
|
|
862
874
|
static int refdb_fs_backend__unlock(git_refdb_backend *backend, void *payload, int success, int update_reflog,
|
863
875
|
const git_reference *ref, const git_signature *sig, const char *message)
|
@@ -868,7 +880,7 @@ static int refdb_fs_backend__unlock(git_refdb_backend *backend, void *payload, i
|
|
868
880
|
if (success == 2)
|
869
881
|
error = refdb_fs_backend__delete_tail(backend, lock, ref->name, NULL, NULL);
|
870
882
|
else if (success)
|
871
|
-
error = refdb_fs_backend__write_tail(backend, ref, lock, update_reflog,
|
883
|
+
error = refdb_fs_backend__write_tail(backend, ref, lock, update_reflog, NULL, NULL, sig, message);
|
872
884
|
else
|
873
885
|
git_filebuf_cleanup(lock);
|
874
886
|
|
@@ -1087,6 +1099,35 @@ fail:
|
|
1087
1099
|
return error;
|
1088
1100
|
}
|
1089
1101
|
|
1102
|
+
static int packed_delete(refdb_fs_backend *backend, const char *ref_name)
|
1103
|
+
{
|
1104
|
+
size_t pack_pos;
|
1105
|
+
int error, found = 0;
|
1106
|
+
|
1107
|
+
if ((error = packed_reload(backend)) < 0)
|
1108
|
+
goto cleanup;
|
1109
|
+
|
1110
|
+
if ((error = git_sortedcache_wlock(backend->refcache)) < 0)
|
1111
|
+
goto cleanup;
|
1112
|
+
|
1113
|
+
/* If a packed reference exists, remove it from the packfile and repack if necessary */
|
1114
|
+
error = git_sortedcache_lookup_index(&pack_pos, backend->refcache, ref_name);
|
1115
|
+
if (error == 0) {
|
1116
|
+
error = git_sortedcache_remove(backend->refcache, pack_pos);
|
1117
|
+
found = 1;
|
1118
|
+
}
|
1119
|
+
if (error == GIT_ENOTFOUND)
|
1120
|
+
error = 0;
|
1121
|
+
|
1122
|
+
git_sortedcache_wunlock(backend->refcache);
|
1123
|
+
|
1124
|
+
if (found)
|
1125
|
+
error = packed_write(backend);
|
1126
|
+
|
1127
|
+
cleanup:
|
1128
|
+
return error;
|
1129
|
+
}
|
1130
|
+
|
1090
1131
|
static int reflog_append(refdb_fs_backend *backend, const git_reference *ref, const git_oid *old, const git_oid *new, const git_signature *author, const char *message);
|
1091
1132
|
static int has_reflog(git_repository *repo, const char *name);
|
1092
1133
|
|
@@ -1094,7 +1135,7 @@ static int should_write_reflog(int *write, git_repository *repo, const char *nam
|
|
1094
1135
|
{
|
1095
1136
|
int error, logall;
|
1096
1137
|
|
1097
|
-
error =
|
1138
|
+
error = git_repository__configmap_lookup(&logall, repo, GIT_CONFIGMAP_LOGALLREFUPDATES);
|
1098
1139
|
if (error < 0)
|
1099
1140
|
return error;
|
1100
1141
|
|
@@ -1239,7 +1280,7 @@ static int refdb_fs_backend__write(
|
|
1239
1280
|
const git_oid *old_id,
|
1240
1281
|
const char *old_target)
|
1241
1282
|
{
|
1242
|
-
refdb_fs_backend *backend = (refdb_fs_backend
|
1283
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1243
1284
|
git_filebuf file = GIT_FILEBUF_INIT;
|
1244
1285
|
int error = 0;
|
1245
1286
|
|
@@ -1252,7 +1293,7 @@ static int refdb_fs_backend__write(
|
|
1252
1293
|
if ((error = loose_lock(&file, backend, ref->name)) < 0)
|
1253
1294
|
return error;
|
1254
1295
|
|
1255
|
-
return refdb_fs_backend__write_tail(_backend, ref, &file, true,
|
1296
|
+
return refdb_fs_backend__write_tail(_backend, ref, &file, true, old_id, old_target, who, message);
|
1256
1297
|
}
|
1257
1298
|
|
1258
1299
|
static int refdb_fs_backend__write_tail(
|
@@ -1260,12 +1301,12 @@ static int refdb_fs_backend__write_tail(
|
|
1260
1301
|
const git_reference *ref,
|
1261
1302
|
git_filebuf *file,
|
1262
1303
|
int update_reflog,
|
1263
|
-
const git_signature *who,
|
1264
|
-
const char *message,
|
1265
1304
|
const git_oid *old_id,
|
1266
|
-
const char *old_target
|
1305
|
+
const char *old_target,
|
1306
|
+
const git_signature *who,
|
1307
|
+
const char *message)
|
1267
1308
|
{
|
1268
|
-
refdb_fs_backend *backend = (refdb_fs_backend
|
1309
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1269
1310
|
int error = 0, cmp = 0, should_write;
|
1270
1311
|
const char *new_target = NULL;
|
1271
1312
|
const git_oid *new_id = NULL;
|
@@ -1313,10 +1354,10 @@ on_error:
|
|
1313
1354
|
return error;
|
1314
1355
|
}
|
1315
1356
|
|
1316
|
-
static void
|
1357
|
+
static void refdb_fs_backend__prune_refs(
|
1317
1358
|
refdb_fs_backend *backend,
|
1318
1359
|
const char *ref_name,
|
1319
|
-
|
1360
|
+
const char *prefix)
|
1320
1361
|
{
|
1321
1362
|
git_buf relative_path = GIT_BUF_INIT;
|
1322
1363
|
git_buf base_path = GIT_BUF_INIT;
|
@@ -1334,8 +1375,8 @@ static void refdb_fs_backend__try_delete_empty_ref_hierarchie(
|
|
1334
1375
|
|
1335
1376
|
git_buf_truncate(&relative_path, commonlen);
|
1336
1377
|
|
1337
|
-
if (
|
1338
|
-
if (git_buf_join3(&base_path, '/', backend->commonpath,
|
1378
|
+
if (prefix) {
|
1379
|
+
if (git_buf_join3(&base_path, '/', backend->commonpath, prefix, git_buf_cstr(&relative_path)) < 0)
|
1339
1380
|
goto cleanup;
|
1340
1381
|
} else {
|
1341
1382
|
if (git_buf_joinpath(&base_path, backend->commonpath, git_buf_cstr(&relative_path)) < 0)
|
@@ -1355,7 +1396,7 @@ static int refdb_fs_backend__delete(
|
|
1355
1396
|
const char *ref_name,
|
1356
1397
|
const git_oid *old_id, const char *old_target)
|
1357
1398
|
{
|
1358
|
-
refdb_fs_backend *backend = (refdb_fs_backend
|
1399
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1359
1400
|
git_filebuf file = GIT_FILEBUF_INIT;
|
1360
1401
|
int error = 0;
|
1361
1402
|
|
@@ -1372,17 +1413,34 @@ static int refdb_fs_backend__delete(
|
|
1372
1413
|
return refdb_fs_backend__delete_tail(_backend, &file, ref_name, old_id, old_target);
|
1373
1414
|
}
|
1374
1415
|
|
1416
|
+
static int loose_delete(refdb_fs_backend *backend, const char *ref_name)
|
1417
|
+
{
|
1418
|
+
git_buf loose_path = GIT_BUF_INIT;
|
1419
|
+
int error = 0;
|
1420
|
+
|
1421
|
+
if (git_buf_joinpath(&loose_path, backend->commonpath, ref_name) < 0)
|
1422
|
+
return -1;
|
1423
|
+
|
1424
|
+
error = p_unlink(loose_path.ptr);
|
1425
|
+
if (error < 0 && errno == ENOENT)
|
1426
|
+
error = GIT_ENOTFOUND;
|
1427
|
+
else if (error != 0)
|
1428
|
+
error = -1;
|
1429
|
+
|
1430
|
+
git_buf_dispose(&loose_path);
|
1431
|
+
|
1432
|
+
return error;
|
1433
|
+
}
|
1434
|
+
|
1375
1435
|
static int refdb_fs_backend__delete_tail(
|
1376
1436
|
git_refdb_backend *_backend,
|
1377
1437
|
git_filebuf *file,
|
1378
1438
|
const char *ref_name,
|
1379
1439
|
const git_oid *old_id, const char *old_target)
|
1380
1440
|
{
|
1381
|
-
refdb_fs_backend *backend = (refdb_fs_backend
|
1382
|
-
git_buf loose_path = GIT_BUF_INIT;
|
1383
|
-
size_t pack_pos;
|
1441
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1384
1442
|
int error = 0, cmp = 0;
|
1385
|
-
bool
|
1443
|
+
bool packed_deleted = 0;
|
1386
1444
|
|
1387
1445
|
error = cmp_old_ref(&cmp, _backend, ref_name, old_id, old_target);
|
1388
1446
|
if (error < 0)
|
@@ -1394,44 +1452,41 @@ static int refdb_fs_backend__delete_tail(
|
|
1394
1452
|
goto cleanup;
|
1395
1453
|
}
|
1396
1454
|
|
1397
|
-
/*
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1455
|
+
/*
|
1456
|
+
* To ensure that an external observer will see either the current ref value
|
1457
|
+
* (because the loose ref still exists), or a missing ref (after the packed-file is
|
1458
|
+
* unlocked, there will be nothing left), we must ensure things happen in the
|
1459
|
+
* following order:
|
1460
|
+
*
|
1461
|
+
* - the packed-ref file is locked and loaded, as well as a loose one, if it exists
|
1462
|
+
* - we optimistically delete a packed ref, keeping track of whether it existed
|
1463
|
+
* - we delete the loose ref, note that we have its .lock
|
1464
|
+
* - the loose ref is "unlocked", then the packed-ref file is rewritten and unlocked
|
1465
|
+
* - we should prune the path components if a loose ref was deleted
|
1466
|
+
*
|
1467
|
+
* Note that, because our packed backend doesn't expose its filesystem lock,
|
1468
|
+
* we might not be able to guarantee that this is what actually happens (ie.
|
1469
|
+
* as our current code never write packed-refs.lock, nothing stops observers
|
1470
|
+
* from grabbing a "stale" value from there).
|
1471
|
+
*/
|
1472
|
+
if ((error = packed_delete(backend, ref_name)) < 0 && error != GIT_ENOTFOUND)
|
1406
1473
|
goto cleanup;
|
1407
|
-
else if (error == 0)
|
1408
|
-
loose_deleted = 1;
|
1409
1474
|
|
1410
|
-
if (
|
1411
|
-
|
1475
|
+
if (error == 0)
|
1476
|
+
packed_deleted = 1;
|
1412
1477
|
|
1413
|
-
|
1414
|
-
if ((error = git_sortedcache_wlock(backend->refcache)) < 0)
|
1478
|
+
if ((error = loose_delete(backend, ref_name)) < 0 && error != GIT_ENOTFOUND)
|
1415
1479
|
goto cleanup;
|
1416
1480
|
|
1417
|
-
if (!(error = git_sortedcache_lookup_index(
|
1418
|
-
&pack_pos, backend->refcache, ref_name)))
|
1419
|
-
error = git_sortedcache_remove(backend->refcache, pack_pos);
|
1420
|
-
|
1421
|
-
git_sortedcache_wunlock(backend->refcache);
|
1422
|
-
|
1423
1481
|
if (error == GIT_ENOTFOUND) {
|
1424
|
-
error =
|
1482
|
+
error = packed_deleted ? 0 : ref_error_notfound(ref_name);
|
1425
1483
|
goto cleanup;
|
1426
1484
|
}
|
1427
1485
|
|
1428
|
-
error = packed_write(backend);
|
1429
|
-
|
1430
1486
|
cleanup:
|
1431
|
-
git_buf_dispose(&loose_path);
|
1432
1487
|
git_filebuf_cleanup(file);
|
1433
|
-
if (
|
1434
|
-
|
1488
|
+
if (error == 0)
|
1489
|
+
refdb_fs_backend__prune_refs(backend, ref_name, "");
|
1435
1490
|
return error;
|
1436
1491
|
}
|
1437
1492
|
|
@@ -1446,8 +1501,8 @@ static int refdb_fs_backend__rename(
|
|
1446
1501
|
const git_signature *who,
|
1447
1502
|
const char *message)
|
1448
1503
|
{
|
1449
|
-
refdb_fs_backend *backend = (refdb_fs_backend
|
1450
|
-
git_reference *old, *new;
|
1504
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1505
|
+
git_reference *old, *new = NULL;
|
1451
1506
|
git_filebuf file = GIT_FILEBUF_INIT;
|
1452
1507
|
int error;
|
1453
1508
|
|
@@ -1463,7 +1518,7 @@ static int refdb_fs_backend__rename(
|
|
1463
1518
|
return error;
|
1464
1519
|
}
|
1465
1520
|
|
1466
|
-
new =
|
1521
|
+
new = git_reference__realloc(&old, new_name);
|
1467
1522
|
if (!new) {
|
1468
1523
|
git_reference_free(old);
|
1469
1524
|
return -1;
|
@@ -1502,7 +1557,7 @@ static int refdb_fs_backend__rename(
|
|
1502
1557
|
static int refdb_fs_backend__compress(git_refdb_backend *_backend)
|
1503
1558
|
{
|
1504
1559
|
int error;
|
1505
|
-
refdb_fs_backend *backend = (refdb_fs_backend
|
1560
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1506
1561
|
|
1507
1562
|
assert(backend);
|
1508
1563
|
|
@@ -1516,7 +1571,7 @@ static int refdb_fs_backend__compress(git_refdb_backend *_backend)
|
|
1516
1571
|
|
1517
1572
|
static void refdb_fs_backend__free(git_refdb_backend *_backend)
|
1518
1573
|
{
|
1519
|
-
refdb_fs_backend *backend = (refdb_fs_backend
|
1574
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1520
1575
|
|
1521
1576
|
assert(backend);
|
1522
1577
|
|
@@ -1597,70 +1652,57 @@ static int reflog_alloc(git_reflog **reflog, const char *name)
|
|
1597
1652
|
|
1598
1653
|
static int reflog_parse(git_reflog *log, const char *buf, size_t buf_size)
|
1599
1654
|
{
|
1600
|
-
|
1601
|
-
git_reflog_entry *entry;
|
1602
|
-
|
1603
|
-
#define seek_forward(_increase) do { \
|
1604
|
-
if (_increase >= buf_size) { \
|
1605
|
-
git_error_set(GIT_ERROR_INVALID, "ran out of data while parsing reflog"); \
|
1606
|
-
goto fail; \
|
1607
|
-
} \
|
1608
|
-
buf += _increase; \
|
1609
|
-
buf_size -= _increase; \
|
1610
|
-
} while (0)
|
1611
|
-
|
1612
|
-
while (buf_size > GIT_REFLOG_SIZE_MIN) {
|
1613
|
-
entry = git__calloc(1, sizeof(git_reflog_entry));
|
1614
|
-
GIT_ERROR_CHECK_ALLOC(entry);
|
1655
|
+
git_parse_ctx parser = GIT_PARSE_CTX_INIT;
|
1615
1656
|
|
1616
|
-
|
1617
|
-
|
1657
|
+
if ((git_parse_ctx_init(&parser, buf, buf_size)) < 0)
|
1658
|
+
return -1;
|
1618
1659
|
|
1619
|
-
|
1620
|
-
|
1621
|
-
|
1660
|
+
for (; parser.remain_len; git_parse_advance_line(&parser)) {
|
1661
|
+
git_reflog_entry *entry;
|
1662
|
+
const char *sig;
|
1663
|
+
char c;
|
1622
1664
|
|
1623
|
-
|
1624
|
-
|
1625
|
-
|
1665
|
+
entry = git__calloc(1, sizeof(*entry));
|
1666
|
+
GIT_ERROR_CHECK_ALLOC(entry);
|
1667
|
+
entry->committer = git__calloc(1, sizeof(*entry->committer));
|
1668
|
+
GIT_ERROR_CHECK_ALLOC(entry->committer);
|
1626
1669
|
|
1627
|
-
|
1670
|
+
if (git_parse_advance_oid(&entry->oid_old, &parser) < 0 ||
|
1671
|
+
git_parse_advance_expected(&parser, " ", 1) < 0 ||
|
1672
|
+
git_parse_advance_oid(&entry->oid_cur, &parser) < 0)
|
1673
|
+
goto next;
|
1628
1674
|
|
1629
|
-
|
1630
|
-
while (
|
1631
|
-
|
1675
|
+
sig = parser.line;
|
1676
|
+
while (git_parse_peek(&c, &parser, 0) == 0 && c != '\t' && c != '\n')
|
1677
|
+
git_parse_advance_chars(&parser, 1);
|
1632
1678
|
|
1633
|
-
if (git_signature__parse(entry->committer, &
|
1634
|
-
goto
|
1679
|
+
if (git_signature__parse(entry->committer, &sig, parser.line, NULL, 0) < 0)
|
1680
|
+
goto next;
|
1635
1681
|
|
1636
|
-
if (
|
1637
|
-
|
1638
|
-
|
1639
|
-
ptr = buf;
|
1682
|
+
if (c == '\t') {
|
1683
|
+
size_t len;
|
1684
|
+
git_parse_advance_chars(&parser, 1);
|
1640
1685
|
|
1641
|
-
|
1642
|
-
|
1686
|
+
len = parser.line_len;
|
1687
|
+
if (parser.line[len - 1] == '\n')
|
1688
|
+
len--;
|
1643
1689
|
|
1644
|
-
entry->msg = git__strndup(
|
1690
|
+
entry->msg = git__strndup(parser.line, len);
|
1645
1691
|
GIT_ERROR_CHECK_ALLOC(entry->msg);
|
1646
|
-
}
|
1647
|
-
entry->msg = NULL;
|
1692
|
+
}
|
1648
1693
|
|
1649
|
-
|
1650
|
-
|
1694
|
+
if ((git_vector_insert(&log->entries, entry)) < 0) {
|
1695
|
+
git_reflog_entry__free(entry);
|
1696
|
+
return -1;
|
1697
|
+
}
|
1651
1698
|
|
1652
|
-
|
1653
|
-
|
1699
|
+
continue;
|
1700
|
+
|
1701
|
+
next:
|
1702
|
+
git_reflog_entry__free(entry);
|
1654
1703
|
}
|
1655
1704
|
|
1656
1705
|
return 0;
|
1657
|
-
|
1658
|
-
#undef seek_forward
|
1659
|
-
|
1660
|
-
fail:
|
1661
|
-
git_reflog_entry__free(entry);
|
1662
|
-
|
1663
|
-
return -1;
|
1664
1706
|
}
|
1665
1707
|
|
1666
1708
|
static int create_new_reflog_file(const char *filepath)
|
@@ -1694,7 +1736,7 @@ static int refdb_reflog_fs__ensure_log(git_refdb_backend *_backend, const char *
|
|
1694
1736
|
|
1695
1737
|
assert(_backend && name);
|
1696
1738
|
|
1697
|
-
backend = (refdb_fs_backend
|
1739
|
+
backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1698
1740
|
repo = backend->repo;
|
1699
1741
|
|
1700
1742
|
if ((error = retrieve_reflog_path(&path, repo, name)) < 0)
|
@@ -1727,7 +1769,7 @@ static int refdb_reflog_fs__has_log(git_refdb_backend *_backend, const char *nam
|
|
1727
1769
|
|
1728
1770
|
assert(_backend && name);
|
1729
1771
|
|
1730
|
-
backend = (refdb_fs_backend
|
1772
|
+
backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1731
1773
|
|
1732
1774
|
return has_reflog(backend->repo, name);
|
1733
1775
|
}
|
@@ -1743,7 +1785,7 @@ static int refdb_reflog_fs__read(git_reflog **out, git_refdb_backend *_backend,
|
|
1743
1785
|
|
1744
1786
|
assert(out && _backend && name);
|
1745
1787
|
|
1746
|
-
backend = (refdb_fs_backend
|
1788
|
+
backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1747
1789
|
repo = backend->repo;
|
1748
1790
|
|
1749
1791
|
if (reflog_alloc(&log, name) < 0)
|
@@ -1802,8 +1844,15 @@ static int serialize_reflog_entry(
|
|
1802
1844
|
git_buf_rtrim(buf);
|
1803
1845
|
|
1804
1846
|
if (msg) {
|
1847
|
+
size_t i;
|
1848
|
+
|
1805
1849
|
git_buf_putc(buf, '\t');
|
1806
1850
|
git_buf_puts(buf, msg);
|
1851
|
+
|
1852
|
+
for (i = 0; i < buf->size - 2; i++)
|
1853
|
+
if (buf->ptr[i] == '\n')
|
1854
|
+
buf->ptr[i] = ' ';
|
1855
|
+
git_buf_rtrim(buf);
|
1807
1856
|
}
|
1808
1857
|
|
1809
1858
|
git_buf_putc(buf, '\n');
|
@@ -1853,7 +1902,7 @@ static int refdb_reflog_fs__write(git_refdb_backend *_backend, git_reflog *reflo
|
|
1853
1902
|
|
1854
1903
|
assert(_backend && reflog);
|
1855
1904
|
|
1856
|
-
backend = (refdb_fs_backend
|
1905
|
+
backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1857
1906
|
|
1858
1907
|
if ((error = lock_reflog(&fbuf, backend, reflog->ref_name)) < 0)
|
1859
1908
|
return -1;
|
@@ -1894,7 +1943,7 @@ static int reflog_append(refdb_fs_backend *backend, const git_reference *ref, co
|
|
1894
1943
|
!(old && new))
|
1895
1944
|
return 0;
|
1896
1945
|
|
1897
|
-
/* From here on
|
1946
|
+
/* From here on is_symbolic also means that it's HEAD */
|
1898
1947
|
|
1899
1948
|
if (old) {
|
1900
1949
|
git_oid_cpy(&old_id, old);
|
@@ -1975,7 +2024,7 @@ static int refdb_reflog_fs__rename(git_refdb_backend *_backend, const char *old_
|
|
1975
2024
|
|
1976
2025
|
assert(_backend && old_name && new_name);
|
1977
2026
|
|
1978
|
-
backend = (refdb_fs_backend
|
2027
|
+
backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1979
2028
|
repo = backend->repo;
|
1980
2029
|
|
1981
2030
|
if ((error = git_reference__normalize_name(
|
@@ -2046,7 +2095,7 @@ cleanup:
|
|
2046
2095
|
|
2047
2096
|
static int refdb_reflog_fs__delete(git_refdb_backend *_backend, const char *name)
|
2048
2097
|
{
|
2049
|
-
refdb_fs_backend *backend = (refdb_fs_backend
|
2098
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
2050
2099
|
git_buf path = GIT_BUF_INIT;
|
2051
2100
|
int error;
|
2052
2101
|
|
@@ -2061,7 +2110,7 @@ static int refdb_reflog_fs__delete(git_refdb_backend *_backend, const char *name
|
|
2061
2110
|
if ((error = p_unlink(path.ptr)) < 0)
|
2062
2111
|
goto out;
|
2063
2112
|
|
2064
|
-
|
2113
|
+
refdb_fs_backend__prune_refs(backend, name, GIT_REFLOG_DIR);
|
2065
2114
|
|
2066
2115
|
out:
|
2067
2116
|
git_buf_dispose(&path);
|
@@ -2080,6 +2129,9 @@ int git_refdb_backend_fs(
|
|
2080
2129
|
backend = git__calloc(1, sizeof(refdb_fs_backend));
|
2081
2130
|
GIT_ERROR_CHECK_ALLOC(backend);
|
2082
2131
|
|
2132
|
+
if (git_refdb_init_backend(&backend->parent, GIT_REFDB_BACKEND_VERSION) < 0)
|
2133
|
+
goto fail;
|
2134
|
+
|
2083
2135
|
backend->repo = repository;
|
2084
2136
|
|
2085
2137
|
if (repository->gitdir) {
|
@@ -2104,15 +2156,15 @@ int git_refdb_backend_fs(
|
|
2104
2156
|
|
2105
2157
|
git_buf_dispose(&gitpath);
|
2106
2158
|
|
2107
|
-
if (!
|
2159
|
+
if (!git_repository__configmap_lookup(&t, backend->repo, GIT_CONFIGMAP_IGNORECASE) && t) {
|
2108
2160
|
backend->iterator_flags |= GIT_ITERATOR_IGNORE_CASE;
|
2109
2161
|
backend->direach_flags |= GIT_PATH_DIR_IGNORE_CASE;
|
2110
2162
|
}
|
2111
|
-
if (!
|
2163
|
+
if (!git_repository__configmap_lookup(&t, backend->repo, GIT_CONFIGMAP_PRECOMPOSE) && t) {
|
2112
2164
|
backend->iterator_flags |= GIT_ITERATOR_PRECOMPOSE_UNICODE;
|
2113
2165
|
backend->direach_flags |= GIT_PATH_DIR_PRECOMPOSE_UNICODE;
|
2114
2166
|
}
|
2115
|
-
if ((!
|
2167
|
+
if ((!git_repository__configmap_lookup(&t, backend->repo, GIT_CONFIGMAP_FSYNCOBJECTFILES) && t) ||
|
2116
2168
|
git_repository__fsync_gitdir)
|
2117
2169
|
backend->fsync = 1;
|
2118
2170
|
backend->iterator_flags |= GIT_ITERATOR_DESCEND_SYMLINKS;
|