rugged 0.28.5 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/ext/rugged/extconf.rb +3 -1
- data/ext/rugged/rugged.c +35 -31
- data/ext/rugged/rugged.h +13 -0
- data/ext/rugged/rugged_blob.c +11 -9
- data/ext/rugged/rugged_commit.c +18 -16
- data/ext/rugged/rugged_config.c +1 -1
- data/ext/rugged/rugged_diff.c +4 -26
- data/ext/rugged/rugged_index.c +4 -2
- data/ext/rugged/rugged_note.c +5 -3
- data/ext/rugged/rugged_object.c +57 -10
- data/ext/rugged/rugged_rebase.c +3 -1
- data/ext/rugged/rugged_remote.c +32 -8
- data/ext/rugged/rugged_repo.c +232 -17
- data/ext/rugged/rugged_tag.c +8 -6
- data/ext/rugged/rugged_tree.c +18 -16
- data/lib/rugged/commit.rb +17 -4
- data/lib/rugged/repository.rb +5 -6
- data/lib/rugged/submodule_collection.rb +4 -4
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +57 -75
- data/vendor/libgit2/COPYING +28 -0
- data/vendor/libgit2/cmake/{Modules/AddCFlagIfSupported.cmake → AddCFlagIfSupported.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/EnableWarnings.cmake → EnableWarnings.cmake} +5 -1
- data/vendor/libgit2/cmake/{Modules/FindCoreFoundation.cmake → FindCoreFoundation.cmake} +2 -2
- data/vendor/libgit2/cmake/{Modules/FindGSSAPI.cmake → FindGSSAPI.cmake} +1 -1
- data/vendor/libgit2/cmake/FindGSSFramework.cmake +28 -0
- data/vendor/libgit2/cmake/{Modules/FindHTTP_Parser.cmake → FindHTTP_Parser.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindIconv.cmake → FindIconv.cmake} +0 -0
- data/vendor/libgit2/cmake/FindPCRE.cmake +38 -0
- data/vendor/libgit2/cmake/FindPCRE2.cmake +37 -0
- data/vendor/libgit2/cmake/{Modules/FindPkgLibraries.cmake → FindPkgLibraries.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindSecurity.cmake → FindSecurity.cmake} +2 -2
- data/vendor/libgit2/cmake/{Modules/FindStatNsec.cmake → FindStatNsec.cmake} +6 -0
- data/vendor/libgit2/cmake/{Modules/FindmbedTLS.cmake → FindmbedTLS.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/IdeSplitSources.cmake → IdeSplitSources.cmake} +0 -0
- data/vendor/libgit2/cmake/PkgBuildConfig.cmake +77 -0
- data/vendor/libgit2/cmake/SanitizeBool.cmake +20 -0
- data/vendor/libgit2/cmake/SelectGSSAPI.cmake +48 -0
- data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +120 -0
- data/vendor/libgit2/cmake/SelectHashes.cmake +61 -0
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +4 -3
- data/vendor/libgit2/deps/http-parser/http_parser.c +11 -6
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +25 -0
- data/vendor/libgit2/deps/ntlmclient/compat.h +28 -0
- data/vendor/libgit2/deps/ntlmclient/crypt.h +64 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +120 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +18 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +145 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +18 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +130 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +21 -0
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +1419 -0
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +174 -0
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +320 -0
- data/vendor/libgit2/deps/ntlmclient/unicode.h +36 -0
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +445 -0
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +201 -0
- data/vendor/libgit2/deps/ntlmclient/utf8.h +1257 -0
- data/vendor/libgit2/deps/ntlmclient/util.c +35 -0
- data/vendor/libgit2/deps/ntlmclient/util.h +15 -0
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +140 -0
- data/vendor/libgit2/deps/pcre/COPYING +5 -0
- data/vendor/libgit2/deps/pcre/LICENCE +93 -0
- data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +22 -0
- data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +17 -0
- data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +58 -0
- data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +29 -0
- data/vendor/libgit2/deps/pcre/config.h.in +57 -0
- data/vendor/libgit2/deps/pcre/pcre.h +641 -0
- data/vendor/libgit2/deps/pcre/pcre_byte_order.c +319 -0
- data/vendor/libgit2/deps/pcre/pcre_chartables.c +198 -0
- data/vendor/libgit2/deps/pcre/pcre_compile.c +9812 -0
- data/vendor/libgit2/deps/pcre/pcre_config.c +190 -0
- data/vendor/libgit2/deps/pcre/pcre_dfa_exec.c +3676 -0
- data/vendor/libgit2/deps/pcre/pcre_exec.c +7173 -0
- data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +245 -0
- data/vendor/libgit2/deps/pcre/pcre_get.c +669 -0
- data/vendor/libgit2/deps/pcre/pcre_globals.c +86 -0
- data/vendor/libgit2/deps/pcre/pcre_internal.h +2787 -0
- data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +11913 -0
- data/vendor/libgit2/deps/pcre/pcre_maketables.c +156 -0
- data/vendor/libgit2/deps/pcre/pcre_newline.c +210 -0
- data/vendor/libgit2/deps/pcre/pcre_ord2utf8.c +94 -0
- data/vendor/libgit2/deps/pcre/pcre_printint.c +834 -0
- data/vendor/libgit2/deps/pcre/pcre_refcount.c +92 -0
- data/vendor/libgit2/deps/pcre/pcre_string_utils.c +211 -0
- data/vendor/libgit2/deps/pcre/pcre_study.c +1686 -0
- data/vendor/libgit2/deps/pcre/pcre_tables.c +727 -0
- data/vendor/libgit2/deps/pcre/pcre_ucd.c +3644 -0
- data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +301 -0
- data/vendor/libgit2/deps/pcre/pcre_version.c +98 -0
- data/vendor/libgit2/deps/pcre/pcre_xclass.c +268 -0
- data/vendor/libgit2/deps/pcre/pcreposix.c +420 -0
- data/vendor/libgit2/deps/pcre/pcreposix.h +117 -0
- data/vendor/libgit2/deps/pcre/ucp.h +224 -0
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +6 -5
- data/vendor/libgit2/deps/zlib/adler32.c +0 -7
- data/vendor/libgit2/deps/zlib/crc32.c +0 -7
- data/vendor/libgit2/deps/zlib/deflate.c +1 -0
- data/vendor/libgit2/include/git2.h +2 -0
- data/vendor/libgit2/include/git2/annotated_commit.h +1 -1
- data/vendor/libgit2/include/git2/apply.h +24 -2
- data/vendor/libgit2/include/git2/attr.h +23 -13
- data/vendor/libgit2/include/git2/blame.h +4 -2
- data/vendor/libgit2/include/git2/blob.h +61 -13
- data/vendor/libgit2/include/git2/branch.h +74 -57
- data/vendor/libgit2/include/git2/buffer.h +20 -14
- data/vendor/libgit2/include/git2/cert.h +135 -0
- data/vendor/libgit2/include/git2/checkout.h +46 -14
- data/vendor/libgit2/include/git2/cherrypick.h +3 -3
- data/vendor/libgit2/include/git2/clone.h +2 -2
- data/vendor/libgit2/include/git2/commit.h +23 -1
- data/vendor/libgit2/include/git2/common.h +34 -8
- data/vendor/libgit2/include/git2/config.h +13 -13
- data/vendor/libgit2/include/git2/cred_helpers.h +4 -42
- data/vendor/libgit2/include/git2/credential.h +314 -0
- data/vendor/libgit2/include/git2/credential_helpers.h +52 -0
- data/vendor/libgit2/include/git2/deprecated.h +362 -4
- data/vendor/libgit2/include/git2/describe.h +4 -4
- data/vendor/libgit2/include/git2/diff.h +17 -15
- data/vendor/libgit2/include/git2/errors.h +5 -2
- data/vendor/libgit2/include/git2/filter.h +8 -0
- data/vendor/libgit2/include/git2/index.h +5 -5
- data/vendor/libgit2/include/git2/indexer.h +49 -4
- data/vendor/libgit2/include/git2/merge.h +6 -10
- data/vendor/libgit2/include/git2/net.h +0 -5
- data/vendor/libgit2/include/git2/object.h +2 -14
- data/vendor/libgit2/include/git2/odb.h +18 -22
- data/vendor/libgit2/include/git2/odb_backend.h +5 -4
- data/vendor/libgit2/include/git2/oid.h +11 -6
- data/vendor/libgit2/include/git2/pack.h +13 -2
- data/vendor/libgit2/include/git2/proxy.h +6 -4
- data/vendor/libgit2/include/git2/rebase.h +46 -2
- data/vendor/libgit2/include/git2/refs.h +22 -3
- data/vendor/libgit2/include/git2/remote.h +40 -15
- data/vendor/libgit2/include/git2/repository.h +124 -58
- data/vendor/libgit2/include/git2/revert.h +1 -1
- data/vendor/libgit2/include/git2/revwalk.h +7 -3
- data/vendor/libgit2/include/git2/stash.h +4 -4
- data/vendor/libgit2/include/git2/status.h +25 -16
- data/vendor/libgit2/include/git2/strarray.h +6 -10
- data/vendor/libgit2/include/git2/submodule.h +20 -3
- data/vendor/libgit2/include/git2/sys/alloc.h +9 -9
- data/vendor/libgit2/include/git2/sys/cred.h +15 -0
- data/vendor/libgit2/include/git2/sys/credential.h +90 -0
- data/vendor/libgit2/include/git2/sys/index.h +4 -2
- data/vendor/libgit2/include/git2/sys/mempack.h +2 -1
- data/vendor/libgit2/include/git2/sys/merge.h +1 -1
- data/vendor/libgit2/include/git2/sys/odb_backend.h +48 -4
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +164 -21
- data/vendor/libgit2/include/git2/sys/repository.h +17 -6
- data/vendor/libgit2/include/git2/sys/transport.h +4 -4
- data/vendor/libgit2/include/git2/tag.h +11 -2
- data/vendor/libgit2/include/git2/trace.h +2 -2
- data/vendor/libgit2/include/git2/transport.h +11 -340
- data/vendor/libgit2/include/git2/tree.h +7 -3
- data/vendor/libgit2/include/git2/types.h +4 -89
- data/vendor/libgit2/include/git2/version.h +5 -5
- data/vendor/libgit2/include/git2/worktree.h +5 -5
- data/vendor/libgit2/src/CMakeLists.txt +147 -272
- data/vendor/libgit2/src/alloc.c +2 -14
- data/vendor/libgit2/src/{stdalloc.c → allocators/stdalloc.c} +3 -4
- data/vendor/libgit2/src/{stdalloc.h → allocators/stdalloc.h} +4 -4
- data/vendor/libgit2/src/allocators/win32_crtdbg.c +118 -0
- data/vendor/libgit2/src/{transports/cred.h → allocators/win32_crtdbg.h} +5 -4
- data/vendor/libgit2/src/apply.c +36 -16
- data/vendor/libgit2/src/assert_safe.h +58 -0
- data/vendor/libgit2/src/attr.c +70 -64
- data/vendor/libgit2/src/attr_file.c +197 -99
- data/vendor/libgit2/src/attr_file.h +9 -9
- data/vendor/libgit2/src/attrcache.c +48 -49
- data/vendor/libgit2/src/attrcache.h +2 -1
- data/vendor/libgit2/src/blame.c +34 -15
- data/vendor/libgit2/src/blame.h +1 -1
- data/vendor/libgit2/src/blame_git.c +27 -10
- data/vendor/libgit2/src/blob.c +92 -17
- data/vendor/libgit2/src/blob.h +2 -2
- data/vendor/libgit2/src/branch.c +68 -42
- data/vendor/libgit2/src/buffer.c +11 -3
- data/vendor/libgit2/src/buffer.h +1 -0
- data/vendor/libgit2/src/cache.c +34 -58
- data/vendor/libgit2/src/cache.h +1 -1
- data/vendor/libgit2/src/cc-compat.h +5 -0
- data/vendor/libgit2/src/checkout.c +73 -86
- data/vendor/libgit2/src/cherrypick.c +9 -1
- data/vendor/libgit2/src/clone.c +130 -27
- data/vendor/libgit2/src/clone.h +4 -0
- data/vendor/libgit2/src/commit.c +70 -22
- data/vendor/libgit2/src/commit.h +6 -0
- data/vendor/libgit2/src/commit_list.c +28 -76
- data/vendor/libgit2/src/commit_list.h +2 -2
- data/vendor/libgit2/src/common.h +4 -75
- data/vendor/libgit2/src/config.c +34 -47
- data/vendor/libgit2/src/config.h +7 -6
- data/vendor/libgit2/src/config_backend.h +12 -0
- data/vendor/libgit2/src/config_cache.c +42 -39
- data/vendor/libgit2/src/config_entries.c +76 -98
- data/vendor/libgit2/src/config_entries.h +1 -0
- data/vendor/libgit2/src/config_file.c +346 -380
- data/vendor/libgit2/src/config_mem.c +12 -16
- data/vendor/libgit2/src/config_parse.c +50 -30
- data/vendor/libgit2/src/config_parse.h +13 -12
- data/vendor/libgit2/src/config_snapshot.c +207 -0
- data/vendor/libgit2/src/crlf.c +14 -14
- data/vendor/libgit2/src/describe.c +26 -21
- data/vendor/libgit2/src/diff.c +53 -75
- data/vendor/libgit2/src/diff.h +4 -3
- data/vendor/libgit2/src/diff_driver.c +37 -38
- data/vendor/libgit2/src/diff_file.c +15 -11
- data/vendor/libgit2/src/diff_file.h +2 -2
- data/vendor/libgit2/src/diff_generate.c +36 -37
- data/vendor/libgit2/src/diff_generate.h +2 -2
- data/vendor/libgit2/src/diff_parse.c +3 -4
- data/vendor/libgit2/src/diff_print.c +86 -71
- data/vendor/libgit2/src/diff_stats.c +13 -12
- data/vendor/libgit2/src/diff_tform.c +15 -16
- data/vendor/libgit2/src/errors.c +23 -25
- data/vendor/libgit2/src/errors.h +81 -0
- data/vendor/libgit2/src/features.h.in +9 -2
- data/vendor/libgit2/src/fetch.c +9 -2
- data/vendor/libgit2/src/fetchhead.c +9 -9
- data/vendor/libgit2/src/filebuf.c +1 -1
- data/vendor/libgit2/src/filebuf.h +1 -1
- data/vendor/libgit2/src/filter.c +19 -11
- data/vendor/libgit2/src/{fileops.c → futils.c} +23 -20
- data/vendor/libgit2/src/{fileops.h → futils.h} +8 -8
- data/vendor/libgit2/src/global.c +3 -1
- data/vendor/libgit2/src/hash.c +61 -0
- data/vendor/libgit2/src/hash.h +19 -21
- data/vendor/libgit2/src/hash/sha1.h +38 -0
- data/vendor/libgit2/src/hash/{hash_collisiondetect.h → sha1/collisiondetect.c} +14 -17
- data/vendor/libgit2/src/{sha1_lookup.h → hash/sha1/collisiondetect.h} +8 -8
- data/vendor/libgit2/src/hash/{hash_common_crypto.h → sha1/common_crypto.c} +15 -19
- data/vendor/libgit2/src/hash/sha1/common_crypto.h +19 -0
- data/vendor/libgit2/src/hash/{hash_generic.c → sha1/generic.c} +22 -10
- data/vendor/libgit2/src/hash/{hash_generic.h → sha1/generic.h} +4 -14
- data/vendor/libgit2/src/hash/{hash_mbedtls.c → sha1/mbedtls.c} +15 -7
- data/vendor/libgit2/src/hash/{hash_mbedtls.h → sha1/mbedtls.h} +6 -11
- data/vendor/libgit2/src/hash/{hash_openssl.h → sha1/openssl.c} +14 -18
- data/vendor/libgit2/src/{refdb_fs.h → hash/sha1/openssl.h} +8 -8
- data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/sha1.c +14 -3
- data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/sha1.h +0 -0
- data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/ubc_check.c +0 -0
- data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/ubc_check.h +0 -0
- data/vendor/libgit2/src/hash/{hash_win32.c → sha1/win32.c} +34 -24
- data/vendor/libgit2/src/hash/{hash_win32.h → sha1/win32.h} +6 -19
- data/vendor/libgit2/src/hashsig.c +1 -1
- data/vendor/libgit2/src/idxmap.c +73 -69
- data/vendor/libgit2/src/idxmap.h +151 -15
- data/vendor/libgit2/src/ignore.c +26 -35
- data/vendor/libgit2/src/index.c +123 -95
- data/vendor/libgit2/src/index.h +1 -1
- data/vendor/libgit2/src/indexer.c +99 -78
- data/vendor/libgit2/src/integer.h +26 -4
- data/vendor/libgit2/src/iterator.c +36 -32
- data/vendor/libgit2/src/iterator.h +8 -8
- data/vendor/libgit2/src/map.h +1 -1
- data/vendor/libgit2/src/merge.c +93 -57
- data/vendor/libgit2/src/merge.h +2 -2
- data/vendor/libgit2/src/merge_driver.c +5 -5
- data/vendor/libgit2/src/merge_file.c +5 -7
- data/vendor/libgit2/src/midx.c +418 -0
- data/vendor/libgit2/src/midx.h +83 -0
- data/vendor/libgit2/src/mwindow.c +144 -74
- data/vendor/libgit2/src/mwindow.h +4 -4
- data/vendor/libgit2/src/net.c +416 -0
- data/vendor/libgit2/src/net.h +57 -0
- data/vendor/libgit2/src/netops.c +6 -222
- data/vendor/libgit2/src/netops.h +1 -37
- data/vendor/libgit2/src/notes.c +8 -5
- data/vendor/libgit2/src/object.c +5 -4
- data/vendor/libgit2/src/object.h +2 -0
- data/vendor/libgit2/src/odb.c +54 -32
- data/vendor/libgit2/src/odb.h +3 -2
- data/vendor/libgit2/src/odb_loose.c +20 -13
- data/vendor/libgit2/src/odb_mempack.c +15 -24
- data/vendor/libgit2/src/odb_pack.c +4 -5
- data/vendor/libgit2/src/offmap.c +43 -55
- data/vendor/libgit2/src/offmap.h +102 -24
- data/vendor/libgit2/src/oid.c +21 -8
- data/vendor/libgit2/src/oidmap.c +39 -57
- data/vendor/libgit2/src/oidmap.h +99 -19
- data/vendor/libgit2/src/pack-objects.c +55 -52
- data/vendor/libgit2/src/pack-objects.h +1 -1
- data/vendor/libgit2/src/pack.c +160 -149
- data/vendor/libgit2/src/pack.h +32 -18
- data/vendor/libgit2/src/parse.c +10 -0
- data/vendor/libgit2/src/parse.h +3 -3
- data/vendor/libgit2/src/patch.c +1 -1
- data/vendor/libgit2/src/patch_generate.c +2 -4
- data/vendor/libgit2/src/patch_parse.c +34 -11
- data/vendor/libgit2/src/path.c +47 -10
- data/vendor/libgit2/src/path.h +2 -0
- data/vendor/libgit2/src/pathspec.c +18 -17
- data/vendor/libgit2/src/pool.c +42 -32
- data/vendor/libgit2/src/pool.h +15 -7
- data/vendor/libgit2/src/posix.c +39 -16
- data/vendor/libgit2/src/posix.h +21 -1
- data/vendor/libgit2/src/proxy.c +9 -2
- data/vendor/libgit2/src/push.c +15 -7
- data/vendor/libgit2/src/reader.c +2 -2
- data/vendor/libgit2/src/rebase.c +89 -28
- data/vendor/libgit2/src/refdb.c +147 -0
- data/vendor/libgit2/src/refdb.h +69 -0
- data/vendor/libgit2/src/refdb_fs.c +230 -241
- data/vendor/libgit2/src/reflog.c +13 -19
- data/vendor/libgit2/src/refs.c +113 -217
- data/vendor/libgit2/src/refs.h +10 -21
- data/vendor/libgit2/src/refspec.c +57 -48
- data/vendor/libgit2/src/regexp.c +221 -0
- data/vendor/libgit2/src/regexp.h +97 -0
- data/vendor/libgit2/src/remote.c +102 -79
- data/vendor/libgit2/src/remote.h +2 -2
- data/vendor/libgit2/src/repository.c +322 -203
- data/vendor/libgit2/src/repository.h +49 -57
- data/vendor/libgit2/src/revert.c +8 -1
- data/vendor/libgit2/src/revparse.c +23 -23
- data/vendor/libgit2/src/revwalk.c +73 -37
- data/vendor/libgit2/src/revwalk.h +20 -0
- data/vendor/libgit2/src/settings.c +22 -1
- data/vendor/libgit2/src/sortedcache.c +14 -29
- data/vendor/libgit2/src/sortedcache.h +1 -1
- data/vendor/libgit2/src/stash.c +49 -67
- data/vendor/libgit2/src/status.c +19 -11
- data/vendor/libgit2/src/strarray.c +63 -0
- data/vendor/libgit2/src/streams/openssl.c +66 -8
- data/vendor/libgit2/src/streams/registry.c +5 -3
- data/vendor/libgit2/src/streams/socket.c +2 -2
- data/vendor/libgit2/src/strmap.c +37 -84
- data/vendor/libgit2/src/strmap.h +105 -33
- data/vendor/libgit2/src/submodule.c +157 -130
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/sysdir.c +4 -20
- data/vendor/libgit2/src/sysdir.h +0 -11
- data/vendor/libgit2/src/tag.c +12 -2
- data/vendor/libgit2/src/thread-utils.h +163 -40
- data/vendor/libgit2/src/trace.c +1 -1
- data/vendor/libgit2/src/trace.h +3 -3
- data/vendor/libgit2/src/trailer.c +46 -32
- data/vendor/libgit2/src/transaction.c +5 -9
- data/vendor/libgit2/src/transports/auth.c +16 -15
- data/vendor/libgit2/src/transports/auth.h +18 -11
- data/vendor/libgit2/src/transports/auth_negotiate.c +64 -33
- data/vendor/libgit2/src/transports/auth_negotiate.h +2 -2
- data/vendor/libgit2/src/transports/auth_ntlm.c +223 -0
- data/vendor/libgit2/src/transports/auth_ntlm.h +38 -0
- data/vendor/libgit2/src/transports/credential.c +478 -0
- data/vendor/libgit2/src/transports/{cred_helpers.c → credential_helpers.c} +23 -8
- data/vendor/libgit2/src/transports/git.c +11 -16
- data/vendor/libgit2/src/transports/http.c +488 -1248
- data/vendor/libgit2/src/transports/http.h +4 -1
- data/vendor/libgit2/src/transports/httpclient.c +1552 -0
- data/vendor/libgit2/src/transports/httpclient.h +190 -0
- data/vendor/libgit2/src/transports/local.c +12 -12
- data/vendor/libgit2/src/transports/smart.c +21 -21
- data/vendor/libgit2/src/transports/smart.h +3 -3
- data/vendor/libgit2/src/transports/smart_protocol.c +40 -64
- data/vendor/libgit2/src/transports/ssh.c +77 -59
- data/vendor/libgit2/src/transports/winhttp.c +368 -285
- data/vendor/libgit2/src/tree-cache.c +14 -7
- data/vendor/libgit2/src/tree.c +16 -26
- data/vendor/libgit2/src/unix/map.c +1 -1
- data/vendor/libgit2/src/unix/posix.h +16 -11
- data/vendor/libgit2/src/userdiff.h +3 -1
- data/vendor/libgit2/src/util.c +75 -110
- data/vendor/libgit2/src/util.h +18 -23
- data/vendor/libgit2/src/wildmatch.c +320 -0
- data/vendor/libgit2/src/wildmatch.h +23 -0
- data/vendor/libgit2/src/win32/git2.rc +18 -3
- data/vendor/libgit2/src/win32/map.c +3 -5
- data/vendor/libgit2/src/win32/path_w32.c +42 -5
- data/vendor/libgit2/src/win32/path_w32.h +15 -29
- data/vendor/libgit2/src/win32/posix.h +1 -4
- data/vendor/libgit2/src/win32/posix_w32.c +117 -5
- data/vendor/libgit2/src/win32/precompiled.h +0 -2
- data/vendor/libgit2/src/win32/thread.c +5 -5
- data/vendor/libgit2/src/win32/w32_buffer.c +7 -3
- data/vendor/libgit2/src/win32/w32_common.h +39 -0
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +0 -93
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +0 -2
- data/vendor/libgit2/src/win32/w32_stack.c +4 -9
- data/vendor/libgit2/src/win32/w32_stack.h +3 -3
- data/vendor/libgit2/src/win32/w32_util.c +31 -0
- data/vendor/libgit2/src/win32/w32_util.h +6 -32
- data/vendor/libgit2/src/worktree.c +91 -50
- data/vendor/libgit2/src/xdiff/xdiffi.c +1 -1
- data/vendor/libgit2/src/xdiff/xmerge.c +12 -0
- data/vendor/libgit2/src/xdiff/xpatience.c +3 -0
- data/vendor/libgit2/src/zstream.c +5 -0
- data/vendor/libgit2/src/zstream.h +1 -0
- metadata +123 -53
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.c.in +0 -29
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.cmake +0 -96
- data/vendor/libgit2/deps/regex/CMakeLists.txt +0 -2
- data/vendor/libgit2/deps/regex/COPYING +0 -502
- data/vendor/libgit2/deps/regex/config.h +0 -7
- data/vendor/libgit2/deps/regex/regcomp.c +0 -3857
- data/vendor/libgit2/deps/regex/regex.c +0 -92
- data/vendor/libgit2/deps/regex/regex.h +0 -582
- data/vendor/libgit2/deps/regex/regex_internal.c +0 -1744
- data/vendor/libgit2/deps/regex/regex_internal.h +0 -819
- data/vendor/libgit2/deps/regex/regexec.c +0 -4369
- data/vendor/libgit2/include/git2/inttypes.h +0 -309
- data/vendor/libgit2/include/git2/sys/time.h +0 -31
- data/vendor/libgit2/libgit2.pc.in +0 -13
- data/vendor/libgit2/src/fnmatch.c +0 -248
- data/vendor/libgit2/src/fnmatch.h +0 -48
- data/vendor/libgit2/src/sha1_lookup.c +0 -35
- data/vendor/libgit2/src/transports/cred.c +0 -390
data/vendor/libgit2/src/refdb.h
CHANGED
@@ -30,6 +30,31 @@ int git_refdb_lookup(
|
|
30
30
|
git_refdb *refdb,
|
31
31
|
const char *ref_name);
|
32
32
|
|
33
|
+
/**
|
34
|
+
* Resolve the reference by following symbolic references.
|
35
|
+
*
|
36
|
+
* Given a reference name, this function will follow any symbolic references up
|
37
|
+
* to `max_nesting` deep and return the resolved direct reference. If any of
|
38
|
+
* the intermediate symbolic references points to a non-existing reference,
|
39
|
+
* then that symbolic reference is returned instead with an error code of `0`.
|
40
|
+
* If the given reference is a direct reference already, it is returned
|
41
|
+
* directly.
|
42
|
+
*
|
43
|
+
* If `max_nesting` is `0`, the reference will not be resolved. If it's
|
44
|
+
* negative, it will be set to the default resolve depth which is `5`.
|
45
|
+
*
|
46
|
+
* @param out Pointer to store the result in.
|
47
|
+
* @param db The refdb to use for resolving the reference.
|
48
|
+
* @param ref_name The reference name to lookup and resolve.
|
49
|
+
* @param max_nesting The maximum nesting depth.
|
50
|
+
* @return `0` on success, a negative error code otherwise.
|
51
|
+
*/
|
52
|
+
int git_refdb_resolve(
|
53
|
+
git_reference **out,
|
54
|
+
git_refdb *db,
|
55
|
+
const char *ref_name,
|
56
|
+
int max_nesting);
|
57
|
+
|
33
58
|
int git_refdb_rename(
|
34
59
|
git_reference **out,
|
35
60
|
git_refdb *db,
|
@@ -50,6 +75,50 @@ int git_refdb_delete(git_refdb *refdb, const char *ref_name, const git_oid *old_
|
|
50
75
|
int git_refdb_reflog_read(git_reflog **out, git_refdb *db, const char *name);
|
51
76
|
int git_refdb_reflog_write(git_reflog *reflog);
|
52
77
|
|
78
|
+
/**
|
79
|
+
* Determine whether a reflog entry should be created for the given reference.
|
80
|
+
*
|
81
|
+
* Whether or not writing to a reference should create a reflog entry is
|
82
|
+
* dependent on a number of things. Most importantly, there's the
|
83
|
+
* "core.logAllRefUpdates" setting that controls in which situations a
|
84
|
+
* reference should get a corresponding reflog entry. The following values for
|
85
|
+
* it are understood:
|
86
|
+
*
|
87
|
+
* - "false": Do not log reference updates.
|
88
|
+
*
|
89
|
+
* - "true": Log normal reference updates. This will write entries for
|
90
|
+
* references in "refs/heads", "refs/remotes", "refs/notes" and
|
91
|
+
* "HEAD" or if the reference already has a log entry.
|
92
|
+
*
|
93
|
+
* - "always": Always create a reflog entry.
|
94
|
+
*
|
95
|
+
* If unset, the value will default to "true" for non-bare repositories and
|
96
|
+
* "false" for bare ones.
|
97
|
+
*
|
98
|
+
* @param out pointer to which the result will be written, `1` means a reflog
|
99
|
+
* entry should be written, `0` means none should be written.
|
100
|
+
* @param db The refdb to decide this for.
|
101
|
+
* @param ref The reference one wants to check.
|
102
|
+
* @return `0` on success, a negative error code otherwise.
|
103
|
+
*/
|
104
|
+
int git_refdb_should_write_reflog(int *out, git_refdb *db, const git_reference *ref);
|
105
|
+
|
106
|
+
/**
|
107
|
+
* Determine whether a reflog entry should be created for HEAD if creating one
|
108
|
+
* for the given reference
|
109
|
+
*
|
110
|
+
* In case the given reference is being pointed to by HEAD, then creating a
|
111
|
+
* reflog entry for this reference also requires us to create a corresponding
|
112
|
+
* reflog entry for HEAD. This function can be used to determine that scenario.
|
113
|
+
*
|
114
|
+
* @param out pointer to which the result will be written, `1` means a reflog
|
115
|
+
* entry should be written, `0` means none should be written.
|
116
|
+
* @param db The refdb to decide this for.
|
117
|
+
* @param ref The reference one wants to check.
|
118
|
+
* @return `0` on success, a negative error code otherwise.
|
119
|
+
*/
|
120
|
+
int git_refdb_should_write_head_reflog(int *out, git_refdb *db, const git_reference *ref);
|
121
|
+
|
53
122
|
int git_refdb_has_log(git_refdb *db, const char *refname);
|
54
123
|
int git_refdb_ensure_log(git_refdb *refdb, const char *refname);
|
55
124
|
|
@@ -5,19 +5,19 @@
|
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
6
6
|
*/
|
7
7
|
|
8
|
-
#include "refdb_fs.h"
|
9
|
-
|
10
8
|
#include "refs.h"
|
11
9
|
#include "hash.h"
|
12
10
|
#include "repository.h"
|
13
|
-
#include "
|
11
|
+
#include "futils.h"
|
14
12
|
#include "filebuf.h"
|
15
13
|
#include "pack.h"
|
14
|
+
#include "parse.h"
|
16
15
|
#include "reflog.h"
|
17
16
|
#include "refdb.h"
|
18
17
|
#include "iterator.h"
|
19
18
|
#include "sortedcache.h"
|
20
19
|
#include "signature.h"
|
20
|
+
#include "wildmatch.h"
|
21
21
|
|
22
22
|
#include <git2/tag.h>
|
23
23
|
#include <git2/object.h>
|
@@ -254,7 +254,8 @@ static int loose_lookup_to_packfile(refdb_fs_backend *backend, const char *name)
|
|
254
254
|
if ((error = loose_parse_oid(&oid, name, &ref_file)) < 0)
|
255
255
|
goto done;
|
256
256
|
|
257
|
-
git_sortedcache_wlock(backend->refcache)
|
257
|
+
if ((error = git_sortedcache_wlock(backend->refcache)) < 0)
|
258
|
+
goto done;
|
258
259
|
|
259
260
|
if (!(error = git_sortedcache_upsert(
|
260
261
|
(void **)&ref, backend->refcache, name))) {
|
@@ -327,21 +328,33 @@ static int refdb_fs_backend__exists(
|
|
327
328
|
git_refdb_backend *_backend,
|
328
329
|
const char *ref_name)
|
329
330
|
{
|
330
|
-
refdb_fs_backend *backend = (refdb_fs_backend
|
331
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
331
332
|
git_buf ref_path = GIT_BUF_INIT;
|
332
333
|
int error;
|
333
334
|
|
334
335
|
assert(backend);
|
335
336
|
|
336
|
-
|
337
|
-
|
338
|
-
|
337
|
+
*exists = 0;
|
338
|
+
|
339
|
+
if ((error = git_buf_joinpath(&ref_path, backend->gitpath, ref_name)) < 0)
|
340
|
+
goto out;
|
341
|
+
|
342
|
+
if (git_path_isfile(ref_path.ptr)) {
|
343
|
+
*exists = 1;
|
344
|
+
goto out;
|
345
|
+
}
|
346
|
+
|
347
|
+
if ((error = packed_reload(backend)) < 0)
|
348
|
+
goto out;
|
339
349
|
|
340
|
-
|
341
|
-
|
350
|
+
if (git_sortedcache_lookup(backend->refcache, ref_name) != NULL) {
|
351
|
+
*exists = 1;
|
352
|
+
goto out;
|
353
|
+
}
|
342
354
|
|
355
|
+
out:
|
343
356
|
git_buf_dispose(&ref_path);
|
344
|
-
return
|
357
|
+
return error;
|
345
358
|
}
|
346
359
|
|
347
360
|
static const char *loose_parse_symbolic(git_buf *file_content)
|
@@ -457,7 +470,7 @@ static int refdb_fs_backend__lookup(
|
|
457
470
|
git_refdb_backend *_backend,
|
458
471
|
const char *ref_name)
|
459
472
|
{
|
460
|
-
refdb_fs_backend *backend = (refdb_fs_backend
|
473
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
461
474
|
int error;
|
462
475
|
|
463
476
|
assert(backend);
|
@@ -490,7 +503,7 @@ typedef struct {
|
|
490
503
|
|
491
504
|
static void refdb_fs_backend__iterator_free(git_reference_iterator *_iter)
|
492
505
|
{
|
493
|
-
refdb_fs_iter *iter = (refdb_fs_iter
|
506
|
+
refdb_fs_iter *iter = GIT_CONTAINER_OF(_iter, refdb_fs_iter, parent);
|
494
507
|
|
495
508
|
git_vector_free(&iter->loose);
|
496
509
|
git_pool_clear(&iter->pool);
|
@@ -552,7 +565,6 @@ static int iter_load_loose_paths(refdb_fs_backend *backend, refdb_fs_iter *iter)
|
|
552
565
|
|
553
566
|
while (!error && !git_iterator_advance(&entry, fsit)) {
|
554
567
|
const char *ref_name;
|
555
|
-
struct packref *ref;
|
556
568
|
char *ref_dup;
|
557
569
|
|
558
570
|
git_buf_truncate(&path, ref_prefix_len);
|
@@ -560,15 +572,9 @@ static int iter_load_loose_paths(refdb_fs_backend *backend, refdb_fs_iter *iter)
|
|
560
572
|
ref_name = git_buf_cstr(&path);
|
561
573
|
|
562
574
|
if (git__suffixcmp(ref_name, ".lock") == 0 ||
|
563
|
-
(iter->glob &&
|
575
|
+
(iter->glob && wildmatch(iter->glob, ref_name, 0) != 0))
|
564
576
|
continue;
|
565
577
|
|
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
578
|
ref_dup = git_pool_strdup(&iter->pool, ref_name);
|
573
579
|
if (!ref_dup)
|
574
580
|
error = -1;
|
@@ -586,24 +592,24 @@ static int refdb_fs_backend__iterator_next(
|
|
586
592
|
git_reference **out, git_reference_iterator *_iter)
|
587
593
|
{
|
588
594
|
int error = GIT_ITEROVER;
|
589
|
-
refdb_fs_iter *iter = (refdb_fs_iter
|
590
|
-
refdb_fs_backend *backend = (
|
595
|
+
refdb_fs_iter *iter = GIT_CONTAINER_OF(_iter, refdb_fs_iter, parent);
|
596
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(iter->parent.db->backend, refdb_fs_backend, parent);
|
591
597
|
struct packref *ref;
|
592
598
|
|
593
599
|
while (iter->loose_pos < iter->loose.length) {
|
594
600
|
const char *path = git_vector_get(&iter->loose, iter->loose_pos++);
|
595
601
|
|
596
|
-
if (loose_lookup(out, backend, path) == 0)
|
602
|
+
if (loose_lookup(out, backend, path) == 0) {
|
603
|
+
ref = git_sortedcache_lookup(iter->cache, path);
|
604
|
+
if (ref)
|
605
|
+
ref->flags |= PACKREF_SHADOWED;
|
606
|
+
|
597
607
|
return 0;
|
608
|
+
}
|
598
609
|
|
599
610
|
git_error_clear();
|
600
611
|
}
|
601
612
|
|
602
|
-
if (!iter->cache) {
|
603
|
-
if ((error = git_sortedcache_copy(&iter->cache, backend->refcache, 1, NULL, NULL)) < 0)
|
604
|
-
return error;
|
605
|
-
}
|
606
|
-
|
607
613
|
error = GIT_ITEROVER;
|
608
614
|
while (iter->packed_pos < git_sortedcache_entrycount(iter->cache)) {
|
609
615
|
ref = git_sortedcache_entry(iter->cache, iter->packed_pos++);
|
@@ -612,7 +618,7 @@ static int refdb_fs_backend__iterator_next(
|
|
612
618
|
|
613
619
|
if (ref->flags & PACKREF_SHADOWED)
|
614
620
|
continue;
|
615
|
-
if (iter->glob &&
|
621
|
+
if (iter->glob && wildmatch(iter->glob, ref->name, 0) != 0)
|
616
622
|
continue;
|
617
623
|
|
618
624
|
*out = git_reference__alloc(ref->name, &ref->oid, &ref->peel);
|
@@ -627,14 +633,19 @@ static int refdb_fs_backend__iterator_next_name(
|
|
627
633
|
const char **out, git_reference_iterator *_iter)
|
628
634
|
{
|
629
635
|
int error = GIT_ITEROVER;
|
630
|
-
refdb_fs_iter *iter = (refdb_fs_iter
|
631
|
-
refdb_fs_backend *backend = (
|
636
|
+
refdb_fs_iter *iter = GIT_CONTAINER_OF(_iter, refdb_fs_iter, parent);
|
637
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(iter->parent.db->backend, refdb_fs_backend, parent);
|
632
638
|
struct packref *ref;
|
633
639
|
|
634
640
|
while (iter->loose_pos < iter->loose.length) {
|
635
641
|
const char *path = git_vector_get(&iter->loose, iter->loose_pos++);
|
642
|
+
struct packref *ref;
|
636
643
|
|
637
644
|
if (loose_lookup(NULL, backend, path) == 0) {
|
645
|
+
ref = git_sortedcache_lookup(iter->cache, path);
|
646
|
+
if (ref)
|
647
|
+
ref->flags |= PACKREF_SHADOWED;
|
648
|
+
|
638
649
|
*out = path;
|
639
650
|
return 0;
|
640
651
|
}
|
@@ -642,11 +653,6 @@ static int refdb_fs_backend__iterator_next_name(
|
|
642
653
|
git_error_clear();
|
643
654
|
}
|
644
655
|
|
645
|
-
if (!iter->cache) {
|
646
|
-
if ((error = git_sortedcache_copy(&iter->cache, backend->refcache, 1, NULL, NULL)) < 0)
|
647
|
-
return error;
|
648
|
-
}
|
649
|
-
|
650
656
|
error = GIT_ITEROVER;
|
651
657
|
while (iter->packed_pos < git_sortedcache_entrycount(iter->cache)) {
|
652
658
|
ref = git_sortedcache_entry(iter->cache, iter->packed_pos++);
|
@@ -655,7 +661,7 @@ static int refdb_fs_backend__iterator_next_name(
|
|
655
661
|
|
656
662
|
if (ref->flags & PACKREF_SHADOWED)
|
657
663
|
continue;
|
658
|
-
if (iter->glob &&
|
664
|
+
if (iter->glob && wildmatch(iter->glob, ref->name, 0) != 0)
|
659
665
|
continue;
|
660
666
|
|
661
667
|
*out = ref->name;
|
@@ -669,40 +675,45 @@ static int refdb_fs_backend__iterator_next_name(
|
|
669
675
|
static int refdb_fs_backend__iterator(
|
670
676
|
git_reference_iterator **out, git_refdb_backend *_backend, const char *glob)
|
671
677
|
{
|
678
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
679
|
+
refdb_fs_iter *iter = NULL;
|
672
680
|
int error;
|
673
|
-
refdb_fs_iter *iter;
|
674
|
-
refdb_fs_backend *backend = (refdb_fs_backend *)_backend;
|
675
681
|
|
676
682
|
assert(backend);
|
677
683
|
|
678
|
-
if ((error = packed_reload(backend)) < 0)
|
679
|
-
return error;
|
680
|
-
|
681
684
|
iter = git__calloc(1, sizeof(refdb_fs_iter));
|
682
685
|
GIT_ERROR_CHECK_ALLOC(iter);
|
683
686
|
|
684
|
-
git_pool_init(&iter->pool, 1)
|
687
|
+
if ((error = git_pool_init(&iter->pool, 1)) < 0)
|
688
|
+
goto out;
|
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(
|
@@ -750,7 +761,8 @@ static int reference_path_available(
|
|
750
761
|
}
|
751
762
|
}
|
752
763
|
|
753
|
-
git_sortedcache_rlock(backend->refcache)
|
764
|
+
if ((error = git_sortedcache_rlock(backend->refcache)) < 0)
|
765
|
+
return error;
|
754
766
|
|
755
767
|
for (i = 0; i < git_sortedcache_entrycount(backend->refcache); ++i) {
|
756
768
|
struct packref *ref = git_sortedcache_entry(backend->refcache, i);
|
@@ -829,7 +841,7 @@ static int refdb_fs_backend__lock(void **out, git_refdb_backend *_backend, const
|
|
829
841
|
{
|
830
842
|
int error;
|
831
843
|
git_filebuf *lock;
|
832
|
-
refdb_fs_backend *backend = (refdb_fs_backend
|
844
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
833
845
|
|
834
846
|
lock = git__calloc(1, sizeof(git_filebuf));
|
835
847
|
GIT_ERROR_CHECK_ALLOC(lock);
|
@@ -848,16 +860,17 @@ static int refdb_fs_backend__write_tail(
|
|
848
860
|
const git_reference *ref,
|
849
861
|
git_filebuf *file,
|
850
862
|
int update_reflog,
|
851
|
-
const git_signature *who,
|
852
|
-
const char *message,
|
853
863
|
const git_oid *old_id,
|
854
|
-
const char *old_target
|
864
|
+
const char *old_target,
|
865
|
+
const git_signature *who,
|
866
|
+
const char *message);
|
855
867
|
|
856
868
|
static int refdb_fs_backend__delete_tail(
|
857
869
|
git_refdb_backend *_backend,
|
858
870
|
git_filebuf *file,
|
859
871
|
const char *ref_name,
|
860
|
-
const git_oid *old_id,
|
872
|
+
const git_oid *old_id,
|
873
|
+
const char *old_target);
|
861
874
|
|
862
875
|
static int refdb_fs_backend__unlock(git_refdb_backend *backend, void *payload, int success, int update_reflog,
|
863
876
|
const git_reference *ref, const git_signature *sig, const char *message)
|
@@ -868,7 +881,7 @@ static int refdb_fs_backend__unlock(git_refdb_backend *backend, void *payload, i
|
|
868
881
|
if (success == 2)
|
869
882
|
error = refdb_fs_backend__delete_tail(backend, lock, ref->name, NULL, NULL);
|
870
883
|
else if (success)
|
871
|
-
error = refdb_fs_backend__write_tail(backend, ref, lock, update_reflog,
|
884
|
+
error = refdb_fs_backend__write_tail(backend, ref, lock, update_reflog, NULL, NULL, sig, message);
|
872
885
|
else
|
873
886
|
git_filebuf_cleanup(lock);
|
874
887
|
|
@@ -1087,46 +1100,37 @@ fail:
|
|
1087
1100
|
return error;
|
1088
1101
|
}
|
1089
1102
|
|
1090
|
-
static int
|
1091
|
-
static int has_reflog(git_repository *repo, const char *name);
|
1092
|
-
|
1093
|
-
static int should_write_reflog(int *write, git_repository *repo, const char *name)
|
1103
|
+
static int packed_delete(refdb_fs_backend *backend, const char *ref_name)
|
1094
1104
|
{
|
1095
|
-
|
1105
|
+
size_t pack_pos;
|
1106
|
+
int error, found = 0;
|
1096
1107
|
|
1097
|
-
error =
|
1098
|
-
|
1099
|
-
return error;
|
1108
|
+
if ((error = packed_reload(backend)) < 0)
|
1109
|
+
goto cleanup;
|
1100
1110
|
|
1101
|
-
|
1102
|
-
|
1103
|
-
logall = !git_repository_is_bare(repo);
|
1111
|
+
if ((error = git_sortedcache_wlock(backend->refcache)) < 0)
|
1112
|
+
goto cleanup;
|
1104
1113
|
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1114
|
+
/* If a packed reference exists, remove it from the packfile and repack if necessary */
|
1115
|
+
error = git_sortedcache_lookup_index(&pack_pos, backend->refcache, ref_name);
|
1116
|
+
if (error == 0) {
|
1117
|
+
error = git_sortedcache_remove(backend->refcache, pack_pos);
|
1118
|
+
found = 1;
|
1119
|
+
}
|
1120
|
+
if (error == GIT_ENOTFOUND)
|
1121
|
+
error = 0;
|
1110
1122
|
|
1111
|
-
|
1112
|
-
/* Only write if it already has a log,
|
1113
|
-
* or if it's under heads/, remotes/ or notes/
|
1114
|
-
*/
|
1115
|
-
*write = has_reflog(repo, name) ||
|
1116
|
-
!git__prefixcmp(name, GIT_REFS_HEADS_DIR) ||
|
1117
|
-
!git__strcmp(name, GIT_HEAD_FILE) ||
|
1118
|
-
!git__prefixcmp(name, GIT_REFS_REMOTES_DIR) ||
|
1119
|
-
!git__prefixcmp(name, GIT_REFS_NOTES_DIR);
|
1120
|
-
break;
|
1123
|
+
git_sortedcache_wunlock(backend->refcache);
|
1121
1124
|
|
1122
|
-
|
1123
|
-
|
1124
|
-
break;
|
1125
|
-
}
|
1125
|
+
if (found)
|
1126
|
+
error = packed_write(backend);
|
1126
1127
|
|
1127
|
-
|
1128
|
+
cleanup:
|
1129
|
+
return error;
|
1128
1130
|
}
|
1129
1131
|
|
1132
|
+
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);
|
1133
|
+
|
1130
1134
|
static int cmp_old_ref(int *cmp, git_refdb_backend *backend, const char *name,
|
1131
1135
|
const git_oid *old_id, const char *old_target)
|
1132
1136
|
{
|
@@ -1179,54 +1183,28 @@ out:
|
|
1179
1183
|
*/
|
1180
1184
|
static int maybe_append_head(refdb_fs_backend *backend, const git_reference *ref, const git_signature *who, const char *message)
|
1181
1185
|
{
|
1182
|
-
|
1186
|
+
git_reference *head = NULL;
|
1187
|
+
git_refdb *refdb = NULL;
|
1188
|
+
int error, write_reflog;
|
1183
1189
|
git_oid old_id;
|
1184
|
-
git_reference *tmp = NULL, *head = NULL, *peeled = NULL;
|
1185
|
-
const char *name;
|
1186
1190
|
|
1187
|
-
if (
|
1188
|
-
|
1191
|
+
if ((error = git_repository_refdb(&refdb, backend->repo)) < 0 ||
|
1192
|
+
(error = git_refdb_should_write_head_reflog(&write_reflog, refdb, ref)) < 0)
|
1193
|
+
goto out;
|
1194
|
+
if (!write_reflog)
|
1195
|
+
goto out;
|
1189
1196
|
|
1190
1197
|
/* if we can't resolve, we use {0}*40 as old id */
|
1191
1198
|
if (git_reference_name_to_id(&old_id, backend->repo, ref->name) < 0)
|
1192
1199
|
memset(&old_id, 0, sizeof(old_id));
|
1193
1200
|
|
1194
|
-
if ((error = git_reference_lookup(&head, backend->repo, GIT_HEAD_FILE)) < 0
|
1195
|
-
|
1196
|
-
|
1197
|
-
if (git_reference_type(head) == GIT_REFERENCE_DIRECT)
|
1198
|
-
goto cleanup;
|
1199
|
-
|
1200
|
-
if ((error = git_reference_lookup(&tmp, backend->repo, GIT_HEAD_FILE)) < 0)
|
1201
|
-
goto cleanup;
|
1202
|
-
|
1203
|
-
/* Go down the symref chain until we find the branch */
|
1204
|
-
while (git_reference_type(tmp) == GIT_REFERENCE_SYMBOLIC) {
|
1205
|
-
error = git_reference_lookup(&peeled, backend->repo, git_reference_symbolic_target(tmp));
|
1206
|
-
if (error < 0)
|
1207
|
-
break;
|
1208
|
-
|
1209
|
-
git_reference_free(tmp);
|
1210
|
-
tmp = peeled;
|
1211
|
-
}
|
1212
|
-
|
1213
|
-
if (error == GIT_ENOTFOUND) {
|
1214
|
-
error = 0;
|
1215
|
-
name = git_reference_symbolic_target(tmp);
|
1216
|
-
} else if (error < 0) {
|
1217
|
-
goto cleanup;
|
1218
|
-
} else {
|
1219
|
-
name = git_reference_name(tmp);
|
1220
|
-
}
|
1221
|
-
|
1222
|
-
if (strcmp(name, ref->name))
|
1223
|
-
goto cleanup;
|
1224
|
-
|
1225
|
-
error = reflog_append(backend, head, &old_id, git_reference_target(ref), who, message);
|
1201
|
+
if ((error = git_reference_lookup(&head, backend->repo, GIT_HEAD_FILE)) < 0 ||
|
1202
|
+
(error = reflog_append(backend, head, &old_id, git_reference_target(ref), who, message)) < 0)
|
1203
|
+
goto out;
|
1226
1204
|
|
1227
|
-
|
1228
|
-
git_reference_free(tmp);
|
1205
|
+
out:
|
1229
1206
|
git_reference_free(head);
|
1207
|
+
git_refdb_free(refdb);
|
1230
1208
|
return error;
|
1231
1209
|
}
|
1232
1210
|
|
@@ -1239,7 +1217,7 @@ static int refdb_fs_backend__write(
|
|
1239
1217
|
const git_oid *old_id,
|
1240
1218
|
const char *old_target)
|
1241
1219
|
{
|
1242
|
-
refdb_fs_backend *backend = (refdb_fs_backend
|
1220
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1243
1221
|
git_filebuf file = GIT_FILEBUF_INIT;
|
1244
1222
|
int error = 0;
|
1245
1223
|
|
@@ -1252,7 +1230,7 @@ static int refdb_fs_backend__write(
|
|
1252
1230
|
if ((error = loose_lock(&file, backend, ref->name)) < 0)
|
1253
1231
|
return error;
|
1254
1232
|
|
1255
|
-
return refdb_fs_backend__write_tail(_backend, ref, &file, true,
|
1233
|
+
return refdb_fs_backend__write_tail(_backend, ref, &file, true, old_id, old_target, who, message);
|
1256
1234
|
}
|
1257
1235
|
|
1258
1236
|
static int refdb_fs_backend__write_tail(
|
@@ -1260,12 +1238,12 @@ static int refdb_fs_backend__write_tail(
|
|
1260
1238
|
const git_reference *ref,
|
1261
1239
|
git_filebuf *file,
|
1262
1240
|
int update_reflog,
|
1263
|
-
const git_signature *who,
|
1264
|
-
const char *message,
|
1265
1241
|
const git_oid *old_id,
|
1266
|
-
const char *old_target
|
1242
|
+
const char *old_target,
|
1243
|
+
const git_signature *who,
|
1244
|
+
const char *message)
|
1267
1245
|
{
|
1268
|
-
refdb_fs_backend *backend = (refdb_fs_backend
|
1246
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1269
1247
|
int error = 0, cmp = 0, should_write;
|
1270
1248
|
const char *new_target = NULL;
|
1271
1249
|
const git_oid *new_id = NULL;
|
@@ -1295,7 +1273,10 @@ static int refdb_fs_backend__write_tail(
|
|
1295
1273
|
}
|
1296
1274
|
|
1297
1275
|
if (update_reflog) {
|
1298
|
-
|
1276
|
+
git_refdb *refdb;
|
1277
|
+
|
1278
|
+
if ((error = git_repository_refdb__weakptr(&refdb, backend->repo)) < 0 ||
|
1279
|
+
(error = git_refdb_should_write_reflog(&should_write, refdb, ref)) < 0)
|
1299
1280
|
goto on_error;
|
1300
1281
|
|
1301
1282
|
if (should_write) {
|
@@ -1313,10 +1294,10 @@ on_error:
|
|
1313
1294
|
return error;
|
1314
1295
|
}
|
1315
1296
|
|
1316
|
-
static void
|
1297
|
+
static void refdb_fs_backend__prune_refs(
|
1317
1298
|
refdb_fs_backend *backend,
|
1318
1299
|
const char *ref_name,
|
1319
|
-
|
1300
|
+
const char *prefix)
|
1320
1301
|
{
|
1321
1302
|
git_buf relative_path = GIT_BUF_INIT;
|
1322
1303
|
git_buf base_path = GIT_BUF_INIT;
|
@@ -1334,8 +1315,8 @@ static void refdb_fs_backend__try_delete_empty_ref_hierarchie(
|
|
1334
1315
|
|
1335
1316
|
git_buf_truncate(&relative_path, commonlen);
|
1336
1317
|
|
1337
|
-
if (
|
1338
|
-
if (git_buf_join3(&base_path, '/', backend->commonpath,
|
1318
|
+
if (prefix) {
|
1319
|
+
if (git_buf_join3(&base_path, '/', backend->commonpath, prefix, git_buf_cstr(&relative_path)) < 0)
|
1339
1320
|
goto cleanup;
|
1340
1321
|
} else {
|
1341
1322
|
if (git_buf_joinpath(&base_path, backend->commonpath, git_buf_cstr(&relative_path)) < 0)
|
@@ -1355,7 +1336,7 @@ static int refdb_fs_backend__delete(
|
|
1355
1336
|
const char *ref_name,
|
1356
1337
|
const git_oid *old_id, const char *old_target)
|
1357
1338
|
{
|
1358
|
-
refdb_fs_backend *backend = (refdb_fs_backend
|
1339
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1359
1340
|
git_filebuf file = GIT_FILEBUF_INIT;
|
1360
1341
|
int error = 0;
|
1361
1342
|
|
@@ -1372,17 +1353,34 @@ static int refdb_fs_backend__delete(
|
|
1372
1353
|
return refdb_fs_backend__delete_tail(_backend, &file, ref_name, old_id, old_target);
|
1373
1354
|
}
|
1374
1355
|
|
1356
|
+
static int loose_delete(refdb_fs_backend *backend, const char *ref_name)
|
1357
|
+
{
|
1358
|
+
git_buf loose_path = GIT_BUF_INIT;
|
1359
|
+
int error = 0;
|
1360
|
+
|
1361
|
+
if (git_buf_joinpath(&loose_path, backend->commonpath, ref_name) < 0)
|
1362
|
+
return -1;
|
1363
|
+
|
1364
|
+
error = p_unlink(loose_path.ptr);
|
1365
|
+
if (error < 0 && errno == ENOENT)
|
1366
|
+
error = GIT_ENOTFOUND;
|
1367
|
+
else if (error != 0)
|
1368
|
+
error = -1;
|
1369
|
+
|
1370
|
+
git_buf_dispose(&loose_path);
|
1371
|
+
|
1372
|
+
return error;
|
1373
|
+
}
|
1374
|
+
|
1375
1375
|
static int refdb_fs_backend__delete_tail(
|
1376
1376
|
git_refdb_backend *_backend,
|
1377
1377
|
git_filebuf *file,
|
1378
1378
|
const char *ref_name,
|
1379
1379
|
const git_oid *old_id, const char *old_target)
|
1380
1380
|
{
|
1381
|
-
refdb_fs_backend *backend = (refdb_fs_backend
|
1382
|
-
git_buf loose_path = GIT_BUF_INIT;
|
1383
|
-
size_t pack_pos;
|
1381
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1384
1382
|
int error = 0, cmp = 0;
|
1385
|
-
bool
|
1383
|
+
bool packed_deleted = 0;
|
1386
1384
|
|
1387
1385
|
error = cmp_old_ref(&cmp, _backend, ref_name, old_id, old_target);
|
1388
1386
|
if (error < 0)
|
@@ -1394,44 +1392,41 @@ static int refdb_fs_backend__delete_tail(
|
|
1394
1392
|
goto cleanup;
|
1395
1393
|
}
|
1396
1394
|
|
1397
|
-
/*
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1395
|
+
/*
|
1396
|
+
* To ensure that an external observer will see either the current ref value
|
1397
|
+
* (because the loose ref still exists), or a missing ref (after the packed-file is
|
1398
|
+
* unlocked, there will be nothing left), we must ensure things happen in the
|
1399
|
+
* following order:
|
1400
|
+
*
|
1401
|
+
* - the packed-ref file is locked and loaded, as well as a loose one, if it exists
|
1402
|
+
* - we optimistically delete a packed ref, keeping track of whether it existed
|
1403
|
+
* - we delete the loose ref, note that we have its .lock
|
1404
|
+
* - the loose ref is "unlocked", then the packed-ref file is rewritten and unlocked
|
1405
|
+
* - we should prune the path components if a loose ref was deleted
|
1406
|
+
*
|
1407
|
+
* Note that, because our packed backend doesn't expose its filesystem lock,
|
1408
|
+
* we might not be able to guarantee that this is what actually happens (ie.
|
1409
|
+
* as our current code never write packed-refs.lock, nothing stops observers
|
1410
|
+
* from grabbing a "stale" value from there).
|
1411
|
+
*/
|
1412
|
+
if ((error = packed_delete(backend, ref_name)) < 0 && error != GIT_ENOTFOUND)
|
1406
1413
|
goto cleanup;
|
1407
|
-
else if (error == 0)
|
1408
|
-
loose_deleted = 1;
|
1409
1414
|
|
1410
|
-
if (
|
1411
|
-
|
1415
|
+
if (error == 0)
|
1416
|
+
packed_deleted = 1;
|
1412
1417
|
|
1413
|
-
|
1414
|
-
if ((error = git_sortedcache_wlock(backend->refcache)) < 0)
|
1418
|
+
if ((error = loose_delete(backend, ref_name)) < 0 && error != GIT_ENOTFOUND)
|
1415
1419
|
goto cleanup;
|
1416
1420
|
|
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
1421
|
if (error == GIT_ENOTFOUND) {
|
1424
|
-
error =
|
1422
|
+
error = packed_deleted ? 0 : ref_error_notfound(ref_name);
|
1425
1423
|
goto cleanup;
|
1426
1424
|
}
|
1427
1425
|
|
1428
|
-
error = packed_write(backend);
|
1429
|
-
|
1430
1426
|
cleanup:
|
1431
|
-
git_buf_dispose(&loose_path);
|
1432
1427
|
git_filebuf_cleanup(file);
|
1433
|
-
if (
|
1434
|
-
|
1428
|
+
if (error == 0)
|
1429
|
+
refdb_fs_backend__prune_refs(backend, ref_name, "");
|
1435
1430
|
return error;
|
1436
1431
|
}
|
1437
1432
|
|
@@ -1446,8 +1441,8 @@ static int refdb_fs_backend__rename(
|
|
1446
1441
|
const git_signature *who,
|
1447
1442
|
const char *message)
|
1448
1443
|
{
|
1449
|
-
refdb_fs_backend *backend = (refdb_fs_backend
|
1450
|
-
git_reference *old, *new;
|
1444
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1445
|
+
git_reference *old, *new = NULL;
|
1451
1446
|
git_filebuf file = GIT_FILEBUF_INIT;
|
1452
1447
|
int error;
|
1453
1448
|
|
@@ -1463,7 +1458,7 @@ static int refdb_fs_backend__rename(
|
|
1463
1458
|
return error;
|
1464
1459
|
}
|
1465
1460
|
|
1466
|
-
new =
|
1461
|
+
new = git_reference__realloc(&old, new_name);
|
1467
1462
|
if (!new) {
|
1468
1463
|
git_reference_free(old);
|
1469
1464
|
return -1;
|
@@ -1502,7 +1497,7 @@ static int refdb_fs_backend__rename(
|
|
1502
1497
|
static int refdb_fs_backend__compress(git_refdb_backend *_backend)
|
1503
1498
|
{
|
1504
1499
|
int error;
|
1505
|
-
refdb_fs_backend *backend = (refdb_fs_backend
|
1500
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1506
1501
|
|
1507
1502
|
assert(backend);
|
1508
1503
|
|
@@ -1516,7 +1511,7 @@ static int refdb_fs_backend__compress(git_refdb_backend *_backend)
|
|
1516
1511
|
|
1517
1512
|
static void refdb_fs_backend__free(git_refdb_backend *_backend)
|
1518
1513
|
{
|
1519
|
-
refdb_fs_backend *backend = (refdb_fs_backend
|
1514
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1520
1515
|
|
1521
1516
|
assert(backend);
|
1522
1517
|
|
@@ -1597,70 +1592,57 @@ static int reflog_alloc(git_reflog **reflog, const char *name)
|
|
1597
1592
|
|
1598
1593
|
static int reflog_parse(git_reflog *log, const char *buf, size_t buf_size)
|
1599
1594
|
{
|
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);
|
1595
|
+
git_parse_ctx parser = GIT_PARSE_CTX_INIT;
|
1615
1596
|
|
1616
|
-
|
1617
|
-
|
1597
|
+
if ((git_parse_ctx_init(&parser, buf, buf_size)) < 0)
|
1598
|
+
return -1;
|
1618
1599
|
|
1619
|
-
|
1620
|
-
|
1621
|
-
|
1600
|
+
for (; parser.remain_len; git_parse_advance_line(&parser)) {
|
1601
|
+
git_reflog_entry *entry;
|
1602
|
+
const char *sig;
|
1603
|
+
char c;
|
1622
1604
|
|
1623
|
-
|
1624
|
-
|
1625
|
-
|
1605
|
+
entry = git__calloc(1, sizeof(*entry));
|
1606
|
+
GIT_ERROR_CHECK_ALLOC(entry);
|
1607
|
+
entry->committer = git__calloc(1, sizeof(*entry->committer));
|
1608
|
+
GIT_ERROR_CHECK_ALLOC(entry->committer);
|
1626
1609
|
|
1627
|
-
|
1610
|
+
if (git_parse_advance_oid(&entry->oid_old, &parser) < 0 ||
|
1611
|
+
git_parse_advance_expected(&parser, " ", 1) < 0 ||
|
1612
|
+
git_parse_advance_oid(&entry->oid_cur, &parser) < 0)
|
1613
|
+
goto next;
|
1628
1614
|
|
1629
|
-
|
1630
|
-
while (
|
1631
|
-
|
1615
|
+
sig = parser.line;
|
1616
|
+
while (git_parse_peek(&c, &parser, 0) == 0 && c != '\t' && c != '\n')
|
1617
|
+
git_parse_advance_chars(&parser, 1);
|
1632
1618
|
|
1633
|
-
if (git_signature__parse(entry->committer, &
|
1634
|
-
goto
|
1619
|
+
if (git_signature__parse(entry->committer, &sig, parser.line, NULL, 0) < 0)
|
1620
|
+
goto next;
|
1635
1621
|
|
1636
|
-
if (
|
1637
|
-
|
1638
|
-
|
1639
|
-
ptr = buf;
|
1622
|
+
if (c == '\t') {
|
1623
|
+
size_t len;
|
1624
|
+
git_parse_advance_chars(&parser, 1);
|
1640
1625
|
|
1641
|
-
|
1642
|
-
|
1626
|
+
len = parser.line_len;
|
1627
|
+
if (parser.line[len - 1] == '\n')
|
1628
|
+
len--;
|
1643
1629
|
|
1644
|
-
entry->msg = git__strndup(
|
1630
|
+
entry->msg = git__strndup(parser.line, len);
|
1645
1631
|
GIT_ERROR_CHECK_ALLOC(entry->msg);
|
1646
|
-
}
|
1647
|
-
entry->msg = NULL;
|
1632
|
+
}
|
1648
1633
|
|
1649
|
-
|
1650
|
-
|
1634
|
+
if ((git_vector_insert(&log->entries, entry)) < 0) {
|
1635
|
+
git_reflog_entry__free(entry);
|
1636
|
+
return -1;
|
1637
|
+
}
|
1651
1638
|
|
1652
|
-
|
1653
|
-
|
1639
|
+
continue;
|
1640
|
+
|
1641
|
+
next:
|
1642
|
+
git_reflog_entry__free(entry);
|
1654
1643
|
}
|
1655
1644
|
|
1656
1645
|
return 0;
|
1657
|
-
|
1658
|
-
#undef seek_forward
|
1659
|
-
|
1660
|
-
fail:
|
1661
|
-
git_reflog_entry__free(entry);
|
1662
|
-
|
1663
|
-
return -1;
|
1664
1646
|
}
|
1665
1647
|
|
1666
1648
|
static int create_new_reflog_file(const char *filepath)
|
@@ -1694,7 +1676,7 @@ static int refdb_reflog_fs__ensure_log(git_refdb_backend *_backend, const char *
|
|
1694
1676
|
|
1695
1677
|
assert(_backend && name);
|
1696
1678
|
|
1697
|
-
backend = (refdb_fs_backend
|
1679
|
+
backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1698
1680
|
repo = backend->repo;
|
1699
1681
|
|
1700
1682
|
if ((error = retrieve_reflog_path(&path, repo, name)) < 0)
|
@@ -1727,7 +1709,7 @@ static int refdb_reflog_fs__has_log(git_refdb_backend *_backend, const char *nam
|
|
1727
1709
|
|
1728
1710
|
assert(_backend && name);
|
1729
1711
|
|
1730
|
-
backend = (refdb_fs_backend
|
1712
|
+
backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1731
1713
|
|
1732
1714
|
return has_reflog(backend->repo, name);
|
1733
1715
|
}
|
@@ -1743,7 +1725,7 @@ static int refdb_reflog_fs__read(git_reflog **out, git_refdb_backend *_backend,
|
|
1743
1725
|
|
1744
1726
|
assert(out && _backend && name);
|
1745
1727
|
|
1746
|
-
backend = (refdb_fs_backend
|
1728
|
+
backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1747
1729
|
repo = backend->repo;
|
1748
1730
|
|
1749
1731
|
if (reflog_alloc(&log, name) < 0)
|
@@ -1802,8 +1784,15 @@ static int serialize_reflog_entry(
|
|
1802
1784
|
git_buf_rtrim(buf);
|
1803
1785
|
|
1804
1786
|
if (msg) {
|
1787
|
+
size_t i;
|
1788
|
+
|
1805
1789
|
git_buf_putc(buf, '\t');
|
1806
1790
|
git_buf_puts(buf, msg);
|
1791
|
+
|
1792
|
+
for (i = 0; i < buf->size - 2; i++)
|
1793
|
+
if (buf->ptr[i] == '\n')
|
1794
|
+
buf->ptr[i] = ' ';
|
1795
|
+
git_buf_rtrim(buf);
|
1807
1796
|
}
|
1808
1797
|
|
1809
1798
|
git_buf_putc(buf, '\n');
|
@@ -1853,7 +1842,7 @@ static int refdb_reflog_fs__write(git_refdb_backend *_backend, git_reflog *reflo
|
|
1853
1842
|
|
1854
1843
|
assert(_backend && reflog);
|
1855
1844
|
|
1856
|
-
backend = (refdb_fs_backend
|
1845
|
+
backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1857
1846
|
|
1858
1847
|
if ((error = lock_reflog(&fbuf, backend, reflog->ref_name)) < 0)
|
1859
1848
|
return -1;
|
@@ -1894,7 +1883,7 @@ static int reflog_append(refdb_fs_backend *backend, const git_reference *ref, co
|
|
1894
1883
|
!(old && new))
|
1895
1884
|
return 0;
|
1896
1885
|
|
1897
|
-
/* From here on
|
1886
|
+
/* From here on is_symbolic also means that it's HEAD */
|
1898
1887
|
|
1899
1888
|
if (old) {
|
1900
1889
|
git_oid_cpy(&old_id, old);
|
@@ -1975,7 +1964,7 @@ static int refdb_reflog_fs__rename(git_refdb_backend *_backend, const char *old_
|
|
1975
1964
|
|
1976
1965
|
assert(_backend && old_name && new_name);
|
1977
1966
|
|
1978
|
-
backend = (refdb_fs_backend
|
1967
|
+
backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
1979
1968
|
repo = backend->repo;
|
1980
1969
|
|
1981
1970
|
if ((error = git_reference__normalize_name(
|
@@ -2046,7 +2035,7 @@ cleanup:
|
|
2046
2035
|
|
2047
2036
|
static int refdb_reflog_fs__delete(git_refdb_backend *_backend, const char *name)
|
2048
2037
|
{
|
2049
|
-
refdb_fs_backend *backend = (refdb_fs_backend
|
2038
|
+
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
2050
2039
|
git_buf path = GIT_BUF_INIT;
|
2051
2040
|
int error;
|
2052
2041
|
|
@@ -2061,7 +2050,7 @@ static int refdb_reflog_fs__delete(git_refdb_backend *_backend, const char *name
|
|
2061
2050
|
if ((error = p_unlink(path.ptr)) < 0)
|
2062
2051
|
goto out;
|
2063
2052
|
|
2064
|
-
|
2053
|
+
refdb_fs_backend__prune_refs(backend, name, GIT_REFLOG_DIR);
|
2065
2054
|
|
2066
2055
|
out:
|
2067
2056
|
git_buf_dispose(&path);
|
@@ -2107,15 +2096,15 @@ int git_refdb_backend_fs(
|
|
2107
2096
|
|
2108
2097
|
git_buf_dispose(&gitpath);
|
2109
2098
|
|
2110
|
-
if (!
|
2099
|
+
if (!git_repository__configmap_lookup(&t, backend->repo, GIT_CONFIGMAP_IGNORECASE) && t) {
|
2111
2100
|
backend->iterator_flags |= GIT_ITERATOR_IGNORE_CASE;
|
2112
2101
|
backend->direach_flags |= GIT_PATH_DIR_IGNORE_CASE;
|
2113
2102
|
}
|
2114
|
-
if (!
|
2103
|
+
if (!git_repository__configmap_lookup(&t, backend->repo, GIT_CONFIGMAP_PRECOMPOSE) && t) {
|
2115
2104
|
backend->iterator_flags |= GIT_ITERATOR_PRECOMPOSE_UNICODE;
|
2116
2105
|
backend->direach_flags |= GIT_PATH_DIR_PRECOMPOSE_UNICODE;
|
2117
2106
|
}
|
2118
|
-
if ((!
|
2107
|
+
if ((!git_repository__configmap_lookup(&t, backend->repo, GIT_CONFIGMAP_FSYNCOBJECTFILES) && t) ||
|
2119
2108
|
git_repository__fsync_gitdir)
|
2120
2109
|
backend->fsync = 1;
|
2121
2110
|
backend->iterator_flags |= GIT_ITERATOR_DESCEND_SYMLINKS;
|