rugged 0.27.7 → 0.27.10
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 +1 -0
- data/vendor/libgit2/CMakeLists.txt +99 -51
- data/vendor/libgit2/COPYING +28 -0
- data/vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake +15 -1
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.c.in +29 -0
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.cmake +96 -0
- data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +9 -8
- data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +2 -2
- data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +1 -1
- data/vendor/libgit2/cmake/Modules/FindGSSFramework.cmake +28 -0
- data/vendor/libgit2/cmake/Modules/FindIconv.cmake +11 -6
- data/vendor/libgit2/cmake/Modules/FindPCRE.cmake +38 -0
- data/vendor/libgit2/cmake/Modules/FindPCRE2.cmake +37 -0
- data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +2 -2
- data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +6 -0
- data/vendor/libgit2/cmake/Modules/PkgBuildConfig.cmake +110 -0
- data/vendor/libgit2/cmake/Modules/SelectGSSAPI.cmake +53 -0
- data/vendor/libgit2/cmake/Modules/SelectHTTPSBackend.cmake +124 -0
- data/vendor/libgit2/cmake/Modules/SelectHashes.cmake +66 -0
- data/vendor/libgit2/deps/http-parser/http_parser.c +11 -6
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +21 -0
- data/vendor/libgit2/deps/ntlmclient/compat.h +33 -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 +1420 -0
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +174 -0
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +320 -0
- data/vendor/libgit2/deps/ntlmclient/unicode.h +36 -0
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +445 -0
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +201 -0
- data/vendor/libgit2/deps/ntlmclient/utf8.h +1257 -0
- data/vendor/libgit2/deps/ntlmclient/util.c +21 -0
- data/vendor/libgit2/deps/ntlmclient/util.h +14 -0
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +140 -0
- data/vendor/libgit2/deps/pcre/COPYING +5 -0
- data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +22 -0
- data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +17 -0
- data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +58 -0
- data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +29 -0
- data/vendor/libgit2/deps/pcre/config.h.in +57 -0
- data/vendor/libgit2/deps/pcre/pcre.h +641 -0
- data/vendor/libgit2/deps/pcre/pcre_byte_order.c +319 -0
- data/vendor/libgit2/deps/pcre/pcre_chartables.c +198 -0
- data/vendor/libgit2/deps/pcre/pcre_compile.c +9800 -0
- data/vendor/libgit2/deps/pcre/pcre_config.c +190 -0
- data/vendor/libgit2/deps/pcre/pcre_dfa_exec.c +3676 -0
- data/vendor/libgit2/deps/pcre/pcre_exec.c +7173 -0
- data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +245 -0
- data/vendor/libgit2/deps/pcre/pcre_get.c +669 -0
- data/vendor/libgit2/deps/pcre/pcre_globals.c +86 -0
- data/vendor/libgit2/deps/pcre/pcre_internal.h +2787 -0
- data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +11913 -0
- data/vendor/libgit2/deps/pcre/pcre_maketables.c +156 -0
- data/vendor/libgit2/deps/pcre/pcre_newline.c +210 -0
- data/vendor/libgit2/deps/pcre/pcre_ord2utf8.c +94 -0
- data/vendor/libgit2/deps/pcre/pcre_printint.c +834 -0
- data/vendor/libgit2/deps/pcre/pcre_refcount.c +92 -0
- data/vendor/libgit2/deps/pcre/pcre_string_utils.c +211 -0
- data/vendor/libgit2/deps/pcre/pcre_study.c +1686 -0
- data/vendor/libgit2/deps/pcre/pcre_tables.c +727 -0
- data/vendor/libgit2/deps/pcre/pcre_ucd.c +3644 -0
- data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +301 -0
- data/vendor/libgit2/deps/pcre/pcre_version.c +98 -0
- data/vendor/libgit2/deps/pcre/pcre_xclass.c +268 -0
- data/vendor/libgit2/deps/pcre/pcreposix.c +421 -0
- data/vendor/libgit2/deps/pcre/pcreposix.h +117 -0
- data/vendor/libgit2/deps/pcre/ucp.h +224 -0
- data/vendor/libgit2/deps/winhttp/COPYING.GPL +993 -0
- data/vendor/libgit2/deps/winhttp/COPYING.LGPL +502 -0
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +1 -0
- data/vendor/libgit2/deps/zlib/COPYING +27 -0
- data/vendor/libgit2/deps/zlib/adler32.c +0 -7
- data/vendor/libgit2/deps/zlib/crc32.c +0 -7
- data/vendor/libgit2/include/git2/annotated_commit.h +9 -0
- data/vendor/libgit2/include/git2/apply.h +149 -0
- data/vendor/libgit2/include/git2/attr.h +20 -13
- data/vendor/libgit2/include/git2/blame.h +4 -4
- data/vendor/libgit2/include/git2/blob.h +44 -12
- data/vendor/libgit2/include/git2/buffer.h +20 -26
- data/vendor/libgit2/include/git2/cert.h +135 -0
- data/vendor/libgit2/include/git2/checkout.h +53 -21
- data/vendor/libgit2/include/git2/cherrypick.h +3 -3
- data/vendor/libgit2/include/git2/clone.h +5 -5
- data/vendor/libgit2/include/git2/commit.h +25 -3
- data/vendor/libgit2/include/git2/common.h +35 -10
- data/vendor/libgit2/include/git2/config.h +29 -19
- data/vendor/libgit2/include/git2/cred.h +308 -0
- data/vendor/libgit2/include/git2/deprecated.h +493 -0
- data/vendor/libgit2/include/git2/describe.h +4 -4
- data/vendor/libgit2/include/git2/diff.h +177 -135
- data/vendor/libgit2/include/git2/errors.h +53 -46
- data/vendor/libgit2/include/git2/filter.h +8 -0
- data/vendor/libgit2/include/git2/index.h +74 -52
- data/vendor/libgit2/include/git2/indexer.h +76 -6
- data/vendor/libgit2/include/git2/merge.h +25 -10
- data/vendor/libgit2/include/git2/net.h +0 -5
- data/vendor/libgit2/include/git2/notes.h +1 -1
- data/vendor/libgit2/include/git2/object.h +17 -29
- data/vendor/libgit2/include/git2/odb.h +12 -11
- data/vendor/libgit2/include/git2/odb_backend.h +10 -9
- data/vendor/libgit2/include/git2/oid.h +2 -2
- data/vendor/libgit2/include/git2/pack.h +14 -3
- data/vendor/libgit2/include/git2/proxy.h +5 -3
- data/vendor/libgit2/include/git2/rebase.h +46 -2
- data/vendor/libgit2/include/git2/refs.h +34 -16
- data/vendor/libgit2/include/git2/remote.h +111 -14
- data/vendor/libgit2/include/git2/repository.h +69 -34
- data/vendor/libgit2/include/git2/revert.h +1 -1
- data/vendor/libgit2/include/git2/revwalk.h +7 -7
- data/vendor/libgit2/include/git2/signature.h +2 -2
- data/vendor/libgit2/include/git2/stash.h +5 -5
- data/vendor/libgit2/include/git2/status.h +26 -17
- data/vendor/libgit2/include/git2/submodule.h +23 -6
- data/vendor/libgit2/include/git2/sys/alloc.h +18 -18
- data/vendor/libgit2/include/git2/sys/commit.h +1 -1
- data/vendor/libgit2/include/git2/sys/config.h +13 -13
- data/vendor/libgit2/include/git2/sys/cred.h +90 -0
- data/vendor/libgit2/include/git2/sys/filter.h +6 -6
- data/vendor/libgit2/include/git2/sys/merge.h +3 -3
- data/vendor/libgit2/include/git2/sys/odb_backend.h +66 -22
- data/vendor/libgit2/include/git2/sys/path.h +14 -5
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +76 -40
- data/vendor/libgit2/include/git2/sys/repository.h +5 -1
- data/vendor/libgit2/include/git2/sys/stream.h +92 -12
- data/vendor/libgit2/include/git2/sys/transport.h +129 -83
- data/vendor/libgit2/include/git2/tag.h +13 -4
- data/vendor/libgit2/include/git2/trace.h +2 -2
- data/vendor/libgit2/include/git2/transport.h +11 -311
- data/vendor/libgit2/include/git2/tree.h +4 -4
- data/vendor/libgit2/include/git2/types.h +25 -106
- data/vendor/libgit2/include/git2/version.h +3 -3
- data/vendor/libgit2/include/git2/worktree.h +5 -5
- data/vendor/libgit2/include/git2.h +4 -0
- data/vendor/libgit2/src/CMakeLists.txt +104 -235
- data/vendor/libgit2/src/alloc.c +14 -18
- data/vendor/libgit2/src/{stdalloc.c → allocators/stdalloc.c} +7 -8
- 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/annotated_commit.c +18 -11
- data/vendor/libgit2/src/apply.c +535 -28
- data/vendor/libgit2/src/apply.h +3 -1
- data/vendor/libgit2/src/array.h +2 -2
- data/vendor/libgit2/src/attr.c +77 -71
- data/vendor/libgit2/src/attr_file.c +203 -117
- data/vendor/libgit2/src/attr_file.h +9 -9
- data/vendor/libgit2/src/attrcache.c +49 -51
- data/vendor/libgit2/src/attrcache.h +2 -1
- data/vendor/libgit2/src/blame.c +38 -18
- data/vendor/libgit2/src/blame.h +1 -1
- data/vendor/libgit2/src/blame_git.c +29 -15
- data/vendor/libgit2/src/blob.c +123 -37
- data/vendor/libgit2/src/blob.h +19 -2
- data/vendor/libgit2/src/branch.c +47 -23
- data/vendor/libgit2/src/buf_text.c +7 -6
- data/vendor/libgit2/src/buffer.c +60 -53
- data/vendor/libgit2/src/cache.c +38 -45
- data/vendor/libgit2/src/cache.h +3 -3
- data/vendor/libgit2/src/cc-compat.h +20 -3
- data/vendor/libgit2/src/checkout.c +77 -67
- data/vendor/libgit2/src/cherrypick.c +12 -6
- data/vendor/libgit2/src/clone.c +36 -14
- data/vendor/libgit2/src/clone.h +4 -0
- data/vendor/libgit2/src/commit.c +103 -48
- data/vendor/libgit2/src/commit.h +7 -0
- data/vendor/libgit2/src/commit_list.c +36 -78
- data/vendor/libgit2/src/commit_list.h +2 -2
- data/vendor/libgit2/src/common.h +24 -90
- data/vendor/libgit2/src/config.c +203 -176
- data/vendor/libgit2/src/config.h +8 -20
- data/vendor/libgit2/src/config_backend.h +96 -0
- data/vendor/libgit2/src/config_cache.c +41 -35
- data/vendor/libgit2/src/config_entries.c +229 -0
- data/vendor/libgit2/src/config_entries.h +24 -0
- data/vendor/libgit2/src/config_file.c +422 -680
- data/vendor/libgit2/src/config_mem.c +220 -0
- data/vendor/libgit2/src/config_parse.c +96 -68
- data/vendor/libgit2/src/config_parse.h +15 -14
- data/vendor/libgit2/src/config_snapshot.c +206 -0
- data/vendor/libgit2/src/crlf.c +219 -196
- data/vendor/libgit2/src/delta.c +25 -18
- data/vendor/libgit2/src/describe.c +42 -41
- data/vendor/libgit2/src/diff.c +52 -67
- data/vendor/libgit2/src/diff.h +2 -1
- data/vendor/libgit2/src/diff_driver.c +44 -46
- data/vendor/libgit2/src/diff_file.c +16 -14
- data/vendor/libgit2/src/diff_file.h +1 -1
- data/vendor/libgit2/src/diff_generate.c +158 -103
- data/vendor/libgit2/src/diff_generate.h +3 -3
- data/vendor/libgit2/src/diff_parse.c +4 -4
- data/vendor/libgit2/src/diff_print.c +34 -22
- data/vendor/libgit2/src/diff_stats.c +22 -7
- data/vendor/libgit2/src/diff_tform.c +18 -16
- data/vendor/libgit2/src/diff_xdiff.c +3 -3
- data/vendor/libgit2/src/errors.c +51 -39
- data/vendor/libgit2/src/errors.h +81 -0
- data/vendor/libgit2/src/features.h.in +9 -3
- data/vendor/libgit2/src/fetch.c +8 -3
- data/vendor/libgit2/src/fetchhead.c +12 -12
- data/vendor/libgit2/src/filebuf.c +28 -32
- data/vendor/libgit2/src/filebuf.h +2 -2
- data/vendor/libgit2/src/filter.c +47 -33
- data/vendor/libgit2/src/filter.h +0 -10
- data/vendor/libgit2/src/{fileops.c → futils.c} +70 -63
- data/vendor/libgit2/src/{fileops.h → futils.h} +6 -6
- data/vendor/libgit2/src/global.c +35 -55
- data/vendor/libgit2/src/global.h +0 -2
- data/vendor/libgit2/src/hash/sha1/collisiondetect.c +48 -0
- data/vendor/libgit2/src/hash/sha1/collisiondetect.h +19 -0
- data/vendor/libgit2/src/hash/{hash_common_crypto.h → sha1/common_crypto.c} +17 -17
- 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 -10
- 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 -7
- data/vendor/libgit2/src/hash/sha1/openssl.c +59 -0
- data/vendor/libgit2/src/hash/sha1/openssl.h +19 -0
- data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/sha1.c +14 -3
- data/vendor/libgit2/src/hash/{hash_win32.c → sha1/win32.c} +47 -37
- data/vendor/libgit2/src/hash/{hash_win32.h → sha1/win32.h} +6 -19
- data/vendor/libgit2/src/hash/sha1.h +38 -0
- data/vendor/libgit2/src/hash.c +61 -0
- data/vendor/libgit2/src/hash.h +20 -21
- data/vendor/libgit2/src/hashsig.c +5 -5
- data/vendor/libgit2/src/idxmap.c +107 -61
- data/vendor/libgit2/src/idxmap.h +153 -31
- data/vendor/libgit2/src/ignore.c +38 -42
- data/vendor/libgit2/src/index.c +264 -199
- data/vendor/libgit2/src/index.h +7 -1
- data/vendor/libgit2/src/indexer.c +338 -167
- data/vendor/libgit2/src/integer.h +71 -26
- data/vendor/libgit2/src/iterator.c +134 -62
- data/vendor/libgit2/src/iterator.h +15 -0
- data/vendor/libgit2/src/mailmap.c +8 -8
- data/vendor/libgit2/src/map.h +1 -1
- data/vendor/libgit2/src/merge.c +137 -93
- data/vendor/libgit2/src/merge_driver.c +11 -11
- data/vendor/libgit2/src/merge_file.c +2 -2
- data/vendor/libgit2/src/mwindow.c +24 -29
- data/vendor/libgit2/src/mwindow.h +4 -4
- data/vendor/libgit2/src/net.c +184 -0
- data/vendor/libgit2/src/net.h +36 -0
- data/vendor/libgit2/src/netops.c +55 -156
- data/vendor/libgit2/src/netops.h +3 -23
- data/vendor/libgit2/src/notes.c +14 -9
- data/vendor/libgit2/src/object.c +120 -69
- data/vendor/libgit2/src/object.h +22 -9
- data/vendor/libgit2/src/object_api.c +8 -8
- data/vendor/libgit2/src/odb.c +111 -88
- data/vendor/libgit2/src/odb.h +8 -7
- data/vendor/libgit2/src/odb_loose.c +58 -47
- data/vendor/libgit2/src/odb_mempack.c +21 -34
- data/vendor/libgit2/src/odb_pack.c +17 -13
- data/vendor/libgit2/src/offmap.c +53 -35
- data/vendor/libgit2/src/offmap.h +108 -21
- data/vendor/libgit2/src/oid.c +12 -7
- data/vendor/libgit2/src/oidmap.c +49 -47
- data/vendor/libgit2/src/oidmap.h +101 -24
- data/vendor/libgit2/src/pack-objects.c +87 -86
- data/vendor/libgit2/src/pack-objects.h +2 -8
- data/vendor/libgit2/src/pack.c +94 -96
- data/vendor/libgit2/src/pack.h +16 -18
- data/vendor/libgit2/src/parse.c +17 -4
- data/vendor/libgit2/src/parse.h +3 -3
- data/vendor/libgit2/src/patch.c +3 -3
- data/vendor/libgit2/src/patch_generate.c +18 -18
- data/vendor/libgit2/src/patch_parse.c +147 -79
- data/vendor/libgit2/src/path.c +207 -62
- data/vendor/libgit2/src/path.h +14 -0
- data/vendor/libgit2/src/pathspec.c +18 -18
- data/vendor/libgit2/src/pool.c +26 -22
- data/vendor/libgit2/src/pool.h +7 -7
- data/vendor/libgit2/src/posix.c +10 -10
- data/vendor/libgit2/src/posix.h +12 -1
- data/vendor/libgit2/src/proxy.c +8 -3
- data/vendor/libgit2/src/push.c +35 -29
- data/vendor/libgit2/src/push.h +2 -1
- data/vendor/libgit2/src/reader.c +265 -0
- data/vendor/libgit2/src/reader.h +107 -0
- data/vendor/libgit2/src/rebase.c +97 -38
- data/vendor/libgit2/src/refdb.c +15 -3
- data/vendor/libgit2/src/refdb_fs.c +318 -222
- data/vendor/libgit2/src/reflog.c +13 -15
- data/vendor/libgit2/src/refs.c +122 -89
- data/vendor/libgit2/src/refs.h +5 -3
- data/vendor/libgit2/src/refspec.c +27 -33
- data/vendor/libgit2/src/regexp.c +221 -0
- data/vendor/libgit2/src/regexp.h +97 -0
- data/vendor/libgit2/src/remote.c +229 -178
- data/vendor/libgit2/src/remote.h +11 -2
- data/vendor/libgit2/src/repository.c +227 -172
- data/vendor/libgit2/src/repository.h +52 -40
- data/vendor/libgit2/src/reset.c +7 -7
- data/vendor/libgit2/src/revert.c +11 -6
- data/vendor/libgit2/src/revparse.c +46 -46
- data/vendor/libgit2/src/revwalk.c +89 -54
- data/vendor/libgit2/src/revwalk.h +20 -0
- data/vendor/libgit2/src/settings.c +22 -9
- data/vendor/libgit2/src/signature.c +15 -13
- data/vendor/libgit2/src/sortedcache.c +22 -36
- data/vendor/libgit2/src/sortedcache.h +1 -1
- data/vendor/libgit2/src/stash.c +56 -76
- data/vendor/libgit2/src/status.c +27 -21
- data/vendor/libgit2/src/stream.h +17 -2
- data/vendor/libgit2/src/streams/mbedtls.c +100 -80
- data/vendor/libgit2/src/streams/mbedtls.h +5 -2
- data/vendor/libgit2/src/streams/openssl.c +93 -81
- data/vendor/libgit2/src/streams/openssl.h +5 -2
- data/vendor/libgit2/src/streams/registry.c +118 -0
- data/vendor/libgit2/src/streams/registry.h +19 -0
- data/vendor/libgit2/src/streams/socket.c +55 -30
- data/vendor/libgit2/src/streams/stransport.c +57 -32
- data/vendor/libgit2/src/streams/stransport.h +5 -0
- data/vendor/libgit2/src/streams/tls.c +48 -20
- data/vendor/libgit2/src/streams/tls.h +12 -4
- data/vendor/libgit2/src/strmap.c +47 -74
- data/vendor/libgit2/src/strmap.h +108 -33
- data/vendor/libgit2/src/submodule.c +190 -169
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/sysdir.c +25 -15
- data/vendor/libgit2/src/tag.c +39 -26
- data/vendor/libgit2/src/tag.h +2 -1
- data/vendor/libgit2/src/trace.c +2 -2
- data/vendor/libgit2/src/trace.h +2 -2
- data/vendor/libgit2/src/trailer.c +46 -32
- data/vendor/libgit2/src/transaction.c +30 -29
- data/vendor/libgit2/src/transport.c +3 -3
- data/vendor/libgit2/src/transports/auth.c +14 -10
- data/vendor/libgit2/src/transports/auth.h +10 -3
- data/vendor/libgit2/src/transports/auth_negotiate.c +31 -16
- 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 +35 -0
- data/vendor/libgit2/src/transports/cred.c +24 -24
- data/vendor/libgit2/src/transports/git.c +25 -30
- data/vendor/libgit2/src/transports/http.c +871 -335
- data/vendor/libgit2/src/transports/http.h +2 -0
- data/vendor/libgit2/src/transports/local.c +28 -28
- data/vendor/libgit2/src/transports/smart.c +64 -46
- data/vendor/libgit2/src/transports/smart.h +5 -6
- data/vendor/libgit2/src/transports/smart_pkt.c +162 -151
- data/vendor/libgit2/src/transports/smart_protocol.c +64 -94
- data/vendor/libgit2/src/transports/ssh.c +76 -65
- data/vendor/libgit2/src/transports/winhttp.c +328 -319
- data/vendor/libgit2/src/tree-cache.c +21 -14
- data/vendor/libgit2/src/tree.c +119 -112
- data/vendor/libgit2/src/tree.h +1 -0
- data/vendor/libgit2/src/unix/map.c +3 -3
- data/vendor/libgit2/src/unix/posix.h +1 -11
- data/vendor/libgit2/src/userdiff.h +3 -1
- data/vendor/libgit2/src/util.c +154 -93
- data/vendor/libgit2/src/util.h +19 -23
- data/vendor/libgit2/src/vector.c +15 -10
- data/vendor/libgit2/src/wildmatch.c +320 -0
- data/vendor/libgit2/src/wildmatch.h +23 -0
- data/vendor/libgit2/src/win32/dir.c +3 -3
- data/vendor/libgit2/src/win32/findfile.c +1 -1
- data/vendor/libgit2/src/win32/map.c +9 -11
- data/vendor/libgit2/src/win32/msvc-compat.h +6 -0
- data/vendor/libgit2/src/win32/path_w32.c +113 -9
- data/vendor/libgit2/src/win32/path_w32.h +18 -29
- data/vendor/libgit2/src/win32/posix.h +1 -4
- data/vendor/libgit2/src/win32/posix_w32.c +69 -44
- data/vendor/libgit2/src/win32/precompiled.h +0 -2
- data/vendor/libgit2/src/win32/thread.c +5 -10
- data/vendor/libgit2/src/win32/w32_buffer.c +9 -5
- data/vendor/libgit2/src/win32/w32_common.h +39 -0
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +2 -95
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +0 -2
- data/vendor/libgit2/src/win32/w32_stack.c +6 -11
- data/vendor/libgit2/src/win32/w32_stack.h +3 -3
- data/vendor/libgit2/src/win32/w32_util.c +27 -64
- data/vendor/libgit2/src/win32/w32_util.h +5 -49
- data/vendor/libgit2/src/worktree.c +44 -30
- data/vendor/libgit2/src/xdiff/xdiffi.c +5 -5
- data/vendor/libgit2/src/xdiff/xhistogram.c +1 -1
- data/vendor/libgit2/src/xdiff/xmerge.c +27 -15
- data/vendor/libgit2/src/xdiff/xpatience.c +3 -0
- data/vendor/libgit2/src/zstream.c +4 -4
- metadata +115 -38
- data/vendor/libgit2/deps/regex/CMakeLists.txt +0 -2
- 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/config_file.h +0 -73
- data/vendor/libgit2/src/fnmatch.c +0 -248
- data/vendor/libgit2/src/fnmatch.h +0 -48
- data/vendor/libgit2/src/hash/hash_collisiondetect.h +0 -47
- data/vendor/libgit2/src/hash/hash_openssl.h +0 -59
- data/vendor/libgit2/src/streams/curl.c +0 -385
- data/vendor/libgit2/src/streams/curl.h +0 -17
- /data/vendor/libgit2/deps/http-parser/{LICENSE-MIT → COPYING} +0 -0
- /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
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
#include "commit.h"
|
|
17
17
|
#include "tag.h"
|
|
18
18
|
#include "blob.h"
|
|
19
|
-
#include "
|
|
19
|
+
#include "futils.h"
|
|
20
20
|
#include "sysdir.h"
|
|
21
21
|
#include "filebuf.h"
|
|
22
22
|
#include "index.h"
|
|
@@ -42,23 +42,24 @@ bool git_repository__fsync_gitdir = false;
|
|
|
42
42
|
|
|
43
43
|
static const struct {
|
|
44
44
|
git_repository_item_t parent;
|
|
45
|
+
git_repository_item_t fallback;
|
|
45
46
|
const char *name;
|
|
46
47
|
bool directory;
|
|
47
48
|
} items[] = {
|
|
48
|
-
{ GIT_REPOSITORY_ITEM_GITDIR, NULL, true },
|
|
49
|
-
{ GIT_REPOSITORY_ITEM_WORKDIR, NULL, true },
|
|
50
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR, NULL, true },
|
|
51
|
-
{ GIT_REPOSITORY_ITEM_GITDIR, "index", false },
|
|
52
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR, "objects", true },
|
|
53
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR, "refs", true },
|
|
54
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR, "packed-refs", false },
|
|
55
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR, "remotes", true },
|
|
56
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR, "config", false },
|
|
57
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR, "info", true },
|
|
58
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR, "hooks", true },
|
|
59
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR, "logs", true },
|
|
60
|
-
{ GIT_REPOSITORY_ITEM_GITDIR, "modules", true },
|
|
61
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR, "worktrees", true }
|
|
49
|
+
{ GIT_REPOSITORY_ITEM_GITDIR, GIT_REPOSITORY_ITEM__LAST, NULL, true },
|
|
50
|
+
{ GIT_REPOSITORY_ITEM_WORKDIR, GIT_REPOSITORY_ITEM__LAST, NULL, true },
|
|
51
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM__LAST, NULL, true },
|
|
52
|
+
{ GIT_REPOSITORY_ITEM_GITDIR, GIT_REPOSITORY_ITEM__LAST, "index", false },
|
|
53
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "objects", true },
|
|
54
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "refs", true },
|
|
55
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "packed-refs", false },
|
|
56
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "remotes", true },
|
|
57
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "config", false },
|
|
58
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "info", true },
|
|
59
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "hooks", true },
|
|
60
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "logs", true },
|
|
61
|
+
{ GIT_REPOSITORY_ITEM_GITDIR, GIT_REPOSITORY_ITEM__LAST, "modules", true },
|
|
62
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "worktrees", true }
|
|
62
63
|
};
|
|
63
64
|
|
|
64
65
|
static int check_repositoryformatversion(git_config *config);
|
|
@@ -121,7 +122,7 @@ static void set_config(git_repository *repo, git_config *config)
|
|
|
121
122
|
git_config_free(config);
|
|
122
123
|
}
|
|
123
124
|
|
|
124
|
-
|
|
125
|
+
git_repository__configmap_lookup_cache_clear(repo);
|
|
125
126
|
}
|
|
126
127
|
|
|
127
128
|
static void set_index(git_repository *repo, git_index *index)
|
|
@@ -160,7 +161,7 @@ void git_repository_free(git_repository *repo)
|
|
|
160
161
|
|
|
161
162
|
git_repository__cleanup(repo);
|
|
162
163
|
|
|
163
|
-
|
|
164
|
+
git_cache_dispose(&repo->objects);
|
|
164
165
|
|
|
165
166
|
git_diff_driver_registry_free(repo->diff_drivers);
|
|
166
167
|
repo->diff_drivers = NULL;
|
|
@@ -238,14 +239,14 @@ static git_repository *repository_alloc(void)
|
|
|
238
239
|
if (!repo->reserved_names.ptr)
|
|
239
240
|
goto on_error;
|
|
240
241
|
|
|
241
|
-
/* set all the entries in the
|
|
242
|
-
|
|
242
|
+
/* set all the entries in the configmap cache to `unset` */
|
|
243
|
+
git_repository__configmap_lookup_cache_clear(repo);
|
|
243
244
|
|
|
244
245
|
return repo;
|
|
245
246
|
|
|
246
247
|
on_error:
|
|
247
248
|
if (repo)
|
|
248
|
-
|
|
249
|
+
git_cache_dispose(&repo->objects);
|
|
249
250
|
|
|
250
251
|
git__free(repo);
|
|
251
252
|
return NULL;
|
|
@@ -256,7 +257,7 @@ int git_repository_new(git_repository **out)
|
|
|
256
257
|
git_repository *repo;
|
|
257
258
|
|
|
258
259
|
*out = repo = repository_alloc();
|
|
259
|
-
|
|
260
|
+
GIT_ERROR_CHECK_ALLOC(repo);
|
|
260
261
|
|
|
261
262
|
repo->is_bare = 1;
|
|
262
263
|
repo->is_worktree = 0;
|
|
@@ -331,7 +332,7 @@ static int load_workdir(git_repository *repo, git_config *config, git_buf *paren
|
|
|
331
332
|
repo->workdir = git_buf_detach(&worktree);
|
|
332
333
|
}
|
|
333
334
|
|
|
334
|
-
|
|
335
|
+
GIT_ERROR_CHECK_ALLOC(repo->workdir);
|
|
335
336
|
cleanup:
|
|
336
337
|
git_buf_dispose(&path);
|
|
337
338
|
git_config_entry_free(ce);
|
|
@@ -413,7 +414,7 @@ static int read_gitfile(git_buf *path_out, const char *file_path)
|
|
|
413
414
|
if (git_buf_len(&file) <= prefix_len ||
|
|
414
415
|
memcmp(git_buf_cstr(&file), GIT_FILE_CONTENT_PREFIX, prefix_len) != 0)
|
|
415
416
|
{
|
|
416
|
-
|
|
417
|
+
git_error_set(GIT_ERROR_REPOSITORY,
|
|
417
418
|
"the `.git` file at '%s' is malformed", file_path);
|
|
418
419
|
error = -1;
|
|
419
420
|
}
|
|
@@ -551,7 +552,7 @@ static int find_repo(
|
|
|
551
552
|
/* If we didn't find the repository, and we don't have any other error
|
|
552
553
|
* to report, report that. */
|
|
553
554
|
if (!git_buf_len(gitdir_path) && !error) {
|
|
554
|
-
|
|
555
|
+
git_error_set(GIT_ERROR_REPOSITORY,
|
|
555
556
|
"could not find repository from '%s'", start_path);
|
|
556
557
|
error = GIT_ENOTFOUND;
|
|
557
558
|
}
|
|
@@ -576,17 +577,17 @@ int git_repository_open_bare(
|
|
|
576
577
|
if (!valid_repository_path(&path, &common_path)) {
|
|
577
578
|
git_buf_dispose(&path);
|
|
578
579
|
git_buf_dispose(&common_path);
|
|
579
|
-
|
|
580
|
+
git_error_set(GIT_ERROR_REPOSITORY, "path is not a repository: %s", bare_path);
|
|
580
581
|
return GIT_ENOTFOUND;
|
|
581
582
|
}
|
|
582
583
|
|
|
583
584
|
repo = repository_alloc();
|
|
584
|
-
|
|
585
|
+
GIT_ERROR_CHECK_ALLOC(repo);
|
|
585
586
|
|
|
586
587
|
repo->gitdir = git_buf_detach(&path);
|
|
587
|
-
|
|
588
|
+
GIT_ERROR_CHECK_ALLOC(repo->gitdir);
|
|
588
589
|
repo->commondir = git_buf_detach(&common_path);
|
|
589
|
-
|
|
590
|
+
GIT_ERROR_CHECK_ALLOC(repo->commondir);
|
|
590
591
|
|
|
591
592
|
/* of course we're bare! */
|
|
592
593
|
repo->is_bare = 1;
|
|
@@ -620,7 +621,7 @@ static int _git_repository_open_ext_from_env(
|
|
|
620
621
|
if (!start_path) {
|
|
621
622
|
error = git__getenv(&dir_buf, "GIT_DIR");
|
|
622
623
|
if (error == GIT_ENOTFOUND) {
|
|
623
|
-
|
|
624
|
+
git_error_clear();
|
|
624
625
|
start_path = ".";
|
|
625
626
|
} else if (error < 0)
|
|
626
627
|
goto error;
|
|
@@ -633,7 +634,7 @@ static int _git_repository_open_ext_from_env(
|
|
|
633
634
|
|
|
634
635
|
error = git__getenv(&ceiling_dirs_buf, "GIT_CEILING_DIRECTORIES");
|
|
635
636
|
if (error == GIT_ENOTFOUND)
|
|
636
|
-
|
|
637
|
+
git_error_clear();
|
|
637
638
|
else if (error < 0)
|
|
638
639
|
goto error;
|
|
639
640
|
else
|
|
@@ -641,7 +642,7 @@ static int _git_repository_open_ext_from_env(
|
|
|
641
642
|
|
|
642
643
|
error = git__getenv(&across_fs_buf, "GIT_DISCOVERY_ACROSS_FILESYSTEM");
|
|
643
644
|
if (error == GIT_ENOTFOUND)
|
|
644
|
-
|
|
645
|
+
git_error_clear();
|
|
645
646
|
else if (error < 0)
|
|
646
647
|
goto error;
|
|
647
648
|
else {
|
|
@@ -655,7 +656,7 @@ static int _git_repository_open_ext_from_env(
|
|
|
655
656
|
|
|
656
657
|
error = git__getenv(&index_file_buf, "GIT_INDEX_FILE");
|
|
657
658
|
if (error == GIT_ENOTFOUND)
|
|
658
|
-
|
|
659
|
+
git_error_clear();
|
|
659
660
|
else if (error < 0)
|
|
660
661
|
goto error;
|
|
661
662
|
else {
|
|
@@ -666,13 +667,13 @@ static int _git_repository_open_ext_from_env(
|
|
|
666
667
|
|
|
667
668
|
error = git__getenv(&namespace_buf, "GIT_NAMESPACE");
|
|
668
669
|
if (error == GIT_ENOTFOUND)
|
|
669
|
-
|
|
670
|
+
git_error_clear();
|
|
670
671
|
else if (error < 0)
|
|
671
672
|
goto error;
|
|
672
673
|
|
|
673
674
|
error = git__getenv(&object_dir_buf, "GIT_OBJECT_DIRECTORY");
|
|
674
675
|
if (error == GIT_ENOTFOUND)
|
|
675
|
-
|
|
676
|
+
git_error_clear();
|
|
676
677
|
else if (error < 0)
|
|
677
678
|
goto error;
|
|
678
679
|
else {
|
|
@@ -683,22 +684,22 @@ static int _git_repository_open_ext_from_env(
|
|
|
683
684
|
|
|
684
685
|
error = git__getenv(&work_tree_buf, "GIT_WORK_TREE");
|
|
685
686
|
if (error == GIT_ENOTFOUND)
|
|
686
|
-
|
|
687
|
+
git_error_clear();
|
|
687
688
|
else if (error < 0)
|
|
688
689
|
goto error;
|
|
689
690
|
else {
|
|
690
|
-
|
|
691
|
+
git_error_set(GIT_ERROR_INVALID, "GIT_WORK_TREE unimplemented");
|
|
691
692
|
error = GIT_ERROR;
|
|
692
693
|
goto error;
|
|
693
694
|
}
|
|
694
695
|
|
|
695
696
|
error = git__getenv(&work_tree_buf, "GIT_COMMON_DIR");
|
|
696
697
|
if (error == GIT_ENOTFOUND)
|
|
697
|
-
|
|
698
|
+
git_error_clear();
|
|
698
699
|
else if (error < 0)
|
|
699
700
|
goto error;
|
|
700
701
|
else {
|
|
701
|
-
|
|
702
|
+
git_error_set(GIT_ERROR_INVALID, "GIT_COMMON_DIR unimplemented");
|
|
702
703
|
error = GIT_ERROR;
|
|
703
704
|
goto error;
|
|
704
705
|
}
|
|
@@ -712,7 +713,7 @@ static int _git_repository_open_ext_from_env(
|
|
|
712
713
|
|
|
713
714
|
error = git__getenv(&alts_buf, "GIT_ALTERNATE_OBJECT_DIRECTORIES");
|
|
714
715
|
if (error == GIT_ENOTFOUND) {
|
|
715
|
-
|
|
716
|
+
git_error_clear();
|
|
716
717
|
error = 0;
|
|
717
718
|
} else if (error < 0)
|
|
718
719
|
goto error;
|
|
@@ -799,7 +800,7 @@ int git_repository_open_ext(
|
|
|
799
800
|
unsigned is_worktree;
|
|
800
801
|
git_buf gitdir = GIT_BUF_INIT, workdir = GIT_BUF_INIT,
|
|
801
802
|
gitlink = GIT_BUF_INIT, commondir = GIT_BUF_INIT;
|
|
802
|
-
git_repository *repo;
|
|
803
|
+
git_repository *repo = NULL;
|
|
803
804
|
git_config *config = NULL;
|
|
804
805
|
|
|
805
806
|
if (flags & GIT_REPOSITORY_OPEN_FROM_ENV)
|
|
@@ -812,21 +813,21 @@ int git_repository_open_ext(
|
|
|
812
813
|
&gitdir, &workdir, &gitlink, &commondir, start_path, flags, ceiling_dirs);
|
|
813
814
|
|
|
814
815
|
if (error < 0 || !repo_ptr)
|
|
815
|
-
|
|
816
|
+
goto cleanup;
|
|
816
817
|
|
|
817
818
|
repo = repository_alloc();
|
|
818
|
-
|
|
819
|
+
GIT_ERROR_CHECK_ALLOC(repo);
|
|
819
820
|
|
|
820
821
|
repo->gitdir = git_buf_detach(&gitdir);
|
|
821
|
-
|
|
822
|
+
GIT_ERROR_CHECK_ALLOC(repo->gitdir);
|
|
822
823
|
|
|
823
824
|
if (gitlink.size) {
|
|
824
825
|
repo->gitlink = git_buf_detach(&gitlink);
|
|
825
|
-
|
|
826
|
+
GIT_ERROR_CHECK_ALLOC(repo->gitlink);
|
|
826
827
|
}
|
|
827
828
|
if (commondir.size) {
|
|
828
829
|
repo->commondir = git_buf_detach(&commondir);
|
|
829
|
-
|
|
830
|
+
GIT_ERROR_CHECK_ALLOC(repo->commondir);
|
|
830
831
|
}
|
|
831
832
|
|
|
832
833
|
if ((error = repo_is_worktree(&is_worktree, repo)) < 0)
|
|
@@ -858,11 +859,14 @@ int git_repository_open_ext(
|
|
|
858
859
|
cleanup:
|
|
859
860
|
git_buf_dispose(&gitdir);
|
|
860
861
|
git_buf_dispose(&workdir);
|
|
862
|
+
git_buf_dispose(&gitlink);
|
|
863
|
+
git_buf_dispose(&commondir);
|
|
861
864
|
git_config_free(config);
|
|
862
865
|
|
|
863
866
|
if (error < 0)
|
|
864
867
|
git_repository_free(repo);
|
|
865
|
-
|
|
868
|
+
|
|
869
|
+
if (repo_ptr)
|
|
866
870
|
*repo_ptr = repo;
|
|
867
871
|
|
|
868
872
|
return error;
|
|
@@ -878,7 +882,8 @@ int git_repository_open_from_worktree(git_repository **repo_out, git_worktree *w
|
|
|
878
882
|
{
|
|
879
883
|
git_buf path = GIT_BUF_INIT;
|
|
880
884
|
git_repository *repo = NULL;
|
|
881
|
-
|
|
885
|
+
size_t len;
|
|
886
|
+
int err;
|
|
882
887
|
|
|
883
888
|
assert(repo_out && wt);
|
|
884
889
|
|
|
@@ -909,7 +914,7 @@ int git_repository_wrap_odb(git_repository **repo_out, git_odb *odb)
|
|
|
909
914
|
git_repository *repo;
|
|
910
915
|
|
|
911
916
|
repo = repository_alloc();
|
|
912
|
-
|
|
917
|
+
GIT_ERROR_CHECK_ALLOC(repo);
|
|
913
918
|
|
|
914
919
|
git_repository_set_odb(repo, odb);
|
|
915
920
|
*repo_out = repo;
|
|
@@ -944,18 +949,20 @@ static int load_config(
|
|
|
944
949
|
git_buf config_path = GIT_BUF_INIT;
|
|
945
950
|
git_config *cfg = NULL;
|
|
946
951
|
|
|
947
|
-
assert(
|
|
952
|
+
assert(out);
|
|
948
953
|
|
|
949
954
|
if ((error = git_config_new(&cfg)) < 0)
|
|
950
955
|
return error;
|
|
951
956
|
|
|
952
|
-
if (
|
|
953
|
-
error =
|
|
957
|
+
if (repo) {
|
|
958
|
+
if ((error = git_repository_item_path(&config_path, repo, GIT_REPOSITORY_ITEM_CONFIG)) == 0)
|
|
959
|
+
error = git_config_add_file_ondisk(cfg, config_path.ptr, GIT_CONFIG_LEVEL_LOCAL, repo, 0);
|
|
954
960
|
|
|
955
|
-
|
|
956
|
-
|
|
961
|
+
if (error && error != GIT_ENOTFOUND)
|
|
962
|
+
goto on_error;
|
|
957
963
|
|
|
958
|
-
|
|
964
|
+
git_buf_dispose(&config_path);
|
|
965
|
+
}
|
|
959
966
|
|
|
960
967
|
if (global_config_path != NULL &&
|
|
961
968
|
(error = git_config_add_file_ondisk(
|
|
@@ -981,7 +988,7 @@ static int load_config(
|
|
|
981
988
|
error != GIT_ENOTFOUND)
|
|
982
989
|
goto on_error;
|
|
983
990
|
|
|
984
|
-
|
|
991
|
+
git_error_clear(); /* clear any lingering ENOTFOUND errors */
|
|
985
992
|
|
|
986
993
|
*out = cfg;
|
|
987
994
|
return 0;
|
|
@@ -1184,7 +1191,8 @@ int git_repository_index__weakptr(git_index **out, git_repository *repo)
|
|
|
1184
1191
|
git_index_free(index);
|
|
1185
1192
|
}
|
|
1186
1193
|
|
|
1187
|
-
error = git_index_set_caps(repo->_index,
|
|
1194
|
+
error = git_index_set_caps(repo->_index,
|
|
1195
|
+
GIT_INDEX_CAPABILITY_FROM_OWNER);
|
|
1188
1196
|
}
|
|
1189
1197
|
|
|
1190
1198
|
git_buf_dispose(&index_path);
|
|
@@ -1282,8 +1290,8 @@ bool git_repository__reserved_names(
|
|
|
1282
1290
|
int (*prefixcmp)(const char *, const char *);
|
|
1283
1291
|
int error, ignorecase;
|
|
1284
1292
|
|
|
1285
|
-
error =
|
|
1286
|
-
&ignorecase, repo,
|
|
1293
|
+
error = git_repository__configmap_lookup(
|
|
1294
|
+
&ignorecase, repo, GIT_CONFIGMAP_IGNORECASE);
|
|
1287
1295
|
prefixcmp = (error || ignorecase) ? git__prefixcmp_icase :
|
|
1288
1296
|
git__prefixcmp;
|
|
1289
1297
|
|
|
@@ -1341,7 +1349,7 @@ static int check_repositoryformatversion(git_config *config)
|
|
|
1341
1349
|
return -1;
|
|
1342
1350
|
|
|
1343
1351
|
if (GIT_REPO_VERSION < version) {
|
|
1344
|
-
|
|
1352
|
+
git_error_set(GIT_ERROR_REPOSITORY,
|
|
1345
1353
|
"unsupported repository version %d. Only versions up to %d are supported.",
|
|
1346
1354
|
version, GIT_REPO_VERSION);
|
|
1347
1355
|
return -1;
|
|
@@ -1355,10 +1363,11 @@ int git_repository_create_head(const char *git_dir, const char *ref_name)
|
|
|
1355
1363
|
git_buf ref_path = GIT_BUF_INIT;
|
|
1356
1364
|
git_filebuf ref = GIT_FILEBUF_INIT;
|
|
1357
1365
|
const char *fmt;
|
|
1366
|
+
int error;
|
|
1358
1367
|
|
|
1359
|
-
if (git_buf_joinpath(&ref_path, git_dir, GIT_HEAD_FILE) < 0 ||
|
|
1360
|
-
|
|
1361
|
-
goto
|
|
1368
|
+
if ((error = git_buf_joinpath(&ref_path, git_dir, GIT_HEAD_FILE)) < 0 ||
|
|
1369
|
+
(error = git_filebuf_open(&ref, ref_path.ptr, 0, GIT_REFS_FILE_MODE)) < 0)
|
|
1370
|
+
goto out;
|
|
1362
1371
|
|
|
1363
1372
|
if (!ref_name)
|
|
1364
1373
|
ref_name = GIT_BRANCH_MASTER;
|
|
@@ -1368,17 +1377,14 @@ int git_repository_create_head(const char *git_dir, const char *ref_name)
|
|
|
1368
1377
|
else
|
|
1369
1378
|
fmt = "ref: " GIT_REFS_HEADS_DIR "%s\n";
|
|
1370
1379
|
|
|
1371
|
-
if (git_filebuf_printf(&ref, fmt, ref_name) < 0 ||
|
|
1372
|
-
|
|
1373
|
-
goto
|
|
1374
|
-
|
|
1375
|
-
git_buf_dispose(&ref_path);
|
|
1376
|
-
return 0;
|
|
1380
|
+
if ((error = git_filebuf_printf(&ref, fmt, ref_name)) < 0 ||
|
|
1381
|
+
(error = git_filebuf_commit(&ref)) < 0)
|
|
1382
|
+
goto out;
|
|
1377
1383
|
|
|
1378
|
-
|
|
1384
|
+
out:
|
|
1379
1385
|
git_buf_dispose(&ref_path);
|
|
1380
1386
|
git_filebuf_cleanup(&ref);
|
|
1381
|
-
return
|
|
1387
|
+
return error;
|
|
1382
1388
|
}
|
|
1383
1389
|
|
|
1384
1390
|
static bool is_chmod_supported(const char *file_path)
|
|
@@ -1411,24 +1417,47 @@ static bool is_filesystem_case_insensitive(const char *gitdir_path)
|
|
|
1411
1417
|
|
|
1412
1418
|
static bool are_symlinks_supported(const char *wd_path)
|
|
1413
1419
|
{
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
p_close(fd) < 0 ||
|
|
1421
|
-
p_unlink(path.ptr) < 0 ||
|
|
1422
|
-
p_symlink("testing", path.ptr) < 0 ||
|
|
1423
|
-
p_lstat(path.ptr, &st) < 0)
|
|
1424
|
-
symlinks_supported = false;
|
|
1425
|
-
else
|
|
1426
|
-
symlinks_supported = (S_ISLNK(st.st_mode) != 0);
|
|
1420
|
+
git_config *config = NULL;
|
|
1421
|
+
git_buf global_buf = GIT_BUF_INIT;
|
|
1422
|
+
git_buf xdg_buf = GIT_BUF_INIT;
|
|
1423
|
+
git_buf system_buf = GIT_BUF_INIT;
|
|
1424
|
+
git_buf programdata_buf = GIT_BUF_INIT;
|
|
1425
|
+
int symlinks = 0;
|
|
1427
1426
|
|
|
1428
|
-
|
|
1429
|
-
|
|
1427
|
+
/*
|
|
1428
|
+
* To emulate Git for Windows, symlinks on Windows must be explicitly
|
|
1429
|
+
* opted-in. We examine the system configuration for a core.symlinks
|
|
1430
|
+
* set to true. If found, we then examine the filesystem to see if
|
|
1431
|
+
* symlinks are _actually_ supported by the current user. If that is
|
|
1432
|
+
* _not_ set, then we do not test or enable symlink support.
|
|
1433
|
+
*/
|
|
1434
|
+
#ifdef GIT_WIN32
|
|
1435
|
+
git_config_find_global(&global_buf);
|
|
1436
|
+
git_config_find_xdg(&xdg_buf);
|
|
1437
|
+
git_config_find_system(&system_buf);
|
|
1438
|
+
git_config_find_programdata(&programdata_buf);
|
|
1439
|
+
|
|
1440
|
+
if (load_config(&config, NULL,
|
|
1441
|
+
path_unless_empty(&global_buf),
|
|
1442
|
+
path_unless_empty(&xdg_buf),
|
|
1443
|
+
path_unless_empty(&system_buf),
|
|
1444
|
+
path_unless_empty(&programdata_buf)) < 0)
|
|
1445
|
+
goto done;
|
|
1446
|
+
|
|
1447
|
+
if (git_config_get_bool(&symlinks, config, "core.symlinks") < 0 || !symlinks)
|
|
1448
|
+
goto done;
|
|
1449
|
+
#endif
|
|
1430
1450
|
|
|
1431
|
-
|
|
1451
|
+
if (!(symlinks = git_path_supports_symlinks(wd_path)))
|
|
1452
|
+
goto done;
|
|
1453
|
+
|
|
1454
|
+
done:
|
|
1455
|
+
git_buf_dispose(&global_buf);
|
|
1456
|
+
git_buf_dispose(&xdg_buf);
|
|
1457
|
+
git_buf_dispose(&system_buf);
|
|
1458
|
+
git_buf_dispose(&programdata_buf);
|
|
1459
|
+
git_config_free(config);
|
|
1460
|
+
return symlinks != 0;
|
|
1432
1461
|
}
|
|
1433
1462
|
|
|
1434
1463
|
static int create_empty_file(const char *path, mode_t mode)
|
|
@@ -1436,12 +1465,12 @@ static int create_empty_file(const char *path, mode_t mode)
|
|
|
1436
1465
|
int fd;
|
|
1437
1466
|
|
|
1438
1467
|
if ((fd = p_creat(path, mode)) < 0) {
|
|
1439
|
-
|
|
1468
|
+
git_error_set(GIT_ERROR_OS, "error while creating '%s'", path);
|
|
1440
1469
|
return -1;
|
|
1441
1470
|
}
|
|
1442
1471
|
|
|
1443
1472
|
if (p_close(fd) < 0) {
|
|
1444
|
-
|
|
1473
|
+
git_error_set(GIT_ERROR_OS, "error while closing '%s'", path);
|
|
1445
1474
|
return -1;
|
|
1446
1475
|
}
|
|
1447
1476
|
|
|
@@ -1476,7 +1505,7 @@ static int repo_local_config(
|
|
|
1476
1505
|
return error;
|
|
1477
1506
|
|
|
1478
1507
|
if (git_config_open_level(out, parent, GIT_CONFIG_LEVEL_LOCAL) < 0) {
|
|
1479
|
-
|
|
1508
|
+
git_error_clear();
|
|
1480
1509
|
|
|
1481
1510
|
if (!(error = git_config_add_file_ondisk(
|
|
1482
1511
|
parent, cfg_path, GIT_CONFIG_LEVEL_LOCAL, repo, false)))
|
|
@@ -1508,14 +1537,14 @@ static int repo_init_fs_configs(
|
|
|
1508
1537
|
if ((error = git_config_set_bool(cfg, "core.symlinks", false)) < 0)
|
|
1509
1538
|
return error;
|
|
1510
1539
|
} else if (git_config_delete_entry(cfg, "core.symlinks") < 0)
|
|
1511
|
-
|
|
1540
|
+
git_error_clear();
|
|
1512
1541
|
|
|
1513
1542
|
if (update_ignorecase) {
|
|
1514
1543
|
if (is_filesystem_case_insensitive(repo_dir)) {
|
|
1515
1544
|
if ((error = git_config_set_bool(cfg, "core.ignorecase", true)) < 0)
|
|
1516
1545
|
return error;
|
|
1517
1546
|
} else if (git_config_delete_entry(cfg, "core.ignorecase") < 0)
|
|
1518
|
-
|
|
1547
|
+
git_error_clear();
|
|
1519
1548
|
}
|
|
1520
1549
|
|
|
1521
1550
|
#ifdef GIT_USE_ICONV
|
|
@@ -1572,7 +1601,7 @@ static int repo_init_config(
|
|
|
1572
1601
|
SET_REPO_CONFIG(string, "core.worktree", worktree_path.ptr);
|
|
1573
1602
|
} else if (is_reinit) {
|
|
1574
1603
|
if (git_config_delete_entry(config, "core.worktree") < 0)
|
|
1575
|
-
|
|
1604
|
+
git_error_clear();
|
|
1576
1605
|
}
|
|
1577
1606
|
}
|
|
1578
1607
|
|
|
@@ -1600,7 +1629,7 @@ static int repo_reinit_submodule_fs(git_submodule *sm, const char *n, void *p)
|
|
|
1600
1629
|
|
|
1601
1630
|
if (git_submodule_open(&smrepo, sm) < 0 ||
|
|
1602
1631
|
git_repository_reinit_filesystem(smrepo, true) < 0)
|
|
1603
|
-
|
|
1632
|
+
git_error_clear();
|
|
1604
1633
|
git_repository_free(smrepo);
|
|
1605
1634
|
|
|
1606
1635
|
return 0;
|
|
@@ -1620,7 +1649,7 @@ int git_repository_reinit_filesystem(git_repository *repo, int recurse)
|
|
|
1620
1649
|
git_config_free(config);
|
|
1621
1650
|
git_buf_dispose(&path);
|
|
1622
1651
|
|
|
1623
|
-
|
|
1652
|
+
git_repository__configmap_lookup_cache_clear(repo);
|
|
1624
1653
|
|
|
1625
1654
|
if (!repo->is_bare && recurse)
|
|
1626
1655
|
(void)git_submodule_foreach(repo, repo_reinit_submodule_fs, NULL);
|
|
@@ -1669,7 +1698,7 @@ static int repo_write_template(
|
|
|
1669
1698
|
git_buf_dispose(&path);
|
|
1670
1699
|
|
|
1671
1700
|
if (error)
|
|
1672
|
-
|
|
1701
|
+
git_error_set(GIT_ERROR_OS,
|
|
1673
1702
|
"failed to initialize repository with template '%s'", file);
|
|
1674
1703
|
|
|
1675
1704
|
return error;
|
|
@@ -1700,7 +1729,7 @@ static int repo_write_gitlink(
|
|
|
1700
1729
|
goto cleanup;
|
|
1701
1730
|
|
|
1702
1731
|
if (!p_stat(buf.ptr, &st) && !S_ISREG(st.st_mode)) {
|
|
1703
|
-
|
|
1732
|
+
git_error_set(GIT_ERROR_REPOSITORY,
|
|
1704
1733
|
"cannot overwrite gitlink file into path '%s'", in_dir);
|
|
1705
1734
|
error = GIT_EEXISTS;
|
|
1706
1735
|
goto cleanup;
|
|
@@ -1754,7 +1783,7 @@ static int repo_init_structure(
|
|
|
1754
1783
|
#ifdef GIT_WIN32
|
|
1755
1784
|
if ((opts->flags & GIT_REPOSITORY_INIT__HAS_DOTGIT) != 0) {
|
|
1756
1785
|
if (git_win32__set_hidden(repo_dir, true) < 0) {
|
|
1757
|
-
|
|
1786
|
+
git_error_set(GIT_ERROR_OS,
|
|
1758
1787
|
"failed to mark Git repository folder as hidden");
|
|
1759
1788
|
return -1;
|
|
1760
1789
|
}
|
|
@@ -1781,7 +1810,7 @@ static int repo_init_structure(
|
|
|
1781
1810
|
else if ((error = git_config_open_default(&cfg)) >= 0) {
|
|
1782
1811
|
if (!git_config_get_path(&template_buf, cfg, "init.templatedir"))
|
|
1783
1812
|
tdir = template_buf.ptr;
|
|
1784
|
-
|
|
1813
|
+
git_error_clear();
|
|
1785
1814
|
}
|
|
1786
1815
|
|
|
1787
1816
|
if (!tdir) {
|
|
@@ -1813,7 +1842,7 @@ static int repo_init_structure(
|
|
|
1813
1842
|
return error;
|
|
1814
1843
|
|
|
1815
1844
|
/* if template was default, ignore error and use internal */
|
|
1816
|
-
|
|
1845
|
+
git_error_clear();
|
|
1817
1846
|
external_tpl = false;
|
|
1818
1847
|
error = 0;
|
|
1819
1848
|
}
|
|
@@ -1915,7 +1944,7 @@ static int repo_init_directories(
|
|
|
1915
1944
|
if (git_path_dirname_r(wd_path, repo_path->ptr) < 0)
|
|
1916
1945
|
return -1;
|
|
1917
1946
|
} else {
|
|
1918
|
-
|
|
1947
|
+
git_error_set(GIT_ERROR_REPOSITORY, "cannot pick working directory"
|
|
1919
1948
|
" for non-bare repository that isn't a '.git' directory");
|
|
1920
1949
|
return -1;
|
|
1921
1950
|
}
|
|
@@ -2018,53 +2047,59 @@ int git_repository_init_ext(
|
|
|
2018
2047
|
const char *given_repo,
|
|
2019
2048
|
git_repository_init_options *opts)
|
|
2020
2049
|
{
|
|
2021
|
-
int error;
|
|
2022
2050
|
git_buf repo_path = GIT_BUF_INIT, wd_path = GIT_BUF_INIT,
|
|
2023
|
-
common_path = GIT_BUF_INIT;
|
|
2051
|
+
common_path = GIT_BUF_INIT, head_path = GIT_BUF_INIT;
|
|
2024
2052
|
const char *wd;
|
|
2053
|
+
int error;
|
|
2025
2054
|
|
|
2026
2055
|
assert(out && given_repo && opts);
|
|
2027
2056
|
|
|
2028
|
-
|
|
2057
|
+
GIT_ERROR_CHECK_VERSION(opts, GIT_REPOSITORY_INIT_OPTIONS_VERSION, "git_repository_init_options");
|
|
2029
2058
|
|
|
2030
|
-
error = repo_init_directories(&repo_path, &wd_path, given_repo, opts)
|
|
2031
|
-
|
|
2032
|
-
goto cleanup;
|
|
2059
|
+
if ((error = repo_init_directories(&repo_path, &wd_path, given_repo, opts)) < 0)
|
|
2060
|
+
goto out;
|
|
2033
2061
|
|
|
2034
2062
|
wd = (opts->flags & GIT_REPOSITORY_INIT_BARE) ? NULL : git_buf_cstr(&wd_path);
|
|
2035
|
-
if (valid_repository_path(&repo_path, &common_path)) {
|
|
2036
2063
|
|
|
2064
|
+
if (valid_repository_path(&repo_path, &common_path)) {
|
|
2037
2065
|
if ((opts->flags & GIT_REPOSITORY_INIT_NO_REINIT) != 0) {
|
|
2038
|
-
|
|
2066
|
+
git_error_set(GIT_ERROR_REPOSITORY,
|
|
2039
2067
|
"attempt to reinitialize '%s'", given_repo);
|
|
2040
2068
|
error = GIT_EEXISTS;
|
|
2041
|
-
goto
|
|
2069
|
+
goto out;
|
|
2042
2070
|
}
|
|
2043
2071
|
|
|
2044
2072
|
opts->flags |= GIT_REPOSITORY_INIT__IS_REINIT;
|
|
2045
2073
|
|
|
2046
|
-
error = repo_init_config(
|
|
2047
|
-
|
|
2074
|
+
if ((error = repo_init_config(repo_path.ptr, wd, opts->flags, opts->mode)) < 0)
|
|
2075
|
+
goto out;
|
|
2048
2076
|
|
|
2049
2077
|
/* TODO: reinitialize the templates */
|
|
2078
|
+
} else {
|
|
2079
|
+
if ((error = repo_init_structure(repo_path.ptr, wd, opts)) < 0 ||
|
|
2080
|
+
(error = repo_init_config(repo_path.ptr, wd, opts->flags, opts->mode)) < 0 ||
|
|
2081
|
+
(error = git_buf_joinpath(&head_path, repo_path.ptr, GIT_HEAD_FILE)) < 0)
|
|
2082
|
+
goto out;
|
|
2083
|
+
|
|
2084
|
+
/*
|
|
2085
|
+
* Only set the new HEAD if the file does not exist already via
|
|
2086
|
+
* a template or if the caller has explicitly supplied an
|
|
2087
|
+
* initial HEAD value.
|
|
2088
|
+
*/
|
|
2089
|
+
if ((!git_path_exists(head_path.ptr) || opts->initial_head) &&
|
|
2090
|
+
(error = git_repository_create_head(repo_path.ptr, opts->initial_head)) < 0)
|
|
2091
|
+
goto out;
|
|
2050
2092
|
}
|
|
2051
|
-
else {
|
|
2052
|
-
if (!(error = repo_init_structure(
|
|
2053
|
-
repo_path.ptr, wd, opts)) &&
|
|
2054
|
-
!(error = repo_init_config(
|
|
2055
|
-
repo_path.ptr, wd, opts->flags, opts->mode)))
|
|
2056
|
-
error = git_repository_create_head(
|
|
2057
|
-
repo_path.ptr, opts->initial_head);
|
|
2058
|
-
}
|
|
2059
|
-
if (error < 0)
|
|
2060
|
-
goto cleanup;
|
|
2061
2093
|
|
|
2062
|
-
error = git_repository_open(out, repo_path.ptr)
|
|
2094
|
+
if ((error = git_repository_open(out, repo_path.ptr)) < 0)
|
|
2095
|
+
goto out;
|
|
2063
2096
|
|
|
2064
|
-
if (
|
|
2065
|
-
|
|
2097
|
+
if (opts->origin_url &&
|
|
2098
|
+
(error = repo_init_create_origin(*out, opts->origin_url)) < 0)
|
|
2099
|
+
goto out;
|
|
2066
2100
|
|
|
2067
|
-
|
|
2101
|
+
out:
|
|
2102
|
+
git_buf_dispose(&head_path);
|
|
2068
2103
|
git_buf_dispose(&common_path);
|
|
2069
2104
|
git_buf_dispose(&repo_path);
|
|
2070
2105
|
git_buf_dispose(&wd_path);
|
|
@@ -2084,7 +2119,7 @@ int git_repository_head_detached(git_repository *repo)
|
|
|
2084
2119
|
if (git_reference_lookup(&ref, repo, GIT_HEAD_FILE) < 0)
|
|
2085
2120
|
return -1;
|
|
2086
2121
|
|
|
2087
|
-
if (git_reference_type(ref) ==
|
|
2122
|
+
if (git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC) {
|
|
2088
2123
|
git_reference_free(ref);
|
|
2089
2124
|
return 0;
|
|
2090
2125
|
}
|
|
@@ -2111,7 +2146,7 @@ int git_repository_head_detached_for_worktree(git_repository *repo, const char *
|
|
|
2111
2146
|
if ((error = git_repository_head_for_worktree(&ref, repo, name)) < 0)
|
|
2112
2147
|
goto out;
|
|
2113
2148
|
|
|
2114
|
-
error = (git_reference_type(ref) !=
|
|
2149
|
+
error = (git_reference_type(ref) != GIT_REFERENCE_SYMBOLIC);
|
|
2115
2150
|
out:
|
|
2116
2151
|
git_reference_free(ref);
|
|
2117
2152
|
|
|
@@ -2123,10 +2158,12 @@ int git_repository_head(git_reference **head_out, git_repository *repo)
|
|
|
2123
2158
|
git_reference *head;
|
|
2124
2159
|
int error;
|
|
2125
2160
|
|
|
2161
|
+
assert(head_out);
|
|
2162
|
+
|
|
2126
2163
|
if ((error = git_reference_lookup(&head, repo, GIT_HEAD_FILE)) < 0)
|
|
2127
2164
|
return error;
|
|
2128
2165
|
|
|
2129
|
-
if (git_reference_type(head) ==
|
|
2166
|
+
if (git_reference_type(head) == GIT_REFERENCE_DIRECT) {
|
|
2130
2167
|
*head_out = head;
|
|
2131
2168
|
return 0;
|
|
2132
2169
|
}
|
|
@@ -2151,7 +2188,7 @@ int git_repository_head_for_worktree(git_reference **out, git_repository *repo,
|
|
|
2151
2188
|
(error = git_reference__read_head(&head, repo, path.ptr)) < 0)
|
|
2152
2189
|
goto out;
|
|
2153
2190
|
|
|
2154
|
-
if (git_reference_type(head) !=
|
|
2191
|
+
if (git_reference_type(head) != GIT_REFERENCE_DIRECT) {
|
|
2155
2192
|
git_reference *resolved;
|
|
2156
2193
|
|
|
2157
2194
|
error = git_reference_lookup_resolved(&resolved, repo, git_reference_symbolic_target(head), -1);
|
|
@@ -2170,30 +2207,37 @@ out:
|
|
|
2170
2207
|
return error;
|
|
2171
2208
|
}
|
|
2172
2209
|
|
|
2173
|
-
int git_repository_foreach_head(git_repository *repo,
|
|
2210
|
+
int git_repository_foreach_head(git_repository *repo,
|
|
2211
|
+
git_repository_foreach_head_cb cb,
|
|
2212
|
+
int flags, void *payload)
|
|
2174
2213
|
{
|
|
2175
2214
|
git_strarray worktrees = GIT_VECTOR_INIT;
|
|
2176
2215
|
git_buf path = GIT_BUF_INIT;
|
|
2177
|
-
int error;
|
|
2216
|
+
int error = 0;
|
|
2178
2217
|
size_t i;
|
|
2179
2218
|
|
|
2180
|
-
/* Execute callback for HEAD of commondir */
|
|
2181
|
-
if ((error = git_buf_joinpath(&path, repo->commondir, GIT_HEAD_FILE)) < 0 ||
|
|
2182
|
-
(error = cb(repo, path.ptr, payload) != 0))
|
|
2183
|
-
goto out;
|
|
2184
2219
|
|
|
2185
|
-
if ((
|
|
2186
|
-
|
|
2187
|
-
|
|
2220
|
+
if (!(flags & GIT_REPOSITORY_FOREACH_HEAD_SKIP_REPO)) {
|
|
2221
|
+
/* Gather HEAD of main repository */
|
|
2222
|
+
if ((error = git_buf_joinpath(&path, repo->commondir, GIT_HEAD_FILE)) < 0 ||
|
|
2223
|
+
(error = cb(repo, path.ptr, payload) != 0))
|
|
2224
|
+
goto out;
|
|
2188
2225
|
}
|
|
2189
2226
|
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
continue;
|
|
2194
|
-
|
|
2195
|
-
if ((error = cb(repo, path.ptr, payload)) != 0)
|
|
2227
|
+
if (!(flags & GIT_REPOSITORY_FOREACH_HEAD_SKIP_WORKTREES)) {
|
|
2228
|
+
if ((error = git_worktree_list(&worktrees, repo)) < 0) {
|
|
2229
|
+
error = 0;
|
|
2196
2230
|
goto out;
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2233
|
+
/* Gather HEADs of all worktrees */
|
|
2234
|
+
for (i = 0; i < worktrees.count; i++) {
|
|
2235
|
+
if (get_worktree_file_path(&path, repo, worktrees.strings[i], GIT_HEAD_FILE) < 0)
|
|
2236
|
+
continue;
|
|
2237
|
+
|
|
2238
|
+
if ((error = cb(repo, path.ptr, payload)) != 0)
|
|
2239
|
+
goto out;
|
|
2240
|
+
}
|
|
2197
2241
|
}
|
|
2198
2242
|
|
|
2199
2243
|
out:
|
|
@@ -2211,7 +2255,7 @@ int git_repository_head_unborn(git_repository *repo)
|
|
|
2211
2255
|
git_reference_free(ref);
|
|
2212
2256
|
|
|
2213
2257
|
if (error == GIT_EUNBORNBRANCH) {
|
|
2214
|
-
|
|
2258
|
+
git_error_clear();
|
|
2215
2259
|
return 1;
|
|
2216
2260
|
}
|
|
2217
2261
|
|
|
@@ -2249,7 +2293,7 @@ int git_repository_is_empty(git_repository *repo)
|
|
|
2249
2293
|
if (git_reference_lookup(&head, repo, GIT_HEAD_FILE) < 0)
|
|
2250
2294
|
return -1;
|
|
2251
2295
|
|
|
2252
|
-
if (git_reference_type(head) ==
|
|
2296
|
+
if (git_reference_type(head) == GIT_REFERENCE_SYMBOLIC)
|
|
2253
2297
|
is_empty =
|
|
2254
2298
|
(strcmp(git_reference_symbolic_target(head),
|
|
2255
2299
|
GIT_REFS_HEADS_DIR "master") == 0) &&
|
|
@@ -2260,11 +2304,11 @@ int git_repository_is_empty(git_repository *repo)
|
|
|
2260
2304
|
return is_empty;
|
|
2261
2305
|
}
|
|
2262
2306
|
|
|
2263
|
-
|
|
2307
|
+
static const char *resolved_parent_path(const git_repository *repo, git_repository_item_t item, git_repository_item_t fallback)
|
|
2264
2308
|
{
|
|
2265
2309
|
const char *parent;
|
|
2266
2310
|
|
|
2267
|
-
switch (
|
|
2311
|
+
switch (item) {
|
|
2268
2312
|
case GIT_REPOSITORY_ITEM_GITDIR:
|
|
2269
2313
|
parent = git_repository_path(repo);
|
|
2270
2314
|
break;
|
|
@@ -2275,12 +2319,20 @@ int git_repository_item_path(git_buf *out, const git_repository *repo, git_repos
|
|
|
2275
2319
|
parent = git_repository_commondir(repo);
|
|
2276
2320
|
break;
|
|
2277
2321
|
default:
|
|
2278
|
-
|
|
2279
|
-
return
|
|
2322
|
+
git_error_set(GIT_ERROR_INVALID, "invalid item directory");
|
|
2323
|
+
return NULL;
|
|
2280
2324
|
}
|
|
2325
|
+
if (!parent && fallback != GIT_REPOSITORY_ITEM__LAST)
|
|
2326
|
+
return resolved_parent_path(repo, fallback, GIT_REPOSITORY_ITEM__LAST);
|
|
2327
|
+
|
|
2328
|
+
return parent;
|
|
2329
|
+
}
|
|
2281
2330
|
|
|
2331
|
+
int git_repository_item_path(git_buf *out, const git_repository *repo, git_repository_item_t item)
|
|
2332
|
+
{
|
|
2333
|
+
const char *parent = resolved_parent_path(repo, items[item].parent, items[item].fallback);
|
|
2282
2334
|
if (parent == NULL) {
|
|
2283
|
-
|
|
2335
|
+
git_error_set(GIT_ERROR_INVALID, "path cannot exist in repository");
|
|
2284
2336
|
return GIT_ENOTFOUND;
|
|
2285
2337
|
}
|
|
2286
2338
|
|
|
@@ -2413,7 +2465,7 @@ int git_repository_head_tree(git_tree **tree, git_repository *repo)
|
|
|
2413
2465
|
if ((error = git_repository_head(&head, repo)) < 0)
|
|
2414
2466
|
return error;
|
|
2415
2467
|
|
|
2416
|
-
if ((error = git_reference_peel(&obj, head,
|
|
2468
|
+
if ((error = git_reference_peel(&obj, head, GIT_OBJECT_TREE)) < 0)
|
|
2417
2469
|
goto cleanup;
|
|
2418
2470
|
|
|
2419
2471
|
*tree = (git_tree *)obj;
|
|
@@ -2433,7 +2485,7 @@ int git_repository__set_orig_head(git_repository *repo, const git_oid *orig_head
|
|
|
2433
2485
|
git_oid_fmt(orig_head_str, orig_head);
|
|
2434
2486
|
|
|
2435
2487
|
if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_ORIG_HEAD_FILE)) == 0 &&
|
|
2436
|
-
(error = git_filebuf_open(&file, file_path.ptr,
|
|
2488
|
+
(error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_CREATE_LEADING_DIRS, GIT_MERGE_FILE_MODE)) == 0 &&
|
|
2437
2489
|
(error = git_filebuf_printf(&file, "%.*s\n", GIT_OID_HEXSZ, orig_head_str)) == 0)
|
|
2438
2490
|
error = git_filebuf_commit(&file);
|
|
2439
2491
|
|
|
@@ -2459,7 +2511,7 @@ int git_repository_message(git_buf *out, git_repository *repo)
|
|
|
2459
2511
|
if ((error = p_stat(git_buf_cstr(&path), &st)) < 0) {
|
|
2460
2512
|
if (errno == ENOENT)
|
|
2461
2513
|
error = GIT_ENOTFOUND;
|
|
2462
|
-
|
|
2514
|
+
git_error_set(GIT_ERROR_OS, "could not access message file");
|
|
2463
2515
|
} else {
|
|
2464
2516
|
error = git_futils_readbuffer(out, git_buf_cstr(&path));
|
|
2465
2517
|
}
|
|
@@ -2487,13 +2539,13 @@ int git_repository_hashfile(
|
|
|
2487
2539
|
git_oid *out,
|
|
2488
2540
|
git_repository *repo,
|
|
2489
2541
|
const char *path,
|
|
2490
|
-
|
|
2542
|
+
git_object_t type,
|
|
2491
2543
|
const char *as_path)
|
|
2492
2544
|
{
|
|
2493
2545
|
int error;
|
|
2494
2546
|
git_filter_list *fl = NULL;
|
|
2495
2547
|
git_file fd = -1;
|
|
2496
|
-
|
|
2548
|
+
uint64_t len;
|
|
2497
2549
|
git_buf full_path = GIT_BUF_INIT;
|
|
2498
2550
|
|
|
2499
2551
|
assert(out && path && repo); /* as_path can be NULL */
|
|
@@ -2530,14 +2582,11 @@ int git_repository_hashfile(
|
|
|
2530
2582
|
goto cleanup;
|
|
2531
2583
|
}
|
|
2532
2584
|
|
|
2533
|
-
|
|
2534
|
-
if (len < 0) {
|
|
2535
|
-
error = (int)len;
|
|
2585
|
+
if ((error = git_futils_filesize(&len, fd)) < 0)
|
|
2536
2586
|
goto cleanup;
|
|
2537
|
-
}
|
|
2538
2587
|
|
|
2539
2588
|
if (!git__is_sizet(len)) {
|
|
2540
|
-
|
|
2589
|
+
git_error_set(GIT_ERROR_OS, "file size overflow for 32-bit systems");
|
|
2541
2590
|
error = -1;
|
|
2542
2591
|
goto cleanup;
|
|
2543
2592
|
}
|
|
@@ -2557,7 +2606,7 @@ static int checkout_message(git_buf *out, git_reference *old, const char *new)
|
|
|
2557
2606
|
{
|
|
2558
2607
|
git_buf_puts(out, "checkout: moving from ");
|
|
2559
2608
|
|
|
2560
|
-
if (git_reference_type(old) ==
|
|
2609
|
+
if (git_reference_type(old) == GIT_REFERENCE_SYMBOLIC)
|
|
2561
2610
|
git_buf_puts(out, git_reference__shorthand(git_reference_symbolic_target(old)));
|
|
2562
2611
|
else
|
|
2563
2612
|
git_buf_puts(out, git_oid_tostr_s(git_reference_target(old)));
|
|
@@ -2589,10 +2638,10 @@ static int detach(git_repository *repo, const git_oid *id, const char *new)
|
|
|
2589
2638
|
if ((error = git_reference_lookup(¤t, repo, GIT_HEAD_FILE)) < 0)
|
|
2590
2639
|
return error;
|
|
2591
2640
|
|
|
2592
|
-
if ((error = git_object_lookup(&object, repo, id,
|
|
2641
|
+
if ((error = git_object_lookup(&object, repo, id, GIT_OBJECT_ANY)) < 0)
|
|
2593
2642
|
goto cleanup;
|
|
2594
2643
|
|
|
2595
|
-
if ((error = git_object_peel(&peeled, object,
|
|
2644
|
+
if ((error = git_object_peel(&peeled, object, GIT_OBJECT_COMMIT)) < 0)
|
|
2596
2645
|
goto cleanup;
|
|
2597
2646
|
|
|
2598
2647
|
if (new == NULL)
|
|
@@ -2632,9 +2681,9 @@ int git_repository_set_head(
|
|
|
2632
2681
|
if (error < 0 && error != GIT_ENOTFOUND)
|
|
2633
2682
|
goto cleanup;
|
|
2634
2683
|
|
|
2635
|
-
if (ref && current->type ==
|
|
2684
|
+
if (ref && current->type == GIT_REFERENCE_SYMBOLIC && git__strcmp(current->target.symbolic, ref->name) &&
|
|
2636
2685
|
git_reference_is_branch(ref) && git_branch_is_checked_out(ref)) {
|
|
2637
|
-
|
|
2686
|
+
git_error_set(GIT_ERROR_REPOSITORY, "cannot set HEAD to reference '%s' as it is the current HEAD "
|
|
2638
2687
|
"of a linked repository.", git_reference_name(ref));
|
|
2639
2688
|
error = -1;
|
|
2640
2689
|
goto cleanup;
|
|
@@ -2692,7 +2741,7 @@ int git_repository_detach_head(git_repository* repo)
|
|
|
2692
2741
|
if ((error = git_repository_head(&old_head, repo)) < 0)
|
|
2693
2742
|
goto cleanup;
|
|
2694
2743
|
|
|
2695
|
-
if ((error = git_object_lookup(&object, repo, git_reference_target(old_head),
|
|
2744
|
+
if ((error = git_object_lookup(&object, repo, git_reference_target(old_head), GIT_OBJECT_COMMIT)) < 0)
|
|
2696
2745
|
goto cleanup;
|
|
2697
2746
|
|
|
2698
2747
|
if ((error = checkout_message(&log_message, current, git_oid_tostr_s(git_object_id(object)))) < 0)
|
|
@@ -2814,7 +2863,7 @@ int git_repository_is_shallow(git_repository *repo)
|
|
|
2814
2863
|
git_buf_dispose(&path);
|
|
2815
2864
|
|
|
2816
2865
|
if (error == GIT_ENOTFOUND) {
|
|
2817
|
-
|
|
2866
|
+
git_error_clear();
|
|
2818
2867
|
return 0;
|
|
2819
2868
|
}
|
|
2820
2869
|
|
|
@@ -2823,7 +2872,7 @@ int git_repository_is_shallow(git_repository *repo)
|
|
|
2823
2872
|
return st.st_size == 0 ? 0 : 1;
|
|
2824
2873
|
}
|
|
2825
2874
|
|
|
2826
|
-
int
|
|
2875
|
+
int git_repository_init_options_init(
|
|
2827
2876
|
git_repository_init_options *opts, unsigned int version)
|
|
2828
2877
|
{
|
|
2829
2878
|
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
|
|
@@ -2832,6 +2881,12 @@ int git_repository_init_init_options(
|
|
|
2832
2881
|
return 0;
|
|
2833
2882
|
}
|
|
2834
2883
|
|
|
2884
|
+
int git_repository_init_init_options(
|
|
2885
|
+
git_repository_init_options *opts, unsigned int version)
|
|
2886
|
+
{
|
|
2887
|
+
return git_repository_init_options_init(opts, version);
|
|
2888
|
+
}
|
|
2889
|
+
|
|
2835
2890
|
int git_repository_ident(const char **name, const char **email, const git_repository *repo)
|
|
2836
2891
|
{
|
|
2837
2892
|
*name = repo->ident_name;
|
|
@@ -2846,12 +2901,12 @@ int git_repository_set_ident(git_repository *repo, const char *name, const char
|
|
|
2846
2901
|
|
|
2847
2902
|
if (name) {
|
|
2848
2903
|
tmp_name = git__strdup(name);
|
|
2849
|
-
|
|
2904
|
+
GIT_ERROR_CHECK_ALLOC(tmp_name);
|
|
2850
2905
|
}
|
|
2851
2906
|
|
|
2852
2907
|
if (email) {
|
|
2853
2908
|
tmp_email = git__strdup(email);
|
|
2854
|
-
|
|
2909
|
+
GIT_ERROR_CHECK_ALLOC(tmp_email);
|
|
2855
2910
|
}
|
|
2856
2911
|
|
|
2857
2912
|
tmp_name = git__swap(repo->ident_name, tmp_name);
|
|
@@ -2869,7 +2924,7 @@ int git_repository_submodule_cache_all(git_repository *repo)
|
|
|
2869
2924
|
|
|
2870
2925
|
assert(repo);
|
|
2871
2926
|
|
|
2872
|
-
if ((error =
|
|
2927
|
+
if ((error = git_strmap_new(&repo->submodule_cache)))
|
|
2873
2928
|
return error;
|
|
2874
2929
|
|
|
2875
2930
|
error = git_submodule__map(repo, repo->submodule_cache);
|