rugged 0.27.9 → 0.27.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +1 -0
- data/vendor/libgit2/CMakeLists.txt +98 -54
- data/vendor/libgit2/COPYING +28 -0
- data/vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake +15 -1
- 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/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/FindmbedTLS.cmake +93 -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/CMakeLists.txt +2 -0
- data/vendor/libgit2/deps/http-parser/{LICENSE-MIT → COPYING} +0 -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.h +5 -0
- 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 +38 -20
- data/vendor/libgit2/include/git2/blame.h +42 -25
- data/vendor/libgit2/include/git2/blob.h +45 -13
- data/vendor/libgit2/include/git2/branch.h +1 -1
- data/vendor/libgit2/include/git2/buffer.h +22 -16
- data/vendor/libgit2/include/git2/cert.h +135 -0
- data/vendor/libgit2/include/git2/checkout.h +65 -32
- data/vendor/libgit2/include/git2/cherrypick.h +9 -7
- data/vendor/libgit2/include/git2/clone.h +12 -10
- data/vendor/libgit2/include/git2/commit.h +53 -3
- data/vendor/libgit2/include/git2/common.h +60 -8
- data/vendor/libgit2/include/git2/config.h +30 -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 +32 -9
- data/vendor/libgit2/include/git2/diff.h +208 -156
- data/vendor/libgit2/include/git2/errors.h +54 -46
- data/vendor/libgit2/include/git2/filter.h +8 -0
- data/vendor/libgit2/include/git2/ignore.h +2 -2
- data/vendor/libgit2/include/git2/index.h +74 -52
- data/vendor/libgit2/include/git2/indexer.h +76 -6
- data/vendor/libgit2/include/git2/mailmap.h +115 -0
- data/vendor/libgit2/include/git2/merge.h +35 -18
- 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 +14 -8
- data/vendor/libgit2/include/git2/rebase.h +53 -6
- data/vendor/libgit2/include/git2/refs.h +33 -15
- data/vendor/libgit2/include/git2/refspec.h +17 -0
- data/vendor/libgit2/include/git2/remote.h +123 -24
- data/vendor/libgit2/include/git2/repository.h +76 -39
- data/vendor/libgit2/include/git2/revert.h +6 -4
- 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 +15 -12
- data/vendor/libgit2/include/git2/status.h +33 -20
- data/vendor/libgit2/include/git2/submodule.h +30 -12
- data/vendor/libgit2/include/git2/sys/alloc.h +101 -0
- 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/index.h +3 -0
- data/vendor/libgit2/include/git2/sys/mempack.h +35 -35
- data/vendor/libgit2/include/git2/sys/merge.h +9 -4
- data/vendor/libgit2/include/git2/sys/odb_backend.h +66 -22
- data/vendor/libgit2/include/git2/sys/path.h +64 -0
- 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/transaction.h +1 -0
- 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 +33 -111
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2/worktree.h +48 -13
- data/vendor/libgit2/src/CMakeLists.txt +96 -164
- data/vendor/libgit2/src/alloc.c +43 -0
- data/vendor/libgit2/src/alloc.h +40 -0
- data/vendor/libgit2/src/allocators/stdalloc.c +119 -0
- data/vendor/libgit2/src/{streams/curl.h → allocators/stdalloc.h} +5 -5
- 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 +15 -8
- data/vendor/libgit2/src/apply.c +537 -31
- data/vendor/libgit2/src/apply.h +3 -1
- data/vendor/libgit2/src/array.h +2 -2
- data/vendor/libgit2/src/attr.c +81 -75
- data/vendor/libgit2/src/attr_file.c +207 -121
- data/vendor/libgit2/src/attr_file.h +9 -9
- data/vendor/libgit2/src/attrcache.c +51 -53
- data/vendor/libgit2/src/attrcache.h +2 -1
- data/vendor/libgit2/src/blame.c +47 -20
- data/vendor/libgit2/src/blame.h +2 -1
- data/vendor/libgit2/src/blame_git.c +37 -20
- data/vendor/libgit2/src/blob.c +128 -42
- data/vendor/libgit2/src/blob.h +19 -2
- data/vendor/libgit2/src/branch.c +67 -43
- data/vendor/libgit2/src/buf_text.c +7 -6
- data/vendor/libgit2/src/buffer.c +69 -57
- data/vendor/libgit2/src/buffer.h +1 -1
- 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 +109 -90
- data/vendor/libgit2/src/cherrypick.c +15 -9
- data/vendor/libgit2/src/clone.c +49 -27
- data/vendor/libgit2/src/clone.h +4 -0
- data/vendor/libgit2/src/commit.c +117 -49
- data/vendor/libgit2/src/commit.h +7 -0
- data/vendor/libgit2/src/commit_list.c +30 -78
- data/vendor/libgit2/src/commit_list.h +2 -2
- data/vendor/libgit2/src/common.h +27 -91
- data/vendor/libgit2/src/config.c +194 -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 +439 -753
- data/vendor/libgit2/src/config_mem.c +220 -0
- data/vendor/libgit2/src/config_parse.c +114 -63
- data/vendor/libgit2/src/config_parse.h +17 -16
- data/vendor/libgit2/src/config_snapshot.c +206 -0
- data/vendor/libgit2/src/crlf.c +219 -190
- data/vendor/libgit2/src/delta.c +25 -18
- data/vendor/libgit2/src/describe.c +42 -41
- data/vendor/libgit2/src/diff.c +53 -68
- data/vendor/libgit2/src/diff.h +2 -1
- data/vendor/libgit2/src/diff_driver.c +47 -49
- data/vendor/libgit2/src/diff_file.c +19 -17
- data/vendor/libgit2/src/diff_file.h +1 -1
- data/vendor/libgit2/src/diff_generate.c +162 -106
- 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 +42 -30
- data/vendor/libgit2/src/diff_stats.c +22 -7
- data/vendor/libgit2/src/diff_tform.c +16 -16
- data/vendor/libgit2/src/diff_xdiff.c +15 -3
- data/vendor/libgit2/src/errors.c +51 -39
- data/vendor/libgit2/src/errors.h +81 -0
- data/vendor/libgit2/src/features.h.in +11 -3
- data/vendor/libgit2/src/fetch.c +10 -5
- data/vendor/libgit2/src/fetchhead.c +17 -17
- data/vendor/libgit2/src/filebuf.c +32 -36
- data/vendor/libgit2/src/filebuf.h +2 -2
- data/vendor/libgit2/src/filter.c +46 -38
- data/vendor/libgit2/src/filter.h +0 -10
- data/vendor/libgit2/src/{fileops.c → futils.c} +80 -73
- data/vendor/libgit2/src/{fileops.h → futils.h} +6 -6
- data/vendor/libgit2/src/global.c +48 -63
- data/vendor/libgit2/src/global.h +0 -2
- data/vendor/libgit2/src/hash.c +61 -0
- data/vendor/libgit2/src/hash.h +20 -19
- data/vendor/libgit2/src/hash/sha1.h +38 -0
- 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/sha1/mbedtls.c +46 -0
- data/vendor/libgit2/src/hash/sha1/mbedtls.h +19 -0
- 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/{sha1dc → sha1/sha1dc}/sha1.h +0 -0
- data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/ubc_check.c +0 -0
- data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/ubc_check.h +0 -0
- data/vendor/libgit2/src/hash/{hash_win32.c → sha1/win32.c} +47 -37
- data/vendor/libgit2/src/hash/{hash_win32.h → sha1/win32.h} +6 -19
- 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 +43 -47
- data/vendor/libgit2/src/index.c +337 -232
- data/vendor/libgit2/src/index.h +17 -1
- data/vendor/libgit2/src/indexer.c +346 -175
- data/vendor/libgit2/src/integer.h +71 -26
- data/vendor/libgit2/src/iterator.c +142 -70
- data/vendor/libgit2/src/iterator.h +15 -0
- data/vendor/libgit2/src/khash.h +3 -1
- data/vendor/libgit2/src/mailmap.c +485 -0
- data/vendor/libgit2/src/mailmap.h +35 -0
- data/vendor/libgit2/src/map.h +1 -1
- data/vendor/libgit2/src/merge.c +144 -100
- 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 +16 -11
- 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 +116 -93
- data/vendor/libgit2/src/odb.h +8 -7
- data/vendor/libgit2/src/odb_loose.c +62 -55
- data/vendor/libgit2/src/odb_mempack.c +21 -34
- data/vendor/libgit2/src/odb_pack.c +18 -14
- 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 +88 -87
- data/vendor/libgit2/src/pack-objects.h +2 -8
- data/vendor/libgit2/src/pack.c +99 -101
- data/vendor/libgit2/src/pack.h +17 -19
- data/vendor/libgit2/src/parse.c +10 -0
- data/vendor/libgit2/src/parse.h +3 -3
- data/vendor/libgit2/src/patch.c +4 -4
- data/vendor/libgit2/src/patch_generate.c +20 -20
- data/vendor/libgit2/src/patch_parse.c +151 -63
- data/vendor/libgit2/src/path.c +169 -125
- data/vendor/libgit2/src/path.h +3 -71
- data/vendor/libgit2/src/pathspec.c +19 -19
- 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 +37 -31
- 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 +115 -59
- data/vendor/libgit2/src/refdb.c +15 -3
- data/vendor/libgit2/src/refdb_fs.c +381 -254
- data/vendor/libgit2/src/reflog.c +13 -15
- data/vendor/libgit2/src/refs.c +118 -88
- data/vendor/libgit2/src/refs.h +5 -3
- data/vendor/libgit2/src/refspec.c +56 -37
- data/vendor/libgit2/src/refspec.h +1 -1
- data/vendor/libgit2/src/regexp.c +221 -0
- data/vendor/libgit2/src/regexp.h +97 -0
- data/vendor/libgit2/src/remote.c +266 -215
- data/vendor/libgit2/src/remote.h +11 -2
- data/vendor/libgit2/src/repository.c +280 -225
- data/vendor/libgit2/src/repository.h +52 -40
- data/vendor/libgit2/src/reset.c +8 -8
- data/vendor/libgit2/src/revert.c +14 -9
- data/vendor/libgit2/src/revparse.c +47 -48
- data/vendor/libgit2/src/revwalk.c +120 -57
- data/vendor/libgit2/src/revwalk.h +22 -1
- data/vendor/libgit2/src/settings.c +47 -10
- data/vendor/libgit2/src/signature.c +11 -11
- data/vendor/libgit2/src/sortedcache.c +22 -36
- data/vendor/libgit2/src/sortedcache.h +1 -1
- data/vendor/libgit2/src/stash.c +125 -99
- data/vendor/libgit2/src/status.c +28 -22
- data/vendor/libgit2/src/stream.h +17 -2
- data/vendor/libgit2/src/streams/mbedtls.c +483 -0
- data/vendor/libgit2/src/streams/mbedtls.h +23 -0
- data/vendor/libgit2/src/streams/openssl.c +224 -114
- data/vendor/libgit2/src/streams/openssl.h +4 -108
- 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 +50 -19
- 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 +272 -216
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/sysdir.c +29 -19
- data/vendor/libgit2/src/tag.c +41 -28
- data/vendor/libgit2/src/tag.h +2 -1
- data/vendor/libgit2/src/trace.c +2 -2
- data/vendor/libgit2/src/trace.h +3 -3
- data/vendor/libgit2/src/trailer.c +52 -38
- data/vendor/libgit2/src/transaction.c +30 -29
- data/vendor/libgit2/src/transport.c +5 -5
- data/vendor/libgit2/src/transports/auth.c +15 -11
- data/vendor/libgit2/src/transports/auth.h +10 -3
- data/vendor/libgit2/src/transports/auth_negotiate.c +33 -18
- 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 +26 -31
- data/vendor/libgit2/src/transports/http.c +881 -348
- data/vendor/libgit2/src/transports/http.h +2 -0
- data/vendor/libgit2/src/transports/local.c +35 -35
- data/vendor/libgit2/src/transports/smart.c +70 -47
- data/vendor/libgit2/src/transports/smart.h +3 -4
- data/vendor/libgit2/src/transports/smart_pkt.c +43 -40
- data/vendor/libgit2/src/transports/smart_protocol.c +96 -116
- data/vendor/libgit2/src/transports/ssh.c +77 -66
- data/vendor/libgit2/src/transports/winhttp.c +318 -314
- data/vendor/libgit2/src/tree-cache.c +19 -12
- data/vendor/libgit2/src/tree.c +103 -142
- data/vendor/libgit2/src/tree.h +1 -12
- 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 +70 -56
- data/vendor/libgit2/src/util.h +28 -156
- data/vendor/libgit2/src/vector.c +4 -4
- 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 +3 -3
- 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 +70 -45
- 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 +3 -2
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +26 -75
- 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 +95 -60
- data/vendor/libgit2/src/worktree.h +2 -0
- data/vendor/libgit2/src/xdiff/xdiffi.c +7 -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 +122 -33
- 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/remote.h
CHANGED
@@ -29,14 +29,23 @@ struct git_remote {
|
|
29
29
|
git_transport *transport;
|
30
30
|
git_repository *repo;
|
31
31
|
git_push *push;
|
32
|
-
|
32
|
+
git_indexer_progress stats;
|
33
33
|
unsigned int need_pack;
|
34
34
|
git_remote_autotag_option_t download_tags;
|
35
35
|
int prune_refs;
|
36
36
|
int passed_refspecs;
|
37
37
|
};
|
38
38
|
|
39
|
-
|
39
|
+
typedef struct git_remote_connection_opts {
|
40
|
+
const git_strarray *custom_headers;
|
41
|
+
const git_proxy_options *proxy;
|
42
|
+
} git_remote_connection_opts;
|
43
|
+
|
44
|
+
#define GIT_REMOTE_CONNECTION_OPTIONS_INIT { NULL, NULL }
|
45
|
+
|
46
|
+
int git_remote__connect(git_remote *remote, git_direction direction, const git_remote_callbacks *callbacks, const git_remote_connection_opts *conn);
|
47
|
+
|
48
|
+
int git_remote__urlfordirection(git_buf *url_out, struct git_remote *remote, int direction, const git_remote_callbacks *callbacks);
|
40
49
|
int git_remote__get_http_proxy(git_remote *remote, bool use_ssl, char **proxy_url);
|
41
50
|
|
42
51
|
git_refspec *git_remote__matching_refspec(git_remote *remote, const char *refname);
|
@@ -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,13 +161,13 @@ 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;
|
167
168
|
|
168
169
|
for (i = 0; i < repo->reserved_names.size; i++)
|
169
|
-
|
170
|
+
git_buf_dispose(git_array_get(repo->reserved_names, i));
|
170
171
|
git_array_clear(repo->reserved_names);
|
171
172
|
|
172
173
|
git__free(repo->gitlink);
|
@@ -203,7 +204,7 @@ static bool valid_repository_path(git_buf *repository_path, git_buf *common_path
|
|
203
204
|
git_buf_swap(common_path, &common_link);
|
204
205
|
}
|
205
206
|
|
206
|
-
|
207
|
+
git_buf_dispose(&common_link);
|
207
208
|
}
|
208
209
|
else {
|
209
210
|
git_buf_set(common_path, repository_path->ptr, repository_path->size);
|
@@ -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,9 +332,9 @@ 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);
|
338
339
|
return error;
|
339
340
|
}
|
@@ -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
|
}
|
@@ -425,7 +426,7 @@ static int read_gitfile(git_buf *path_out, const char *file_path)
|
|
425
426
|
path_out, gitlink, git_buf_cstr(path_out));
|
426
427
|
}
|
427
428
|
|
428
|
-
|
429
|
+
git_buf_dispose(&file);
|
429
430
|
return error;
|
430
431
|
}
|
431
432
|
|
@@ -551,14 +552,14 @@ 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
|
}
|
558
559
|
|
559
|
-
|
560
|
-
|
561
|
-
|
560
|
+
git_buf_dispose(&path);
|
561
|
+
git_buf_dispose(&repo_link);
|
562
|
+
git_buf_dispose(&common_link);
|
562
563
|
return error;
|
563
564
|
}
|
564
565
|
|
@@ -574,19 +575,19 @@ int git_repository_open_bare(
|
|
574
575
|
return error;
|
575
576
|
|
576
577
|
if (!valid_repository_path(&path, &common_path)) {
|
577
|
-
|
578
|
-
|
579
|
-
|
578
|
+
git_buf_dispose(&path);
|
579
|
+
git_buf_dispose(&common_path);
|
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;
|
@@ -754,15 +755,15 @@ error:
|
|
754
755
|
success:
|
755
756
|
git_odb_free(odb);
|
756
757
|
git_index_free(index);
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
758
|
+
git_buf_dispose(&common_dir_buf);
|
759
|
+
git_buf_dispose(&work_tree_buf);
|
760
|
+
git_buf_dispose(&alts_buf);
|
761
|
+
git_buf_dispose(&object_dir_buf);
|
762
|
+
git_buf_dispose(&namespace_buf);
|
763
|
+
git_buf_dispose(&index_file_buf);
|
764
|
+
git_buf_dispose(&across_fs_buf);
|
765
|
+
git_buf_dispose(&ceiling_dirs_buf);
|
766
|
+
git_buf_dispose(&dir_buf);
|
766
767
|
return error;
|
767
768
|
}
|
768
769
|
|
@@ -785,7 +786,7 @@ static int repo_is_worktree(unsigned *out, const git_repository *repo)
|
|
785
786
|
* only used when the repository is a working tree. */
|
786
787
|
*out = !!git_path_exists(gitdir_link.ptr);
|
787
788
|
|
788
|
-
|
789
|
+
git_buf_dispose(&gitdir_link);
|
789
790
|
return error;
|
790
791
|
}
|
791
792
|
|
@@ -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)
|
@@ -856,13 +857,16 @@ int git_repository_open_ext(
|
|
856
857
|
}
|
857
858
|
|
858
859
|
cleanup:
|
859
|
-
|
860
|
-
|
860
|
+
git_buf_dispose(&gitdir);
|
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
|
|
@@ -899,7 +904,7 @@ int git_repository_open_from_worktree(git_repository **repo_out, git_worktree *w
|
|
899
904
|
*repo_out = repo;
|
900
905
|
|
901
906
|
out:
|
902
|
-
|
907
|
+
git_buf_dispose(&path);
|
903
908
|
|
904
909
|
return err;
|
905
910
|
}
|
@@ -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,13 +988,13 @@ 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;
|
988
995
|
|
989
996
|
on_error:
|
990
|
-
|
997
|
+
git_buf_dispose(&config_path);
|
991
998
|
git_config_free(cfg);
|
992
999
|
*out = NULL;
|
993
1000
|
return error;
|
@@ -1034,10 +1041,10 @@ int git_repository_config__weakptr(git_config **out, git_repository *repo)
|
|
1034
1041
|
}
|
1035
1042
|
}
|
1036
1043
|
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1044
|
+
git_buf_dispose(&global_buf);
|
1045
|
+
git_buf_dispose(&xdg_buf);
|
1046
|
+
git_buf_dispose(&system_buf);
|
1047
|
+
git_buf_dispose(&programdata_buf);
|
1041
1048
|
}
|
1042
1049
|
|
1043
1050
|
*out = repo->_config;
|
@@ -1099,7 +1106,7 @@ int git_repository_odb__weakptr(git_odb **out, git_repository *repo)
|
|
1099
1106
|
git_odb_free(odb);
|
1100
1107
|
}
|
1101
1108
|
|
1102
|
-
|
1109
|
+
git_buf_dispose(&odb_path);
|
1103
1110
|
}
|
1104
1111
|
|
1105
1112
|
*out = repo->_odb;
|
@@ -1184,10 +1191,11 @@ 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);
|
1191
1199
|
}
|
1192
1200
|
|
1193
1201
|
*out = repo->_index;
|
@@ -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_free(&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
|
-
|
1379
|
-
|
1384
|
+
out:
|
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)
|
@@ -1405,30 +1411,53 @@ static bool is_filesystem_case_insensitive(const char *gitdir_path)
|
|
1405
1411
|
if (!git_buf_joinpath(&path, gitdir_path, "CoNfIg"))
|
1406
1412
|
is_insensitive = git_path_exists(git_buf_cstr(&path));
|
1407
1413
|
|
1408
|
-
|
1414
|
+
git_buf_dispose(&path);
|
1409
1415
|
return is_insensitive;
|
1410
1416
|
}
|
1411
1417
|
|
1412
1418
|
static bool are_symlinks_supported(const char *wd_path)
|
1413
1419
|
{
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
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;
|
1426
|
+
|
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
|
1427
1450
|
|
1428
|
-
(
|
1429
|
-
|
1451
|
+
if (!(symlinks = git_path_supports_symlinks(wd_path)))
|
1452
|
+
goto done;
|
1430
1453
|
|
1431
|
-
|
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
|
|
@@ -1586,8 +1615,8 @@ static int repo_init_config(
|
|
1586
1615
|
}
|
1587
1616
|
|
1588
1617
|
cleanup:
|
1589
|
-
|
1590
|
-
|
1618
|
+
git_buf_dispose(&cfg_path);
|
1619
|
+
git_buf_dispose(&worktree_path);
|
1591
1620
|
git_config_free(config);
|
1592
1621
|
|
1593
1622
|
return error;
|
@@ -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;
|
@@ -1618,9 +1647,9 @@ int git_repository_reinit_filesystem(git_repository *repo, int recurse)
|
|
1618
1647
|
config, path.ptr, repo_dir, git_repository_workdir(repo), true);
|
1619
1648
|
|
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);
|
@@ -1666,10 +1695,10 @@ static int repo_write_template(
|
|
1666
1695
|
GIT_UNUSED(hidden);
|
1667
1696
|
#endif
|
1668
1697
|
|
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;
|
@@ -1720,8 +1749,8 @@ static int repo_write_gitlink(
|
|
1720
1749
|
error = repo_write_template(in_dir, true, DOT_GIT, 0666, true, buf.ptr);
|
1721
1750
|
|
1722
1751
|
cleanup:
|
1723
|
-
|
1724
|
-
|
1752
|
+
git_buf_dispose(&buf);
|
1753
|
+
git_buf_dispose(&path_to_repo);
|
1725
1754
|
return error;
|
1726
1755
|
}
|
1727
1756
|
|
@@ -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) {
|
@@ -1805,7 +1834,7 @@ static int repo_init_structure(
|
|
1805
1834
|
error = git_futils_cp_r(tdir, repo_dir, cpflags, dmode);
|
1806
1835
|
}
|
1807
1836
|
|
1808
|
-
|
1837
|
+
git_buf_dispose(&template_buf);
|
1809
1838
|
git_config_free(cfg);
|
1810
1839
|
|
1811
1840
|
if (error < 0) {
|
@@ -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,56 +2047,62 @@ 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
|
-
|
2068
|
-
|
2069
|
-
|
2070
|
-
|
2101
|
+
out:
|
2102
|
+
git_buf_dispose(&head_path);
|
2103
|
+
git_buf_dispose(&common_path);
|
2104
|
+
git_buf_dispose(&repo_path);
|
2105
|
+
git_buf_dispose(&wd_path);
|
2071
2106
|
|
2072
2107
|
return error;
|
2073
2108
|
}
|
@@ -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);
|
@@ -2165,39 +2202,46 @@ out:
|
|
2165
2202
|
if (error)
|
2166
2203
|
git_reference_free(head);
|
2167
2204
|
|
2168
|
-
|
2205
|
+
git_buf_dispose(&path);
|
2169
2206
|
|
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:
|
2200
|
-
|
2244
|
+
git_buf_dispose(&path);
|
2201
2245
|
git_strarray_free(&worktrees);
|
2202
2246
|
return error;
|
2203
2247
|
}
|
@@ -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,14 +2485,14 @@ 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
|
|
2440
2492
|
if (error < 0)
|
2441
2493
|
git_filebuf_cleanup(&file);
|
2442
2494
|
|
2443
|
-
|
2495
|
+
git_buf_dispose(&file_path);
|
2444
2496
|
|
2445
2497
|
return error;
|
2446
2498
|
}
|
@@ -2459,12 +2511,12 @@ 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
|
}
|
2466
2518
|
|
2467
|
-
|
2519
|
+
git_buf_dispose(&path);
|
2468
2520
|
|
2469
2521
|
return error;
|
2470
2522
|
}
|
@@ -2478,7 +2530,7 @@ int git_repository_message_remove(git_repository *repo)
|
|
2478
2530
|
return -1;
|
2479
2531
|
|
2480
2532
|
error = p_unlink(git_buf_cstr(&path));
|
2481
|
-
|
2533
|
+
git_buf_dispose(&path);
|
2482
2534
|
|
2483
2535
|
return error;
|
2484
2536
|
}
|
@@ -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
|
}
|
@@ -2548,7 +2597,7 @@ cleanup:
|
|
2548
2597
|
if (fd >= 0)
|
2549
2598
|
p_close(fd);
|
2550
2599
|
git_filter_list_free(fl);
|
2551
|
-
|
2600
|
+
git_buf_dispose(&full_path);
|
2552
2601
|
|
2553
2602
|
return error;
|
2554
2603
|
}
|
@@ -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)
|
@@ -2604,7 +2653,7 @@ static int detach(git_repository *repo, const git_oid *id, const char *new)
|
|
2604
2653
|
error = git_reference_create(&new_head, repo, GIT_HEAD_FILE, git_object_id(peeled), true, git_buf_cstr(&log_message));
|
2605
2654
|
|
2606
2655
|
cleanup:
|
2607
|
-
|
2656
|
+
git_buf_dispose(&log_message);
|
2608
2657
|
git_object_free(object);
|
2609
2658
|
git_object_free(peeled);
|
2610
2659
|
git_reference_free(current);
|
@@ -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;
|
@@ -2654,7 +2703,7 @@ int git_repository_set_head(
|
|
2654
2703
|
}
|
2655
2704
|
|
2656
2705
|
cleanup:
|
2657
|
-
|
2706
|
+
git_buf_dispose(&log_message);
|
2658
2707
|
git_reference_free(current);
|
2659
2708
|
git_reference_free(ref);
|
2660
2709
|
git_reference_free(new_head);
|
@@ -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)
|
@@ -2702,7 +2751,7 @@ int git_repository_detach_head(git_repository* repo)
|
|
2702
2751
|
1, git_buf_cstr(&log_message));
|
2703
2752
|
|
2704
2753
|
cleanup:
|
2705
|
-
|
2754
|
+
git_buf_dispose(&log_message);
|
2706
2755
|
git_object_free(object);
|
2707
2756
|
git_reference_free(old_head);
|
2708
2757
|
git_reference_free(new_head);
|
@@ -2749,7 +2798,7 @@ int git_repository_state(git_repository *repo)
|
|
2749
2798
|
} else if (git_path_contains_file(&repo_path, GIT_BISECT_LOG_FILE))
|
2750
2799
|
state = GIT_REPOSITORY_STATE_BISECT;
|
2751
2800
|
|
2752
|
-
|
2801
|
+
git_buf_dispose(&repo_path);
|
2753
2802
|
return state;
|
2754
2803
|
}
|
2755
2804
|
|
@@ -2778,7 +2827,7 @@ int git_repository__cleanup_files(
|
|
2778
2827
|
git_buf_clear(&buf);
|
2779
2828
|
}
|
2780
2829
|
|
2781
|
-
|
2830
|
+
git_buf_dispose(&buf);
|
2782
2831
|
return error;
|
2783
2832
|
}
|
2784
2833
|
|
@@ -2811,10 +2860,10 @@ int git_repository_is_shallow(git_repository *repo)
|
|
2811
2860
|
return error;
|
2812
2861
|
|
2813
2862
|
error = git_path_lstat(path.ptr, &st);
|
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);
|