rugged 0.28.4 → 0.28.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +0 -1
- data/vendor/libgit2/CMakeLists.txt +16 -36
- data/vendor/libgit2/COPYING +0 -28
- data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +1 -5
- data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +2 -2
- data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +1 -1
- data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +2 -2
- data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +0 -6
- data/vendor/libgit2/deps/http-parser/http_parser.c +6 -11
- data/vendor/libgit2/deps/regex/CMakeLists.txt +2 -0
- data/vendor/libgit2/deps/regex/COPYING +502 -0
- data/vendor/libgit2/deps/regex/config.h +7 -0
- data/vendor/libgit2/deps/regex/regcomp.c +3857 -0
- data/vendor/libgit2/deps/regex/regex.c +92 -0
- data/vendor/libgit2/deps/regex/regex.h +582 -0
- data/vendor/libgit2/deps/regex/regex_internal.c +1744 -0
- data/vendor/libgit2/deps/regex/regex_internal.h +819 -0
- data/vendor/libgit2/deps/regex/regexec.c +4369 -0
- data/vendor/libgit2/deps/zlib/adler32.c +7 -0
- data/vendor/libgit2/deps/zlib/crc32.c +7 -0
- data/vendor/libgit2/include/git2.h +0 -2
- data/vendor/libgit2/include/git2/apply.h +2 -22
- data/vendor/libgit2/include/git2/attr.h +12 -19
- data/vendor/libgit2/include/git2/blame.h +2 -2
- data/vendor/libgit2/include/git2/blob.h +12 -44
- data/vendor/libgit2/include/git2/buffer.h +14 -20
- data/vendor/libgit2/include/git2/checkout.h +14 -46
- 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 +1 -23
- data/vendor/libgit2/include/git2/common.h +5 -7
- data/vendor/libgit2/include/git2/config.h +12 -12
- data/vendor/libgit2/include/git2/deprecated.h +3 -243
- data/vendor/libgit2/include/git2/describe.h +4 -4
- data/vendor/libgit2/include/git2/diff.h +14 -16
- data/vendor/libgit2/include/git2/filter.h +0 -8
- data/vendor/libgit2/include/git2/index.h +1 -2
- data/vendor/libgit2/include/git2/indexer.h +4 -48
- data/vendor/libgit2/include/git2/inttypes.h +309 -0
- data/vendor/libgit2/include/git2/merge.h +10 -6
- data/vendor/libgit2/include/git2/net.h +5 -0
- data/vendor/libgit2/include/git2/object.h +14 -2
- data/vendor/libgit2/include/git2/odb.h +2 -3
- data/vendor/libgit2/include/git2/odb_backend.h +4 -5
- data/vendor/libgit2/include/git2/oid.h +1 -1
- data/vendor/libgit2/include/git2/pack.h +1 -12
- data/vendor/libgit2/include/git2/proxy.h +3 -5
- data/vendor/libgit2/include/git2/rebase.h +2 -46
- data/vendor/libgit2/include/git2/refs.h +0 -19
- data/vendor/libgit2/include/git2/remote.h +12 -35
- data/vendor/libgit2/include/git2/repository.h +2 -24
- data/vendor/libgit2/include/git2/revert.h +1 -1
- data/vendor/libgit2/include/git2/stash.h +3 -3
- data/vendor/libgit2/include/git2/status.h +16 -25
- data/vendor/libgit2/include/git2/submodule.h +3 -20
- data/vendor/libgit2/include/git2/sys/alloc.h +9 -9
- data/vendor/libgit2/include/git2/sys/odb_backend.h +4 -48
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +21 -57
- data/vendor/libgit2/include/git2/sys/repository.h +1 -5
- data/vendor/libgit2/include/git2/sys/time.h +31 -0
- data/vendor/libgit2/include/git2/sys/transport.h +2 -2
- data/vendor/libgit2/include/git2/tag.h +2 -11
- data/vendor/libgit2/include/git2/trace.h +2 -2
- data/vendor/libgit2/include/git2/transport.h +340 -11
- data/vendor/libgit2/include/git2/tree.h +1 -1
- data/vendor/libgit2/include/git2/types.h +89 -4
- data/vendor/libgit2/include/git2/version.h +2 -2
- data/vendor/libgit2/include/git2/worktree.h +5 -5
- data/vendor/libgit2/libgit2.pc.in +13 -0
- data/vendor/libgit2/src/CMakeLists.txt +222 -88
- data/vendor/libgit2/src/alloc.c +14 -2
- data/vendor/libgit2/src/apply.c +30 -60
- data/vendor/libgit2/src/attr.c +64 -70
- data/vendor/libgit2/src/attr_file.c +96 -189
- data/vendor/libgit2/src/attr_file.h +9 -9
- data/vendor/libgit2/src/attrcache.c +46 -44
- data/vendor/libgit2/src/attrcache.h +1 -2
- data/vendor/libgit2/src/blame.c +5 -17
- data/vendor/libgit2/src/blame.h +1 -1
- data/vendor/libgit2/src/blame_git.c +7 -21
- data/vendor/libgit2/src/blob.c +17 -81
- data/vendor/libgit2/src/blob.h +2 -2
- data/vendor/libgit2/src/branch.c +5 -29
- data/vendor/libgit2/src/buffer.c +7 -14
- data/vendor/libgit2/src/cache.c +33 -26
- data/vendor/libgit2/src/cache.h +1 -1
- data/vendor/libgit2/src/cc-compat.h +0 -5
- data/vendor/libgit2/src/checkout.c +16 -26
- data/vendor/libgit2/src/cherrypick.c +3 -9
- data/vendor/libgit2/src/clone.c +7 -29
- data/vendor/libgit2/src/clone.h +0 -4
- data/vendor/libgit2/src/commit.c +21 -69
- data/vendor/libgit2/src/commit.h +0 -6
- data/vendor/libgit2/src/commit_list.c +76 -28
- data/vendor/libgit2/src/commit_list.h +2 -2
- data/vendor/libgit2/src/common.h +75 -3
- data/vendor/libgit2/src/config.c +40 -31
- data/vendor/libgit2/src/config.h +6 -7
- data/vendor/libgit2/src/config_backend.h +0 -12
- data/vendor/libgit2/src/config_cache.c +39 -39
- data/vendor/libgit2/src/config_entries.c +99 -69
- data/vendor/libgit2/src/config_entries.h +0 -1
- data/vendor/libgit2/src/config_file.c +380 -337
- data/vendor/libgit2/src/config_mem.c +16 -12
- data/vendor/libgit2/src/config_parse.c +29 -49
- data/vendor/libgit2/src/config_parse.h +12 -13
- data/vendor/libgit2/src/crlf.c +14 -14
- data/vendor/libgit2/src/describe.c +20 -21
- data/vendor/libgit2/src/diff.c +58 -43
- data/vendor/libgit2/src/diff.h +1 -2
- data/vendor/libgit2/src/diff_driver.c +38 -37
- data/vendor/libgit2/src/diff_file.c +7 -9
- data/vendor/libgit2/src/diff_file.h +1 -1
- data/vendor/libgit2/src/diff_generate.c +85 -135
- 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 +13 -25
- data/vendor/libgit2/src/diff_stats.c +1 -1
- data/vendor/libgit2/src/diff_tform.c +4 -4
- data/vendor/libgit2/src/errors.c +22 -12
- data/vendor/libgit2/src/features.h.in +2 -9
- data/vendor/libgit2/src/fetch.c +2 -7
- data/vendor/libgit2/src/fetchhead.c +1 -1
- data/vendor/libgit2/src/filebuf.c +10 -6
- data/vendor/libgit2/src/filebuf.h +2 -2
- data/vendor/libgit2/src/{futils.c → fileops.c} +17 -21
- data/vendor/libgit2/src/{futils.h → fileops.h} +5 -5
- data/vendor/libgit2/src/filter.c +8 -16
- data/vendor/libgit2/src/fnmatch.c +248 -0
- data/vendor/libgit2/src/fnmatch.h +48 -0
- data/vendor/libgit2/src/global.c +40 -12
- data/vendor/libgit2/src/global.h +2 -0
- data/vendor/libgit2/src/hash.c +0 -61
- data/vendor/libgit2/src/hash.h +21 -19
- data/vendor/libgit2/src/hash/{sha1/collisiondetect.c → hash_collisiondetect.h} +17 -14
- data/vendor/libgit2/src/hash/{sha1/common_crypto.c → hash_common_crypto.h} +19 -15
- data/vendor/libgit2/src/hash/{sha1/generic.c → hash_generic.c} +10 -22
- data/vendor/libgit2/src/hash/{sha1/generic.h → hash_generic.h} +14 -4
- data/vendor/libgit2/src/hash/{sha1/mbedtls.c → hash_mbedtls.c} +7 -15
- data/vendor/libgit2/src/hash/{sha1/mbedtls.h → hash_mbedtls.h} +11 -6
- data/vendor/libgit2/src/hash/{sha1/openssl.c → hash_openssl.h} +18 -14
- data/vendor/libgit2/src/hash/{sha1/win32.c → hash_win32.c} +24 -34
- data/vendor/libgit2/src/hash/{sha1/win32.h → hash_win32.h} +19 -6
- data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/sha1.c +3 -14
- data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/sha1.h +0 -0
- data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/ubc_check.c +0 -0
- data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/ubc_check.h +0 -0
- data/vendor/libgit2/src/hashsig.c +1 -1
- data/vendor/libgit2/src/idxmap.c +65 -91
- data/vendor/libgit2/src/idxmap.h +15 -151
- data/vendor/libgit2/src/ignore.c +38 -32
- data/vendor/libgit2/src/index.c +43 -66
- data/vendor/libgit2/src/index.h +1 -1
- data/vendor/libgit2/src/indexer.c +70 -69
- data/vendor/libgit2/src/integer.h +4 -39
- data/vendor/libgit2/src/iterator.c +22 -27
- data/vendor/libgit2/src/map.h +1 -1
- data/vendor/libgit2/src/merge.c +44 -58
- data/vendor/libgit2/src/merge_driver.c +4 -4
- data/vendor/libgit2/src/merge_file.c +1 -1
- data/vendor/libgit2/src/mwindow.c +23 -18
- data/vendor/libgit2/src/mwindow.h +4 -4
- data/vendor/libgit2/src/netops.c +165 -55
- data/vendor/libgit2/src/netops.h +25 -3
- data/vendor/libgit2/src/notes.c +2 -2
- data/vendor/libgit2/src/object.c +2 -2
- data/vendor/libgit2/src/object.h +0 -2
- data/vendor/libgit2/src/odb.c +23 -41
- data/vendor/libgit2/src/odb.h +2 -3
- data/vendor/libgit2/src/odb_loose.c +10 -17
- data/vendor/libgit2/src/odb_mempack.c +23 -10
- data/vendor/libgit2/src/odb_pack.c +4 -4
- data/vendor/libgit2/src/offmap.c +55 -43
- data/vendor/libgit2/src/offmap.h +24 -102
- data/vendor/libgit2/src/oid.c +1 -6
- data/vendor/libgit2/src/oidmap.c +57 -39
- data/vendor/libgit2/src/oidmap.h +19 -99
- data/vendor/libgit2/src/pack-objects.c +32 -25
- data/vendor/libgit2/src/pack-objects.h +1 -1
- data/vendor/libgit2/src/pack.c +47 -45
- data/vendor/libgit2/src/pack.h +14 -12
- data/vendor/libgit2/src/parse.c +0 -10
- 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 +31 -124
- data/vendor/libgit2/src/path.c +6 -43
- data/vendor/libgit2/src/path.h +0 -2
- data/vendor/libgit2/src/pathspec.c +13 -13
- data/vendor/libgit2/src/pool.c +22 -26
- data/vendor/libgit2/src/pool.h +7 -7
- data/vendor/libgit2/src/posix.c +7 -7
- data/vendor/libgit2/src/posix.h +1 -12
- data/vendor/libgit2/src/proxy.c +2 -7
- data/vendor/libgit2/src/push.c +5 -10
- data/vendor/libgit2/src/reader.c +2 -2
- data/vendor/libgit2/src/rebase.c +7 -66
- data/vendor/libgit2/src/refdb.c +0 -12
- data/vendor/libgit2/src/refdb_fs.c +165 -214
- data/vendor/libgit2/src/reflog.c +13 -11
- data/vendor/libgit2/src/refs.c +18 -24
- data/vendor/libgit2/src/refspec.c +16 -9
- data/vendor/libgit2/src/remote.c +52 -50
- data/vendor/libgit2/src/remote.h +2 -2
- data/vendor/libgit2/src/repository.c +100 -115
- data/vendor/libgit2/src/repository.h +40 -49
- data/vendor/libgit2/src/revert.c +3 -8
- data/vendor/libgit2/src/revparse.c +19 -18
- data/vendor/libgit2/src/revwalk.c +30 -63
- data/vendor/libgit2/src/revwalk.h +0 -20
- data/vendor/libgit2/src/settings.c +0 -5
- data/vendor/libgit2/src/sortedcache.c +26 -12
- data/vendor/libgit2/src/sortedcache.h +1 -1
- data/vendor/libgit2/src/stash.c +65 -45
- data/vendor/libgit2/src/status.c +9 -15
- data/vendor/libgit2/src/{allocators/stdalloc.c → stdalloc.c} +4 -3
- data/vendor/libgit2/src/{allocators/stdalloc.h → stdalloc.h} +4 -4
- data/vendor/libgit2/src/streams/openssl.c +0 -20
- data/vendor/libgit2/src/streams/socket.c +2 -2
- data/vendor/libgit2/src/strmap.c +84 -37
- data/vendor/libgit2/src/strmap.h +33 -105
- data/vendor/libgit2/src/submodule.c +70 -102
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/sysdir.c +1 -11
- data/vendor/libgit2/src/tag.c +2 -10
- data/vendor/libgit2/src/trace.c +1 -1
- data/vendor/libgit2/src/trace.h +2 -2
- data/vendor/libgit2/src/trailer.c +32 -46
- data/vendor/libgit2/src/transaction.c +9 -10
- data/vendor/libgit2/src/transports/auth.c +9 -10
- data/vendor/libgit2/src/transports/auth.h +4 -11
- data/vendor/libgit2/src/transports/auth_negotiate.c +9 -23
- data/vendor/libgit2/src/transports/auth_negotiate.h +2 -2
- data/vendor/libgit2/src/transports/cred.c +6 -6
- data/vendor/libgit2/src/{allocators/win32_crtdbg.h → transports/cred.h} +4 -5
- data/vendor/libgit2/src/transports/git.c +16 -11
- data/vendor/libgit2/src/transports/http.c +276 -419
- data/vendor/libgit2/src/transports/http.h +1 -1
- data/vendor/libgit2/src/transports/local.c +9 -9
- data/vendor/libgit2/src/transports/smart.c +17 -17
- data/vendor/libgit2/src/transports/smart.h +2 -2
- data/vendor/libgit2/src/transports/smart_protocol.c +60 -36
- data/vendor/libgit2/src/transports/ssh.c +36 -46
- data/vendor/libgit2/src/transports/winhttp.c +207 -231
- data/vendor/libgit2/src/tree-cache.c +7 -14
- data/vendor/libgit2/src/tree.c +24 -10
- data/vendor/libgit2/src/unix/map.c +1 -1
- data/vendor/libgit2/src/unix/posix.h +11 -1
- data/vendor/libgit2/src/userdiff.h +1 -3
- data/vendor/libgit2/src/util.c +53 -51
- data/vendor/libgit2/src/util.h +21 -16
- data/vendor/libgit2/src/win32/map.c +5 -3
- data/vendor/libgit2/src/win32/path_w32.c +2 -12
- data/vendor/libgit2/src/win32/path_w32.h +29 -0
- data/vendor/libgit2/src/win32/posix.h +4 -1
- data/vendor/libgit2/src/win32/posix_w32.c +5 -40
- data/vendor/libgit2/src/win32/precompiled.h +2 -0
- data/vendor/libgit2/src/win32/thread.c +10 -5
- data/vendor/libgit2/src/win32/w32_buffer.c +3 -7
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +93 -0
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +2 -0
- data/vendor/libgit2/src/win32/w32_stack.c +9 -4
- data/vendor/libgit2/src/win32/w32_stack.h +3 -3
- data/vendor/libgit2/src/win32/w32_util.c +0 -31
- data/vendor/libgit2/src/win32/w32_util.h +32 -6
- data/vendor/libgit2/src/worktree.c +22 -36
- data/vendor/libgit2/src/xdiff/xdiffi.c +1 -1
- data/vendor/libgit2/src/xdiff/xmerge.c +0 -12
- data/vendor/libgit2/src/xdiff/xpatience.c +0 -3
- metadata +34 -98
- data/vendor/libgit2/cmake/Modules/FindGSSFramework.cmake +0 -28
- data/vendor/libgit2/cmake/Modules/FindPCRE.cmake +0 -38
- data/vendor/libgit2/cmake/Modules/FindPCRE2.cmake +0 -37
- data/vendor/libgit2/cmake/Modules/PkgBuildConfig.cmake +0 -110
- data/vendor/libgit2/cmake/Modules/SelectGSSAPI.cmake +0 -53
- data/vendor/libgit2/cmake/Modules/SelectHTTPSBackend.cmake +0 -124
- data/vendor/libgit2/cmake/Modules/SelectHashes.cmake +0 -66
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +0 -21
- data/vendor/libgit2/deps/ntlmclient/compat.h +0 -33
- data/vendor/libgit2/deps/ntlmclient/crypt.h +0 -64
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +0 -120
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +0 -18
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +0 -145
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +0 -18
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +0 -130
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +0 -21
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +0 -1420
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +0 -174
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +0 -320
- data/vendor/libgit2/deps/ntlmclient/unicode.h +0 -36
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +0 -445
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +0 -201
- data/vendor/libgit2/deps/ntlmclient/utf8.h +0 -1257
- data/vendor/libgit2/deps/ntlmclient/util.c +0 -21
- data/vendor/libgit2/deps/ntlmclient/util.h +0 -14
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +0 -140
- data/vendor/libgit2/deps/pcre/COPYING +0 -5
- data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +0 -22
- data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +0 -17
- data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +0 -58
- data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +0 -29
- data/vendor/libgit2/deps/pcre/config.h.in +0 -57
- data/vendor/libgit2/deps/pcre/pcre.h +0 -641
- data/vendor/libgit2/deps/pcre/pcre_byte_order.c +0 -319
- data/vendor/libgit2/deps/pcre/pcre_chartables.c +0 -198
- data/vendor/libgit2/deps/pcre/pcre_compile.c +0 -9800
- data/vendor/libgit2/deps/pcre/pcre_config.c +0 -190
- data/vendor/libgit2/deps/pcre/pcre_dfa_exec.c +0 -3676
- data/vendor/libgit2/deps/pcre/pcre_exec.c +0 -7173
- data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +0 -245
- data/vendor/libgit2/deps/pcre/pcre_get.c +0 -669
- data/vendor/libgit2/deps/pcre/pcre_globals.c +0 -86
- data/vendor/libgit2/deps/pcre/pcre_internal.h +0 -2787
- data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +0 -11913
- data/vendor/libgit2/deps/pcre/pcre_maketables.c +0 -156
- data/vendor/libgit2/deps/pcre/pcre_newline.c +0 -210
- data/vendor/libgit2/deps/pcre/pcre_ord2utf8.c +0 -94
- data/vendor/libgit2/deps/pcre/pcre_printint.c +0 -834
- data/vendor/libgit2/deps/pcre/pcre_refcount.c +0 -92
- data/vendor/libgit2/deps/pcre/pcre_string_utils.c +0 -211
- data/vendor/libgit2/deps/pcre/pcre_study.c +0 -1686
- data/vendor/libgit2/deps/pcre/pcre_tables.c +0 -727
- data/vendor/libgit2/deps/pcre/pcre_ucd.c +0 -3644
- data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +0 -301
- data/vendor/libgit2/deps/pcre/pcre_version.c +0 -98
- data/vendor/libgit2/deps/pcre/pcre_xclass.c +0 -268
- data/vendor/libgit2/deps/pcre/pcreposix.c +0 -421
- data/vendor/libgit2/deps/pcre/pcreposix.h +0 -117
- data/vendor/libgit2/deps/pcre/ucp.h +0 -224
- data/vendor/libgit2/include/git2/cert.h +0 -135
- data/vendor/libgit2/include/git2/cred.h +0 -308
- data/vendor/libgit2/include/git2/sys/cred.h +0 -90
- data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
- data/vendor/libgit2/src/config_snapshot.c +0 -206
- data/vendor/libgit2/src/errors.h +0 -81
- data/vendor/libgit2/src/hash/sha1.h +0 -38
- data/vendor/libgit2/src/hash/sha1/collisiondetect.h +0 -19
- data/vendor/libgit2/src/hash/sha1/common_crypto.h +0 -19
- data/vendor/libgit2/src/hash/sha1/openssl.h +0 -19
- data/vendor/libgit2/src/net.c +0 -184
- data/vendor/libgit2/src/net.h +0 -36
- data/vendor/libgit2/src/regexp.c +0 -221
- data/vendor/libgit2/src/regexp.h +0 -97
- data/vendor/libgit2/src/transports/auth_ntlm.c +0 -223
- data/vendor/libgit2/src/transports/auth_ntlm.h +0 -35
- data/vendor/libgit2/src/wildmatch.c +0 -320
- data/vendor/libgit2/src/wildmatch.h +0 -23
- data/vendor/libgit2/src/win32/w32_common.h +0 -39
data/vendor/libgit2/src/refdb.c
CHANGED
|
@@ -66,18 +66,6 @@ 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
|
-
|
|
81
69
|
refdb_free_backend(db);
|
|
82
70
|
db->backend = backend;
|
|
83
71
|
|
|
@@ -10,16 +10,14 @@
|
|
|
10
10
|
#include "refs.h"
|
|
11
11
|
#include "hash.h"
|
|
12
12
|
#include "repository.h"
|
|
13
|
-
#include "
|
|
13
|
+
#include "fileops.h"
|
|
14
14
|
#include "filebuf.h"
|
|
15
15
|
#include "pack.h"
|
|
16
|
-
#include "parse.h"
|
|
17
16
|
#include "reflog.h"
|
|
18
17
|
#include "refdb.h"
|
|
19
18
|
#include "iterator.h"
|
|
20
19
|
#include "sortedcache.h"
|
|
21
20
|
#include "signature.h"
|
|
22
|
-
#include "wildmatch.h"
|
|
23
21
|
|
|
24
22
|
#include <git2/tag.h>
|
|
25
23
|
#include <git2/object.h>
|
|
@@ -329,33 +327,21 @@ static int refdb_fs_backend__exists(
|
|
|
329
327
|
git_refdb_backend *_backend,
|
|
330
328
|
const char *ref_name)
|
|
331
329
|
{
|
|
332
|
-
refdb_fs_backend *backend =
|
|
330
|
+
refdb_fs_backend *backend = (refdb_fs_backend *)_backend;
|
|
333
331
|
git_buf ref_path = GIT_BUF_INIT;
|
|
334
332
|
int error;
|
|
335
333
|
|
|
336
334
|
assert(backend);
|
|
337
335
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
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;
|
|
336
|
+
if ((error = packed_reload(backend)) < 0 ||
|
|
337
|
+
(error = git_buf_joinpath(&ref_path, backend->gitpath, ref_name)) < 0)
|
|
338
|
+
return error;
|
|
350
339
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
goto out;
|
|
354
|
-
}
|
|
340
|
+
*exists = git_path_isfile(ref_path.ptr) ||
|
|
341
|
+
(git_sortedcache_lookup(backend->refcache, ref_name) != NULL);
|
|
355
342
|
|
|
356
|
-
out:
|
|
357
343
|
git_buf_dispose(&ref_path);
|
|
358
|
-
return
|
|
344
|
+
return 0;
|
|
359
345
|
}
|
|
360
346
|
|
|
361
347
|
static const char *loose_parse_symbolic(git_buf *file_content)
|
|
@@ -471,7 +457,7 @@ static int refdb_fs_backend__lookup(
|
|
|
471
457
|
git_refdb_backend *_backend,
|
|
472
458
|
const char *ref_name)
|
|
473
459
|
{
|
|
474
|
-
refdb_fs_backend *backend =
|
|
460
|
+
refdb_fs_backend *backend = (refdb_fs_backend *)_backend;
|
|
475
461
|
int error;
|
|
476
462
|
|
|
477
463
|
assert(backend);
|
|
@@ -504,7 +490,7 @@ typedef struct {
|
|
|
504
490
|
|
|
505
491
|
static void refdb_fs_backend__iterator_free(git_reference_iterator *_iter)
|
|
506
492
|
{
|
|
507
|
-
refdb_fs_iter *iter =
|
|
493
|
+
refdb_fs_iter *iter = (refdb_fs_iter *) _iter;
|
|
508
494
|
|
|
509
495
|
git_vector_free(&iter->loose);
|
|
510
496
|
git_pool_clear(&iter->pool);
|
|
@@ -566,6 +552,7 @@ static int iter_load_loose_paths(refdb_fs_backend *backend, refdb_fs_iter *iter)
|
|
|
566
552
|
|
|
567
553
|
while (!error && !git_iterator_advance(&entry, fsit)) {
|
|
568
554
|
const char *ref_name;
|
|
555
|
+
struct packref *ref;
|
|
569
556
|
char *ref_dup;
|
|
570
557
|
|
|
571
558
|
git_buf_truncate(&path, ref_prefix_len);
|
|
@@ -573,9 +560,15 @@ static int iter_load_loose_paths(refdb_fs_backend *backend, refdb_fs_iter *iter)
|
|
|
573
560
|
ref_name = git_buf_cstr(&path);
|
|
574
561
|
|
|
575
562
|
if (git__suffixcmp(ref_name, ".lock") == 0 ||
|
|
576
|
-
(iter->glob &&
|
|
563
|
+
(iter->glob && p_fnmatch(iter->glob, ref_name, 0) != 0))
|
|
577
564
|
continue;
|
|
578
565
|
|
|
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
|
+
|
|
579
572
|
ref_dup = git_pool_strdup(&iter->pool, ref_name);
|
|
580
573
|
if (!ref_dup)
|
|
581
574
|
error = -1;
|
|
@@ -593,24 +586,24 @@ static int refdb_fs_backend__iterator_next(
|
|
|
593
586
|
git_reference **out, git_reference_iterator *_iter)
|
|
594
587
|
{
|
|
595
588
|
int error = GIT_ITEROVER;
|
|
596
|
-
refdb_fs_iter *iter =
|
|
597
|
-
refdb_fs_backend *backend =
|
|
589
|
+
refdb_fs_iter *iter = (refdb_fs_iter *)_iter;
|
|
590
|
+
refdb_fs_backend *backend = (refdb_fs_backend *)iter->parent.db->backend;
|
|
598
591
|
struct packref *ref;
|
|
599
592
|
|
|
600
593
|
while (iter->loose_pos < iter->loose.length) {
|
|
601
594
|
const char *path = git_vector_get(&iter->loose, iter->loose_pos++);
|
|
602
595
|
|
|
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
|
-
|
|
596
|
+
if (loose_lookup(out, backend, path) == 0)
|
|
608
597
|
return 0;
|
|
609
|
-
}
|
|
610
598
|
|
|
611
599
|
git_error_clear();
|
|
612
600
|
}
|
|
613
601
|
|
|
602
|
+
if (!iter->cache) {
|
|
603
|
+
if ((error = git_sortedcache_copy(&iter->cache, backend->refcache, 1, NULL, NULL)) < 0)
|
|
604
|
+
return error;
|
|
605
|
+
}
|
|
606
|
+
|
|
614
607
|
error = GIT_ITEROVER;
|
|
615
608
|
while (iter->packed_pos < git_sortedcache_entrycount(iter->cache)) {
|
|
616
609
|
ref = git_sortedcache_entry(iter->cache, iter->packed_pos++);
|
|
@@ -619,7 +612,7 @@ static int refdb_fs_backend__iterator_next(
|
|
|
619
612
|
|
|
620
613
|
if (ref->flags & PACKREF_SHADOWED)
|
|
621
614
|
continue;
|
|
622
|
-
if (iter->glob &&
|
|
615
|
+
if (iter->glob && p_fnmatch(iter->glob, ref->name, 0) != 0)
|
|
623
616
|
continue;
|
|
624
617
|
|
|
625
618
|
*out = git_reference__alloc(ref->name, &ref->oid, &ref->peel);
|
|
@@ -634,19 +627,14 @@ static int refdb_fs_backend__iterator_next_name(
|
|
|
634
627
|
const char **out, git_reference_iterator *_iter)
|
|
635
628
|
{
|
|
636
629
|
int error = GIT_ITEROVER;
|
|
637
|
-
refdb_fs_iter *iter =
|
|
638
|
-
refdb_fs_backend *backend =
|
|
630
|
+
refdb_fs_iter *iter = (refdb_fs_iter *)_iter;
|
|
631
|
+
refdb_fs_backend *backend = (refdb_fs_backend *)iter->parent.db->backend;
|
|
639
632
|
struct packref *ref;
|
|
640
633
|
|
|
641
634
|
while (iter->loose_pos < iter->loose.length) {
|
|
642
635
|
const char *path = git_vector_get(&iter->loose, iter->loose_pos++);
|
|
643
|
-
struct packref *ref;
|
|
644
636
|
|
|
645
637
|
if (loose_lookup(NULL, backend, path) == 0) {
|
|
646
|
-
ref = git_sortedcache_lookup(iter->cache, path);
|
|
647
|
-
if (ref)
|
|
648
|
-
ref->flags |= PACKREF_SHADOWED;
|
|
649
|
-
|
|
650
638
|
*out = path;
|
|
651
639
|
return 0;
|
|
652
640
|
}
|
|
@@ -654,6 +642,11 @@ static int refdb_fs_backend__iterator_next_name(
|
|
|
654
642
|
git_error_clear();
|
|
655
643
|
}
|
|
656
644
|
|
|
645
|
+
if (!iter->cache) {
|
|
646
|
+
if ((error = git_sortedcache_copy(&iter->cache, backend->refcache, 1, NULL, NULL)) < 0)
|
|
647
|
+
return error;
|
|
648
|
+
}
|
|
649
|
+
|
|
657
650
|
error = GIT_ITEROVER;
|
|
658
651
|
while (iter->packed_pos < git_sortedcache_entrycount(iter->cache)) {
|
|
659
652
|
ref = git_sortedcache_entry(iter->cache, iter->packed_pos++);
|
|
@@ -662,7 +655,7 @@ static int refdb_fs_backend__iterator_next_name(
|
|
|
662
655
|
|
|
663
656
|
if (ref->flags & PACKREF_SHADOWED)
|
|
664
657
|
continue;
|
|
665
|
-
if (iter->glob &&
|
|
658
|
+
if (iter->glob && p_fnmatch(iter->glob, ref->name, 0) != 0)
|
|
666
659
|
continue;
|
|
667
660
|
|
|
668
661
|
*out = ref->name;
|
|
@@ -676,44 +669,40 @@ static int refdb_fs_backend__iterator_next_name(
|
|
|
676
669
|
static int refdb_fs_backend__iterator(
|
|
677
670
|
git_reference_iterator **out, git_refdb_backend *_backend, const char *glob)
|
|
678
671
|
{
|
|
679
|
-
refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
|
|
680
|
-
refdb_fs_iter *iter = NULL;
|
|
681
672
|
int error;
|
|
673
|
+
refdb_fs_iter *iter;
|
|
674
|
+
refdb_fs_backend *backend = (refdb_fs_backend *)_backend;
|
|
682
675
|
|
|
683
676
|
assert(backend);
|
|
684
677
|
|
|
678
|
+
if ((error = packed_reload(backend)) < 0)
|
|
679
|
+
return error;
|
|
680
|
+
|
|
685
681
|
iter = git__calloc(1, sizeof(refdb_fs_iter));
|
|
686
682
|
GIT_ERROR_CHECK_ALLOC(iter);
|
|
687
683
|
|
|
688
684
|
git_pool_init(&iter->pool, 1);
|
|
689
685
|
|
|
690
|
-
if (
|
|
691
|
-
goto
|
|
686
|
+
if (git_vector_init(&iter->loose, 8, NULL) < 0)
|
|
687
|
+
goto fail;
|
|
692
688
|
|
|
693
689
|
if (glob != NULL &&
|
|
694
|
-
|
|
695
|
-
|
|
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;
|
|
690
|
+
(iter->glob = git_pool_strdup(&iter->pool, glob)) == NULL)
|
|
691
|
+
goto fail;
|
|
707
692
|
|
|
708
693
|
iter->parent.next = refdb_fs_backend__iterator_next;
|
|
709
694
|
iter->parent.next_name = refdb_fs_backend__iterator_next_name;
|
|
710
695
|
iter->parent.free = refdb_fs_backend__iterator_free;
|
|
711
696
|
|
|
697
|
+
if (iter_load_loose_paths(backend, iter) < 0)
|
|
698
|
+
goto fail;
|
|
699
|
+
|
|
712
700
|
*out = (git_reference_iterator *)iter;
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
701
|
+
return 0;
|
|
702
|
+
|
|
703
|
+
fail:
|
|
704
|
+
refdb_fs_backend__iterator_free((git_reference_iterator *)iter);
|
|
705
|
+
return -1;
|
|
717
706
|
}
|
|
718
707
|
|
|
719
708
|
static bool ref_is_available(
|
|
@@ -805,7 +794,7 @@ static int loose_lock(git_filebuf *file, refdb_fs_backend *backend, const char *
|
|
|
805
794
|
if (git_buf_joinpath(&ref_path, basedir, name) < 0)
|
|
806
795
|
return -1;
|
|
807
796
|
|
|
808
|
-
filebuf_flags =
|
|
797
|
+
filebuf_flags = GIT_FILEBUF_FORCE;
|
|
809
798
|
if (backend->fsync)
|
|
810
799
|
filebuf_flags |= GIT_FILEBUF_FSYNC;
|
|
811
800
|
|
|
@@ -840,7 +829,7 @@ static int refdb_fs_backend__lock(void **out, git_refdb_backend *_backend, const
|
|
|
840
829
|
{
|
|
841
830
|
int error;
|
|
842
831
|
git_filebuf *lock;
|
|
843
|
-
refdb_fs_backend *backend =
|
|
832
|
+
refdb_fs_backend *backend = (refdb_fs_backend *) _backend;
|
|
844
833
|
|
|
845
834
|
lock = git__calloc(1, sizeof(git_filebuf));
|
|
846
835
|
GIT_ERROR_CHECK_ALLOC(lock);
|
|
@@ -859,17 +848,16 @@ static int refdb_fs_backend__write_tail(
|
|
|
859
848
|
const git_reference *ref,
|
|
860
849
|
git_filebuf *file,
|
|
861
850
|
int update_reflog,
|
|
862
|
-
const git_oid *old_id,
|
|
863
|
-
const char *old_target,
|
|
864
851
|
const git_signature *who,
|
|
865
|
-
const char *message
|
|
852
|
+
const char *message,
|
|
853
|
+
const git_oid *old_id,
|
|
854
|
+
const char *old_target);
|
|
866
855
|
|
|
867
856
|
static int refdb_fs_backend__delete_tail(
|
|
868
857
|
git_refdb_backend *_backend,
|
|
869
858
|
git_filebuf *file,
|
|
870
859
|
const char *ref_name,
|
|
871
|
-
const git_oid *old_id,
|
|
872
|
-
const char *old_target);
|
|
860
|
+
const git_oid *old_id, const char *old_target);
|
|
873
861
|
|
|
874
862
|
static int refdb_fs_backend__unlock(git_refdb_backend *backend, void *payload, int success, int update_reflog,
|
|
875
863
|
const git_reference *ref, const git_signature *sig, const char *message)
|
|
@@ -880,7 +868,7 @@ static int refdb_fs_backend__unlock(git_refdb_backend *backend, void *payload, i
|
|
|
880
868
|
if (success == 2)
|
|
881
869
|
error = refdb_fs_backend__delete_tail(backend, lock, ref->name, NULL, NULL);
|
|
882
870
|
else if (success)
|
|
883
|
-
error = refdb_fs_backend__write_tail(backend, ref, lock, update_reflog,
|
|
871
|
+
error = refdb_fs_backend__write_tail(backend, ref, lock, update_reflog, sig, message, NULL, NULL);
|
|
884
872
|
else
|
|
885
873
|
git_filebuf_cleanup(lock);
|
|
886
874
|
|
|
@@ -1099,35 +1087,6 @@ fail:
|
|
|
1099
1087
|
return error;
|
|
1100
1088
|
}
|
|
1101
1089
|
|
|
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
|
-
|
|
1131
1090
|
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);
|
|
1132
1091
|
static int has_reflog(git_repository *repo, const char *name);
|
|
1133
1092
|
|
|
@@ -1135,7 +1094,7 @@ static int should_write_reflog(int *write, git_repository *repo, const char *nam
|
|
|
1135
1094
|
{
|
|
1136
1095
|
int error, logall;
|
|
1137
1096
|
|
|
1138
|
-
error =
|
|
1097
|
+
error = git_repository__cvar(&logall, repo, GIT_CVAR_LOGALLREFUPDATES);
|
|
1139
1098
|
if (error < 0)
|
|
1140
1099
|
return error;
|
|
1141
1100
|
|
|
@@ -1280,7 +1239,7 @@ static int refdb_fs_backend__write(
|
|
|
1280
1239
|
const git_oid *old_id,
|
|
1281
1240
|
const char *old_target)
|
|
1282
1241
|
{
|
|
1283
|
-
refdb_fs_backend *backend =
|
|
1242
|
+
refdb_fs_backend *backend = (refdb_fs_backend *)_backend;
|
|
1284
1243
|
git_filebuf file = GIT_FILEBUF_INIT;
|
|
1285
1244
|
int error = 0;
|
|
1286
1245
|
|
|
@@ -1293,7 +1252,7 @@ static int refdb_fs_backend__write(
|
|
|
1293
1252
|
if ((error = loose_lock(&file, backend, ref->name)) < 0)
|
|
1294
1253
|
return error;
|
|
1295
1254
|
|
|
1296
|
-
return refdb_fs_backend__write_tail(_backend, ref, &file, true,
|
|
1255
|
+
return refdb_fs_backend__write_tail(_backend, ref, &file, true, who, message, old_id, old_target);
|
|
1297
1256
|
}
|
|
1298
1257
|
|
|
1299
1258
|
static int refdb_fs_backend__write_tail(
|
|
@@ -1301,12 +1260,12 @@ static int refdb_fs_backend__write_tail(
|
|
|
1301
1260
|
const git_reference *ref,
|
|
1302
1261
|
git_filebuf *file,
|
|
1303
1262
|
int update_reflog,
|
|
1304
|
-
const git_oid *old_id,
|
|
1305
|
-
const char *old_target,
|
|
1306
1263
|
const git_signature *who,
|
|
1307
|
-
const char *message
|
|
1264
|
+
const char *message,
|
|
1265
|
+
const git_oid *old_id,
|
|
1266
|
+
const char *old_target)
|
|
1308
1267
|
{
|
|
1309
|
-
refdb_fs_backend *backend =
|
|
1268
|
+
refdb_fs_backend *backend = (refdb_fs_backend *)_backend;
|
|
1310
1269
|
int error = 0, cmp = 0, should_write;
|
|
1311
1270
|
const char *new_target = NULL;
|
|
1312
1271
|
const git_oid *new_id = NULL;
|
|
@@ -1354,10 +1313,10 @@ on_error:
|
|
|
1354
1313
|
return error;
|
|
1355
1314
|
}
|
|
1356
1315
|
|
|
1357
|
-
static void
|
|
1316
|
+
static void refdb_fs_backend__try_delete_empty_ref_hierarchie(
|
|
1358
1317
|
refdb_fs_backend *backend,
|
|
1359
1318
|
const char *ref_name,
|
|
1360
|
-
|
|
1319
|
+
bool reflog)
|
|
1361
1320
|
{
|
|
1362
1321
|
git_buf relative_path = GIT_BUF_INIT;
|
|
1363
1322
|
git_buf base_path = GIT_BUF_INIT;
|
|
@@ -1375,8 +1334,8 @@ static void refdb_fs_backend__prune_refs(
|
|
|
1375
1334
|
|
|
1376
1335
|
git_buf_truncate(&relative_path, commonlen);
|
|
1377
1336
|
|
|
1378
|
-
if (
|
|
1379
|
-
if (git_buf_join3(&base_path, '/', backend->commonpath,
|
|
1337
|
+
if (reflog) {
|
|
1338
|
+
if (git_buf_join3(&base_path, '/', backend->commonpath, GIT_REFLOG_DIR, git_buf_cstr(&relative_path)) < 0)
|
|
1380
1339
|
goto cleanup;
|
|
1381
1340
|
} else {
|
|
1382
1341
|
if (git_buf_joinpath(&base_path, backend->commonpath, git_buf_cstr(&relative_path)) < 0)
|
|
@@ -1396,7 +1355,7 @@ static int refdb_fs_backend__delete(
|
|
|
1396
1355
|
const char *ref_name,
|
|
1397
1356
|
const git_oid *old_id, const char *old_target)
|
|
1398
1357
|
{
|
|
1399
|
-
refdb_fs_backend *backend =
|
|
1358
|
+
refdb_fs_backend *backend = (refdb_fs_backend *)_backend;
|
|
1400
1359
|
git_filebuf file = GIT_FILEBUF_INIT;
|
|
1401
1360
|
int error = 0;
|
|
1402
1361
|
|
|
@@ -1413,34 +1372,17 @@ static int refdb_fs_backend__delete(
|
|
|
1413
1372
|
return refdb_fs_backend__delete_tail(_backend, &file, ref_name, old_id, old_target);
|
|
1414
1373
|
}
|
|
1415
1374
|
|
|
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
|
-
|
|
1435
1375
|
static int refdb_fs_backend__delete_tail(
|
|
1436
1376
|
git_refdb_backend *_backend,
|
|
1437
1377
|
git_filebuf *file,
|
|
1438
1378
|
const char *ref_name,
|
|
1439
1379
|
const git_oid *old_id, const char *old_target)
|
|
1440
1380
|
{
|
|
1441
|
-
refdb_fs_backend *backend =
|
|
1381
|
+
refdb_fs_backend *backend = (refdb_fs_backend *)_backend;
|
|
1382
|
+
git_buf loose_path = GIT_BUF_INIT;
|
|
1383
|
+
size_t pack_pos;
|
|
1442
1384
|
int error = 0, cmp = 0;
|
|
1443
|
-
bool
|
|
1385
|
+
bool loose_deleted = 0;
|
|
1444
1386
|
|
|
1445
1387
|
error = cmp_old_ref(&cmp, _backend, ref_name, old_id, old_target);
|
|
1446
1388
|
if (error < 0)
|
|
@@ -1452,41 +1394,44 @@ static int refdb_fs_backend__delete_tail(
|
|
|
1452
1394
|
goto cleanup;
|
|
1453
1395
|
}
|
|
1454
1396
|
|
|
1455
|
-
/*
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
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)
|
|
1397
|
+
/* If a loose reference exists, remove it from the filesystem */
|
|
1398
|
+
if (git_buf_joinpath(&loose_path, backend->commonpath, ref_name) < 0)
|
|
1399
|
+
return -1;
|
|
1400
|
+
|
|
1401
|
+
|
|
1402
|
+
error = p_unlink(loose_path.ptr);
|
|
1403
|
+
if (error < 0 && errno == ENOENT)
|
|
1404
|
+
error = 0;
|
|
1405
|
+
else if (error < 0)
|
|
1473
1406
|
goto cleanup;
|
|
1407
|
+
else if (error == 0)
|
|
1408
|
+
loose_deleted = 1;
|
|
1474
1409
|
|
|
1475
|
-
if (error
|
|
1476
|
-
|
|
1410
|
+
if ((error = packed_reload(backend)) < 0)
|
|
1411
|
+
goto cleanup;
|
|
1477
1412
|
|
|
1478
|
-
|
|
1413
|
+
/* If a packed reference exists, remove it from the packfile and repack */
|
|
1414
|
+
if ((error = git_sortedcache_wlock(backend->refcache)) < 0)
|
|
1479
1415
|
goto cleanup;
|
|
1480
1416
|
|
|
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
|
+
|
|
1481
1423
|
if (error == GIT_ENOTFOUND) {
|
|
1482
|
-
error =
|
|
1424
|
+
error = loose_deleted ? 0 : ref_error_notfound(ref_name);
|
|
1483
1425
|
goto cleanup;
|
|
1484
1426
|
}
|
|
1485
1427
|
|
|
1428
|
+
error = packed_write(backend);
|
|
1429
|
+
|
|
1486
1430
|
cleanup:
|
|
1431
|
+
git_buf_dispose(&loose_path);
|
|
1487
1432
|
git_filebuf_cleanup(file);
|
|
1488
|
-
if (
|
|
1489
|
-
|
|
1433
|
+
if (loose_deleted)
|
|
1434
|
+
refdb_fs_backend__try_delete_empty_ref_hierarchie(backend, ref_name, false);
|
|
1490
1435
|
return error;
|
|
1491
1436
|
}
|
|
1492
1437
|
|
|
@@ -1501,7 +1446,7 @@ static int refdb_fs_backend__rename(
|
|
|
1501
1446
|
const git_signature *who,
|
|
1502
1447
|
const char *message)
|
|
1503
1448
|
{
|
|
1504
|
-
refdb_fs_backend *backend =
|
|
1449
|
+
refdb_fs_backend *backend = (refdb_fs_backend *)_backend;
|
|
1505
1450
|
git_reference *old, *new;
|
|
1506
1451
|
git_filebuf file = GIT_FILEBUF_INIT;
|
|
1507
1452
|
int error;
|
|
@@ -1557,7 +1502,7 @@ static int refdb_fs_backend__rename(
|
|
|
1557
1502
|
static int refdb_fs_backend__compress(git_refdb_backend *_backend)
|
|
1558
1503
|
{
|
|
1559
1504
|
int error;
|
|
1560
|
-
refdb_fs_backend *backend =
|
|
1505
|
+
refdb_fs_backend *backend = (refdb_fs_backend *)_backend;
|
|
1561
1506
|
|
|
1562
1507
|
assert(backend);
|
|
1563
1508
|
|
|
@@ -1571,7 +1516,7 @@ static int refdb_fs_backend__compress(git_refdb_backend *_backend)
|
|
|
1571
1516
|
|
|
1572
1517
|
static void refdb_fs_backend__free(git_refdb_backend *_backend)
|
|
1573
1518
|
{
|
|
1574
|
-
refdb_fs_backend *backend =
|
|
1519
|
+
refdb_fs_backend *backend = (refdb_fs_backend *)_backend;
|
|
1575
1520
|
|
|
1576
1521
|
assert(backend);
|
|
1577
1522
|
|
|
@@ -1652,57 +1597,70 @@ static int reflog_alloc(git_reflog **reflog, const char *name)
|
|
|
1652
1597
|
|
|
1653
1598
|
static int reflog_parse(git_reflog *log, const char *buf, size_t buf_size)
|
|
1654
1599
|
{
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
if ((git_parse_ctx_init(&parser, buf, buf_size)) < 0)
|
|
1658
|
-
return -1;
|
|
1659
|
-
|
|
1660
|
-
for (; parser.remain_len; git_parse_advance_line(&parser)) {
|
|
1661
|
-
git_reflog_entry *entry;
|
|
1662
|
-
const char *sig;
|
|
1663
|
-
char c;
|
|
1600
|
+
const char *ptr;
|
|
1601
|
+
git_reflog_entry *entry;
|
|
1664
1602
|
|
|
1665
|
-
|
|
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));
|
|
1666
1614
|
GIT_ERROR_CHECK_ALLOC(entry);
|
|
1667
|
-
|
|
1615
|
+
|
|
1616
|
+
entry->committer = git__calloc(1, sizeof(git_signature));
|
|
1668
1617
|
GIT_ERROR_CHECK_ALLOC(entry->committer);
|
|
1669
1618
|
|
|
1670
|
-
if (
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
goto next;
|
|
1619
|
+
if (git_oid_fromstrn(&entry->oid_old, buf, GIT_OID_HEXSZ) < 0)
|
|
1620
|
+
goto fail;
|
|
1621
|
+
seek_forward(GIT_OID_HEXSZ + 1);
|
|
1674
1622
|
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1623
|
+
if (git_oid_fromstrn(&entry->oid_cur, buf, GIT_OID_HEXSZ) < 0)
|
|
1624
|
+
goto fail;
|
|
1625
|
+
seek_forward(GIT_OID_HEXSZ + 1);
|
|
1678
1626
|
|
|
1679
|
-
|
|
1680
|
-
goto next;
|
|
1627
|
+
ptr = buf;
|
|
1681
1628
|
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1629
|
+
/* Seek forward to the end of the signature. */
|
|
1630
|
+
while (*buf && *buf != '\t' && *buf != '\n')
|
|
1631
|
+
seek_forward(1);
|
|
1685
1632
|
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
len--;
|
|
1633
|
+
if (git_signature__parse(entry->committer, &ptr, buf + 1, NULL, *buf) < 0)
|
|
1634
|
+
goto fail;
|
|
1689
1635
|
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1636
|
+
if (*buf == '\t') {
|
|
1637
|
+
/* We got a message. Read everything till we reach LF. */
|
|
1638
|
+
seek_forward(1);
|
|
1639
|
+
ptr = buf;
|
|
1693
1640
|
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1641
|
+
while (*buf && *buf != '\n')
|
|
1642
|
+
seek_forward(1);
|
|
1643
|
+
|
|
1644
|
+
entry->msg = git__strndup(ptr, buf - ptr);
|
|
1645
|
+
GIT_ERROR_CHECK_ALLOC(entry->msg);
|
|
1646
|
+
} else
|
|
1647
|
+
entry->msg = NULL;
|
|
1698
1648
|
|
|
1699
|
-
|
|
1649
|
+
while (*buf && *buf == '\n' && buf_size > 1)
|
|
1650
|
+
seek_forward(1);
|
|
1700
1651
|
|
|
1701
|
-
|
|
1702
|
-
|
|
1652
|
+
if (git_vector_insert(&log->entries, entry) < 0)
|
|
1653
|
+
goto fail;
|
|
1703
1654
|
}
|
|
1704
1655
|
|
|
1705
1656
|
return 0;
|
|
1657
|
+
|
|
1658
|
+
#undef seek_forward
|
|
1659
|
+
|
|
1660
|
+
fail:
|
|
1661
|
+
git_reflog_entry__free(entry);
|
|
1662
|
+
|
|
1663
|
+
return -1;
|
|
1706
1664
|
}
|
|
1707
1665
|
|
|
1708
1666
|
static int create_new_reflog_file(const char *filepath)
|
|
@@ -1736,7 +1694,7 @@ static int refdb_reflog_fs__ensure_log(git_refdb_backend *_backend, const char *
|
|
|
1736
1694
|
|
|
1737
1695
|
assert(_backend && name);
|
|
1738
1696
|
|
|
1739
|
-
backend =
|
|
1697
|
+
backend = (refdb_fs_backend *) _backend;
|
|
1740
1698
|
repo = backend->repo;
|
|
1741
1699
|
|
|
1742
1700
|
if ((error = retrieve_reflog_path(&path, repo, name)) < 0)
|
|
@@ -1769,7 +1727,7 @@ static int refdb_reflog_fs__has_log(git_refdb_backend *_backend, const char *nam
|
|
|
1769
1727
|
|
|
1770
1728
|
assert(_backend && name);
|
|
1771
1729
|
|
|
1772
|
-
backend =
|
|
1730
|
+
backend = (refdb_fs_backend *) _backend;
|
|
1773
1731
|
|
|
1774
1732
|
return has_reflog(backend->repo, name);
|
|
1775
1733
|
}
|
|
@@ -1785,7 +1743,7 @@ static int refdb_reflog_fs__read(git_reflog **out, git_refdb_backend *_backend,
|
|
|
1785
1743
|
|
|
1786
1744
|
assert(out && _backend && name);
|
|
1787
1745
|
|
|
1788
|
-
backend =
|
|
1746
|
+
backend = (refdb_fs_backend *) _backend;
|
|
1789
1747
|
repo = backend->repo;
|
|
1790
1748
|
|
|
1791
1749
|
if (reflog_alloc(&log, name) < 0)
|
|
@@ -1844,15 +1802,8 @@ static int serialize_reflog_entry(
|
|
|
1844
1802
|
git_buf_rtrim(buf);
|
|
1845
1803
|
|
|
1846
1804
|
if (msg) {
|
|
1847
|
-
size_t i;
|
|
1848
|
-
|
|
1849
1805
|
git_buf_putc(buf, '\t');
|
|
1850
1806
|
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);
|
|
1856
1807
|
}
|
|
1857
1808
|
|
|
1858
1809
|
git_buf_putc(buf, '\n');
|
|
@@ -1902,7 +1853,7 @@ static int refdb_reflog_fs__write(git_refdb_backend *_backend, git_reflog *reflo
|
|
|
1902
1853
|
|
|
1903
1854
|
assert(_backend && reflog);
|
|
1904
1855
|
|
|
1905
|
-
backend =
|
|
1856
|
+
backend = (refdb_fs_backend *) _backend;
|
|
1906
1857
|
|
|
1907
1858
|
if ((error = lock_reflog(&fbuf, backend, reflog->ref_name)) < 0)
|
|
1908
1859
|
return -1;
|
|
@@ -1943,7 +1894,7 @@ static int reflog_append(refdb_fs_backend *backend, const git_reference *ref, co
|
|
|
1943
1894
|
!(old && new))
|
|
1944
1895
|
return 0;
|
|
1945
1896
|
|
|
1946
|
-
/* From here on
|
|
1897
|
+
/* From here on is_symoblic also means that it's HEAD */
|
|
1947
1898
|
|
|
1948
1899
|
if (old) {
|
|
1949
1900
|
git_oid_cpy(&old_id, old);
|
|
@@ -2024,7 +1975,7 @@ static int refdb_reflog_fs__rename(git_refdb_backend *_backend, const char *old_
|
|
|
2024
1975
|
|
|
2025
1976
|
assert(_backend && old_name && new_name);
|
|
2026
1977
|
|
|
2027
|
-
backend =
|
|
1978
|
+
backend = (refdb_fs_backend *) _backend;
|
|
2028
1979
|
repo = backend->repo;
|
|
2029
1980
|
|
|
2030
1981
|
if ((error = git_reference__normalize_name(
|
|
@@ -2095,7 +2046,7 @@ cleanup:
|
|
|
2095
2046
|
|
|
2096
2047
|
static int refdb_reflog_fs__delete(git_refdb_backend *_backend, const char *name)
|
|
2097
2048
|
{
|
|
2098
|
-
refdb_fs_backend *backend =
|
|
2049
|
+
refdb_fs_backend *backend = (refdb_fs_backend *) _backend;
|
|
2099
2050
|
git_buf path = GIT_BUF_INIT;
|
|
2100
2051
|
int error;
|
|
2101
2052
|
|
|
@@ -2110,7 +2061,7 @@ static int refdb_reflog_fs__delete(git_refdb_backend *_backend, const char *name
|
|
|
2110
2061
|
if ((error = p_unlink(path.ptr)) < 0)
|
|
2111
2062
|
goto out;
|
|
2112
2063
|
|
|
2113
|
-
|
|
2064
|
+
refdb_fs_backend__try_delete_empty_ref_hierarchie(backend, name, true);
|
|
2114
2065
|
|
|
2115
2066
|
out:
|
|
2116
2067
|
git_buf_dispose(&path);
|
|
@@ -2153,15 +2104,15 @@ int git_refdb_backend_fs(
|
|
|
2153
2104
|
|
|
2154
2105
|
git_buf_dispose(&gitpath);
|
|
2155
2106
|
|
|
2156
|
-
if (!
|
|
2107
|
+
if (!git_repository__cvar(&t, backend->repo, GIT_CVAR_IGNORECASE) && t) {
|
|
2157
2108
|
backend->iterator_flags |= GIT_ITERATOR_IGNORE_CASE;
|
|
2158
2109
|
backend->direach_flags |= GIT_PATH_DIR_IGNORE_CASE;
|
|
2159
2110
|
}
|
|
2160
|
-
if (!
|
|
2111
|
+
if (!git_repository__cvar(&t, backend->repo, GIT_CVAR_PRECOMPOSE) && t) {
|
|
2161
2112
|
backend->iterator_flags |= GIT_ITERATOR_PRECOMPOSE_UNICODE;
|
|
2162
2113
|
backend->direach_flags |= GIT_PATH_DIR_PRECOMPOSE_UNICODE;
|
|
2163
2114
|
}
|
|
2164
|
-
if ((!
|
|
2115
|
+
if ((!git_repository__cvar(&t, backend->repo, GIT_CVAR_FSYNCOBJECTFILES) && t) ||
|
|
2165
2116
|
git_repository__fsync_gitdir)
|
|
2166
2117
|
backend->fsync = 1;
|
|
2167
2118
|
backend->iterator_flags |= GIT_ITERATOR_DESCEND_SYMLINKS;
|