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
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
#include "buf_text.h"
|
|
16
16
|
#include "vector.h"
|
|
17
17
|
#include "posix.h"
|
|
18
|
-
#include "
|
|
18
|
+
#include "config_backend.h"
|
|
19
19
|
#include "config.h"
|
|
20
20
|
#include "repository.h"
|
|
21
21
|
#include "tree.h"
|
|
@@ -23,31 +23,32 @@
|
|
|
23
23
|
#include "path.h"
|
|
24
24
|
#include "index.h"
|
|
25
25
|
#include "worktree.h"
|
|
26
|
+
#include "clone.h"
|
|
26
27
|
|
|
27
28
|
#define GIT_MODULES_FILE ".gitmodules"
|
|
28
29
|
|
|
29
|
-
static
|
|
30
|
-
{
|
|
31
|
-
{
|
|
32
|
-
{
|
|
33
|
-
{
|
|
34
|
-
{
|
|
35
|
-
{
|
|
30
|
+
static git_configmap _sm_update_map[] = {
|
|
31
|
+
{GIT_CONFIGMAP_STRING, "checkout", GIT_SUBMODULE_UPDATE_CHECKOUT},
|
|
32
|
+
{GIT_CONFIGMAP_STRING, "rebase", GIT_SUBMODULE_UPDATE_REBASE},
|
|
33
|
+
{GIT_CONFIGMAP_STRING, "merge", GIT_SUBMODULE_UPDATE_MERGE},
|
|
34
|
+
{GIT_CONFIGMAP_STRING, "none", GIT_SUBMODULE_UPDATE_NONE},
|
|
35
|
+
{GIT_CONFIGMAP_FALSE, NULL, GIT_SUBMODULE_UPDATE_NONE},
|
|
36
|
+
{GIT_CONFIGMAP_TRUE, NULL, GIT_SUBMODULE_UPDATE_CHECKOUT},
|
|
36
37
|
};
|
|
37
38
|
|
|
38
|
-
static
|
|
39
|
-
{
|
|
40
|
-
{
|
|
41
|
-
{
|
|
42
|
-
{
|
|
43
|
-
{
|
|
44
|
-
{
|
|
39
|
+
static git_configmap _sm_ignore_map[] = {
|
|
40
|
+
{GIT_CONFIGMAP_STRING, "none", GIT_SUBMODULE_IGNORE_NONE},
|
|
41
|
+
{GIT_CONFIGMAP_STRING, "untracked", GIT_SUBMODULE_IGNORE_UNTRACKED},
|
|
42
|
+
{GIT_CONFIGMAP_STRING, "dirty", GIT_SUBMODULE_IGNORE_DIRTY},
|
|
43
|
+
{GIT_CONFIGMAP_STRING, "all", GIT_SUBMODULE_IGNORE_ALL},
|
|
44
|
+
{GIT_CONFIGMAP_FALSE, NULL, GIT_SUBMODULE_IGNORE_NONE},
|
|
45
|
+
{GIT_CONFIGMAP_TRUE, NULL, GIT_SUBMODULE_IGNORE_ALL},
|
|
45
46
|
};
|
|
46
47
|
|
|
47
|
-
static
|
|
48
|
-
{
|
|
49
|
-
{
|
|
50
|
-
{
|
|
48
|
+
static git_configmap _sm_recurse_map[] = {
|
|
49
|
+
{GIT_CONFIGMAP_STRING, "on-demand", GIT_SUBMODULE_RECURSE_ONDEMAND},
|
|
50
|
+
{GIT_CONFIGMAP_FALSE, NULL, GIT_SUBMODULE_RECURSE_NO},
|
|
51
|
+
{GIT_CONFIGMAP_TRUE, NULL, GIT_SUBMODULE_RECURSE_YES},
|
|
51
52
|
};
|
|
52
53
|
|
|
53
54
|
enum {
|
|
@@ -60,35 +61,6 @@ enum {
|
|
|
60
61
|
GITMODULES_CREATE = 1,
|
|
61
62
|
};
|
|
62
63
|
|
|
63
|
-
static kh_inline khint_t str_hash_no_trailing_slash(const char *s)
|
|
64
|
-
{
|
|
65
|
-
khint_t h;
|
|
66
|
-
|
|
67
|
-
for (h = 0; *s; ++s)
|
|
68
|
-
if (s[1] != '\0' || *s != '/')
|
|
69
|
-
h = (h << 5) - h + *s;
|
|
70
|
-
|
|
71
|
-
return h;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
static kh_inline int str_equal_no_trailing_slash(const char *a, const char *b)
|
|
75
|
-
{
|
|
76
|
-
size_t alen = a ? strlen(a) : 0;
|
|
77
|
-
size_t blen = b ? strlen(b) : 0;
|
|
78
|
-
|
|
79
|
-
if (alen > 0 && a[alen - 1] == '/')
|
|
80
|
-
alen--;
|
|
81
|
-
if (blen > 0 && b[blen - 1] == '/')
|
|
82
|
-
blen--;
|
|
83
|
-
|
|
84
|
-
return (alen == 0 && blen == 0) ||
|
|
85
|
-
(alen == blen && strncmp(a, b, alen) == 0);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
__KHASH_IMPL(
|
|
89
|
-
str, static kh_inline, const char *, void *, 1,
|
|
90
|
-
str_hash_no_trailing_slash, str_equal_no_trailing_slash)
|
|
91
|
-
|
|
92
64
|
static int submodule_alloc(git_submodule **out, git_repository *repo, const char *name);
|
|
93
65
|
static git_config_backend *open_gitmodules(git_repository *repo, int gitmod);
|
|
94
66
|
static int gitmodules_snapshot(git_config **snap, git_repository *repo);
|
|
@@ -124,7 +96,7 @@ static void submodule_set_lookup_error(int error, const char *name)
|
|
|
124
96
|
if (!error)
|
|
125
97
|
return;
|
|
126
98
|
|
|
127
|
-
|
|
99
|
+
git_error_set(GIT_ERROR_SUBMODULE, (error == GIT_ENOTFOUND) ?
|
|
128
100
|
"no submodule named '%s'" :
|
|
129
101
|
"submodule '%s' has not been added yet", name);
|
|
130
102
|
}
|
|
@@ -143,7 +115,7 @@ static int find_by_path(const git_config_entry *entry, void *payload)
|
|
|
143
115
|
fdot = strchr(entry->name, '.');
|
|
144
116
|
ldot = strrchr(entry->name, '.');
|
|
145
117
|
data->name = git__strndup(fdot + 1, ldot - fdot - 1);
|
|
146
|
-
|
|
118
|
+
GIT_ERROR_CHECK_ALLOC(data->name);
|
|
147
119
|
}
|
|
148
120
|
|
|
149
121
|
return 0;
|
|
@@ -165,7 +137,7 @@ static int is_path_occupied(bool *occupied, git_repository *repo, const char *pa
|
|
|
165
137
|
|
|
166
138
|
if ((error = git_index_find(NULL, index, path)) != GIT_ENOTFOUND) {
|
|
167
139
|
if (!error) {
|
|
168
|
-
|
|
140
|
+
git_error_set(GIT_ERROR_SUBMODULE,
|
|
169
141
|
"File '%s' already exists in the index", path);
|
|
170
142
|
*occupied = true;
|
|
171
143
|
}
|
|
@@ -180,7 +152,7 @@ static int is_path_occupied(bool *occupied, git_repository *repo, const char *pa
|
|
|
180
152
|
|
|
181
153
|
if ((error = git_index_find_prefix(NULL, index, dir.ptr)) != GIT_ENOTFOUND) {
|
|
182
154
|
if (!error) {
|
|
183
|
-
|
|
155
|
+
git_error_set(GIT_ERROR_SUBMODULE,
|
|
184
156
|
"Directory '%s' already exists in the index", path);
|
|
185
157
|
*occupied = true;
|
|
186
158
|
}
|
|
@@ -199,13 +171,15 @@ out:
|
|
|
199
171
|
*/
|
|
200
172
|
static void free_submodule_names(git_strmap *names)
|
|
201
173
|
{
|
|
202
|
-
|
|
174
|
+
const char *key;
|
|
175
|
+
char *value;
|
|
203
176
|
|
|
204
177
|
if (names == NULL)
|
|
205
178
|
return;
|
|
206
179
|
|
|
207
|
-
|
|
208
|
-
git__free(
|
|
180
|
+
git_strmap_foreach(names, key, value, {
|
|
181
|
+
git__free((char *) key);
|
|
182
|
+
git__free(value);
|
|
209
183
|
});
|
|
210
184
|
git_strmap_free(names);
|
|
211
185
|
|
|
@@ -224,24 +198,23 @@ static int load_submodule_names(git_strmap **out, git_repository *repo, git_conf
|
|
|
224
198
|
git_config_entry *entry;
|
|
225
199
|
git_buf buf = GIT_BUF_INIT;
|
|
226
200
|
git_strmap *names;
|
|
227
|
-
int
|
|
228
|
-
int error = 0;
|
|
201
|
+
int isvalid, error;
|
|
229
202
|
|
|
230
203
|
*out = NULL;
|
|
231
204
|
|
|
232
|
-
if ((error =
|
|
205
|
+
if ((error = git_strmap_new(&names)) < 0)
|
|
233
206
|
goto out;
|
|
234
207
|
|
|
235
208
|
if ((error = git_config_iterator_glob_new(&iter, cfg, key)) < 0)
|
|
236
209
|
goto out;
|
|
237
210
|
|
|
238
|
-
while (git_config_next(&entry, iter) == 0) {
|
|
211
|
+
while ((error = git_config_next(&entry, iter)) == 0) {
|
|
239
212
|
const char *fdot, *ldot;
|
|
240
213
|
fdot = strchr(entry->name, '.');
|
|
241
214
|
ldot = strrchr(entry->name, '.');
|
|
242
215
|
|
|
243
216
|
if (git_strmap_exists(names, entry->value)) {
|
|
244
|
-
|
|
217
|
+
git_error_set(GIT_ERROR_SUBMODULE,
|
|
245
218
|
"duplicated submodule path '%s'", entry->value);
|
|
246
219
|
error = -1;
|
|
247
220
|
goto out;
|
|
@@ -257,10 +230,10 @@ static int load_submodule_names(git_strmap **out, git_repository *repo, git_conf
|
|
|
257
230
|
if (!isvalid)
|
|
258
231
|
continue;
|
|
259
232
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
233
|
+
if ((error = git_strmap_set(names, git__strdup(entry->value), git_buf_detach(&buf))) < 0) {
|
|
234
|
+
git_error_set(GIT_ERROR_NOMEMORY, "error inserting submodule into hash table");
|
|
235
|
+
error = -1;
|
|
236
|
+
goto out;
|
|
264
237
|
}
|
|
265
238
|
}
|
|
266
239
|
if (error == GIT_ITEROVER)
|
|
@@ -288,15 +261,14 @@ int git_submodule_lookup(
|
|
|
288
261
|
assert(repo && name);
|
|
289
262
|
|
|
290
263
|
if (repo->is_bare) {
|
|
291
|
-
|
|
264
|
+
git_error_set(GIT_ERROR_SUBMODULE, "cannot get submodules without a working tree");
|
|
292
265
|
return -1;
|
|
293
266
|
}
|
|
294
267
|
|
|
295
268
|
if (repo->submodule_cache != NULL) {
|
|
296
|
-
|
|
297
|
-
if (git_strmap_valid_index(repo->submodule_cache, pos)) {
|
|
269
|
+
if ((sm = git_strmap_get(repo->submodule_cache, name)) != NULL) {
|
|
298
270
|
if (out) {
|
|
299
|
-
*out =
|
|
271
|
+
*out = sm;
|
|
300
272
|
GIT_REFCOUNT_INC(*out);
|
|
301
273
|
}
|
|
302
274
|
return 0;
|
|
@@ -332,9 +304,9 @@ int git_submodule_lookup(
|
|
|
332
304
|
mods = open_gitmodules(repo, GITMODULES_EXISTING);
|
|
333
305
|
|
|
334
306
|
if (mods)
|
|
335
|
-
error =
|
|
307
|
+
error = git_config_backend_foreach_match(mods, pattern, find_by_path, &data);
|
|
336
308
|
|
|
337
|
-
|
|
309
|
+
git_config_backend_free(mods);
|
|
338
310
|
|
|
339
311
|
if (error < 0) {
|
|
340
312
|
git_submodule_free(sm);
|
|
@@ -421,30 +393,21 @@ static void submodule_free_dup(void *sm)
|
|
|
421
393
|
|
|
422
394
|
static int submodule_get_or_create(git_submodule **out, git_repository *repo, git_strmap *map, const char *name)
|
|
423
395
|
{
|
|
424
|
-
int error = 0;
|
|
425
|
-
khiter_t pos;
|
|
426
396
|
git_submodule *sm = NULL;
|
|
397
|
+
int error;
|
|
427
398
|
|
|
428
|
-
|
|
429
|
-
if (git_strmap_valid_index(map, pos)) {
|
|
430
|
-
sm = git_strmap_value_at(map, pos);
|
|
399
|
+
if ((sm = git_strmap_get(map, name)) != NULL)
|
|
431
400
|
goto done;
|
|
432
|
-
}
|
|
433
401
|
|
|
434
402
|
/* if the submodule doesn't exist yet in the map, create it */
|
|
435
403
|
if ((error = submodule_alloc(&sm, repo, name)) < 0)
|
|
436
404
|
return error;
|
|
437
405
|
|
|
438
|
-
|
|
439
|
-
/* nobody can beat us to adding it */
|
|
440
|
-
assert(error != 0);
|
|
441
|
-
if (error < 0) {
|
|
406
|
+
if ((error = git_strmap_set(map, sm->name, sm)) < 0) {
|
|
442
407
|
git_submodule_free(sm);
|
|
443
408
|
return error;
|
|
444
409
|
}
|
|
445
410
|
|
|
446
|
-
git_strmap_set_value_at(map, pos, sm);
|
|
447
|
-
|
|
448
411
|
done:
|
|
449
412
|
GIT_REFCOUNT_INC(sm);
|
|
450
413
|
*out = sm;
|
|
@@ -465,26 +428,18 @@ static int submodules_from_index(git_strmap *map, git_index *idx, git_config *cf
|
|
|
465
428
|
goto done;
|
|
466
429
|
|
|
467
430
|
while (!(error = git_iterator_advance(&entry, i))) {
|
|
468
|
-
khiter_t pos = git_strmap_lookup_index(map, entry->path);
|
|
469
431
|
git_submodule *sm;
|
|
470
432
|
|
|
471
|
-
if (
|
|
472
|
-
sm = git_strmap_value_at(map, pos);
|
|
473
|
-
|
|
433
|
+
if ((sm = git_strmap_get(map, entry->path)) != NULL) {
|
|
474
434
|
if (S_ISGITLINK(entry->mode))
|
|
475
435
|
submodule_update_from_index_entry(sm, entry);
|
|
476
436
|
else
|
|
477
437
|
sm->flags |= GIT_SUBMODULE_STATUS__INDEX_NOT_SUBMODULE;
|
|
478
438
|
} else if (S_ISGITLINK(entry->mode)) {
|
|
479
|
-
khiter_t name_pos;
|
|
480
439
|
const char *name;
|
|
481
440
|
|
|
482
|
-
|
|
483
|
-
if (git_strmap_valid_index(names, name_pos)) {
|
|
484
|
-
name = git_strmap_value_at(names, name_pos);
|
|
485
|
-
} else {
|
|
441
|
+
if ((name = git_strmap_get(names, entry->path)) == NULL)
|
|
486
442
|
name = entry->path;
|
|
487
|
-
}
|
|
488
443
|
|
|
489
444
|
if (!submodule_get_or_create(&sm, git_index_owner(idx), map, name)) {
|
|
490
445
|
submodule_update_from_index_entry(sm, entry);
|
|
@@ -517,26 +472,18 @@ static int submodules_from_head(git_strmap *map, git_tree *head, git_config *cfg
|
|
|
517
472
|
goto done;
|
|
518
473
|
|
|
519
474
|
while (!(error = git_iterator_advance(&entry, i))) {
|
|
520
|
-
khiter_t pos = git_strmap_lookup_index(map, entry->path);
|
|
521
475
|
git_submodule *sm;
|
|
522
476
|
|
|
523
|
-
if (
|
|
524
|
-
sm = git_strmap_value_at(map, pos);
|
|
525
|
-
|
|
477
|
+
if ((sm = git_strmap_get(map, entry->path)) != NULL) {
|
|
526
478
|
if (S_ISGITLINK(entry->mode))
|
|
527
479
|
submodule_update_from_head_data(sm, entry->mode, &entry->id);
|
|
528
480
|
else
|
|
529
481
|
sm->flags |= GIT_SUBMODULE_STATUS__HEAD_NOT_SUBMODULE;
|
|
530
482
|
} else if (S_ISGITLINK(entry->mode)) {
|
|
531
|
-
khiter_t name_pos;
|
|
532
483
|
const char *name;
|
|
533
484
|
|
|
534
|
-
|
|
535
|
-
if (git_strmap_valid_index(names, name_pos)) {
|
|
536
|
-
name = git_strmap_value_at(names, name_pos);
|
|
537
|
-
} else {
|
|
485
|
+
if ((name = git_strmap_get(names, entry->path)) == NULL)
|
|
538
486
|
name = entry->path;
|
|
539
|
-
}
|
|
540
487
|
|
|
541
488
|
if (!submodule_get_or_create(&sm, git_tree_owner(head), map, name)) {
|
|
542
489
|
submodule_update_from_head_data(
|
|
@@ -577,9 +524,9 @@ int git_submodule__map(git_repository *repo, git_strmap *map)
|
|
|
577
524
|
|
|
578
525
|
/* get sources that we will need to check */
|
|
579
526
|
if (git_repository_index(&idx, repo) < 0)
|
|
580
|
-
|
|
527
|
+
git_error_clear();
|
|
581
528
|
if (git_repository_head_tree(&head, repo) < 0)
|
|
582
|
-
|
|
529
|
+
git_error_clear();
|
|
583
530
|
|
|
584
531
|
wd = git_repository_workdir(repo);
|
|
585
532
|
if (wd && (error = git_buf_joinpath(&path, wd, GIT_MODULES_FILE)) < 0)
|
|
@@ -640,18 +587,18 @@ int git_submodule_foreach(
|
|
|
640
587
|
size_t i;
|
|
641
588
|
|
|
642
589
|
if (repo->is_bare) {
|
|
643
|
-
|
|
590
|
+
git_error_set(GIT_ERROR_SUBMODULE, "cannot get submodules without a working tree");
|
|
644
591
|
return -1;
|
|
645
592
|
}
|
|
646
593
|
|
|
647
|
-
if ((error =
|
|
594
|
+
if ((error = git_strmap_new(&submodules)) < 0)
|
|
648
595
|
return error;
|
|
649
596
|
|
|
650
597
|
if ((error = git_submodule__map(repo, submodules)) < 0)
|
|
651
598
|
goto done;
|
|
652
599
|
|
|
653
600
|
if (!(error = git_vector_init(
|
|
654
|
-
&snapshot,
|
|
601
|
+
&snapshot, git_strmap_size(submodules), submodule_cmp))) {
|
|
655
602
|
|
|
656
603
|
git_strmap_foreach_value(submodules, sm, {
|
|
657
604
|
if ((error = git_vector_insert(&snapshot, sm)) < 0)
|
|
@@ -667,7 +614,7 @@ int git_submodule_foreach(
|
|
|
667
614
|
|
|
668
615
|
git_vector_foreach(&snapshot, i, sm) {
|
|
669
616
|
if ((error = callback(sm, sm->name, payload)) != 0) {
|
|
670
|
-
|
|
617
|
+
git_error_set_after_callback(error);
|
|
671
618
|
break;
|
|
672
619
|
}
|
|
673
620
|
}
|
|
@@ -756,9 +703,9 @@ int git_submodule_add_setup(
|
|
|
756
703
|
/* see if there is already an entry for this submodule */
|
|
757
704
|
|
|
758
705
|
if (git_submodule_lookup(NULL, repo, path) < 0)
|
|
759
|
-
|
|
706
|
+
git_error_clear();
|
|
760
707
|
else {
|
|
761
|
-
|
|
708
|
+
git_error_set(GIT_ERROR_SUBMODULE,
|
|
762
709
|
"attempt to add submodule '%s' that already exists", path);
|
|
763
710
|
return GIT_EEXISTS;
|
|
764
711
|
}
|
|
@@ -769,7 +716,7 @@ int git_submodule_add_setup(
|
|
|
769
716
|
path += strlen(git_repository_workdir(repo));
|
|
770
717
|
|
|
771
718
|
if (git_path_root(path) >= 0) {
|
|
772
|
-
|
|
719
|
+
git_error_set(GIT_ERROR_SUBMODULE, "submodule path must be a relative path");
|
|
773
720
|
error = -1;
|
|
774
721
|
goto cleanup;
|
|
775
722
|
}
|
|
@@ -785,17 +732,17 @@ int git_submodule_add_setup(
|
|
|
785
732
|
/* update .gitmodules */
|
|
786
733
|
|
|
787
734
|
if (!(mods = open_gitmodules(repo, GITMODULES_CREATE))) {
|
|
788
|
-
|
|
735
|
+
git_error_set(GIT_ERROR_SUBMODULE,
|
|
789
736
|
"adding submodules to a bare repository is not supported");
|
|
790
737
|
return -1;
|
|
791
738
|
}
|
|
792
739
|
|
|
793
740
|
if ((error = git_buf_printf(&name, "submodule.%s.path", path)) < 0 ||
|
|
794
|
-
(error =
|
|
741
|
+
(error = git_config_backend_set_string(mods, name.ptr, path)) < 0)
|
|
795
742
|
goto cleanup;
|
|
796
743
|
|
|
797
744
|
if ((error = submodule_config_key_trunc_puts(&name, "url")) < 0 ||
|
|
798
|
-
(error =
|
|
745
|
+
(error = git_config_backend_set_string(mods, name.ptr, url)) < 0)
|
|
799
746
|
goto cleanup;
|
|
800
747
|
|
|
801
748
|
git_buf_clear(&name);
|
|
@@ -833,7 +780,7 @@ cleanup:
|
|
|
833
780
|
if (out != NULL)
|
|
834
781
|
*out = sm;
|
|
835
782
|
|
|
836
|
-
|
|
783
|
+
git_config_backend_free(mods);
|
|
837
784
|
git_repository_free(subrepo);
|
|
838
785
|
git_buf_dispose(&real_url);
|
|
839
786
|
git_buf_dispose(&name);
|
|
@@ -869,6 +816,64 @@ done:
|
|
|
869
816
|
return error;
|
|
870
817
|
}
|
|
871
818
|
|
|
819
|
+
static int clone_return_origin(git_remote **out, git_repository *repo, const char *name, const char *url, void *payload)
|
|
820
|
+
{
|
|
821
|
+
GIT_UNUSED(url);
|
|
822
|
+
GIT_UNUSED(payload);
|
|
823
|
+
return git_remote_lookup(out, repo, name);
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
static int clone_return_repo(git_repository **out, const char *path, int bare, void *payload)
|
|
827
|
+
{
|
|
828
|
+
git_submodule *sm = payload;
|
|
829
|
+
|
|
830
|
+
GIT_UNUSED(path);
|
|
831
|
+
GIT_UNUSED(bare);
|
|
832
|
+
return git_submodule_open(out, sm);
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
int git_submodule_clone(git_repository **out, git_submodule *submodule, const git_submodule_update_options *given_opts)
|
|
836
|
+
{
|
|
837
|
+
int error;
|
|
838
|
+
git_repository *clone;
|
|
839
|
+
git_buf rel_path = GIT_BUF_INIT;
|
|
840
|
+
git_submodule_update_options sub_opts = GIT_SUBMODULE_UPDATE_OPTIONS_INIT;
|
|
841
|
+
git_clone_options opts = GIT_CLONE_OPTIONS_INIT;
|
|
842
|
+
|
|
843
|
+
assert(submodule);
|
|
844
|
+
|
|
845
|
+
if (given_opts)
|
|
846
|
+
memcpy(&sub_opts, given_opts, sizeof(sub_opts));
|
|
847
|
+
|
|
848
|
+
GIT_ERROR_CHECK_VERSION(&sub_opts, GIT_SUBMODULE_UPDATE_OPTIONS_VERSION, "git_submodule_update_options");
|
|
849
|
+
|
|
850
|
+
memcpy(&opts.checkout_opts, &sub_opts.checkout_opts, sizeof(sub_opts.checkout_opts));
|
|
851
|
+
memcpy(&opts.fetch_opts, &sub_opts.fetch_opts, sizeof(sub_opts.fetch_opts));
|
|
852
|
+
opts.repository_cb = clone_return_repo;
|
|
853
|
+
opts.repository_cb_payload = submodule;
|
|
854
|
+
opts.remote_cb = clone_return_origin;
|
|
855
|
+
opts.remote_cb_payload = submodule;
|
|
856
|
+
|
|
857
|
+
git_buf_puts(&rel_path, git_repository_workdir(git_submodule_owner(submodule)));
|
|
858
|
+
git_buf_joinpath(&rel_path, git_buf_cstr(&rel_path), git_submodule_path(submodule));
|
|
859
|
+
|
|
860
|
+
GIT_ERROR_CHECK_ALLOC_BUF(&rel_path);
|
|
861
|
+
|
|
862
|
+
error = git_clone__submodule(&clone, git_submodule_url(submodule), git_buf_cstr(&rel_path), &opts);
|
|
863
|
+
if (error < 0)
|
|
864
|
+
goto cleanup;
|
|
865
|
+
|
|
866
|
+
if (!out)
|
|
867
|
+
git_repository_free(clone);
|
|
868
|
+
else
|
|
869
|
+
*out = clone;
|
|
870
|
+
|
|
871
|
+
cleanup:
|
|
872
|
+
git_buf_dispose(&rel_path);
|
|
873
|
+
|
|
874
|
+
return error;
|
|
875
|
+
}
|
|
876
|
+
|
|
872
877
|
int git_submodule_add_finalize(git_submodule *sm)
|
|
873
878
|
{
|
|
874
879
|
int error;
|
|
@@ -906,7 +911,7 @@ int git_submodule_add_to_index(git_submodule *sm, int write_index)
|
|
|
906
911
|
|
|
907
912
|
/* read stat information for submodule working directory */
|
|
908
913
|
if (p_stat(path.ptr, &st) < 0) {
|
|
909
|
-
|
|
914
|
+
git_error_set(GIT_ERROR_SUBMODULE,
|
|
910
915
|
"cannot add submodule without working directory");
|
|
911
916
|
error = -1;
|
|
912
917
|
goto cleanup;
|
|
@@ -915,11 +920,11 @@ int git_submodule_add_to_index(git_submodule *sm, int write_index)
|
|
|
915
920
|
memset(&entry, 0, sizeof(entry));
|
|
916
921
|
entry.path = sm->path;
|
|
917
922
|
git_index_entry__init_from_stat(
|
|
918
|
-
&entry, &st, !(git_index_caps(index) &
|
|
923
|
+
&entry, &st, !(git_index_caps(index) & GIT_INDEX_CAPABILITY_NO_FILEMODE));
|
|
919
924
|
|
|
920
925
|
/* calling git_submodule_open will have set sm->wd_oid if possible */
|
|
921
926
|
if ((sm->flags & GIT_SUBMODULE_STATUS__WD_OID_VALID) == 0) {
|
|
922
|
-
|
|
927
|
+
git_error_set(GIT_ERROR_SUBMODULE,
|
|
923
928
|
"cannot add submodule without HEAD to index");
|
|
924
929
|
error = -1;
|
|
925
930
|
goto cleanup;
|
|
@@ -1010,7 +1015,7 @@ int git_submodule_resolve_url(git_buf *out, git_repository *repo, const char *ur
|
|
|
1010
1015
|
} else if (strchr(url, ':') != NULL || url[0] == '/') {
|
|
1011
1016
|
error = git_buf_sets(out, url);
|
|
1012
1017
|
} else {
|
|
1013
|
-
|
|
1018
|
+
git_error_set(GIT_ERROR_SUBMODULE, "invalid format for submodule URL");
|
|
1014
1019
|
error = -1;
|
|
1015
1020
|
}
|
|
1016
1021
|
|
|
@@ -1032,28 +1037,28 @@ static int write_var(git_repository *repo, const char *name, const char *var, co
|
|
|
1032
1037
|
goto cleanup;
|
|
1033
1038
|
|
|
1034
1039
|
if (val)
|
|
1035
|
-
error =
|
|
1040
|
+
error = git_config_backend_set_string(mods, key.ptr, val);
|
|
1036
1041
|
else
|
|
1037
|
-
error =
|
|
1042
|
+
error = git_config_backend_delete(mods, key.ptr);
|
|
1038
1043
|
|
|
1039
1044
|
git_buf_dispose(&key);
|
|
1040
1045
|
|
|
1041
1046
|
cleanup:
|
|
1042
|
-
|
|
1047
|
+
git_config_backend_free(mods);
|
|
1043
1048
|
return error;
|
|
1044
1049
|
}
|
|
1045
1050
|
|
|
1046
|
-
static int write_mapped_var(git_repository *repo, const char *name,
|
|
1051
|
+
static int write_mapped_var(git_repository *repo, const char *name, git_configmap *maps, size_t nmaps, const char *var, int ival)
|
|
1047
1052
|
{
|
|
1048
|
-
|
|
1053
|
+
git_configmap_t type;
|
|
1049
1054
|
const char *val;
|
|
1050
1055
|
|
|
1051
1056
|
if (git_config_lookup_map_enum(&type, &val, maps, nmaps, ival) < 0) {
|
|
1052
|
-
|
|
1057
|
+
git_error_set(GIT_ERROR_SUBMODULE, "invalid value for %s", var);
|
|
1053
1058
|
return -1;
|
|
1054
1059
|
}
|
|
1055
1060
|
|
|
1056
|
-
if (type ==
|
|
1061
|
+
if (type == GIT_CONFIGMAP_TRUE)
|
|
1057
1062
|
val = "true";
|
|
1058
1063
|
|
|
1059
1064
|
return write_var(repo, name, var, val);
|
|
@@ -1112,7 +1117,7 @@ const git_oid *git_submodule_wd_id(git_submodule *submodule)
|
|
|
1112
1117
|
if (!git_submodule_open_bare(&subrepo, submodule))
|
|
1113
1118
|
git_repository_free(subrepo);
|
|
1114
1119
|
else
|
|
1115
|
-
|
|
1120
|
+
git_error_clear();
|
|
1116
1121
|
}
|
|
1117
1122
|
|
|
1118
1123
|
if (submodule->flags & GIT_SUBMODULE_STATUS__WD_OID_VALID)
|
|
@@ -1228,13 +1233,18 @@ static int git_submodule_update_repo_init_cb(
|
|
|
1228
1233
|
return submodule_repo_create(out, sm->repo, path);
|
|
1229
1234
|
}
|
|
1230
1235
|
|
|
1231
|
-
int
|
|
1236
|
+
int git_submodule_update_options_init(git_submodule_update_options *opts, unsigned int version)
|
|
1232
1237
|
{
|
|
1233
1238
|
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
|
|
1234
1239
|
opts, version, git_submodule_update_options, GIT_SUBMODULE_UPDATE_OPTIONS_INIT);
|
|
1235
1240
|
return 0;
|
|
1236
1241
|
}
|
|
1237
1242
|
|
|
1243
|
+
int git_submodule_update_init_options(git_submodule_update_options *opts, unsigned int version)
|
|
1244
|
+
{
|
|
1245
|
+
return git_submodule_update_options_init(opts, version);
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1238
1248
|
int git_submodule_update(git_submodule *sm, int init, git_submodule_update_options *_update_options)
|
|
1239
1249
|
{
|
|
1240
1250
|
int error;
|
|
@@ -1253,7 +1263,7 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
|
|
|
1253
1263
|
if (_update_options)
|
|
1254
1264
|
memcpy(&update_options, _update_options, sizeof(git_submodule_update_options));
|
|
1255
1265
|
|
|
1256
|
-
|
|
1266
|
+
GIT_ERROR_CHECK_VERSION(&update_options, GIT_SUBMODULE_UPDATE_OPTIONS_VERSION, "git_submodule_update_options");
|
|
1257
1267
|
|
|
1258
1268
|
/* Copy over the remote callbacks */
|
|
1259
1269
|
memcpy(&clone_options.fetch_opts, &update_options.fetch_opts, sizeof(git_fetch_options));
|
|
@@ -1284,7 +1294,7 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
|
|
|
1284
1294
|
goto done;
|
|
1285
1295
|
|
|
1286
1296
|
if (!init) {
|
|
1287
|
-
|
|
1297
|
+
git_error_set(GIT_ERROR_SUBMODULE, "submodule is not initialized");
|
|
1288
1298
|
error = GIT_ERROR;
|
|
1289
1299
|
goto done;
|
|
1290
1300
|
}
|
|
@@ -1328,18 +1338,18 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
|
|
|
1328
1338
|
goto done;
|
|
1329
1339
|
|
|
1330
1340
|
if ((oid = git_submodule_index_id(sm)) == NULL) {
|
|
1331
|
-
|
|
1341
|
+
git_error_set(GIT_ERROR_SUBMODULE, "could not get ID of submodule in index");
|
|
1332
1342
|
error = -1;
|
|
1333
1343
|
goto done;
|
|
1334
1344
|
}
|
|
1335
1345
|
|
|
1336
1346
|
/* Look up the target commit in the submodule. */
|
|
1337
|
-
if ((error = git_object_lookup(&target_commit, sub_repo, oid,
|
|
1347
|
+
if ((error = git_object_lookup(&target_commit, sub_repo, oid, GIT_OBJECT_COMMIT)) < 0) {
|
|
1338
1348
|
/* If it isn't found then fetch and try again. */
|
|
1339
1349
|
if (error != GIT_ENOTFOUND || !update_options.allow_fetch ||
|
|
1340
1350
|
(error = lookup_default_remote(&remote, sub_repo)) < 0 ||
|
|
1341
1351
|
(error = git_remote_fetch(remote, NULL, &update_options.fetch_opts, NULL)) < 0 ||
|
|
1342
|
-
(error = git_object_lookup(&target_commit, sub_repo, git_submodule_index_id(sm),
|
|
1352
|
+
(error = git_object_lookup(&target_commit, sub_repo, git_submodule_index_id(sm), GIT_OBJECT_COMMIT)) < 0)
|
|
1343
1353
|
goto done;
|
|
1344
1354
|
}
|
|
1345
1355
|
|
|
@@ -1372,7 +1382,7 @@ int git_submodule_init(git_submodule *sm, int overwrite)
|
|
|
1372
1382
|
git_config *cfg = NULL;
|
|
1373
1383
|
|
|
1374
1384
|
if (!sm->url) {
|
|
1375
|
-
|
|
1385
|
+
git_error_set(GIT_ERROR_SUBMODULE,
|
|
1376
1386
|
"no URL configured for submodule '%s'", sm->name);
|
|
1377
1387
|
return -1;
|
|
1378
1388
|
}
|
|
@@ -1416,7 +1426,7 @@ int git_submodule_sync(git_submodule *sm)
|
|
|
1416
1426
|
git_repository *smrepo = NULL;
|
|
1417
1427
|
|
|
1418
1428
|
if (!sm->url) {
|
|
1419
|
-
|
|
1429
|
+
git_error_set(GIT_ERROR_SUBMODULE,
|
|
1420
1430
|
"no URL configured for submodule '%s'", sm->name);
|
|
1421
1431
|
return -1;
|
|
1422
1432
|
}
|
|
@@ -1438,7 +1448,7 @@ int git_submodule_sync(git_submodule *sm)
|
|
|
1438
1448
|
if ((error = git_repository_config__weakptr(&cfg, smrepo)) < 0)
|
|
1439
1449
|
/* return error from reading submodule config */;
|
|
1440
1450
|
else if ((error = lookup_head_remote_key(&remote_name, smrepo)) < 0) {
|
|
1441
|
-
|
|
1451
|
+
git_error_clear();
|
|
1442
1452
|
error = git_buf_sets(&key, "remote.origin.url");
|
|
1443
1453
|
} else {
|
|
1444
1454
|
error = git_buf_join3(
|
|
@@ -1495,7 +1505,7 @@ static int git_submodule__open(
|
|
|
1495
1505
|
if (!git_reference_name_to_id(&sm->wd_oid, *subrepo, GIT_HEAD_FILE))
|
|
1496
1506
|
sm->flags |= GIT_SUBMODULE_STATUS__WD_OID_VALID;
|
|
1497
1507
|
else
|
|
1498
|
-
|
|
1508
|
+
git_error_clear();
|
|
1499
1509
|
} else if (git_path_exists(path.ptr)) {
|
|
1500
1510
|
sm->flags |= GIT_SUBMODULE_STATUS__WD_SCANNED |
|
|
1501
1511
|
GIT_SUBMODULE_STATUS_IN_WD;
|
|
@@ -1585,7 +1595,7 @@ static int submodule_update_head(git_submodule *submodule)
|
|
|
1585
1595
|
/* if we can't look up file in current head, then done */
|
|
1586
1596
|
if (git_repository_head_tree(&head, submodule->repo) < 0 ||
|
|
1587
1597
|
git_tree_entry_bypath(&te, head, submodule->path) < 0)
|
|
1588
|
-
|
|
1598
|
+
git_error_clear();
|
|
1589
1599
|
else
|
|
1590
1600
|
submodule_update_from_head_data(submodule, te->attr, git_tree_entry_id(te));
|
|
1591
1601
|
|
|
@@ -1688,12 +1698,12 @@ int git_submodule__status(
|
|
|
1688
1698
|
if (ign == GIT_SUBMODULE_IGNORE_DIRTY) {
|
|
1689
1699
|
/* git_submodule_open_bare will load WD OID data */
|
|
1690
1700
|
if (git_submodule_open_bare(&smrepo, sm) < 0)
|
|
1691
|
-
|
|
1701
|
+
git_error_clear();
|
|
1692
1702
|
else
|
|
1693
1703
|
git_repository_free(smrepo);
|
|
1694
1704
|
smrepo = NULL;
|
|
1695
1705
|
} else if (git_submodule_open(&smrepo, sm) < 0) {
|
|
1696
|
-
|
|
1706
|
+
git_error_clear();
|
|
1697
1707
|
smrepo = NULL;
|
|
1698
1708
|
}
|
|
1699
1709
|
|
|
@@ -1751,12 +1761,12 @@ static int submodule_alloc(
|
|
|
1751
1761
|
git_submodule *sm;
|
|
1752
1762
|
|
|
1753
1763
|
if (!name || !(namelen = strlen(name))) {
|
|
1754
|
-
|
|
1764
|
+
git_error_set(GIT_ERROR_SUBMODULE, "invalid submodule name");
|
|
1755
1765
|
return -1;
|
|
1756
1766
|
}
|
|
1757
1767
|
|
|
1758
1768
|
sm = git__calloc(1, sizeof(git_submodule));
|
|
1759
|
-
|
|
1769
|
+
GIT_ERROR_CHECK_ALLOC(sm);
|
|
1760
1770
|
|
|
1761
1771
|
sm->name = sm->path = git__strdup(name);
|
|
1762
1772
|
if (!sm->name) {
|
|
@@ -1802,7 +1812,7 @@ void git_submodule_free(git_submodule *sm)
|
|
|
1802
1812
|
|
|
1803
1813
|
static int submodule_config_error(const char *property, const char *value)
|
|
1804
1814
|
{
|
|
1805
|
-
|
|
1815
|
+
git_error_set(GIT_ERROR_INVALID,
|
|
1806
1816
|
"invalid value for submodule '%s' property: '%s'", property, value);
|
|
1807
1817
|
return -1;
|
|
1808
1818
|
}
|
|
@@ -1862,6 +1872,14 @@ static int get_value(const char **out, git_config *cfg, git_buf *buf, const char
|
|
|
1862
1872
|
return error;
|
|
1863
1873
|
}
|
|
1864
1874
|
|
|
1875
|
+
static bool looks_like_command_line_option(const char *s)
|
|
1876
|
+
{
|
|
1877
|
+
if (s && s[0] == '-')
|
|
1878
|
+
return true;
|
|
1879
|
+
|
|
1880
|
+
return false;
|
|
1881
|
+
}
|
|
1882
|
+
|
|
1865
1883
|
static int submodule_read_config(git_submodule *sm, git_config *cfg)
|
|
1866
1884
|
{
|
|
1867
1885
|
git_buf key = GIT_BUF_INIT;
|
|
@@ -1875,24 +1893,31 @@ static int submodule_read_config(git_submodule *sm, git_config *cfg)
|
|
|
1875
1893
|
|
|
1876
1894
|
if ((error = get_value(&value, cfg, &key, sm->name, "path")) == 0) {
|
|
1877
1895
|
in_config = 1;
|
|
1896
|
+
/* We would warn here if we had that API */
|
|
1897
|
+
if (!looks_like_command_line_option(value)) {
|
|
1878
1898
|
/*
|
|
1879
1899
|
* TODO: if case insensitive filesystem, then the following strcmp
|
|
1880
1900
|
* should be strcasecmp
|
|
1881
1901
|
*/
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1902
|
+
if (strcmp(sm->name, value) != 0) {
|
|
1903
|
+
if (sm->path != sm->name)
|
|
1904
|
+
git__free(sm->path);
|
|
1905
|
+
sm->path = git__strdup(value);
|
|
1906
|
+
GIT_ERROR_CHECK_ALLOC(sm->path);
|
|
1907
|
+
}
|
|
1908
|
+
|
|
1887
1909
|
}
|
|
1888
1910
|
} else if (error != GIT_ENOTFOUND) {
|
|
1889
1911
|
goto cleanup;
|
|
1890
1912
|
}
|
|
1891
1913
|
|
|
1892
1914
|
if ((error = get_value(&value, cfg, &key, sm->name, "url")) == 0) {
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1915
|
+
/* We would warn here if we had that API */
|
|
1916
|
+
if (!looks_like_command_line_option(value)) {
|
|
1917
|
+
in_config = 1;
|
|
1918
|
+
sm->url = git__strdup(value);
|
|
1919
|
+
GIT_ERROR_CHECK_ALLOC(sm->url);
|
|
1920
|
+
}
|
|
1896
1921
|
} else if (error != GIT_ENOTFOUND) {
|
|
1897
1922
|
goto cleanup;
|
|
1898
1923
|
}
|
|
@@ -1900,7 +1925,7 @@ static int submodule_read_config(git_submodule *sm, git_config *cfg)
|
|
|
1900
1925
|
if ((error = get_value(&value, cfg, &key, sm->name, "branch")) == 0) {
|
|
1901
1926
|
in_config = 1;
|
|
1902
1927
|
sm->branch = git__strdup(value);
|
|
1903
|
-
|
|
1928
|
+
GIT_ERROR_CHECK_ALLOC(sm->branch);
|
|
1904
1929
|
} else if (error != GIT_ENOTFOUND) {
|
|
1905
1930
|
goto cleanup;
|
|
1906
1931
|
}
|
|
@@ -1946,7 +1971,6 @@ static int submodule_load_each(const git_config_entry *entry, void *payload)
|
|
|
1946
1971
|
{
|
|
1947
1972
|
lfc_data *data = payload;
|
|
1948
1973
|
const char *namestart, *property;
|
|
1949
|
-
git_strmap_iter pos;
|
|
1950
1974
|
git_strmap *map = data->map;
|
|
1951
1975
|
git_buf name = GIT_BUF_INIT;
|
|
1952
1976
|
git_submodule *sm;
|
|
@@ -1978,8 +2002,7 @@ static int submodule_load_each(const git_config_entry *entry, void *payload)
|
|
|
1978
2002
|
* a new submodule, load the config and insert it. If it's
|
|
1979
2003
|
* already inserted, we've already loaded it, so we skip.
|
|
1980
2004
|
*/
|
|
1981
|
-
|
|
1982
|
-
if (git_strmap_valid_index(map, pos)) {
|
|
2005
|
+
if (git_strmap_exists(map, name.ptr)) {
|
|
1983
2006
|
error = 0;
|
|
1984
2007
|
goto done;
|
|
1985
2008
|
}
|
|
@@ -1992,9 +2015,7 @@ static int submodule_load_each(const git_config_entry *entry, void *payload)
|
|
|
1992
2015
|
goto done;
|
|
1993
2016
|
}
|
|
1994
2017
|
|
|
1995
|
-
|
|
1996
|
-
assert(error != 0);
|
|
1997
|
-
if (error < 0)
|
|
2018
|
+
if ((error = git_strmap_set(map, sm->name, sm)) < 0)
|
|
1998
2019
|
goto done;
|
|
1999
2020
|
|
|
2000
2021
|
error = 0;
|
|
@@ -2069,12 +2090,12 @@ static git_config_backend *open_gitmodules(
|
|
|
2069
2090
|
return NULL;
|
|
2070
2091
|
|
|
2071
2092
|
if (okay_to_create || git_path_isfile(path.ptr)) {
|
|
2072
|
-
/*
|
|
2073
|
-
if (
|
|
2093
|
+
/* git_config_backend_from_file should only fail if OOM */
|
|
2094
|
+
if (git_config_backend_from_file(&mods, path.ptr) < 0)
|
|
2074
2095
|
mods = NULL;
|
|
2075
2096
|
/* open should only fail here if the file is malformed */
|
|
2076
|
-
else if (
|
|
2077
|
-
|
|
2097
|
+
else if (git_config_backend_open(mods, GIT_CONFIG_LEVEL_LOCAL, repo) < 0) {
|
|
2098
|
+
git_config_backend_free(mods);
|
|
2078
2099
|
mods = NULL;
|
|
2079
2100
|
}
|
|
2080
2101
|
}
|
|
@@ -2102,7 +2123,7 @@ static int lookup_head_remote_key(git_buf *remote_name, git_repository *repo)
|
|
|
2102
2123
|
* a remote key for the local tracking branch HEAD points to.
|
|
2103
2124
|
**/
|
|
2104
2125
|
if (!git_reference_is_branch(head)) {
|
|
2105
|
-
|
|
2126
|
+
git_error_set(GIT_ERROR_INVALID,
|
|
2106
2127
|
"HEAD does not refer to a branch.");
|
|
2107
2128
|
error = GIT_ENOTFOUND;
|
|
2108
2129
|
goto done;
|
|
@@ -2151,8 +2172,8 @@ static int lookup_default_remote(git_remote **remote, git_repository *repo)
|
|
|
2151
2172
|
error = git_remote_lookup(remote, repo, "origin");
|
|
2152
2173
|
|
|
2153
2174
|
if (error == GIT_ENOTFOUND)
|
|
2154
|
-
|
|
2155
|
-
|
|
2175
|
+
git_error_set(
|
|
2176
|
+
GIT_ERROR_SUBMODULE,
|
|
2156
2177
|
"cannot get default remote for submodule - no local tracking "
|
|
2157
2178
|
"branch for HEAD and origin does not exist");
|
|
2158
2179
|
|
|
@@ -2171,7 +2192,7 @@ static int get_url_base(git_buf *url, git_repository *repo)
|
|
|
2171
2192
|
} else if (error != GIT_ENOTFOUND)
|
|
2172
2193
|
goto out;
|
|
2173
2194
|
else
|
|
2174
|
-
|
|
2195
|
+
git_error_clear();
|
|
2175
2196
|
|
|
2176
2197
|
/* if repository does not have a default remote, use workdir instead */
|
|
2177
2198
|
if (git_repository_is_worktree(repo)) {
|
|
@@ -2252,11 +2273,11 @@ static void submodule_get_wd_status(
|
|
|
2252
2273
|
|
|
2253
2274
|
/* if we don't have an unborn head, check diff with index */
|
|
2254
2275
|
if (git_repository_head_tree(&sm_head, sm_repo) < 0)
|
|
2255
|
-
|
|
2276
|
+
git_error_clear();
|
|
2256
2277
|
else {
|
|
2257
2278
|
/* perform head to index diff on submodule */
|
|
2258
2279
|
if (git_diff_tree_to_index(&diff, sm_repo, sm_head, index, &opt) < 0)
|
|
2259
|
-
|
|
2280
|
+
git_error_clear();
|
|
2260
2281
|
else {
|
|
2261
2282
|
if (git_diff_num_deltas(diff) > 0)
|
|
2262
2283
|
*status |= GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED;
|
|
@@ -2269,7 +2290,7 @@ static void submodule_get_wd_status(
|
|
|
2269
2290
|
|
|
2270
2291
|
/* perform index-to-workdir diff on submodule */
|
|
2271
2292
|
if (git_diff_index_to_workdir(&diff, sm_repo, index, &opt) < 0)
|
|
2272
|
-
|
|
2293
|
+
git_error_clear();
|
|
2273
2294
|
else {
|
|
2274
2295
|
size_t untracked =
|
|
2275
2296
|
git_diff_num_deltas_of_type(diff, GIT_DELTA_UNTRACKED);
|