rugged 1.7.2 → 1.9.0
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 +23 -10
- data/vendor/libgit2/COPYING +195 -1
- data/vendor/libgit2/cmake/{FindIconv.cmake → FindIntlIconv.cmake} +6 -0
- data/vendor/libgit2/cmake/FindLLHTTP.cmake +39 -0
- data/vendor/libgit2/cmake/SelectGSSAPI.cmake +1 -1
- data/vendor/libgit2/cmake/SelectHTTPParser.cmake +23 -8
- data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +17 -8
- data/vendor/libgit2/cmake/SelectHashes.cmake +28 -11
- data/vendor/libgit2/cmake/SelectRegex.cmake +6 -1
- data/vendor/libgit2/cmake/SelectSSH.cmake +22 -17
- data/vendor/libgit2/cmake/SelectZlib.cmake +4 -0
- data/vendor/libgit2/deps/llhttp/CMakeLists.txt +8 -0
- data/vendor/libgit2/deps/llhttp/LICENSE-MIT +22 -0
- data/vendor/libgit2/deps/llhttp/api.c +510 -0
- data/vendor/libgit2/deps/llhttp/http.c +170 -0
- data/vendor/libgit2/deps/llhttp/llhttp.c +10168 -0
- data/vendor/libgit2/deps/llhttp/llhttp.h +897 -0
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +1 -1
- data/vendor/libgit2/deps/ntlmclient/crypt_builtin_md4.c +311 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +2 -1
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +0 -20
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +4 -4
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +21 -21
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +5 -4
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +2 -1
- data/vendor/libgit2/deps/ntlmclient/utf8.h +1176 -721
- data/vendor/libgit2/deps/ntlmclient/util.h +11 -0
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +1 -0
- data/vendor/libgit2/deps/xdiff/xmerge.c +2 -2
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +6 -1
- data/vendor/libgit2/deps/zlib/LICENSE +22 -0
- data/vendor/libgit2/deps/zlib/adler32.c +5 -27
- data/vendor/libgit2/deps/zlib/crc32.c +94 -167
- data/vendor/libgit2/deps/zlib/deflate.c +358 -435
- data/vendor/libgit2/deps/zlib/deflate.h +41 -10
- data/vendor/libgit2/deps/zlib/gzguts.h +13 -18
- data/vendor/libgit2/deps/zlib/infback.c +17 -30
- data/vendor/libgit2/deps/zlib/inffast.c +1 -4
- data/vendor/libgit2/deps/zlib/inffast.h +1 -1
- data/vendor/libgit2/deps/zlib/inflate.c +36 -102
- data/vendor/libgit2/deps/zlib/inftrees.c +6 -11
- data/vendor/libgit2/deps/zlib/inftrees.h +6 -6
- data/vendor/libgit2/deps/zlib/trees.c +287 -352
- data/vendor/libgit2/deps/zlib/zconf.h +23 -14
- data/vendor/libgit2/deps/zlib/zlib.h +202 -202
- data/vendor/libgit2/deps/zlib/zutil.c +18 -44
- data/vendor/libgit2/deps/zlib/zutil.h +13 -33
- data/vendor/libgit2/include/git2/annotated_commit.h +12 -5
- data/vendor/libgit2/include/git2/apply.h +27 -6
- data/vendor/libgit2/include/git2/attr.h +17 -4
- data/vendor/libgit2/include/git2/blame.h +133 -28
- data/vendor/libgit2/include/git2/blob.h +71 -28
- data/vendor/libgit2/include/git2/branch.h +22 -15
- data/vendor/libgit2/include/git2/buffer.h +6 -4
- data/vendor/libgit2/include/git2/cert.h +2 -1
- data/vendor/libgit2/include/git2/checkout.h +83 -32
- data/vendor/libgit2/include/git2/cherrypick.h +10 -3
- data/vendor/libgit2/include/git2/clone.h +25 -9
- data/vendor/libgit2/include/git2/commit.h +132 -3
- data/vendor/libgit2/include/git2/common.h +120 -63
- data/vendor/libgit2/include/git2/config.h +93 -23
- data/vendor/libgit2/include/git2/credential.h +30 -2
- data/vendor/libgit2/include/git2/credential_helpers.h +1 -0
- data/vendor/libgit2/include/git2/deprecated.h +133 -3
- data/vendor/libgit2/include/git2/describe.h +13 -1
- data/vendor/libgit2/include/git2/diff.h +38 -8
- data/vendor/libgit2/include/git2/email.h +9 -29
- data/vendor/libgit2/include/git2/errors.h +46 -73
- data/vendor/libgit2/include/git2/filter.h +14 -7
- data/vendor/libgit2/include/git2/global.h +8 -1
- data/vendor/libgit2/include/git2/graph.h +3 -2
- data/vendor/libgit2/include/git2/ignore.h +10 -0
- data/vendor/libgit2/include/git2/index.h +99 -14
- data/vendor/libgit2/include/git2/indexer.h +21 -4
- data/vendor/libgit2/include/git2/mailmap.h +7 -1
- data/vendor/libgit2/include/git2/merge.h +46 -1
- data/vendor/libgit2/include/git2/message.h +2 -2
- data/vendor/libgit2/include/git2/net.h +3 -1
- data/vendor/libgit2/include/git2/notes.h +9 -6
- data/vendor/libgit2/include/git2/object.h +9 -8
- data/vendor/libgit2/include/git2/odb.h +91 -49
- data/vendor/libgit2/include/git2/odb_backend.h +80 -52
- data/vendor/libgit2/include/git2/oid.h +23 -24
- data/vendor/libgit2/include/git2/oidarray.h +7 -1
- data/vendor/libgit2/include/git2/pack.h +13 -1
- data/vendor/libgit2/include/git2/patch.h +2 -3
- data/vendor/libgit2/include/git2/pathspec.h +9 -0
- data/vendor/libgit2/include/git2/proxy.h +10 -0
- data/vendor/libgit2/include/git2/rebase.h +9 -6
- data/vendor/libgit2/include/git2/refdb.h +2 -2
- data/vendor/libgit2/include/git2/reflog.h +3 -2
- data/vendor/libgit2/include/git2/refs.h +9 -6
- data/vendor/libgit2/include/git2/refspec.h +14 -4
- data/vendor/libgit2/include/git2/remote.h +94 -18
- data/vendor/libgit2/include/git2/repository.h +57 -21
- data/vendor/libgit2/include/git2/reset.h +16 -3
- data/vendor/libgit2/include/git2/revert.h +9 -4
- data/vendor/libgit2/include/git2/revparse.h +3 -3
- data/vendor/libgit2/include/git2/revwalk.h +3 -2
- data/vendor/libgit2/include/git2/signature.h +46 -1
- data/vendor/libgit2/include/git2/stash.h +17 -3
- data/vendor/libgit2/include/git2/status.h +10 -6
- data/vendor/libgit2/include/git2/stdint.h +87 -85
- data/vendor/libgit2/include/git2/strarray.h +2 -3
- data/vendor/libgit2/include/git2/submodule.h +20 -9
- data/vendor/libgit2/include/git2/sys/alloc.h +12 -0
- data/vendor/libgit2/include/git2/sys/commit.h +77 -3
- data/vendor/libgit2/include/git2/sys/commit_graph.h +103 -62
- data/vendor/libgit2/include/git2/sys/config.h +80 -4
- data/vendor/libgit2/include/git2/sys/credential.h +4 -3
- data/vendor/libgit2/include/git2/sys/diff.h +21 -1
- data/vendor/libgit2/include/git2/sys/email.h +7 -0
- data/vendor/libgit2/include/git2/sys/errors.h +76 -0
- data/vendor/libgit2/include/git2/sys/filter.h +66 -3
- data/vendor/libgit2/include/git2/sys/hashsig.h +11 -0
- data/vendor/libgit2/include/git2/sys/index.h +3 -2
- data/vendor/libgit2/include/git2/sys/mempack.h +32 -2
- data/vendor/libgit2/include/git2/sys/merge.h +55 -7
- data/vendor/libgit2/include/git2/sys/midx.h +43 -4
- data/vendor/libgit2/include/git2/sys/odb_backend.h +7 -3
- data/vendor/libgit2/include/git2/sys/openssl.h +8 -1
- data/vendor/libgit2/include/git2/sys/path.h +12 -1
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +40 -36
- data/vendor/libgit2/include/git2/sys/refs.h +3 -2
- data/vendor/libgit2/include/git2/sys/remote.h +8 -1
- data/vendor/libgit2/include/git2/sys/repository.h +63 -3
- data/vendor/libgit2/include/git2/sys/stream.h +11 -2
- data/vendor/libgit2/include/git2/sys/transport.h +24 -3
- data/vendor/libgit2/include/git2/tag.h +3 -1
- data/vendor/libgit2/include/git2/trace.h +9 -3
- data/vendor/libgit2/include/git2/transaction.h +3 -2
- data/vendor/libgit2/include/git2/transport.h +11 -3
- data/vendor/libgit2/include/git2/tree.h +16 -5
- data/vendor/libgit2/include/git2/types.h +19 -3
- data/vendor/libgit2/include/git2/version.h +44 -8
- data/vendor/libgit2/include/git2/worktree.h +16 -6
- data/vendor/libgit2/src/CMakeLists.txt +6 -4
- data/vendor/libgit2/src/cli/CMakeLists.txt +2 -2
- data/vendor/libgit2/src/cli/cmd.c +1 -1
- data/vendor/libgit2/src/cli/cmd.h +4 -0
- data/vendor/libgit2/src/cli/cmd_blame.c +287 -0
- data/vendor/libgit2/src/cli/cmd_cat_file.c +6 -8
- data/vendor/libgit2/src/cli/cmd_clone.c +5 -7
- data/vendor/libgit2/src/cli/cmd_config.c +241 -0
- data/vendor/libgit2/src/cli/cmd_hash_object.c +6 -8
- data/vendor/libgit2/src/cli/cmd_help.c +6 -7
- data/vendor/libgit2/src/cli/cmd_index_pack.c +114 -0
- data/vendor/libgit2/src/cli/cmd_init.c +102 -0
- data/vendor/libgit2/src/cli/common.c +168 -0
- data/vendor/libgit2/src/cli/common.h +63 -0
- data/vendor/libgit2/src/cli/error.h +1 -1
- data/vendor/libgit2/src/cli/main.c +52 -24
- data/vendor/libgit2/src/cli/opt.c +29 -3
- data/vendor/libgit2/src/cli/opt.h +21 -3
- data/vendor/libgit2/src/cli/opt_usage.c +102 -33
- data/vendor/libgit2/src/cli/opt_usage.h +6 -1
- data/vendor/libgit2/src/cli/progress.c +51 -2
- data/vendor/libgit2/src/cli/progress.h +12 -0
- data/vendor/libgit2/src/cli/unix/sighandler.c +2 -1
- data/vendor/libgit2/src/cli/win32/precompiled.h +1 -1
- data/vendor/libgit2/src/cli/win32/sighandler.c +1 -1
- data/vendor/libgit2/src/libgit2/CMakeLists.txt +26 -8
- data/vendor/libgit2/src/libgit2/apply.c +10 -13
- data/vendor/libgit2/src/libgit2/attr.c +30 -13
- data/vendor/libgit2/src/libgit2/attr_file.c +7 -2
- data/vendor/libgit2/src/libgit2/attr_file.h +2 -0
- data/vendor/libgit2/src/libgit2/attrcache.c +69 -33
- data/vendor/libgit2/src/libgit2/attrcache.h +5 -9
- data/vendor/libgit2/src/libgit2/blame.c +130 -44
- data/vendor/libgit2/src/libgit2/blame.h +1 -0
- data/vendor/libgit2/src/libgit2/cache.c +22 -17
- data/vendor/libgit2/src/libgit2/cache.h +7 -9
- data/vendor/libgit2/src/libgit2/checkout.c +34 -24
- data/vendor/libgit2/src/libgit2/checkout.h +0 -2
- data/vendor/libgit2/src/libgit2/cherrypick.c +1 -2
- data/vendor/libgit2/src/libgit2/clone.c +186 -166
- data/vendor/libgit2/src/libgit2/clone.h +4 -1
- data/vendor/libgit2/src/libgit2/commit.c +92 -0
- data/vendor/libgit2/src/libgit2/commit_graph.c +67 -56
- data/vendor/libgit2/src/libgit2/commit_graph.h +1 -2
- data/vendor/libgit2/src/libgit2/config.c +389 -298
- data/vendor/libgit2/src/libgit2/config.cmake.in +3 -0
- data/vendor/libgit2/src/libgit2/config.h +9 -4
- data/vendor/libgit2/src/libgit2/config_backend.h +8 -10
- data/vendor/libgit2/src/libgit2/config_cache.c +4 -5
- data/vendor/libgit2/src/libgit2/config_file.c +99 -88
- data/vendor/libgit2/src/libgit2/config_list.c +285 -0
- data/vendor/libgit2/src/libgit2/config_list.h +32 -0
- data/vendor/libgit2/src/libgit2/config_mem.c +194 -40
- data/vendor/libgit2/src/libgit2/config_parse.c +10 -9
- data/vendor/libgit2/src/libgit2/config_snapshot.c +24 -31
- data/vendor/libgit2/src/libgit2/describe.c +24 -24
- data/vendor/libgit2/src/libgit2/diff.c +1 -1
- data/vendor/libgit2/src/libgit2/diff_driver.c +12 -19
- data/vendor/libgit2/src/libgit2/diff_driver.h +2 -2
- data/vendor/libgit2/src/libgit2/diff_generate.c +3 -3
- data/vendor/libgit2/src/libgit2/diff_parse.c +2 -2
- data/vendor/libgit2/src/libgit2/diff_print.c +65 -9
- data/vendor/libgit2/src/libgit2/diff_tform.c +36 -8
- data/vendor/libgit2/src/libgit2/email.c +1 -0
- data/vendor/libgit2/src/libgit2/fetch.c +5 -3
- data/vendor/libgit2/src/libgit2/filter.c +5 -5
- data/vendor/libgit2/src/libgit2/git2.rc +3 -3
- data/vendor/libgit2/src/libgit2/grafts.c +18 -20
- data/vendor/libgit2/src/libgit2/grafts.h +0 -1
- data/vendor/libgit2/src/libgit2/graph.c +1 -1
- data/vendor/libgit2/src/libgit2/hashmap_oid.h +30 -0
- data/vendor/libgit2/src/libgit2/ignore.c +9 -5
- data/vendor/libgit2/src/libgit2/index.c +68 -90
- data/vendor/libgit2/src/libgit2/index.h +2 -2
- data/vendor/libgit2/src/libgit2/index_map.c +95 -0
- data/vendor/libgit2/src/libgit2/index_map.h +28 -0
- data/vendor/libgit2/src/libgit2/indexer.c +34 -38
- data/vendor/libgit2/src/libgit2/iterator.c +14 -8
- data/vendor/libgit2/src/libgit2/libgit2.c +153 -368
- data/vendor/libgit2/src/libgit2/mailmap.c +1 -1
- data/vendor/libgit2/src/libgit2/merge.c +42 -37
- data/vendor/libgit2/src/libgit2/merge_driver.c +2 -2
- data/vendor/libgit2/src/libgit2/midx.c +28 -15
- data/vendor/libgit2/src/libgit2/mwindow.c +38 -45
- data/vendor/libgit2/src/libgit2/mwindow.h +4 -0
- data/vendor/libgit2/src/libgit2/object.c +6 -5
- data/vendor/libgit2/src/libgit2/odb.c +5 -4
- data/vendor/libgit2/src/libgit2/odb_mempack.c +49 -17
- data/vendor/libgit2/src/libgit2/odb_pack.c +13 -5
- data/vendor/libgit2/src/libgit2/oid.c +32 -5
- data/vendor/libgit2/src/libgit2/oid.h +11 -0
- data/vendor/libgit2/src/libgit2/pack-objects.c +58 -31
- data/vendor/libgit2/src/libgit2/pack-objects.h +12 -4
- data/vendor/libgit2/src/libgit2/pack.c +30 -24
- data/vendor/libgit2/src/libgit2/pack.h +15 -10
- data/vendor/libgit2/src/libgit2/patch_parse.c +2 -2
- data/vendor/libgit2/src/libgit2/path.c +1 -1
- data/vendor/libgit2/src/libgit2/pathspec.c +1 -1
- data/vendor/libgit2/src/libgit2/push.c +79 -28
- data/vendor/libgit2/src/libgit2/push.h +1 -0
- data/vendor/libgit2/src/libgit2/refdb_fs.c +128 -61
- data/vendor/libgit2/src/libgit2/reflog.c +1 -2
- data/vendor/libgit2/src/libgit2/reflog.h +2 -0
- data/vendor/libgit2/src/libgit2/refs.c +26 -7
- data/vendor/libgit2/src/libgit2/refs.h +6 -1
- data/vendor/libgit2/src/libgit2/refspec.c +28 -1
- data/vendor/libgit2/src/libgit2/refspec.h +8 -0
- data/vendor/libgit2/src/libgit2/remote.c +121 -61
- data/vendor/libgit2/src/libgit2/repository.c +231 -51
- data/vendor/libgit2/src/libgit2/repository.h +10 -6
- data/vendor/libgit2/src/libgit2/revert.c +1 -2
- data/vendor/libgit2/src/libgit2/revparse.c +2 -2
- data/vendor/libgit2/src/libgit2/revwalk.c +13 -10
- data/vendor/libgit2/src/libgit2/revwalk.h +3 -3
- data/vendor/libgit2/src/libgit2/settings.c +468 -0
- data/vendor/libgit2/src/libgit2/settings.h +6 -2
- data/vendor/libgit2/src/libgit2/signature.c +132 -15
- data/vendor/libgit2/src/libgit2/signature.h +0 -1
- data/vendor/libgit2/src/libgit2/status.c +1 -1
- data/vendor/libgit2/src/libgit2/streams/mbedtls.c +54 -60
- data/vendor/libgit2/src/libgit2/streams/openssl.c +32 -7
- data/vendor/libgit2/src/libgit2/streams/openssl.h +2 -0
- data/vendor/libgit2/src/libgit2/streams/openssl_dynamic.c +4 -0
- data/vendor/libgit2/src/libgit2/streams/openssl_dynamic.h +3 -0
- data/vendor/libgit2/src/libgit2/streams/stransport.c +39 -7
- data/vendor/libgit2/src/libgit2/submodule.c +106 -63
- data/vendor/libgit2/src/libgit2/submodule.h +6 -7
- data/vendor/libgit2/src/libgit2/tag.c +1 -1
- data/vendor/libgit2/src/libgit2/trailer.c +6 -6
- data/vendor/libgit2/src/libgit2/transaction.c +26 -20
- data/vendor/libgit2/src/libgit2/transaction.h +4 -1
- data/vendor/libgit2/src/libgit2/transport.c +4 -1
- data/vendor/libgit2/src/libgit2/transports/credential.c +1 -1
- data/vendor/libgit2/src/libgit2/transports/http.c +1 -2
- data/vendor/libgit2/src/libgit2/transports/http.h +0 -10
- data/vendor/libgit2/src/libgit2/transports/httpclient.c +112 -72
- data/vendor/libgit2/src/libgit2/transports/httpparser.c +128 -0
- data/vendor/libgit2/src/libgit2/transports/httpparser.h +99 -0
- data/vendor/libgit2/src/libgit2/transports/local.c +8 -7
- data/vendor/libgit2/src/libgit2/transports/smart.c +20 -8
- data/vendor/libgit2/src/libgit2/transports/smart.h +4 -2
- data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +2 -2
- data/vendor/libgit2/src/libgit2/transports/smart_protocol.c +55 -10
- data/vendor/libgit2/src/libgit2/transports/ssh.c +41 -1103
- data/vendor/libgit2/src/libgit2/transports/ssh_exec.c +347 -0
- data/vendor/libgit2/src/libgit2/transports/ssh_exec.h +26 -0
- data/vendor/libgit2/src/libgit2/transports/ssh_libssh2.c +1126 -0
- data/vendor/libgit2/src/libgit2/transports/ssh_libssh2.h +28 -0
- data/vendor/libgit2/src/libgit2/transports/winhttp.c +35 -7
- data/vendor/libgit2/src/libgit2/tree.c +34 -26
- data/vendor/libgit2/src/libgit2/tree.h +3 -2
- data/vendor/libgit2/src/libgit2/worktree.c +14 -17
- data/vendor/libgit2/src/util/CMakeLists.txt +4 -6
- data/vendor/libgit2/src/util/alloc.c +4 -1
- data/vendor/libgit2/src/util/allocators/debugalloc.c +73 -0
- data/vendor/libgit2/src/{cli/cli.h → util/allocators/debugalloc.h} +6 -9
- data/vendor/libgit2/src/util/allocators/stdalloc.c +0 -10
- data/vendor/libgit2/src/util/array.h +18 -17
- data/vendor/libgit2/src/util/cc-compat.h +2 -0
- data/vendor/libgit2/src/util/ctype_compat.h +70 -0
- data/vendor/libgit2/src/util/date.c +22 -14
- data/vendor/libgit2/src/util/date.h +12 -0
- data/vendor/libgit2/src/util/errors.c +401 -0
- data/vendor/libgit2/src/{libgit2 → util}/errors.h +21 -17
- data/vendor/libgit2/src/util/fs_path.c +15 -4
- data/vendor/libgit2/src/util/fs_path.h +23 -0
- data/vendor/libgit2/src/util/futils.c +6 -5
- data/vendor/libgit2/src/util/futils.h +13 -4
- data/vendor/libgit2/src/util/git2_features.h.in +12 -1
- data/vendor/libgit2/src/util/git2_util.h +6 -0
- data/vendor/libgit2/src/util/hash/openssl.c +152 -0
- data/vendor/libgit2/src/util/hash/openssl.h +17 -1
- data/vendor/libgit2/src/util/hash/sha.h +4 -1
- data/vendor/libgit2/src/util/hashmap.h +424 -0
- data/vendor/libgit2/src/util/hashmap_str.h +43 -0
- data/vendor/libgit2/src/util/integer.h +3 -1
- data/vendor/libgit2/src/util/net.c +13 -7
- data/vendor/libgit2/src/util/net.h +2 -0
- data/vendor/libgit2/src/util/pool.c +1 -1
- data/vendor/libgit2/src/util/pool.h +5 -0
- data/vendor/libgit2/src/util/pqueue.h +1 -1
- data/vendor/libgit2/src/util/process.h +222 -0
- data/vendor/libgit2/src/util/rand.c +1 -7
- data/vendor/libgit2/src/util/regexp.c +1 -1
- data/vendor/libgit2/src/util/sortedcache.c +14 -13
- data/vendor/libgit2/src/util/sortedcache.h +3 -3
- data/vendor/libgit2/src/util/str.c +2 -2
- data/vendor/libgit2/src/util/strlist.c +108 -0
- data/vendor/libgit2/src/util/strlist.h +36 -0
- data/vendor/libgit2/src/util/unix/posix.h +0 -2
- data/vendor/libgit2/src/util/unix/process.c +629 -0
- data/vendor/libgit2/src/util/unix/realpath.c +23 -5
- data/vendor/libgit2/src/util/util.c +2 -2
- data/vendor/libgit2/src/util/util.h +4 -38
- data/vendor/libgit2/src/util/vector.c +3 -3
- data/vendor/libgit2/src/util/vector.h +2 -2
- data/vendor/libgit2/src/util/win32/posix_w32.c +29 -6
- data/vendor/libgit2/src/util/win32/process.c +506 -0
- metadata +45 -28
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +0 -6
- data/vendor/libgit2/deps/http-parser/COPYING +0 -23
- data/vendor/libgit2/deps/http-parser/http_parser.c +0 -2182
- data/vendor/libgit2/deps/http-parser/http_parser.h +0 -305
- data/vendor/libgit2/deps/zlib/COPYING +0 -27
- data/vendor/libgit2/include/git2/sys/reflog.h +0 -21
- data/vendor/libgit2/src/libgit2/config_entries.c +0 -237
- data/vendor/libgit2/src/libgit2/config_entries.h +0 -24
- data/vendor/libgit2/src/libgit2/errors.c +0 -293
- data/vendor/libgit2/src/libgit2/idxmap.c +0 -157
- data/vendor/libgit2/src/libgit2/idxmap.h +0 -177
- data/vendor/libgit2/src/libgit2/libgit2.h +0 -15
- data/vendor/libgit2/src/libgit2/offmap.c +0 -101
- data/vendor/libgit2/src/libgit2/offmap.h +0 -133
- data/vendor/libgit2/src/libgit2/oidmap.c +0 -107
- data/vendor/libgit2/src/libgit2/oidmap.h +0 -128
- data/vendor/libgit2/src/libgit2/threadstate.c +0 -97
- data/vendor/libgit2/src/libgit2/threadstate.h +0 -22
- data/vendor/libgit2/src/libgit2/transports/ssh.h +0 -14
- data/vendor/libgit2/src/util/khash.h +0 -615
- data/vendor/libgit2/src/util/strmap.c +0 -100
- data/vendor/libgit2/src/util/strmap.h +0 -131
- /data/vendor/libgit2/cmake/{FindHTTPParser.cmake → FindHTTP_Parser.cmake} +0 -0
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
#include "fs_path.h"
|
|
31
31
|
#include "attr.h"
|
|
32
32
|
#include "pool.h"
|
|
33
|
-
#include "strmap.h"
|
|
34
33
|
#include "path.h"
|
|
34
|
+
#include "hashmap_str.h"
|
|
35
35
|
|
|
36
36
|
/* See docs/checkout-internals.md for more information */
|
|
37
37
|
|
|
@@ -72,7 +72,7 @@ typedef struct {
|
|
|
72
72
|
size_t total_steps;
|
|
73
73
|
size_t completed_steps;
|
|
74
74
|
git_checkout_perfdata perfdata;
|
|
75
|
-
|
|
75
|
+
git_hashset_str mkdir_pathcache;
|
|
76
76
|
git_attr_session attr_session;
|
|
77
77
|
} checkout_data;
|
|
78
78
|
|
|
@@ -294,6 +294,9 @@ static int checkout_action_no_wd(
|
|
|
294
294
|
|
|
295
295
|
*action = CHECKOUT_ACTION__NONE;
|
|
296
296
|
|
|
297
|
+
if ((data->strategy & GIT_CHECKOUT_NONE))
|
|
298
|
+
return 0;
|
|
299
|
+
|
|
297
300
|
switch (delta->status) {
|
|
298
301
|
case GIT_DELTA_UNMODIFIED: /* case 12 */
|
|
299
302
|
error = checkout_notify(data, GIT_CHECKOUT_NOTIFY_DIRTY, delta, NULL);
|
|
@@ -302,17 +305,17 @@ static int checkout_action_no_wd(
|
|
|
302
305
|
*action = CHECKOUT_ACTION_IF(RECREATE_MISSING, UPDATE_BLOB, NONE);
|
|
303
306
|
break;
|
|
304
307
|
case GIT_DELTA_ADDED: /* case 2 or 28 (and 5 but not really) */
|
|
305
|
-
*action =
|
|
308
|
+
*action = CHECKOUT_ACTION__UPDATE_BLOB;
|
|
306
309
|
break;
|
|
307
310
|
case GIT_DELTA_MODIFIED: /* case 13 (and 35 but not really) */
|
|
308
311
|
*action = CHECKOUT_ACTION_IF(RECREATE_MISSING, UPDATE_BLOB, CONFLICT);
|
|
309
312
|
break;
|
|
310
313
|
case GIT_DELTA_TYPECHANGE: /* case 21 (B->T) and 28 (T->B)*/
|
|
311
314
|
if (delta->new_file.mode == GIT_FILEMODE_TREE)
|
|
312
|
-
*action =
|
|
315
|
+
*action = CHECKOUT_ACTION__UPDATE_BLOB;
|
|
313
316
|
break;
|
|
314
317
|
case GIT_DELTA_DELETED: /* case 8 or 25 */
|
|
315
|
-
*action =
|
|
318
|
+
*action = CHECKOUT_ACTION__REMOVE;
|
|
316
319
|
break;
|
|
317
320
|
default: /* impossible */
|
|
318
321
|
break;
|
|
@@ -494,6 +497,9 @@ static int checkout_action_with_wd(
|
|
|
494
497
|
{
|
|
495
498
|
*action = CHECKOUT_ACTION__NONE;
|
|
496
499
|
|
|
500
|
+
if ((data->strategy & GIT_CHECKOUT_NONE))
|
|
501
|
+
return 0;
|
|
502
|
+
|
|
497
503
|
switch (delta->status) {
|
|
498
504
|
case GIT_DELTA_UNMODIFIED: /* case 14/15 or 33 */
|
|
499
505
|
if (checkout_is_workdir_modified(data, &delta->old_file, &delta->new_file, wd)) {
|
|
@@ -512,14 +518,14 @@ static int checkout_action_with_wd(
|
|
|
512
518
|
if (checkout_is_workdir_modified(data, &delta->old_file, &delta->new_file, wd))
|
|
513
519
|
*action = CHECKOUT_ACTION_IF(FORCE, REMOVE, CONFLICT);
|
|
514
520
|
else
|
|
515
|
-
*action =
|
|
521
|
+
*action = CHECKOUT_ACTION__REMOVE;
|
|
516
522
|
break;
|
|
517
523
|
case GIT_DELTA_MODIFIED: /* case 16, 17, 18 (or 36 but not really) */
|
|
518
524
|
if (wd->mode != GIT_FILEMODE_COMMIT &&
|
|
519
525
|
checkout_is_workdir_modified(data, &delta->old_file, &delta->new_file, wd))
|
|
520
526
|
*action = CHECKOUT_ACTION_IF(FORCE, UPDATE_BLOB, CONFLICT);
|
|
521
527
|
else
|
|
522
|
-
*action =
|
|
528
|
+
*action = CHECKOUT_ACTION__UPDATE_BLOB;
|
|
523
529
|
break;
|
|
524
530
|
case GIT_DELTA_TYPECHANGE: /* case 22, 23, 29, 30 */
|
|
525
531
|
if (delta->old_file.mode == GIT_FILEMODE_TREE) {
|
|
@@ -527,13 +533,13 @@ static int checkout_action_with_wd(
|
|
|
527
533
|
/* either deleting items in old tree will delete the wd dir,
|
|
528
534
|
* or we'll get a conflict when we attempt blob update...
|
|
529
535
|
*/
|
|
530
|
-
*action =
|
|
536
|
+
*action = CHECKOUT_ACTION__UPDATE_BLOB;
|
|
531
537
|
else if (wd->mode == GIT_FILEMODE_COMMIT) {
|
|
532
538
|
/* workdir is possibly a "phantom" submodule - treat as a
|
|
533
539
|
* tree if the only submodule info came from the config
|
|
534
540
|
*/
|
|
535
541
|
if (submodule_is_config_only(data, wd->path))
|
|
536
|
-
*action =
|
|
542
|
+
*action = CHECKOUT_ACTION__UPDATE_BLOB;
|
|
537
543
|
else
|
|
538
544
|
*action = CHECKOUT_ACTION_IF(FORCE, REMOVE_AND_UPDATE, CONFLICT);
|
|
539
545
|
} else
|
|
@@ -542,7 +548,7 @@ static int checkout_action_with_wd(
|
|
|
542
548
|
else if (checkout_is_workdir_modified(data, &delta->old_file, &delta->new_file, wd))
|
|
543
549
|
*action = CHECKOUT_ACTION_IF(FORCE, REMOVE_AND_UPDATE, CONFLICT);
|
|
544
550
|
else
|
|
545
|
-
*action =
|
|
551
|
+
*action = CHECKOUT_ACTION__REMOVE_AND_UPDATE;
|
|
546
552
|
|
|
547
553
|
/* don't update if the typechange is to a tree */
|
|
548
554
|
if (delta->new_file.mode == GIT_FILEMODE_TREE)
|
|
@@ -563,6 +569,9 @@ static int checkout_action_with_wd_blocker(
|
|
|
563
569
|
{
|
|
564
570
|
*action = CHECKOUT_ACTION__NONE;
|
|
565
571
|
|
|
572
|
+
if ((data->strategy & GIT_CHECKOUT_NONE))
|
|
573
|
+
return 0;
|
|
574
|
+
|
|
566
575
|
switch (delta->status) {
|
|
567
576
|
case GIT_DELTA_UNMODIFIED:
|
|
568
577
|
/* should show delta as dirty / deleted */
|
|
@@ -597,6 +606,9 @@ static int checkout_action_with_wd_dir(
|
|
|
597
606
|
{
|
|
598
607
|
*action = CHECKOUT_ACTION__NONE;
|
|
599
608
|
|
|
609
|
+
if ((data->strategy & GIT_CHECKOUT_NONE))
|
|
610
|
+
return 0;
|
|
611
|
+
|
|
600
612
|
switch (delta->status) {
|
|
601
613
|
case GIT_DELTA_UNMODIFIED: /* case 19 or 24 (or 34 but not really) */
|
|
602
614
|
GIT_ERROR_CHECK_ERROR(
|
|
@@ -627,7 +639,7 @@ static int checkout_action_with_wd_dir(
|
|
|
627
639
|
* directory if is it left empty, so we can defer removing the
|
|
628
640
|
* dir and it will succeed if no children are left.
|
|
629
641
|
*/
|
|
630
|
-
*action =
|
|
642
|
+
*action = CHECKOUT_ACTION__UPDATE_BLOB;
|
|
631
643
|
}
|
|
632
644
|
else if (delta->new_file.mode != GIT_FILEMODE_TREE)
|
|
633
645
|
/* For typechange to dir, dir is already created so no action */
|
|
@@ -1419,8 +1431,10 @@ static int checkout_mkdir(
|
|
|
1419
1431
|
struct git_futils_mkdir_options mkdir_opts = {0};
|
|
1420
1432
|
int error;
|
|
1421
1433
|
|
|
1422
|
-
|
|
1423
|
-
|
|
1434
|
+
if (git_pool_is_initialized(&data->pool)) {
|
|
1435
|
+
mkdir_opts.cache_pool = &data->pool;
|
|
1436
|
+
mkdir_opts.cache_pathset = &data->mkdir_pathcache;
|
|
1437
|
+
}
|
|
1424
1438
|
|
|
1425
1439
|
error = git_futils_mkdir_relative(
|
|
1426
1440
|
path, base, mode, flags, &mkdir_opts);
|
|
@@ -2316,11 +2330,11 @@ static void checkout_data_clear(checkout_data *data)
|
|
|
2316
2330
|
data->opts.baseline = NULL;
|
|
2317
2331
|
}
|
|
2318
2332
|
|
|
2319
|
-
|
|
2333
|
+
git_vector_dispose(&data->removes);
|
|
2320
2334
|
git_pool_clear(&data->pool);
|
|
2321
2335
|
|
|
2322
|
-
|
|
2323
|
-
|
|
2336
|
+
git_vector_dispose_deep(&data->remove_conflicts);
|
|
2337
|
+
git_vector_dispose_deep(&data->update_conflicts);
|
|
2324
2338
|
|
|
2325
2339
|
git__free(data->pfx);
|
|
2326
2340
|
data->pfx = NULL;
|
|
@@ -2331,8 +2345,7 @@ static void checkout_data_clear(checkout_data *data)
|
|
|
2331
2345
|
git_index_free(data->index);
|
|
2332
2346
|
data->index = NULL;
|
|
2333
2347
|
|
|
2334
|
-
|
|
2335
|
-
data->mkdir_map = NULL;
|
|
2348
|
+
git_hashset_str_dispose(&data->mkdir_pathcache);
|
|
2336
2349
|
|
|
2337
2350
|
git_attr_session__free(&data->attr_session);
|
|
2338
2351
|
}
|
|
@@ -2432,14 +2445,12 @@ static int checkout_data_init(
|
|
|
2432
2445
|
|
|
2433
2446
|
/* if you are forcing, allow all safe updates, plus recreate missing */
|
|
2434
2447
|
if ((data->opts.checkout_strategy & GIT_CHECKOUT_FORCE) != 0)
|
|
2435
|
-
data->opts.checkout_strategy |=
|
|
2436
|
-
GIT_CHECKOUT_RECREATE_MISSING;
|
|
2448
|
+
data->opts.checkout_strategy |= GIT_CHECKOUT_RECREATE_MISSING;
|
|
2437
2449
|
|
|
2438
2450
|
/* if the repository does not actually have an index file, then this
|
|
2439
2451
|
* is an initial checkout (perhaps from clone), so we allow safe updates
|
|
2440
2452
|
*/
|
|
2441
|
-
if (!data->index->on_disk
|
|
2442
|
-
(data->opts.checkout_strategy & GIT_CHECKOUT_SAFE) != 0)
|
|
2453
|
+
if (!data->index->on_disk)
|
|
2443
2454
|
data->opts.checkout_strategy |= GIT_CHECKOUT_RECREATE_MISSING;
|
|
2444
2455
|
|
|
2445
2456
|
data->strategy = data->opts.checkout_strategy;
|
|
@@ -2513,8 +2524,7 @@ static int checkout_data_init(
|
|
|
2513
2524
|
(error = git_vector_init(&data->remove_conflicts, 0, NULL)) < 0 ||
|
|
2514
2525
|
(error = git_vector_init(&data->update_conflicts, 0, NULL)) < 0 ||
|
|
2515
2526
|
(error = git_str_puts(&data->target_path, data->opts.target_directory)) < 0 ||
|
|
2516
|
-
(error = git_fs_path_to_dir(&data->target_path)) < 0
|
|
2517
|
-
(error = git_strmap_new(&data->mkdir_map)) < 0)
|
|
2527
|
+
(error = git_fs_path_to_dir(&data->target_path)) < 0)
|
|
2518
2528
|
goto cleanup;
|
|
2519
2529
|
|
|
2520
2530
|
data->target_len = git_str_len(&data->target_path);
|
|
@@ -12,8 +12,6 @@
|
|
|
12
12
|
#include "git2/checkout.h"
|
|
13
13
|
#include "iterator.h"
|
|
14
14
|
|
|
15
|
-
#define GIT_CHECKOUT__NOTIFY_CONFLICT_TREE (1u << 12)
|
|
16
|
-
|
|
17
15
|
/**
|
|
18
16
|
* Update the working directory to match the target iterator. The
|
|
19
17
|
* expected baseline value can be passed in via the checkout options
|
|
@@ -73,8 +73,7 @@ static int cherrypick_normalize_opts(
|
|
|
73
73
|
const char *their_label)
|
|
74
74
|
{
|
|
75
75
|
int error = 0;
|
|
76
|
-
unsigned int default_checkout_strategy =
|
|
77
|
-
GIT_CHECKOUT_ALLOW_CONFLICTS;
|
|
76
|
+
unsigned int default_checkout_strategy = GIT_CHECKOUT_ALLOW_CONFLICTS;
|
|
78
77
|
|
|
79
78
|
GIT_UNUSED(repo);
|
|
80
79
|
|
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
#include "git2/commit.h"
|
|
17
17
|
#include "git2/tree.h"
|
|
18
18
|
|
|
19
|
+
#include "checkout.h"
|
|
19
20
|
#include "remote.h"
|
|
20
21
|
#include "futils.h"
|
|
21
22
|
#include "refs.h"
|
|
22
23
|
#include "fs_path.h"
|
|
23
24
|
#include "repository.h"
|
|
24
25
|
#include "odb.h"
|
|
25
|
-
|
|
26
|
-
static int clone_local_into(git_repository *repo, git_remote *remote, const git_fetch_options *fetch_opts, const git_checkout_options *co_opts, const char *branch, int link);
|
|
26
|
+
#include "net.h"
|
|
27
27
|
|
|
28
28
|
static int create_branch(
|
|
29
29
|
git_reference **branch,
|
|
@@ -336,8 +336,9 @@ static int create_and_configure_origin(
|
|
|
336
336
|
git_remote_create_cb remote_create = options->remote_cb;
|
|
337
337
|
void *payload = options->remote_cb_payload;
|
|
338
338
|
|
|
339
|
-
/* If the path
|
|
340
|
-
if (
|
|
339
|
+
/* If the path is local and exists it should be the absolute path. */
|
|
340
|
+
if (!git_net_str_is_url(url) && git_fs_path_root(url) < 0 &&
|
|
341
|
+
git_fs_path_exists(url)) {
|
|
341
342
|
if (p_realpath(url, buf) == NULL)
|
|
342
343
|
return -1;
|
|
343
344
|
|
|
@@ -360,35 +361,50 @@ on_error:
|
|
|
360
361
|
return error;
|
|
361
362
|
}
|
|
362
363
|
|
|
363
|
-
static
|
|
364
|
+
static int should_checkout(
|
|
365
|
+
bool *out,
|
|
364
366
|
git_repository *repo,
|
|
365
367
|
bool is_bare,
|
|
366
|
-
const
|
|
368
|
+
const git_clone_options *opts)
|
|
367
369
|
{
|
|
368
|
-
|
|
369
|
-
return false;
|
|
370
|
+
int error;
|
|
370
371
|
|
|
371
|
-
if (!opts
|
|
372
|
-
|
|
372
|
+
if (!opts || is_bare ||
|
|
373
|
+
opts->checkout_opts.checkout_strategy == GIT_CHECKOUT_NONE) {
|
|
374
|
+
*out = false;
|
|
375
|
+
return 0;
|
|
376
|
+
}
|
|
373
377
|
|
|
374
|
-
if (
|
|
375
|
-
return
|
|
378
|
+
if ((error = git_repository_head_unborn(repo)) < 0)
|
|
379
|
+
return error;
|
|
376
380
|
|
|
377
|
-
|
|
381
|
+
*out = !error;
|
|
382
|
+
return 0;
|
|
378
383
|
}
|
|
379
384
|
|
|
380
|
-
static int checkout_branch(
|
|
385
|
+
static int checkout_branch(
|
|
386
|
+
git_repository *repo,
|
|
387
|
+
git_remote *remote,
|
|
388
|
+
const git_clone_options *opts,
|
|
389
|
+
const char *reflog_message)
|
|
381
390
|
{
|
|
391
|
+
bool checkout;
|
|
382
392
|
int error;
|
|
383
393
|
|
|
384
|
-
if (
|
|
385
|
-
error = update_head_to_branch(repo, remote,
|
|
394
|
+
if (opts->checkout_branch)
|
|
395
|
+
error = update_head_to_branch(repo, remote, opts->checkout_branch, reflog_message);
|
|
386
396
|
/* Point HEAD to the same ref as the remote's head */
|
|
387
397
|
else
|
|
388
398
|
error = update_head_to_remote(repo, remote, reflog_message);
|
|
389
399
|
|
|
390
|
-
if (
|
|
391
|
-
error
|
|
400
|
+
if (error < 0)
|
|
401
|
+
return error;
|
|
402
|
+
|
|
403
|
+
if ((error = should_checkout(&checkout, repo, git_repository_is_bare(repo), opts)) < 0)
|
|
404
|
+
return error;
|
|
405
|
+
|
|
406
|
+
if (checkout)
|
|
407
|
+
error = git_checkout_head(repo, &opts->checkout_opts);
|
|
392
408
|
|
|
393
409
|
return error;
|
|
394
410
|
}
|
|
@@ -396,16 +412,13 @@ static int checkout_branch(git_repository *repo, git_remote *remote, const git_c
|
|
|
396
412
|
static int clone_into(
|
|
397
413
|
git_repository *repo,
|
|
398
414
|
git_remote *_remote,
|
|
399
|
-
const
|
|
400
|
-
const git_checkout_options *co_opts,
|
|
401
|
-
const char *branch)
|
|
415
|
+
const git_clone_options *opts)
|
|
402
416
|
{
|
|
403
|
-
int error;
|
|
404
417
|
git_str reflog_message = GIT_STR_INIT;
|
|
405
418
|
git_remote_connect_options connect_opts = GIT_REMOTE_CONNECT_OPTIONS_INIT;
|
|
406
|
-
git_fetch_options fetch_opts;
|
|
407
419
|
git_remote *remote;
|
|
408
420
|
git_oid_t oid_type;
|
|
421
|
+
int error;
|
|
409
422
|
|
|
410
423
|
GIT_ASSERT_ARG(repo);
|
|
411
424
|
GIT_ASSERT_ARG(_remote);
|
|
@@ -418,13 +431,7 @@ static int clone_into(
|
|
|
418
431
|
if ((error = git_remote_dup(&remote, _remote)) < 0)
|
|
419
432
|
return error;
|
|
420
433
|
|
|
421
|
-
|
|
422
|
-
fetch_opts.update_fetchhead = 0;
|
|
423
|
-
|
|
424
|
-
if (!opts->depth)
|
|
425
|
-
fetch_opts.download_tags = GIT_REMOTE_DOWNLOAD_TAGS_ALL;
|
|
426
|
-
|
|
427
|
-
if ((error = git_remote_connect_options__from_fetch_opts(&connect_opts, remote, &fetch_opts)) < 0)
|
|
434
|
+
if ((error = git_remote_connect_options__from_fetch_opts(&connect_opts, remote, &opts->fetch_opts)) < 0)
|
|
428
435
|
goto cleanup;
|
|
429
436
|
|
|
430
437
|
git_str_printf(&reflog_message, "clone: from %s", git_remote_url(remote));
|
|
@@ -442,10 +449,10 @@ static int clone_into(
|
|
|
442
449
|
(error = git_repository__set_objectformat(repo, oid_type)) < 0)
|
|
443
450
|
goto cleanup;
|
|
444
451
|
|
|
445
|
-
if ((error = git_remote_fetch(remote, NULL, &fetch_opts, git_str_cstr(&reflog_message))) != 0)
|
|
452
|
+
if ((error = git_remote_fetch(remote, NULL, &opts->fetch_opts, git_str_cstr(&reflog_message))) != 0)
|
|
446
453
|
goto cleanup;
|
|
447
454
|
|
|
448
|
-
error = checkout_branch(repo, remote,
|
|
455
|
+
error = checkout_branch(repo, remote, opts, git_str_cstr(&reflog_message));
|
|
449
456
|
|
|
450
457
|
cleanup:
|
|
451
458
|
git_remote_free(remote);
|
|
@@ -455,37 +462,142 @@ cleanup:
|
|
|
455
462
|
return error;
|
|
456
463
|
}
|
|
457
464
|
|
|
458
|
-
|
|
465
|
+
static bool can_link(const char *src, const char *dst, int link)
|
|
466
|
+
{
|
|
467
|
+
#ifdef GIT_WIN32
|
|
468
|
+
GIT_UNUSED(src);
|
|
469
|
+
GIT_UNUSED(dst);
|
|
470
|
+
GIT_UNUSED(link);
|
|
471
|
+
return false;
|
|
472
|
+
#else
|
|
473
|
+
|
|
474
|
+
struct stat st_src, st_dst;
|
|
475
|
+
|
|
476
|
+
if (!link)
|
|
477
|
+
return false;
|
|
478
|
+
|
|
479
|
+
if (p_stat(src, &st_src) < 0)
|
|
480
|
+
return false;
|
|
481
|
+
|
|
482
|
+
if (p_stat(dst, &st_dst) < 0)
|
|
483
|
+
return false;
|
|
484
|
+
|
|
485
|
+
return st_src.st_dev == st_dst.st_dev;
|
|
486
|
+
#endif
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
static int clone_local_into(
|
|
490
|
+
git_repository *repo,
|
|
491
|
+
git_remote *remote,
|
|
492
|
+
const git_clone_options *opts)
|
|
493
|
+
{
|
|
494
|
+
int error, flags;
|
|
495
|
+
git_repository *src;
|
|
496
|
+
git_str src_odb = GIT_STR_INIT, dst_odb = GIT_STR_INIT, src_path = GIT_STR_INIT;
|
|
497
|
+
git_str reflog_message = GIT_STR_INIT;
|
|
498
|
+
bool link = (opts && opts->local != GIT_CLONE_LOCAL_NO_LINKS);
|
|
499
|
+
|
|
500
|
+
GIT_ASSERT_ARG(repo);
|
|
501
|
+
GIT_ASSERT_ARG(remote);
|
|
502
|
+
|
|
503
|
+
if (!git_repository_is_empty(repo)) {
|
|
504
|
+
git_error_set(GIT_ERROR_INVALID, "the repository is not empty");
|
|
505
|
+
return -1;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
/*
|
|
509
|
+
* Let's figure out what path we should use for the source
|
|
510
|
+
* repo, if it's not rooted, the path should be relative to
|
|
511
|
+
* the repository's worktree/gitdir.
|
|
512
|
+
*/
|
|
513
|
+
if ((error = git_fs_path_from_url_or_path(&src_path, git_remote_url(remote))) < 0)
|
|
514
|
+
return error;
|
|
515
|
+
|
|
516
|
+
/* Copy .git/objects/ from the source to the target */
|
|
517
|
+
if ((error = git_repository_open(&src, git_str_cstr(&src_path))) < 0) {
|
|
518
|
+
git_str_dispose(&src_path);
|
|
519
|
+
return error;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
if (git_repository__item_path(&src_odb, src, GIT_REPOSITORY_ITEM_OBJECTS) < 0 ||
|
|
523
|
+
git_repository__item_path(&dst_odb, repo, GIT_REPOSITORY_ITEM_OBJECTS) < 0) {
|
|
524
|
+
error = -1;
|
|
525
|
+
goto cleanup;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
flags = 0;
|
|
529
|
+
if (can_link(git_repository_path(src), git_repository_path(repo), link))
|
|
530
|
+
flags |= GIT_CPDIR_LINK_FILES;
|
|
531
|
+
|
|
532
|
+
error = git_futils_cp_r(git_str_cstr(&src_odb), git_str_cstr(&dst_odb),
|
|
533
|
+
flags, GIT_OBJECT_DIR_MODE);
|
|
534
|
+
|
|
535
|
+
/*
|
|
536
|
+
* can_link() doesn't catch all variations, so if we hit an
|
|
537
|
+
* error and did want to link, let's try again without trying
|
|
538
|
+
* to link.
|
|
539
|
+
*/
|
|
540
|
+
if (error < 0 && link) {
|
|
541
|
+
flags &= ~GIT_CPDIR_LINK_FILES;
|
|
542
|
+
error = git_futils_cp_r(git_str_cstr(&src_odb), git_str_cstr(&dst_odb),
|
|
543
|
+
flags, GIT_OBJECT_DIR_MODE);
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
if (error < 0)
|
|
547
|
+
goto cleanup;
|
|
548
|
+
|
|
549
|
+
git_str_printf(&reflog_message, "clone: from %s", git_remote_url(remote));
|
|
550
|
+
|
|
551
|
+
if ((error = git_remote_fetch(remote, NULL, &opts->fetch_opts, git_str_cstr(&reflog_message))) != 0)
|
|
552
|
+
goto cleanup;
|
|
553
|
+
|
|
554
|
+
error = checkout_branch(repo, remote, opts, git_str_cstr(&reflog_message));
|
|
555
|
+
|
|
556
|
+
cleanup:
|
|
557
|
+
git_str_dispose(&reflog_message);
|
|
558
|
+
git_str_dispose(&src_path);
|
|
559
|
+
git_str_dispose(&src_odb);
|
|
560
|
+
git_str_dispose(&dst_odb);
|
|
561
|
+
git_repository_free(src);
|
|
562
|
+
return error;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
int git_clone__should_clone_local(
|
|
566
|
+
bool *out,
|
|
567
|
+
const char *url_or_path,
|
|
568
|
+
git_clone_local_t local)
|
|
459
569
|
{
|
|
460
570
|
git_str fromurl = GIT_STR_INIT;
|
|
461
|
-
|
|
462
|
-
|
|
571
|
+
|
|
572
|
+
*out = false;
|
|
463
573
|
|
|
464
574
|
if (local == GIT_CLONE_NO_LOCAL)
|
|
465
575
|
return 0;
|
|
466
576
|
|
|
467
|
-
if ((
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
577
|
+
if (git_net_str_is_url(url_or_path)) {
|
|
578
|
+
/* If GIT_CLONE_LOCAL_AUTO is specified, any url should
|
|
579
|
+
* be treated as remote */
|
|
580
|
+
if (local == GIT_CLONE_LOCAL_AUTO ||
|
|
581
|
+
!git_fs_path_is_local_file_url(url_or_path))
|
|
582
|
+
return 0;
|
|
472
583
|
|
|
473
|
-
|
|
474
|
-
|
|
584
|
+
if (git_fs_path_fromurl(&fromurl, url_or_path) < 0)
|
|
585
|
+
return -1;
|
|
475
586
|
|
|
476
|
-
|
|
477
|
-
|
|
587
|
+
*out = git_fs_path_isdir(git_str_cstr(&fromurl));
|
|
588
|
+
git_str_dispose(&fromurl);
|
|
589
|
+
} else {
|
|
590
|
+
*out = git_fs_path_isdir(url_or_path);
|
|
591
|
+
}
|
|
478
592
|
|
|
479
|
-
|
|
480
|
-
git_str_dispose(&fromurl);
|
|
481
|
-
return is_local;
|
|
593
|
+
return 0;
|
|
482
594
|
}
|
|
483
595
|
|
|
484
|
-
static int
|
|
596
|
+
static int clone_repo(
|
|
485
597
|
git_repository **out,
|
|
486
598
|
const char *url,
|
|
487
599
|
const char *local_path,
|
|
488
|
-
const git_clone_options *
|
|
600
|
+
const git_clone_options *given_opts,
|
|
489
601
|
int use_existing)
|
|
490
602
|
{
|
|
491
603
|
int error = 0;
|
|
@@ -499,11 +611,17 @@ static int git__clone(
|
|
|
499
611
|
GIT_ASSERT_ARG(url);
|
|
500
612
|
GIT_ASSERT_ARG(local_path);
|
|
501
613
|
|
|
502
|
-
if (
|
|
503
|
-
memcpy(&options,
|
|
614
|
+
if (given_opts)
|
|
615
|
+
memcpy(&options, given_opts, sizeof(git_clone_options));
|
|
504
616
|
|
|
505
617
|
GIT_ERROR_CHECK_VERSION(&options, GIT_CLONE_OPTIONS_VERSION, "git_clone_options");
|
|
506
618
|
|
|
619
|
+
/* enforce some behavior on fetch */
|
|
620
|
+
options.fetch_opts.update_fetchhead = 0;
|
|
621
|
+
|
|
622
|
+
if (!options.fetch_opts.depth)
|
|
623
|
+
options.fetch_opts.download_tags = GIT_REMOTE_DOWNLOAD_TAGS_ALL;
|
|
624
|
+
|
|
507
625
|
/* Only clone to a new directory or an empty directory */
|
|
508
626
|
if (git_fs_path_exists(local_path) && !use_existing && !git_fs_path_is_empty_dir(local_path)) {
|
|
509
627
|
git_error_set(GIT_ERROR_INVALID,
|
|
@@ -524,33 +642,31 @@ static int git__clone(
|
|
|
524
642
|
return error;
|
|
525
643
|
|
|
526
644
|
if (!(error = create_and_configure_origin(&origin, repo, url, &options))) {
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
error
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
error =
|
|
536
|
-
repo, origin, &options.fetch_opts, &options.checkout_opts,
|
|
537
|
-
options.checkout_branch);
|
|
645
|
+
bool clone_local;
|
|
646
|
+
|
|
647
|
+
if ((error = git_clone__should_clone_local(&clone_local, url, options.local)) < 0) {
|
|
648
|
+
git_remote_free(origin);
|
|
649
|
+
return error;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
if (clone_local)
|
|
653
|
+
error = clone_local_into(repo, origin, &options);
|
|
538
654
|
else
|
|
539
|
-
error =
|
|
655
|
+
error = clone_into(repo, origin, &options);
|
|
540
656
|
|
|
541
657
|
git_remote_free(origin);
|
|
542
658
|
}
|
|
543
659
|
|
|
544
660
|
if (error != 0) {
|
|
545
|
-
|
|
546
|
-
|
|
661
|
+
git_error *last_error;
|
|
662
|
+
git_error_save(&last_error);
|
|
547
663
|
|
|
548
664
|
git_repository_free(repo);
|
|
549
665
|
repo = NULL;
|
|
550
666
|
|
|
551
667
|
(void)git_futils_rmdir_r(local_path, NULL, rmdir_flags);
|
|
552
668
|
|
|
553
|
-
|
|
669
|
+
git_error_restore(last_error);
|
|
554
670
|
}
|
|
555
671
|
|
|
556
672
|
*out = repo;
|
|
@@ -561,18 +677,18 @@ int git_clone(
|
|
|
561
677
|
git_repository **out,
|
|
562
678
|
const char *url,
|
|
563
679
|
const char *local_path,
|
|
564
|
-
const git_clone_options *
|
|
680
|
+
const git_clone_options *options)
|
|
565
681
|
{
|
|
566
|
-
return
|
|
682
|
+
return clone_repo(out, url, local_path, options, 0);
|
|
567
683
|
}
|
|
568
684
|
|
|
569
685
|
int git_clone__submodule(
|
|
570
686
|
git_repository **out,
|
|
571
687
|
const char *url,
|
|
572
688
|
const char *local_path,
|
|
573
|
-
const git_clone_options *
|
|
689
|
+
const git_clone_options *options)
|
|
574
690
|
{
|
|
575
|
-
return
|
|
691
|
+
return clone_repo(out, url, local_path, options, 1);
|
|
576
692
|
}
|
|
577
693
|
|
|
578
694
|
int git_clone_options_init(git_clone_options *opts, unsigned int version)
|
|
@@ -588,99 +704,3 @@ int git_clone_init_options(git_clone_options *opts, unsigned int version)
|
|
|
588
704
|
return git_clone_options_init(opts, version);
|
|
589
705
|
}
|
|
590
706
|
#endif
|
|
591
|
-
|
|
592
|
-
static bool can_link(const char *src, const char *dst, int link)
|
|
593
|
-
{
|
|
594
|
-
#ifdef GIT_WIN32
|
|
595
|
-
GIT_UNUSED(src);
|
|
596
|
-
GIT_UNUSED(dst);
|
|
597
|
-
GIT_UNUSED(link);
|
|
598
|
-
return false;
|
|
599
|
-
#else
|
|
600
|
-
|
|
601
|
-
struct stat st_src, st_dst;
|
|
602
|
-
|
|
603
|
-
if (!link)
|
|
604
|
-
return false;
|
|
605
|
-
|
|
606
|
-
if (p_stat(src, &st_src) < 0)
|
|
607
|
-
return false;
|
|
608
|
-
|
|
609
|
-
if (p_stat(dst, &st_dst) < 0)
|
|
610
|
-
return false;
|
|
611
|
-
|
|
612
|
-
return st_src.st_dev == st_dst.st_dev;
|
|
613
|
-
#endif
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
static int clone_local_into(git_repository *repo, git_remote *remote, const git_fetch_options *fetch_opts, const git_checkout_options *co_opts, const char *branch, int link)
|
|
617
|
-
{
|
|
618
|
-
int error, flags;
|
|
619
|
-
git_repository *src;
|
|
620
|
-
git_str src_odb = GIT_STR_INIT, dst_odb = GIT_STR_INIT, src_path = GIT_STR_INIT;
|
|
621
|
-
git_str reflog_message = GIT_STR_INIT;
|
|
622
|
-
|
|
623
|
-
GIT_ASSERT_ARG(repo);
|
|
624
|
-
GIT_ASSERT_ARG(remote);
|
|
625
|
-
|
|
626
|
-
if (!git_repository_is_empty(repo)) {
|
|
627
|
-
git_error_set(GIT_ERROR_INVALID, "the repository is not empty");
|
|
628
|
-
return -1;
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
/*
|
|
632
|
-
* Let's figure out what path we should use for the source
|
|
633
|
-
* repo, if it's not rooted, the path should be relative to
|
|
634
|
-
* the repository's worktree/gitdir.
|
|
635
|
-
*/
|
|
636
|
-
if ((error = git_fs_path_from_url_or_path(&src_path, git_remote_url(remote))) < 0)
|
|
637
|
-
return error;
|
|
638
|
-
|
|
639
|
-
/* Copy .git/objects/ from the source to the target */
|
|
640
|
-
if ((error = git_repository_open(&src, git_str_cstr(&src_path))) < 0) {
|
|
641
|
-
git_str_dispose(&src_path);
|
|
642
|
-
return error;
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
if (git_repository__item_path(&src_odb, src, GIT_REPOSITORY_ITEM_OBJECTS) < 0 ||
|
|
646
|
-
git_repository__item_path(&dst_odb, repo, GIT_REPOSITORY_ITEM_OBJECTS) < 0) {
|
|
647
|
-
error = -1;
|
|
648
|
-
goto cleanup;
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
flags = 0;
|
|
652
|
-
if (can_link(git_repository_path(src), git_repository_path(repo), link))
|
|
653
|
-
flags |= GIT_CPDIR_LINK_FILES;
|
|
654
|
-
|
|
655
|
-
error = git_futils_cp_r(git_str_cstr(&src_odb), git_str_cstr(&dst_odb),
|
|
656
|
-
flags, GIT_OBJECT_DIR_MODE);
|
|
657
|
-
|
|
658
|
-
/*
|
|
659
|
-
* can_link() doesn't catch all variations, so if we hit an
|
|
660
|
-
* error and did want to link, let's try again without trying
|
|
661
|
-
* to link.
|
|
662
|
-
*/
|
|
663
|
-
if (error < 0 && link) {
|
|
664
|
-
flags &= ~GIT_CPDIR_LINK_FILES;
|
|
665
|
-
error = git_futils_cp_r(git_str_cstr(&src_odb), git_str_cstr(&dst_odb),
|
|
666
|
-
flags, GIT_OBJECT_DIR_MODE);
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
if (error < 0)
|
|
670
|
-
goto cleanup;
|
|
671
|
-
|
|
672
|
-
git_str_printf(&reflog_message, "clone: from %s", git_remote_url(remote));
|
|
673
|
-
|
|
674
|
-
if ((error = git_remote_fetch(remote, NULL, fetch_opts, git_str_cstr(&reflog_message))) != 0)
|
|
675
|
-
goto cleanup;
|
|
676
|
-
|
|
677
|
-
error = checkout_branch(repo, remote, co_opts, branch, git_str_cstr(&reflog_message));
|
|
678
|
-
|
|
679
|
-
cleanup:
|
|
680
|
-
git_str_dispose(&reflog_message);
|
|
681
|
-
git_str_dispose(&src_path);
|
|
682
|
-
git_str_dispose(&src_odb);
|
|
683
|
-
git_str_dispose(&dst_odb);
|
|
684
|
-
git_repository_free(src);
|
|
685
|
-
return error;
|
|
686
|
-
}
|