rugged 1.0.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -0
- data/README.md +1 -1
- data/ext/rugged/rugged.c +7 -4
- data/ext/rugged/rugged_commit.c +1 -1
- data/ext/rugged/rugged_object.c +1 -1
- data/ext/rugged/rugged_repo.c +3 -3
- data/lib/rugged/commit.rb +16 -2
- data/lib/rugged/repository.rb +2 -2
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +41 -74
- data/vendor/libgit2/COPYING +109 -1
- data/vendor/libgit2/cmake/{Modules/AddCFlagIfSupported.cmake → AddCFlagIfSupported.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/EnableWarnings.cmake → EnableWarnings.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindCoreFoundation.cmake → FindCoreFoundation.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindGSSAPI.cmake → FindGSSAPI.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindGSSFramework.cmake → FindGSSFramework.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindHTTP_Parser.cmake → FindHTTP_Parser.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindIconv.cmake → FindIconv.cmake} +0 -0
- data/vendor/libgit2/cmake/FindLibSSH2.cmake +13 -0
- data/vendor/libgit2/cmake/{Modules/FindPCRE.cmake → FindPCRE.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindPCRE2.cmake → FindPCRE2.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindPkgLibraries.cmake → FindPkgLibraries.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindSecurity.cmake → FindSecurity.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindStatNsec.cmake → FindStatNsec.cmake} +0 -0
- data/vendor/libgit2/cmake/Findfutimens.cmake +14 -0
- data/vendor/libgit2/cmake/{Modules/FindmbedTLS.cmake → FindmbedTLS.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/IdeSplitSources.cmake → IdeSplitSources.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/PkgBuildConfig.cmake → PkgBuildConfig.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/SanitizeBool.cmake → SanitizeBool.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/SelectGSSAPI.cmake → SelectGSSAPI.cmake} +18 -26
- data/vendor/libgit2/cmake/{Modules/SelectHTTPSBackend.cmake → SelectHTTPSBackend.cmake} +29 -32
- data/vendor/libgit2/cmake/{Modules/SelectHashes.cmake → SelectHashes.cmake} +21 -28
- data/vendor/libgit2/deps/chromium-zlib/CMakeLists.txt +101 -0
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +4 -3
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +24 -10
- data/vendor/libgit2/deps/ntlmclient/compat.h +0 -27
- data/vendor/libgit2/deps/ntlmclient/crypt.h +14 -9
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +20 -20
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +3 -3
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +37 -36
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +4 -3
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +178 -51
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +74 -5
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +164 -135
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +13 -9
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +16 -3
- data/vendor/libgit2/deps/ntlmclient/unicode.h +10 -4
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +16 -27
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.h +20 -0
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +28 -52
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.h +22 -0
- data/vendor/libgit2/deps/ntlmclient/util.c +15 -1
- data/vendor/libgit2/deps/ntlmclient/util.h +2 -1
- data/vendor/libgit2/deps/pcre/LICENCE +93 -0
- data/vendor/libgit2/deps/pcre/pcre.h +2 -2
- data/vendor/libgit2/deps/pcre/pcre_compile.c +29 -17
- data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +4 -4
- data/vendor/libgit2/deps/pcre/pcreposix.c +2 -3
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +6 -5
- data/vendor/libgit2/deps/zlib/deflate.c +1 -0
- data/vendor/libgit2/include/git2/annotated_commit.h +1 -1
- data/vendor/libgit2/include/git2/apply.h +2 -0
- data/vendor/libgit2/include/git2/attr.h +95 -0
- data/vendor/libgit2/include/git2/blame.h +95 -42
- data/vendor/libgit2/include/git2/blob.h +37 -3
- data/vendor/libgit2/include/git2/branch.h +25 -0
- data/vendor/libgit2/include/git2/cert.h +42 -5
- data/vendor/libgit2/include/git2/checkout.h +28 -12
- data/vendor/libgit2/include/git2/clone.h +1 -1
- data/vendor/libgit2/include/git2/commit.h +35 -19
- data/vendor/libgit2/include/git2/common.h +51 -6
- data/vendor/libgit2/include/git2/config.h +1 -1
- data/vendor/libgit2/include/git2/deprecated.h +368 -8
- data/vendor/libgit2/include/git2/diff.h +34 -113
- data/vendor/libgit2/include/git2/email.h +127 -0
- data/vendor/libgit2/include/git2/errors.h +8 -7
- data/vendor/libgit2/include/git2/filter.h +63 -17
- data/vendor/libgit2/include/git2/graph.h +20 -2
- data/vendor/libgit2/include/git2/index.h +4 -5
- data/vendor/libgit2/include/git2/indexer.h +2 -1
- data/vendor/libgit2/include/git2/notes.h +2 -2
- data/vendor/libgit2/include/git2/odb.h +44 -20
- data/vendor/libgit2/include/git2/oidarray.h +5 -8
- data/vendor/libgit2/include/git2/pack.h +1 -1
- data/vendor/libgit2/include/git2/patch.h +8 -0
- data/vendor/libgit2/include/git2/rebase.h +25 -1
- data/vendor/libgit2/include/git2/refs.h +9 -5
- data/vendor/libgit2/include/git2/remote.h +62 -9
- data/vendor/libgit2/include/git2/repository.h +107 -62
- data/vendor/libgit2/include/git2/revparse.h +5 -5
- data/vendor/libgit2/include/git2/stash.h +1 -1
- data/vendor/libgit2/include/git2/status.h +115 -59
- data/vendor/libgit2/include/git2/stdint.h +3 -3
- data/vendor/libgit2/include/git2/strarray.h +6 -10
- data/vendor/libgit2/include/git2/submodule.h +9 -0
- data/vendor/libgit2/include/git2/sys/commit_graph.h +174 -0
- data/vendor/libgit2/include/git2/sys/email.h +45 -0
- data/vendor/libgit2/include/git2/sys/filter.h +49 -28
- data/vendor/libgit2/include/git2/sys/midx.h +74 -0
- data/vendor/libgit2/include/git2/sys/odb_backend.h +7 -0
- data/vendor/libgit2/include/git2/sys/transport.h +1 -0
- data/vendor/libgit2/include/git2/tag.h +12 -0
- data/vendor/libgit2/include/git2/transport.h +1 -1
- data/vendor/libgit2/include/git2/tree.h +2 -14
- data/vendor/libgit2/include/git2/types.h +9 -0
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2/worktree.h +1 -0
- data/vendor/libgit2/include/git2.h +1 -0
- data/vendor/libgit2/src/CMakeLists.txt +84 -44
- data/vendor/libgit2/src/alloc.c +21 -8
- data/vendor/libgit2/src/allocators/failalloc.c +92 -0
- data/vendor/libgit2/src/allocators/failalloc.h +23 -0
- data/vendor/libgit2/src/allocators/stdalloc.c +41 -10
- data/vendor/libgit2/src/allocators/win32_leakcheck.c +118 -0
- data/vendor/libgit2/src/allocators/{win32_crtdbg.h → win32_leakcheck.h} +3 -3
- data/vendor/libgit2/src/annotated_commit.c +21 -9
- data/vendor/libgit2/src/apply.c +21 -8
- data/vendor/libgit2/src/array.h +11 -11
- data/vendor/libgit2/src/assert_safe.h +58 -0
- data/vendor/libgit2/src/attr.c +192 -70
- data/vendor/libgit2/src/attr_file.c +99 -41
- data/vendor/libgit2/src/attr_file.h +32 -11
- data/vendor/libgit2/src/attrcache.c +44 -40
- data/vendor/libgit2/src/attrcache.h +4 -5
- data/vendor/libgit2/src/blame.c +32 -19
- data/vendor/libgit2/src/blame_git.c +7 -4
- data/vendor/libgit2/src/blob.c +60 -32
- data/vendor/libgit2/src/branch.c +87 -37
- data/vendor/libgit2/src/buffer.c +349 -29
- data/vendor/libgit2/src/buffer.h +154 -2
- data/vendor/libgit2/src/cache.c +3 -24
- data/vendor/libgit2/src/cache.h +7 -7
- data/vendor/libgit2/src/cc-compat.h +10 -8
- data/vendor/libgit2/src/checkout.c +103 -105
- data/vendor/libgit2/src/cherrypick.c +8 -2
- data/vendor/libgit2/src/clone.c +105 -30
- data/vendor/libgit2/src/commit.c +41 -28
- data/vendor/libgit2/src/commit_graph.c +1209 -0
- data/vendor/libgit2/src/commit_graph.h +162 -0
- data/vendor/libgit2/src/commit_list.c +46 -0
- data/vendor/libgit2/src/commit_list.h +2 -0
- data/vendor/libgit2/src/common.h +26 -2
- data/vendor/libgit2/src/config.c +41 -23
- data/vendor/libgit2/src/config_cache.c +9 -4
- data/vendor/libgit2/src/config_entries.c +35 -27
- data/vendor/libgit2/src/config_file.c +17 -9
- data/vendor/libgit2/src/config_parse.c +6 -8
- data/vendor/libgit2/src/config_snapshot.c +2 -1
- data/vendor/libgit2/src/crlf.c +16 -6
- data/vendor/libgit2/src/date.c +4 -3
- data/vendor/libgit2/src/delta.c +1 -1
- data/vendor/libgit2/src/describe.c +12 -5
- data/vendor/libgit2/src/diff.c +55 -183
- data/vendor/libgit2/src/diff_driver.c +21 -17
- data/vendor/libgit2/src/diff_file.c +5 -7
- data/vendor/libgit2/src/diff_generate.c +56 -28
- data/vendor/libgit2/src/diff_parse.c +2 -3
- data/vendor/libgit2/src/diff_print.c +81 -65
- data/vendor/libgit2/src/diff_stats.c +19 -16
- data/vendor/libgit2/src/diff_tform.c +13 -13
- data/vendor/libgit2/src/diff_xdiff.c +4 -2
- data/vendor/libgit2/src/diff_xdiff.h +1 -1
- data/vendor/libgit2/src/email.c +299 -0
- data/vendor/libgit2/src/email.h +25 -0
- data/vendor/libgit2/src/errors.c +26 -19
- data/vendor/libgit2/src/features.h.in +5 -1
- data/vendor/libgit2/src/fetch.c +7 -2
- data/vendor/libgit2/src/fetchhead.c +8 -4
- data/vendor/libgit2/src/filebuf.c +9 -7
- data/vendor/libgit2/src/filter.c +215 -113
- data/vendor/libgit2/src/filter.h +24 -5
- data/vendor/libgit2/src/futils.c +8 -8
- data/vendor/libgit2/src/futils.h +4 -4
- data/vendor/libgit2/src/graph.c +64 -9
- data/vendor/libgit2/src/hash/sha1/collisiondetect.c +3 -3
- data/vendor/libgit2/src/hash/sha1/common_crypto.c +3 -3
- data/vendor/libgit2/src/hash/sha1/generic.h +1 -1
- data/vendor/libgit2/src/hash/sha1/mbedtls.c +12 -12
- data/vendor/libgit2/src/hash/sha1/openssl.c +3 -3
- data/vendor/libgit2/src/hash/sha1/sha1dc/sha1.c +8 -10
- data/vendor/libgit2/src/hash/sha1/win32.c +15 -11
- data/vendor/libgit2/src/hash.c +16 -13
- data/vendor/libgit2/src/hash.h +1 -1
- data/vendor/libgit2/src/hashsig.c +23 -10
- data/vendor/libgit2/src/ident.c +13 -3
- data/vendor/libgit2/src/idxmap.c +0 -22
- data/vendor/libgit2/src/ignore.c +33 -17
- data/vendor/libgit2/src/index.c +124 -82
- data/vendor/libgit2/src/index.h +1 -1
- data/vendor/libgit2/src/indexer.c +95 -37
- data/vendor/libgit2/src/integer.h +79 -2
- data/vendor/libgit2/src/iterator.c +40 -28
- data/vendor/libgit2/src/iterator.h +1 -1
- data/vendor/libgit2/src/khash.h +2 -11
- data/vendor/libgit2/src/{settings.c → libgit2.c} +148 -49
- data/vendor/libgit2/src/libgit2.h +15 -0
- data/vendor/libgit2/src/mailmap.c +23 -10
- data/vendor/libgit2/src/map.h +3 -3
- data/vendor/libgit2/src/merge.c +95 -43
- data/vendor/libgit2/src/merge.h +2 -1
- data/vendor/libgit2/src/merge_driver.c +19 -13
- data/vendor/libgit2/src/merge_file.c +15 -9
- data/vendor/libgit2/src/message.c +3 -1
- data/vendor/libgit2/src/midx.c +879 -0
- data/vendor/libgit2/src/midx.h +110 -0
- data/vendor/libgit2/src/mwindow.c +214 -95
- data/vendor/libgit2/src/mwindow.h +3 -3
- data/vendor/libgit2/src/net.c +133 -4
- data/vendor/libgit2/src/net.h +16 -2
- data/vendor/libgit2/src/netops.c +6 -4
- data/vendor/libgit2/src/netops.h +2 -2
- data/vendor/libgit2/src/notes.c +40 -40
- data/vendor/libgit2/src/object.c +24 -15
- data/vendor/libgit2/src/odb.c +298 -57
- data/vendor/libgit2/src/odb.h +16 -2
- data/vendor/libgit2/src/odb_loose.c +31 -21
- data/vendor/libgit2/src/odb_mempack.c +3 -1
- data/vendor/libgit2/src/odb_pack.c +391 -114
- data/vendor/libgit2/src/oid.c +7 -4
- data/vendor/libgit2/src/oidarray.c +10 -1
- data/vendor/libgit2/src/pack-objects.c +83 -69
- data/vendor/libgit2/src/pack.c +383 -150
- data/vendor/libgit2/src/pack.h +44 -9
- data/vendor/libgit2/src/patch.c +14 -7
- data/vendor/libgit2/src/patch_generate.c +3 -5
- data/vendor/libgit2/src/patch_parse.c +6 -3
- data/vendor/libgit2/src/path.c +103 -58
- data/vendor/libgit2/src/path.h +80 -7
- data/vendor/libgit2/src/pathspec.c +12 -11
- data/vendor/libgit2/src/pool.c +34 -22
- data/vendor/libgit2/src/pool.h +9 -1
- data/vendor/libgit2/src/posix.c +43 -12
- data/vendor/libgit2/src/posix.h +9 -0
- data/vendor/libgit2/src/proxy.c +2 -0
- data/vendor/libgit2/src/push.c +2 -0
- data/vendor/libgit2/src/reader.c +10 -6
- data/vendor/libgit2/src/rebase.c +95 -49
- data/vendor/libgit2/src/refdb.c +165 -13
- data/vendor/libgit2/src/refdb.h +69 -0
- data/vendor/libgit2/src/refdb_fs.c +145 -153
- data/vendor/libgit2/src/reflog.c +21 -20
- data/vendor/libgit2/src/refs.c +153 -233
- data/vendor/libgit2/src/refs.h +2 -20
- data/vendor/libgit2/src/refspec.c +81 -45
- data/vendor/libgit2/src/regexp.c +2 -2
- data/vendor/libgit2/src/remote.c +320 -122
- data/vendor/libgit2/src/remote.h +2 -1
- data/vendor/libgit2/src/repository.c +476 -203
- data/vendor/libgit2/src/repository.h +27 -29
- data/vendor/libgit2/src/reset.c +8 -7
- data/vendor/libgit2/src/revert.c +8 -2
- data/vendor/libgit2/src/revparse.c +23 -17
- data/vendor/libgit2/src/revwalk.c +35 -20
- data/vendor/libgit2/src/runtime.c +162 -0
- data/vendor/libgit2/src/runtime.h +62 -0
- data/vendor/libgit2/src/{refdb_fs.h → settings.h} +3 -11
- data/vendor/libgit2/src/signature.c +6 -5
- data/vendor/libgit2/src/sortedcache.c +2 -3
- data/vendor/libgit2/src/sortedcache.h +10 -8
- data/vendor/libgit2/src/stash.c +6 -2
- data/vendor/libgit2/src/status.c +9 -4
- data/vendor/libgit2/src/strarray.c +64 -0
- data/vendor/libgit2/src/streams/mbedtls.c +14 -17
- data/vendor/libgit2/src/streams/mbedtls.h +1 -1
- data/vendor/libgit2/src/streams/openssl.c +113 -207
- data/vendor/libgit2/src/streams/openssl.h +9 -1
- data/vendor/libgit2/src/streams/openssl_dynamic.c +309 -0
- data/vendor/libgit2/src/streams/openssl_dynamic.h +348 -0
- data/vendor/libgit2/src/streams/openssl_legacy.c +203 -0
- data/vendor/libgit2/src/streams/openssl_legacy.h +63 -0
- data/vendor/libgit2/src/streams/registry.c +10 -9
- data/vendor/libgit2/src/streams/socket.c +6 -2
- data/vendor/libgit2/src/streams/stransport.c +6 -3
- data/vendor/libgit2/src/streams/tls.c +5 -3
- data/vendor/libgit2/src/submodule.c +134 -66
- data/vendor/libgit2/src/submodule.h +9 -9
- data/vendor/libgit2/src/sysdir.c +8 -26
- data/vendor/libgit2/src/sysdir.h +0 -11
- data/vendor/libgit2/src/tag.c +49 -11
- data/vendor/libgit2/src/thread.c +140 -0
- data/vendor/libgit2/src/thread.h +479 -0
- data/vendor/libgit2/src/threadstate.c +84 -0
- data/vendor/libgit2/src/threadstate.h +24 -0
- data/vendor/libgit2/src/trace.c +2 -2
- data/vendor/libgit2/src/trace.h +17 -13
- data/vendor/libgit2/src/trailer.c +1 -1
- data/vendor/libgit2/src/transaction.c +21 -9
- data/vendor/libgit2/src/transport.c +3 -3
- data/vendor/libgit2/src/transports/auth.c +1 -1
- data/vendor/libgit2/src/transports/auth_negotiate.c +11 -4
- data/vendor/libgit2/src/transports/auth_ntlm.c +10 -6
- data/vendor/libgit2/src/transports/credential.c +17 -7
- data/vendor/libgit2/src/transports/credential_helpers.c +2 -0
- data/vendor/libgit2/src/transports/git.c +1 -3
- data/vendor/libgit2/src/transports/http.c +19 -17
- data/vendor/libgit2/src/transports/http.h +1 -0
- data/vendor/libgit2/src/transports/httpclient.c +68 -38
- data/vendor/libgit2/src/transports/httpclient.h +1 -1
- data/vendor/libgit2/src/transports/local.c +5 -5
- data/vendor/libgit2/src/transports/smart.c +14 -9
- data/vendor/libgit2/src/transports/smart.h +1 -1
- data/vendor/libgit2/src/transports/smart_protocol.c +11 -5
- data/vendor/libgit2/src/transports/ssh.c +55 -21
- data/vendor/libgit2/src/transports/winhttp.c +157 -89
- data/vendor/libgit2/src/tree.c +100 -77
- data/vendor/libgit2/src/tree.h +1 -0
- data/vendor/libgit2/src/tsort.c +0 -2
- data/vendor/libgit2/src/unix/map.c +3 -1
- data/vendor/libgit2/src/unix/posix.h +16 -1
- data/vendor/libgit2/src/unix/pthread.h +2 -1
- data/vendor/libgit2/src/utf8.c +150 -0
- data/vendor/libgit2/src/utf8.h +52 -0
- data/vendor/libgit2/src/util.c +75 -184
- data/vendor/libgit2/src/util.h +34 -40
- data/vendor/libgit2/src/vector.c +23 -19
- data/vendor/libgit2/src/vector.h +4 -2
- data/vendor/libgit2/src/win32/findfile.c +5 -3
- data/vendor/libgit2/src/win32/git2.rc +18 -3
- data/vendor/libgit2/src/win32/map.c +1 -1
- data/vendor/libgit2/src/win32/msvc-compat.h +9 -1
- data/vendor/libgit2/src/win32/path_w32.c +23 -25
- data/vendor/libgit2/src/win32/path_w32.h +0 -1
- data/vendor/libgit2/src/win32/posix.h +6 -6
- data/vendor/libgit2/src/win32/posix_w32.c +86 -7
- data/vendor/libgit2/src/win32/precompiled.h +0 -1
- data/vendor/libgit2/src/win32/reparse.h +4 -4
- data/vendor/libgit2/src/win32/thread.c +24 -15
- data/vendor/libgit2/src/win32/thread.h +1 -1
- data/vendor/libgit2/src/win32/w32_buffer.c +3 -3
- data/vendor/libgit2/src/win32/w32_common.h +18 -9
- data/vendor/libgit2/src/win32/{w32_crtdbg_stacktrace.c → w32_leakcheck.c} +269 -33
- data/vendor/libgit2/src/win32/w32_leakcheck.h +222 -0
- data/vendor/libgit2/src/win32/w32_util.h +6 -6
- data/vendor/libgit2/src/worktree.c +36 -14
- data/vendor/libgit2/src/zstream.c +1 -1
- metadata +65 -42
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.c.in +0 -29
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.cmake +0 -96
- data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
- data/vendor/libgit2/src/buf_text.c +0 -316
- data/vendor/libgit2/src/buf_text.h +0 -122
- data/vendor/libgit2/src/global.c +0 -361
- data/vendor/libgit2/src/global.h +0 -41
- data/vendor/libgit2/src/thread-utils.c +0 -58
- data/vendor/libgit2/src/thread-utils.h +0 -246
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +0 -127
- data/vendor/libgit2/src/win32/w32_stack.c +0 -188
- data/vendor/libgit2/src/win32/w32_stack.h +0 -140
@@ -12,7 +12,6 @@
|
|
12
12
|
#include "git2/types.h"
|
13
13
|
#include "git2/index.h"
|
14
14
|
#include "buffer.h"
|
15
|
-
#include "buf_text.h"
|
16
15
|
#include "vector.h"
|
17
16
|
#include "posix.h"
|
18
17
|
#include "config_backend.h"
|
@@ -249,24 +248,62 @@ out:
|
|
249
248
|
return error;
|
250
249
|
}
|
251
250
|
|
251
|
+
int git_submodule_cache_init(git_strmap **out, git_repository *repo)
|
252
|
+
{
|
253
|
+
int error = 0;
|
254
|
+
git_strmap *cache = NULL;
|
255
|
+
GIT_ASSERT_ARG(out);
|
256
|
+
GIT_ASSERT_ARG(repo);
|
257
|
+
if ((error = git_strmap_new(&cache)) < 0)
|
258
|
+
return error;
|
259
|
+
if ((error = git_submodule__map(repo, cache)) < 0) {
|
260
|
+
git_submodule_cache_free(cache);
|
261
|
+
return error;
|
262
|
+
}
|
263
|
+
*out = cache;
|
264
|
+
return error;
|
265
|
+
}
|
266
|
+
|
267
|
+
int git_submodule_cache_free(git_strmap *cache)
|
268
|
+
{
|
269
|
+
git_submodule *sm = NULL;
|
270
|
+
if (cache == NULL)
|
271
|
+
return 0;
|
272
|
+
git_strmap_foreach_value(cache, sm, {
|
273
|
+
git_submodule_free(sm);
|
274
|
+
});
|
275
|
+
git_strmap_free(cache);
|
276
|
+
return 0;
|
277
|
+
}
|
278
|
+
|
252
279
|
int git_submodule_lookup(
|
253
280
|
git_submodule **out, /* NULL if user only wants to test existence */
|
254
281
|
git_repository *repo,
|
255
282
|
const char *name) /* trailing slash is allowed */
|
283
|
+
{
|
284
|
+
return git_submodule__lookup_with_cache(out, repo, name, repo->submodule_cache);
|
285
|
+
}
|
286
|
+
|
287
|
+
int git_submodule__lookup_with_cache(
|
288
|
+
git_submodule **out, /* NULL if user only wants to test existence */
|
289
|
+
git_repository *repo,
|
290
|
+
const char *name, /* trailing slash is allowed */
|
291
|
+
git_strmap *cache)
|
256
292
|
{
|
257
293
|
int error;
|
258
294
|
unsigned int location;
|
259
295
|
git_submodule *sm;
|
260
296
|
|
261
|
-
|
297
|
+
GIT_ASSERT_ARG(repo);
|
298
|
+
GIT_ASSERT_ARG(name);
|
262
299
|
|
263
300
|
if (repo->is_bare) {
|
264
301
|
git_error_set(GIT_ERROR_SUBMODULE, "cannot get submodules without a working tree");
|
265
302
|
return -1;
|
266
303
|
}
|
267
304
|
|
268
|
-
if (
|
269
|
-
if ((sm = git_strmap_get(
|
305
|
+
if (cache != NULL) {
|
306
|
+
if ((sm = git_strmap_get(cache, name)) != NULL) {
|
270
307
|
if (out) {
|
271
308
|
*out = sm;
|
272
309
|
GIT_REFCOUNT_INC(*out);
|
@@ -342,8 +379,10 @@ int git_submodule_lookup(
|
|
342
379
|
/* If it's not configured, we still check if there's a repo at the path */
|
343
380
|
if (git_repository_workdir(repo)) {
|
344
381
|
git_buf path = GIT_BUF_INIT;
|
345
|
-
if (git_buf_join3(&path,
|
346
|
-
|
382
|
+
if (git_buf_join3(&path, '/',
|
383
|
+
git_repository_workdir(repo),
|
384
|
+
name, DOT_GIT) < 0 ||
|
385
|
+
git_path_validate_workdir_buf(NULL, &path) < 0)
|
347
386
|
return -1;
|
348
387
|
|
349
388
|
if (git_path_exists(path.ptr))
|
@@ -380,7 +419,7 @@ int git_submodule_name_is_valid(git_repository *repo, const char *name, int flag
|
|
380
419
|
git_buf_attach_notowned(&buf, name, strlen(name));
|
381
420
|
}
|
382
421
|
|
383
|
-
isvalid =
|
422
|
+
isvalid = git_path_validate(repo, buf.ptr, 0, flags);
|
384
423
|
git_buf_dispose(&buf);
|
385
424
|
|
386
425
|
return isvalid;
|
@@ -515,12 +554,13 @@ int git_submodule__map(git_repository *repo, git_strmap *map)
|
|
515
554
|
int error = 0;
|
516
555
|
git_index *idx = NULL;
|
517
556
|
git_tree *head = NULL;
|
518
|
-
const char *wd = NULL;
|
519
557
|
git_buf path = GIT_BUF_INIT;
|
520
558
|
git_submodule *sm;
|
521
559
|
git_config *mods = NULL;
|
560
|
+
bool has_workdir;
|
522
561
|
|
523
|
-
|
562
|
+
GIT_ASSERT_ARG(repo);
|
563
|
+
GIT_ASSERT_ARG(map);
|
524
564
|
|
525
565
|
/* get sources that we will need to check */
|
526
566
|
if (git_repository_index(&idx, repo) < 0)
|
@@ -528,12 +568,14 @@ int git_submodule__map(git_repository *repo, git_strmap *map)
|
|
528
568
|
if (git_repository_head_tree(&head, repo) < 0)
|
529
569
|
git_error_clear();
|
530
570
|
|
531
|
-
|
532
|
-
|
571
|
+
has_workdir = git_repository_workdir(repo) != NULL;
|
572
|
+
|
573
|
+
if (has_workdir &&
|
574
|
+
(error = git_repository_workdir_path(&path, repo, GIT_MODULES_FILE)) < 0)
|
533
575
|
goto cleanup;
|
534
576
|
|
535
577
|
/* add submodule information from .gitmodules */
|
536
|
-
if (
|
578
|
+
if (has_workdir) {
|
537
579
|
lfc_data data = { 0 };
|
538
580
|
data.map = map;
|
539
581
|
data.repo = repo;
|
@@ -560,7 +602,7 @@ int git_submodule__map(git_repository *repo, git_strmap *map)
|
|
560
602
|
goto cleanup;
|
561
603
|
}
|
562
604
|
/* shallow scan submodules in work tree as needed */
|
563
|
-
if (
|
605
|
+
if (has_workdir) {
|
564
606
|
git_strmap_foreach_value(map, sm, {
|
565
607
|
submodule_load_from_wd_lite(sm);
|
566
608
|
});
|
@@ -644,7 +686,7 @@ static int submodule_repo_init(
|
|
644
686
|
git_repository_init_options initopt = GIT_REPOSITORY_INIT_OPTIONS_INIT;
|
645
687
|
git_repository *subrepo = NULL;
|
646
688
|
|
647
|
-
error =
|
689
|
+
error = git_repository_workdir_path(&workdir, parent_repo, path);
|
648
690
|
if (error < 0)
|
649
691
|
goto cleanup;
|
650
692
|
|
@@ -698,7 +740,9 @@ int git_submodule_add_setup(
|
|
698
740
|
git_repository *subrepo = NULL;
|
699
741
|
bool path_occupied;
|
700
742
|
|
701
|
-
|
743
|
+
GIT_ASSERT_ARG(repo);
|
744
|
+
GIT_ASSERT_ARG(url);
|
745
|
+
GIT_ASSERT_ARG(path);
|
702
746
|
|
703
747
|
/* see if there is already an entry for this submodule */
|
704
748
|
|
@@ -749,7 +793,7 @@ int git_submodule_add_setup(
|
|
749
793
|
|
750
794
|
/* init submodule repository and add origin remote as needed */
|
751
795
|
|
752
|
-
error =
|
796
|
+
error = git_repository_workdir_path(&name, repo, path);
|
753
797
|
if (error < 0)
|
754
798
|
goto cleanup;
|
755
799
|
|
@@ -799,7 +843,8 @@ int git_submodule_repo_init(
|
|
799
843
|
git_config *cfg = NULL;
|
800
844
|
git_buf buf = GIT_BUF_INIT;
|
801
845
|
|
802
|
-
|
846
|
+
GIT_ASSERT_ARG(out);
|
847
|
+
GIT_ASSERT_ARG(sm);
|
803
848
|
|
804
849
|
/* get the configured remote url of the submodule */
|
805
850
|
if ((error = git_buf_printf(&buf, "submodule.%s.url", sm->name)) < 0 ||
|
@@ -840,7 +885,7 @@ int git_submodule_clone(git_repository **out, git_submodule *submodule, const gi
|
|
840
885
|
git_submodule_update_options sub_opts = GIT_SUBMODULE_UPDATE_OPTIONS_INIT;
|
841
886
|
git_clone_options opts = GIT_CLONE_OPTIONS_INIT;
|
842
887
|
|
843
|
-
|
888
|
+
GIT_ASSERT_ARG(submodule);
|
844
889
|
|
845
890
|
if (given_opts)
|
846
891
|
memcpy(&sub_opts, given_opts, sizeof(sub_opts));
|
@@ -854,10 +899,9 @@ int git_submodule_clone(git_repository **out, git_submodule *submodule, const gi
|
|
854
899
|
opts.remote_cb = clone_return_origin;
|
855
900
|
opts.remote_cb_payload = submodule;
|
856
901
|
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
GIT_ERROR_CHECK_ALLOC_BUF(&rel_path);
|
902
|
+
error = git_repository_workdir_path(&rel_path, git_submodule_owner(submodule), git_submodule_path(submodule));
|
903
|
+
if (error < 0)
|
904
|
+
goto cleanup;
|
861
905
|
|
862
906
|
error = git_clone__submodule(&clone, git_submodule_url(submodule), git_buf_cstr(&rel_path), &opts);
|
863
907
|
if (error < 0)
|
@@ -879,7 +923,7 @@ int git_submodule_add_finalize(git_submodule *sm)
|
|
879
923
|
int error;
|
880
924
|
git_index *index;
|
881
925
|
|
882
|
-
|
926
|
+
GIT_ASSERT_ARG(sm);
|
883
927
|
|
884
928
|
if ((error = git_repository_index__weakptr(&index, sm->repo)) < 0 ||
|
885
929
|
(error = git_index_add_bypath(index, GIT_MODULES_FILE)) < 0)
|
@@ -898,15 +942,14 @@ int git_submodule_add_to_index(git_submodule *sm, int write_index)
|
|
898
942
|
git_index_entry entry;
|
899
943
|
struct stat st;
|
900
944
|
|
901
|
-
|
945
|
+
GIT_ASSERT_ARG(sm);
|
902
946
|
|
903
947
|
/* force reload of wd OID by git_submodule_open */
|
904
948
|
sm->flags = sm->flags & ~GIT_SUBMODULE_STATUS__WD_OID_VALID;
|
905
949
|
|
906
950
|
if ((error = git_repository_index__weakptr(&index, sm->repo)) < 0 ||
|
907
|
-
|
908
|
-
|
909
|
-
(error = git_submodule_open(&sm_repo, sm)) < 0)
|
951
|
+
(error = git_repository_workdir_path(&path, sm->repo, sm->path)) < 0 ||
|
952
|
+
(error = git_submodule_open(&sm_repo, sm)) < 0)
|
910
953
|
goto cleanup;
|
911
954
|
|
912
955
|
/* read stat information for submodule working directory */
|
@@ -958,7 +1001,7 @@ cleanup:
|
|
958
1001
|
return error;
|
959
1002
|
}
|
960
1003
|
|
961
|
-
const char *
|
1004
|
+
static const char *submodule_update_to_str(git_submodule_update_t update)
|
962
1005
|
{
|
963
1006
|
int i;
|
964
1007
|
for (i = 0; i < (int)ARRAY_SIZE(_sm_update_map); ++i)
|
@@ -969,25 +1012,25 @@ const char *git_submodule_update_to_str(git_submodule_update_t update)
|
|
969
1012
|
|
970
1013
|
git_repository *git_submodule_owner(git_submodule *submodule)
|
971
1014
|
{
|
972
|
-
|
1015
|
+
GIT_ASSERT_ARG_WITH_RETVAL(submodule, NULL);
|
973
1016
|
return submodule->repo;
|
974
1017
|
}
|
975
1018
|
|
976
1019
|
const char *git_submodule_name(git_submodule *submodule)
|
977
1020
|
{
|
978
|
-
|
1021
|
+
GIT_ASSERT_ARG_WITH_RETVAL(submodule, NULL);
|
979
1022
|
return submodule->name;
|
980
1023
|
}
|
981
1024
|
|
982
1025
|
const char *git_submodule_path(git_submodule *submodule)
|
983
1026
|
{
|
984
|
-
|
1027
|
+
GIT_ASSERT_ARG_WITH_RETVAL(submodule, NULL);
|
985
1028
|
return submodule->path;
|
986
1029
|
}
|
987
1030
|
|
988
1031
|
const char *git_submodule_url(git_submodule *submodule)
|
989
1032
|
{
|
990
|
-
|
1033
|
+
GIT_ASSERT_ARG_WITH_RETVAL(submodule, NULL);
|
991
1034
|
return submodule->url;
|
992
1035
|
}
|
993
1036
|
|
@@ -996,9 +1039,12 @@ int git_submodule_resolve_url(git_buf *out, git_repository *repo, const char *ur
|
|
996
1039
|
int error = 0;
|
997
1040
|
git_buf normalized = GIT_BUF_INIT;
|
998
1041
|
|
999
|
-
|
1042
|
+
GIT_ASSERT_ARG(out);
|
1043
|
+
GIT_ASSERT_ARG(repo);
|
1044
|
+
GIT_ASSERT_ARG(url);
|
1000
1045
|
|
1001
|
-
git_buf_sanitize(out)
|
1046
|
+
if ((error = git_buf_sanitize(out)) < 0)
|
1047
|
+
return error;
|
1002
1048
|
|
1003
1049
|
/* We do this in all platforms in case someone on Windows created the .gitmodules */
|
1004
1050
|
if (strchr(url, '\\')) {
|
@@ -1066,28 +1112,30 @@ static int write_mapped_var(git_repository *repo, const char *name, git_configma
|
|
1066
1112
|
|
1067
1113
|
const char *git_submodule_branch(git_submodule *submodule)
|
1068
1114
|
{
|
1069
|
-
|
1115
|
+
GIT_ASSERT_ARG_WITH_RETVAL(submodule, NULL);
|
1070
1116
|
return submodule->branch;
|
1071
1117
|
}
|
1072
1118
|
|
1073
1119
|
int git_submodule_set_branch(git_repository *repo, const char *name, const char *branch)
|
1074
1120
|
{
|
1075
|
-
|
1076
|
-
|
1121
|
+
GIT_ASSERT_ARG(repo);
|
1122
|
+
GIT_ASSERT_ARG(name);
|
1077
1123
|
|
1078
1124
|
return write_var(repo, name, "branch", branch);
|
1079
1125
|
}
|
1080
1126
|
|
1081
1127
|
int git_submodule_set_url(git_repository *repo, const char *name, const char *url)
|
1082
1128
|
{
|
1083
|
-
|
1129
|
+
GIT_ASSERT_ARG(repo);
|
1130
|
+
GIT_ASSERT_ARG(name);
|
1131
|
+
GIT_ASSERT_ARG(url);
|
1084
1132
|
|
1085
1133
|
return write_var(repo, name, "url", url);
|
1086
1134
|
}
|
1087
1135
|
|
1088
1136
|
const git_oid *git_submodule_index_id(git_submodule *submodule)
|
1089
1137
|
{
|
1090
|
-
|
1138
|
+
GIT_ASSERT_ARG_WITH_RETVAL(submodule, NULL);
|
1091
1139
|
|
1092
1140
|
if (submodule->flags & GIT_SUBMODULE_STATUS__INDEX_OID_VALID)
|
1093
1141
|
return &submodule->index_oid;
|
@@ -1097,7 +1145,7 @@ const git_oid *git_submodule_index_id(git_submodule *submodule)
|
|
1097
1145
|
|
1098
1146
|
const git_oid *git_submodule_head_id(git_submodule *submodule)
|
1099
1147
|
{
|
1100
|
-
|
1148
|
+
GIT_ASSERT_ARG_WITH_RETVAL(submodule, NULL);
|
1101
1149
|
|
1102
1150
|
if (submodule->flags & GIT_SUBMODULE_STATUS__HEAD_OID_VALID)
|
1103
1151
|
return &submodule->head_oid;
|
@@ -1107,7 +1155,7 @@ const git_oid *git_submodule_head_id(git_submodule *submodule)
|
|
1107
1155
|
|
1108
1156
|
const git_oid *git_submodule_wd_id(git_submodule *submodule)
|
1109
1157
|
{
|
1110
|
-
|
1158
|
+
GIT_ASSERT_ARG_WITH_RETVAL(submodule, NULL);
|
1111
1159
|
|
1112
1160
|
/* load unless we think we have a valid oid */
|
1113
1161
|
if (!(submodule->flags & GIT_SUBMODULE_STATUS__WD_OID_VALID)) {
|
@@ -1128,28 +1176,32 @@ const git_oid *git_submodule_wd_id(git_submodule *submodule)
|
|
1128
1176
|
|
1129
1177
|
git_submodule_ignore_t git_submodule_ignore(git_submodule *submodule)
|
1130
1178
|
{
|
1131
|
-
|
1179
|
+
GIT_ASSERT_ARG_WITH_RETVAL(submodule, GIT_SUBMODULE_IGNORE_UNSPECIFIED);
|
1180
|
+
|
1132
1181
|
return (submodule->ignore < GIT_SUBMODULE_IGNORE_NONE) ?
|
1133
1182
|
GIT_SUBMODULE_IGNORE_NONE : submodule->ignore;
|
1134
1183
|
}
|
1135
1184
|
|
1136
1185
|
int git_submodule_set_ignore(git_repository *repo, const char *name, git_submodule_ignore_t ignore)
|
1137
1186
|
{
|
1138
|
-
|
1187
|
+
GIT_ASSERT_ARG(repo);
|
1188
|
+
GIT_ASSERT_ARG(name);
|
1139
1189
|
|
1140
1190
|
return write_mapped_var(repo, name, _sm_ignore_map, ARRAY_SIZE(_sm_ignore_map), "ignore", ignore);
|
1141
1191
|
}
|
1142
1192
|
|
1143
1193
|
git_submodule_update_t git_submodule_update_strategy(git_submodule *submodule)
|
1144
1194
|
{
|
1145
|
-
|
1195
|
+
GIT_ASSERT_ARG_WITH_RETVAL(submodule, GIT_SUBMODULE_UPDATE_NONE);
|
1196
|
+
|
1146
1197
|
return (submodule->update < GIT_SUBMODULE_UPDATE_CHECKOUT) ?
|
1147
1198
|
GIT_SUBMODULE_UPDATE_CHECKOUT : submodule->update;
|
1148
1199
|
}
|
1149
1200
|
|
1150
1201
|
int git_submodule_set_update(git_repository *repo, const char *name, git_submodule_update_t update)
|
1151
1202
|
{
|
1152
|
-
|
1203
|
+
GIT_ASSERT_ARG(repo);
|
1204
|
+
GIT_ASSERT_ARG(name);
|
1153
1205
|
|
1154
1206
|
return write_mapped_var(repo, name, _sm_update_map, ARRAY_SIZE(_sm_update_map), "update", update);
|
1155
1207
|
}
|
@@ -1157,13 +1209,14 @@ int git_submodule_set_update(git_repository *repo, const char *name, git_submodu
|
|
1157
1209
|
git_submodule_recurse_t git_submodule_fetch_recurse_submodules(
|
1158
1210
|
git_submodule *submodule)
|
1159
1211
|
{
|
1160
|
-
|
1212
|
+
GIT_ASSERT_ARG_WITH_RETVAL(submodule, GIT_SUBMODULE_RECURSE_NO);
|
1161
1213
|
return submodule->fetch_recurse;
|
1162
1214
|
}
|
1163
1215
|
|
1164
1216
|
int git_submodule_set_fetch_recurse_submodules(git_repository *repo, const char *name, git_submodule_recurse_t recurse)
|
1165
1217
|
{
|
1166
|
-
|
1218
|
+
GIT_ASSERT_ARG(repo);
|
1219
|
+
GIT_ASSERT_ARG(name);
|
1167
1220
|
|
1168
1221
|
return write_mapped_var(repo, name, _sm_recurse_map, ARRAY_SIZE(_sm_recurse_map), "fetchRecurseSubmodules", recurse);
|
1169
1222
|
}
|
@@ -1185,7 +1238,7 @@ static int submodule_repo_create(
|
|
1185
1238
|
GIT_REPOSITORY_INIT_RELATIVE_GITLINK;
|
1186
1239
|
|
1187
1240
|
/* Workdir: path to sub-repo working directory */
|
1188
|
-
error =
|
1241
|
+
error = git_repository_workdir_path(&workdir, parent_repo, path);
|
1189
1242
|
if (error < 0)
|
1190
1243
|
goto cleanup;
|
1191
1244
|
|
@@ -1240,10 +1293,12 @@ int git_submodule_update_options_init(git_submodule_update_options *opts, unsign
|
|
1240
1293
|
return 0;
|
1241
1294
|
}
|
1242
1295
|
|
1296
|
+
#ifndef GIT_DEPRECATE_HARD
|
1243
1297
|
int git_submodule_update_init_options(git_submodule_update_options *opts, unsigned int version)
|
1244
1298
|
{
|
1245
1299
|
return git_submodule_update_options_init(opts, version);
|
1246
1300
|
}
|
1301
|
+
#endif
|
1247
1302
|
|
1248
1303
|
int git_submodule_update(git_submodule *sm, int init, git_submodule_update_options *_update_options)
|
1249
1304
|
{
|
@@ -1258,7 +1313,7 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
|
|
1258
1313
|
git_submodule_update_options update_options = GIT_SUBMODULE_UPDATE_OPTIONS_INIT;
|
1259
1314
|
git_clone_options clone_options = GIT_CLONE_OPTIONS_INIT;
|
1260
1315
|
|
1261
|
-
|
1316
|
+
GIT_ASSERT_ARG(sm);
|
1262
1317
|
|
1263
1318
|
if (_update_options)
|
1264
1319
|
memcpy(&update_options, _update_options, sizeof(git_submodule_update_options));
|
@@ -1401,7 +1456,7 @@ int git_submodule_init(git_submodule *sm, int overwrite)
|
|
1401
1456
|
/* write "submodule.NAME.update" if not default */
|
1402
1457
|
|
1403
1458
|
val = (sm->update == GIT_SUBMODULE_UPDATE_CHECKOUT) ?
|
1404
|
-
NULL :
|
1459
|
+
NULL : submodule_update_to_str(sm->update);
|
1405
1460
|
|
1406
1461
|
if ((error = git_buf_printf(&key, "submodule.%s.update", sm->name)) < 0 ||
|
1407
1462
|
(error = git_config__update_entry(
|
@@ -1471,7 +1526,8 @@ static int git_submodule__open(
|
|
1471
1526
|
unsigned int flags = GIT_REPOSITORY_OPEN_NO_SEARCH;
|
1472
1527
|
const char *wd;
|
1473
1528
|
|
1474
|
-
|
1529
|
+
GIT_ASSERT_ARG(sm);
|
1530
|
+
GIT_ASSERT_ARG(subrepo);
|
1475
1531
|
|
1476
1532
|
if (git_repository__ensure_not_bare(
|
1477
1533
|
sm->repo, "open submodule repository") < 0)
|
@@ -1479,8 +1535,7 @@ static int git_submodule__open(
|
|
1479
1535
|
|
1480
1536
|
wd = git_repository_workdir(sm->repo);
|
1481
1537
|
|
1482
|
-
if (
|
1483
|
-
git_buf_joinpath(&path, path.ptr, DOT_GIT) < 0)
|
1538
|
+
if (git_buf_join3(&path, '/', wd, sm->path, DOT_GIT) < 0)
|
1484
1539
|
return -1;
|
1485
1540
|
|
1486
1541
|
sm->flags = sm->flags &
|
@@ -1607,7 +1662,7 @@ int git_submodule_reload(git_submodule *sm, int force)
|
|
1607
1662
|
|
1608
1663
|
GIT_UNUSED(force);
|
1609
1664
|
|
1610
|
-
|
1665
|
+
GIT_ASSERT_ARG(sm);
|
1611
1666
|
|
1612
1667
|
if ((error = git_submodule_name_is_valid(sm->repo, sm->name, 0)) <= 0)
|
1613
1668
|
/* This should come with a warning, but we've no API for that */
|
@@ -1724,7 +1779,9 @@ int git_submodule_status(unsigned int *status, git_repository *repo, const char
|
|
1724
1779
|
git_submodule *sm;
|
1725
1780
|
int error;
|
1726
1781
|
|
1727
|
-
|
1782
|
+
GIT_ASSERT_ARG(status);
|
1783
|
+
GIT_ASSERT_ARG(repo);
|
1784
|
+
GIT_ASSERT_ARG(name);
|
1728
1785
|
|
1729
1786
|
if ((error = git_submodule_lookup(&sm, repo, name)) < 0)
|
1730
1787
|
return error;
|
@@ -1737,7 +1794,8 @@ int git_submodule_status(unsigned int *status, git_repository *repo, const char
|
|
1737
1794
|
|
1738
1795
|
int git_submodule_location(unsigned int *location, git_submodule *sm)
|
1739
1796
|
{
|
1740
|
-
|
1797
|
+
GIT_ASSERT_ARG(location);
|
1798
|
+
GIT_ASSERT_ARG(sm);
|
1741
1799
|
|
1742
1800
|
return git_submodule__status(
|
1743
1801
|
location, NULL, NULL, NULL, sm, GIT_SUBMODULE_IGNORE_ALL);
|
@@ -1796,6 +1854,17 @@ static void submodule_release(git_submodule *sm)
|
|
1796
1854
|
git__free(sm);
|
1797
1855
|
}
|
1798
1856
|
|
1857
|
+
int git_submodule_dup(git_submodule **out, git_submodule *source)
|
1858
|
+
{
|
1859
|
+
GIT_ASSERT_ARG(out);
|
1860
|
+
GIT_ASSERT_ARG(source);
|
1861
|
+
|
1862
|
+
GIT_REFCOUNT_INC(source);
|
1863
|
+
|
1864
|
+
*out = source;
|
1865
|
+
return 0;
|
1866
|
+
}
|
1867
|
+
|
1799
1868
|
void git_submodule_free(git_submodule *sm)
|
1800
1869
|
{
|
1801
1870
|
if (!sm)
|
@@ -1838,7 +1907,7 @@ int git_submodule_parse_update(git_submodule_update_t *out, const char *value)
|
|
1838
1907
|
return 0;
|
1839
1908
|
}
|
1840
1909
|
|
1841
|
-
int
|
1910
|
+
static int submodule_parse_recurse(git_submodule_recurse_t *out, const char *value)
|
1842
1911
|
{
|
1843
1912
|
int val;
|
1844
1913
|
|
@@ -1934,7 +2003,7 @@ static int submodule_read_config(git_submodule *sm, git_config *cfg)
|
|
1934
2003
|
|
1935
2004
|
if ((error = get_value(&value, cfg, &key, sm->name, "fetchRecurseSubmodules")) == 0) {
|
1936
2005
|
in_config = 1;
|
1937
|
-
if ((error =
|
2006
|
+
if ((error = submodule_parse_recurse(&sm->fetch_recurse, value)) < 0)
|
1938
2007
|
goto cleanup;
|
1939
2008
|
sm->fetch_recurse_default = sm->fetch_recurse;
|
1940
2009
|
} else if (error != GIT_ENOTFOUND) {
|
@@ -2022,7 +2091,7 @@ static int submodule_load_from_wd_lite(git_submodule *sm)
|
|
2022
2091
|
{
|
2023
2092
|
git_buf path = GIT_BUF_INIT;
|
2024
2093
|
|
2025
|
-
if (
|
2094
|
+
if (git_repository_workdir_path(&path, sm->repo, sm->path) < 0)
|
2026
2095
|
return -1;
|
2027
2096
|
|
2028
2097
|
if (git_path_isdir(path.ptr))
|
@@ -2042,15 +2111,14 @@ static int submodule_load_from_wd_lite(git_submodule *sm)
|
|
2042
2111
|
*/
|
2043
2112
|
static int gitmodules_snapshot(git_config **snap, git_repository *repo)
|
2044
2113
|
{
|
2045
|
-
const char *workdir = git_repository_workdir(repo);
|
2046
2114
|
git_config *mods = NULL;
|
2047
2115
|
git_buf path = GIT_BUF_INIT;
|
2048
2116
|
int error;
|
2049
2117
|
|
2050
|
-
if (
|
2118
|
+
if (git_repository_workdir(repo) == NULL)
|
2051
2119
|
return GIT_ENOTFOUND;
|
2052
2120
|
|
2053
|
-
if ((error =
|
2121
|
+
if ((error = git_repository_workdir_path(&path, repo, GIT_MODULES_FILE)) < 0)
|
2054
2122
|
return error;
|
2055
2123
|
|
2056
2124
|
if ((error = git_config_open_ondisk(&mods, path.ptr)) < 0)
|
@@ -2074,12 +2142,11 @@ static git_config_backend *open_gitmodules(
|
|
2074
2142
|
git_repository *repo,
|
2075
2143
|
int okay_to_create)
|
2076
2144
|
{
|
2077
|
-
const char *workdir = git_repository_workdir(repo);
|
2078
2145
|
git_buf path = GIT_BUF_INIT;
|
2079
2146
|
git_config_backend *mods = NULL;
|
2080
2147
|
|
2081
|
-
if (
|
2082
|
-
if (
|
2148
|
+
if (git_repository_workdir(repo) != NULL) {
|
2149
|
+
if (git_repository_workdir_path(&path, repo, GIT_MODULES_FILE) != 0)
|
2083
2150
|
return NULL;
|
2084
2151
|
|
2085
2152
|
if (okay_to_create || git_path_isfile(path.ptr)) {
|
@@ -2192,8 +2259,9 @@ static int get_url_base(git_buf *url, git_repository *repo)
|
|
2192
2259
|
if ((error = git_worktree_open_from_repository(&wt, repo)) < 0)
|
2193
2260
|
goto out;
|
2194
2261
|
error = git_buf_sets(url, wt->parent_path);
|
2195
|
-
} else
|
2262
|
+
} else {
|
2196
2263
|
error = git_buf_sets(url, git_repository_workdir(repo));
|
2264
|
+
}
|
2197
2265
|
|
2198
2266
|
out:
|
2199
2267
|
git_remote_free(remote);
|
@@ -101,12 +101,6 @@ struct git_submodule {
|
|
101
101
|
git_oid wd_oid;
|
102
102
|
};
|
103
103
|
|
104
|
-
/* Force revalidation of submodule data cache (alloc as needed) */
|
105
|
-
extern int git_submodule_cache_refresh(git_repository *repo);
|
106
|
-
|
107
|
-
/* Release all submodules */
|
108
|
-
extern void git_submodule_cache_free(git_repository *repo);
|
109
|
-
|
110
104
|
/* Additional flags on top of public GIT_SUBMODULE_STATUS values */
|
111
105
|
enum {
|
112
106
|
GIT_SUBMODULE_STATUS__WD_SCANNED = (1u << 20),
|
@@ -122,9 +116,15 @@ enum {
|
|
122
116
|
#define GIT_SUBMODULE_STATUS__CLEAR_INTERNAL(S) \
|
123
117
|
((S) & ~(0xFFFFFFFFu << 20))
|
124
118
|
|
125
|
-
/*
|
126
|
-
extern int
|
127
|
-
|
119
|
+
/* Initialize an external submodule cache for the provided repo. */
|
120
|
+
extern int git_submodule_cache_init(git_strmap **out, git_repository *repo);
|
121
|
+
|
122
|
+
/* Release the resources of the submodule cache. */
|
123
|
+
extern int git_submodule_cache_free(git_strmap *cache);
|
124
|
+
|
125
|
+
/* Submodule lookup with an explicit cache */
|
126
|
+
extern int git_submodule__lookup_with_cache(
|
127
|
+
git_submodule **out, git_repository *repo, const char *path, git_strmap *cache);
|
128
128
|
|
129
129
|
/* Internal status fn returns status and optionally the various OIDs */
|
130
130
|
extern int git_submodule__status(
|
data/vendor/libgit2/src/sysdir.c
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
#include "sysdir.h"
|
9
9
|
|
10
|
-
#include "
|
10
|
+
#include "runtime.h"
|
11
11
|
#include "buffer.h"
|
12
12
|
#include "path.h"
|
13
13
|
#include <ctype.h>
|
@@ -45,7 +45,7 @@ static int get_passwd_home(git_buf *out, uid_t uid)
|
|
45
45
|
long buflen;
|
46
46
|
int error;
|
47
47
|
|
48
|
-
|
48
|
+
GIT_ASSERT_ARG(out);
|
49
49
|
|
50
50
|
if ((buflen = sysconf(_SC_GETPW_R_SIZE_MAX)) == -1)
|
51
51
|
buflen = 1024;
|
@@ -189,9 +189,7 @@ int git_sysdir_global_init(void)
|
|
189
189
|
for (i = 0; !error && i < ARRAY_SIZE(git_sysdir__dirs); i++)
|
190
190
|
error = git_sysdir__dirs[i].guess(&git_sysdir__dirs[i].buf);
|
191
191
|
|
192
|
-
|
193
|
-
|
194
|
-
return error;
|
192
|
+
return git_runtime_shutdown_register(git_sysdir_global_shutdown);
|
195
193
|
}
|
196
194
|
|
197
195
|
static int git_sysdir_check_selector(git_sysdir_t which)
|
@@ -206,7 +204,7 @@ static int git_sysdir_check_selector(git_sysdir_t which)
|
|
206
204
|
|
207
205
|
int git_sysdir_get(const git_buf **out, git_sysdir_t which)
|
208
206
|
{
|
209
|
-
|
207
|
+
GIT_ASSERT_ARG(out);
|
210
208
|
|
211
209
|
*out = NULL;
|
212
210
|
|
@@ -216,25 +214,6 @@ int git_sysdir_get(const git_buf **out, git_sysdir_t which)
|
|
216
214
|
return 0;
|
217
215
|
}
|
218
216
|
|
219
|
-
int git_sysdir_get_str(
|
220
|
-
char *out,
|
221
|
-
size_t outlen,
|
222
|
-
git_sysdir_t which)
|
223
|
-
{
|
224
|
-
const git_buf *path = NULL;
|
225
|
-
|
226
|
-
GIT_ERROR_CHECK_ERROR(git_sysdir_check_selector(which));
|
227
|
-
GIT_ERROR_CHECK_ERROR(git_sysdir_get(&path, which));
|
228
|
-
|
229
|
-
if (!out || path->size >= outlen) {
|
230
|
-
git_error_set(GIT_ERROR_NOMEMORY, "buffer is too short for the path");
|
231
|
-
return GIT_EBUFS;
|
232
|
-
}
|
233
|
-
|
234
|
-
git_buf_copy_cstr(out, outlen, path);
|
235
|
-
return 0;
|
236
|
-
}
|
237
|
-
|
238
217
|
#define PATH_MAGIC "$PATH"
|
239
218
|
|
240
219
|
int git_sysdir_set(git_sysdir_t which, const char *search_path)
|
@@ -317,8 +296,11 @@ static int git_sysdir_find_in_dirlist(
|
|
317
296
|
}
|
318
297
|
|
319
298
|
done:
|
299
|
+
if (name)
|
300
|
+
git_error_set(GIT_ERROR_OS, "the %s file '%s' doesn't exist", label, name);
|
301
|
+
else
|
302
|
+
git_error_set(GIT_ERROR_OS, "the %s directory doesn't exist", label);
|
320
303
|
git_buf_dispose(path);
|
321
|
-
git_error_set(GIT_ERROR_OS, "the %s file '%s' doesn't exist", label, name);
|
322
304
|
return GIT_ENOTFOUND;
|
323
305
|
}
|
324
306
|
|
data/vendor/libgit2/src/sysdir.h
CHANGED
@@ -93,17 +93,6 @@ extern int git_sysdir_global_init(void);
|
|
93
93
|
*/
|
94
94
|
extern int git_sysdir_get(const git_buf **out, git_sysdir_t which);
|
95
95
|
|
96
|
-
/**
|
97
|
-
* Get search path into a preallocated buffer
|
98
|
-
*
|
99
|
-
* @param out String buffer to write into
|
100
|
-
* @param outlen Size of string buffer
|
101
|
-
* @param which Which search path to return
|
102
|
-
* @return 0 on success, GIT_EBUFS if out is too small, <0 on other failure
|
103
|
-
*/
|
104
|
-
|
105
|
-
extern int git_sysdir_get_str(char *out, size_t outlen, git_sysdir_t which);
|
106
|
-
|
107
96
|
/**
|
108
97
|
* Set search paths for global/system/xdg files
|
109
98
|
*
|