rugged 1.7.2 → 1.9.4
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/ext/rugged/extconf.rb +4 -4
- data/ext/rugged/rugged.c +12 -1
- data/ext/rugged/rugged_blame.c +22 -6
- data/ext/rugged/rugged_blob.c +24 -9
- data/ext/rugged/rugged_branch.c +10 -7
- data/ext/rugged/rugged_branch_collection.c +8 -6
- data/ext/rugged/rugged_commit.c +7 -6
- data/ext/rugged/rugged_config.c +20 -11
- data/ext/rugged/rugged_diff.c +26 -12
- data/ext/rugged/rugged_diff_hunk.c +2 -1
- data/ext/rugged/rugged_index.c +39 -29
- data/ext/rugged/rugged_note.c +7 -6
- data/ext/rugged/rugged_object.c +3 -2
- data/ext/rugged/rugged_patch.c +23 -9
- data/ext/rugged/rugged_rebase.c +22 -10
- data/ext/rugged/rugged_reference.c +22 -13
- data/ext/rugged/rugged_reference_collection.c +9 -7
- data/ext/rugged/rugged_remote.c +23 -12
- data/ext/rugged/rugged_remote_collection.c +11 -9
- data/ext/rugged/rugged_repo.c +60 -45
- data/ext/rugged/rugged_revwalk.c +22 -12
- data/ext/rugged/rugged_submodule.c +23 -20
- data/ext/rugged/rugged_submodule_collection.c +20 -9
- data/ext/rugged/rugged_tag.c +6 -4
- data/ext/rugged/rugged_tag_collection.c +7 -5
- data/ext/rugged/rugged_tree.c +27 -15
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +3 -0
- data/vendor/libgit2/CMakeLists.txt +23 -10
- data/vendor/libgit2/COPYING +195 -1
- data/vendor/libgit2/cmake/DefaultCFlags.cmake +4 -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 +30 -19
- 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 +3 -3
- data/vendor/libgit2/deps/xdiff/CMakeLists.txt +1 -1
- data/vendor/libgit2/deps/xdiff/xmerge.c +16 -12
- 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 +134 -4
- 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 +100 -15
- 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 +50 -3
- 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 -25
- 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 +12 -3
- 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 +113 -25
- 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 +25 -4
- 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 +46 -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 +3 -4
- 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 +31 -5
- 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 +55 -21
- 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 +17 -5
- 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 +192 -166
- data/vendor/libgit2/src/libgit2/clone.h +4 -1
- data/vendor/libgit2/src/libgit2/commit.c +93 -1
- data/vendor/libgit2/src/libgit2/commit_graph.c +68 -58
- data/vendor/libgit2/src/libgit2/commit_graph.h +1 -2
- data/vendor/libgit2/src/libgit2/config.c +390 -299
- 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 +101 -89
- 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 +195 -40
- data/vendor/libgit2/src/libgit2/config_parse.c +12 -10
- data/vendor/libgit2/src/libgit2/config_snapshot.c +24 -31
- data/vendor/libgit2/src/libgit2/delta.c +5 -1
- 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 +13 -20
- 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_stats.c +19 -12
- 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/fetchhead.c +1 -1
- 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 +76 -98
- data/vendor/libgit2/src/libgit2/index.h +5 -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 +36 -40
- 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 +43 -38
- data/vendor/libgit2/src/libgit2/merge.h +4 -0
- data/vendor/libgit2/src/libgit2/merge_driver.c +2 -2
- data/vendor/libgit2/src/libgit2/merge_file.c +43 -30
- data/vendor/libgit2/src/libgit2/message.c +1 -1
- data/vendor/libgit2/src/libgit2/midx.c +30 -18
- 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 +7 -10
- data/vendor/libgit2/src/libgit2/odb_loose.c +24 -14
- 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 +36 -10
- data/vendor/libgit2/src/libgit2/oid.h +11 -0
- data/vendor/libgit2/src/libgit2/pack-objects.c +59 -34
- data/vendor/libgit2/src/libgit2/pack-objects.h +12 -4
- data/vendor/libgit2/src/libgit2/pack.c +33 -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 +41 -13
- 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 +125 -62
- data/vendor/libgit2/src/libgit2/remote.h +0 -1
- data/vendor/libgit2/src/libgit2/repository.c +235 -54
- 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/socket.c +30 -0
- data/vendor/libgit2/src/libgit2/streams/stransport.c +39 -7
- data/vendor/libgit2/src/libgit2/submodule.c +118 -68
- data/vendor/libgit2/src/libgit2/submodule.h +6 -7
- data/vendor/libgit2/src/libgit2/tag.c +4 -2
- 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/auth_sspi.c +2 -0
- data/vendor/libgit2/src/libgit2/transports/credential.c +2 -2
- data/vendor/libgit2/src/libgit2/transports/git.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 +124 -81
- 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 +16 -8
- data/vendor/libgit2/src/libgit2/transports/smart.c +25 -13
- data/vendor/libgit2/src/libgit2/transports/smart.h +4 -2
- data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +5 -5
- 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 +386 -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 +7 -10
- 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 +81 -10
- data/vendor/libgit2/src/util/fs_path.h +29 -0
- data/vendor/libgit2/src/util/futils.c +6 -5
- data/vendor/libgit2/src/util/futils.h +24 -7
- 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/builtin.c +14 -4
- data/vendor/libgit2/src/util/hash/openssl.c +148 -0
- data/vendor/libgit2/src/util/hash/openssl.h +17 -1
- data/vendor/libgit2/src/util/hash/rfc6234/sha224-256.c +8 -6
- data/vendor/libgit2/src/util/hash/sha.h +4 -1
- data/vendor/libgit2/src/util/hashmap.h +425 -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 +17 -11
- 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 +223 -0
- data/vendor/libgit2/src/util/rand.c +1 -7
- data/vendor/libgit2/src/util/regexp.c +1 -1
- data/vendor/libgit2/src/util/runtime.c +2 -2
- 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 +20 -8
- data/vendor/libgit2/src/util/str.h +5 -3
- 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 +706 -0
- data/vendor/libgit2/src/util/unix/realpath.c +23 -5
- data/vendor/libgit2/src/util/util.c +18 -5
- data/vendor/libgit2/src/util/util.h +5 -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/path_w32.c +81 -5
- data/vendor/libgit2/src/util/win32/posix_w32.c +29 -6
- data/vendor/libgit2/src/util/win32/process.c +522 -0
- metadata +60 -32
- 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
|
@@ -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,148 @@ 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
|
+
/* Propagate the source repository's object format to the target
|
|
523
|
+
* so that it can read the copied object database. */
|
|
524
|
+
if ((error = git_repository__set_objectformat(
|
|
525
|
+
repo, git_repository_oid_type(src))) < 0)
|
|
526
|
+
goto cleanup;
|
|
527
|
+
|
|
528
|
+
if (git_repository__item_path(&src_odb, src, GIT_REPOSITORY_ITEM_OBJECTS) < 0 ||
|
|
529
|
+
git_repository__item_path(&dst_odb, repo, GIT_REPOSITORY_ITEM_OBJECTS) < 0) {
|
|
530
|
+
error = -1;
|
|
531
|
+
goto cleanup;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
flags = 0;
|
|
535
|
+
if (can_link(git_repository_path(src), git_repository_path(repo), link))
|
|
536
|
+
flags |= GIT_CPDIR_LINK_FILES;
|
|
537
|
+
|
|
538
|
+
error = git_futils_cp_r(git_str_cstr(&src_odb), git_str_cstr(&dst_odb),
|
|
539
|
+
flags, GIT_OBJECT_DIR_MODE);
|
|
540
|
+
|
|
541
|
+
/*
|
|
542
|
+
* can_link() doesn't catch all variations, so if we hit an
|
|
543
|
+
* error and did want to link, let's try again without trying
|
|
544
|
+
* to link.
|
|
545
|
+
*/
|
|
546
|
+
if (error < 0 && link) {
|
|
547
|
+
flags &= ~GIT_CPDIR_LINK_FILES;
|
|
548
|
+
error = git_futils_cp_r(git_str_cstr(&src_odb), git_str_cstr(&dst_odb),
|
|
549
|
+
flags, GIT_OBJECT_DIR_MODE);
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
if (error < 0)
|
|
553
|
+
goto cleanup;
|
|
554
|
+
|
|
555
|
+
git_str_printf(&reflog_message, "clone: from %s", git_remote_url(remote));
|
|
556
|
+
|
|
557
|
+
if ((error = git_remote_fetch(remote, NULL, &opts->fetch_opts, git_str_cstr(&reflog_message))) != 0)
|
|
558
|
+
goto cleanup;
|
|
559
|
+
|
|
560
|
+
error = checkout_branch(repo, remote, opts, git_str_cstr(&reflog_message));
|
|
561
|
+
|
|
562
|
+
cleanup:
|
|
563
|
+
git_str_dispose(&reflog_message);
|
|
564
|
+
git_str_dispose(&src_path);
|
|
565
|
+
git_str_dispose(&src_odb);
|
|
566
|
+
git_str_dispose(&dst_odb);
|
|
567
|
+
git_repository_free(src);
|
|
568
|
+
return error;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
int git_clone__should_clone_local(
|
|
572
|
+
bool *out,
|
|
573
|
+
const char *url_or_path,
|
|
574
|
+
git_clone_local_t local)
|
|
459
575
|
{
|
|
460
576
|
git_str fromurl = GIT_STR_INIT;
|
|
461
|
-
|
|
462
|
-
|
|
577
|
+
|
|
578
|
+
*out = false;
|
|
463
579
|
|
|
464
580
|
if (local == GIT_CLONE_NO_LOCAL)
|
|
465
581
|
return 0;
|
|
466
582
|
|
|
467
|
-
if ((
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
583
|
+
if (git_net_str_is_url(url_or_path)) {
|
|
584
|
+
/* If GIT_CLONE_LOCAL_AUTO is specified, any url should
|
|
585
|
+
* be treated as remote */
|
|
586
|
+
if (local == GIT_CLONE_LOCAL_AUTO ||
|
|
587
|
+
!git_fs_path_is_local_file_url(url_or_path))
|
|
588
|
+
return 0;
|
|
472
589
|
|
|
473
|
-
|
|
474
|
-
|
|
590
|
+
if (git_fs_path_fromurl(&fromurl, url_or_path) < 0)
|
|
591
|
+
return -1;
|
|
475
592
|
|
|
476
|
-
|
|
477
|
-
|
|
593
|
+
*out = git_fs_path_isdir(git_str_cstr(&fromurl));
|
|
594
|
+
git_str_dispose(&fromurl);
|
|
595
|
+
} else {
|
|
596
|
+
*out = git_fs_path_isdir(url_or_path);
|
|
597
|
+
}
|
|
478
598
|
|
|
479
|
-
|
|
480
|
-
git_str_dispose(&fromurl);
|
|
481
|
-
return is_local;
|
|
599
|
+
return 0;
|
|
482
600
|
}
|
|
483
601
|
|
|
484
|
-
static int
|
|
602
|
+
static int clone_repo(
|
|
485
603
|
git_repository **out,
|
|
486
604
|
const char *url,
|
|
487
605
|
const char *local_path,
|
|
488
|
-
const git_clone_options *
|
|
606
|
+
const git_clone_options *given_opts,
|
|
489
607
|
int use_existing)
|
|
490
608
|
{
|
|
491
609
|
int error = 0;
|
|
@@ -499,11 +617,17 @@ static int git__clone(
|
|
|
499
617
|
GIT_ASSERT_ARG(url);
|
|
500
618
|
GIT_ASSERT_ARG(local_path);
|
|
501
619
|
|
|
502
|
-
if (
|
|
503
|
-
memcpy(&options,
|
|
620
|
+
if (given_opts)
|
|
621
|
+
memcpy(&options, given_opts, sizeof(git_clone_options));
|
|
504
622
|
|
|
505
623
|
GIT_ERROR_CHECK_VERSION(&options, GIT_CLONE_OPTIONS_VERSION, "git_clone_options");
|
|
506
624
|
|
|
625
|
+
/* enforce some behavior on fetch */
|
|
626
|
+
options.fetch_opts.update_fetchhead = 0;
|
|
627
|
+
|
|
628
|
+
if (!options.fetch_opts.depth)
|
|
629
|
+
options.fetch_opts.download_tags = GIT_REMOTE_DOWNLOAD_TAGS_ALL;
|
|
630
|
+
|
|
507
631
|
/* Only clone to a new directory or an empty directory */
|
|
508
632
|
if (git_fs_path_exists(local_path) && !use_existing && !git_fs_path_is_empty_dir(local_path)) {
|
|
509
633
|
git_error_set(GIT_ERROR_INVALID,
|
|
@@ -524,33 +648,31 @@ static int git__clone(
|
|
|
524
648
|
return error;
|
|
525
649
|
|
|
526
650
|
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);
|
|
651
|
+
bool clone_local;
|
|
652
|
+
|
|
653
|
+
if ((error = git_clone__should_clone_local(&clone_local, url, options.local)) < 0) {
|
|
654
|
+
git_remote_free(origin);
|
|
655
|
+
return error;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
if (clone_local)
|
|
659
|
+
error = clone_local_into(repo, origin, &options);
|
|
538
660
|
else
|
|
539
|
-
error =
|
|
661
|
+
error = clone_into(repo, origin, &options);
|
|
540
662
|
|
|
541
663
|
git_remote_free(origin);
|
|
542
664
|
}
|
|
543
665
|
|
|
544
666
|
if (error != 0) {
|
|
545
|
-
|
|
546
|
-
|
|
667
|
+
git_error *last_error;
|
|
668
|
+
git_error_save(&last_error);
|
|
547
669
|
|
|
548
670
|
git_repository_free(repo);
|
|
549
671
|
repo = NULL;
|
|
550
672
|
|
|
551
673
|
(void)git_futils_rmdir_r(local_path, NULL, rmdir_flags);
|
|
552
674
|
|
|
553
|
-
|
|
675
|
+
git_error_restore(last_error);
|
|
554
676
|
}
|
|
555
677
|
|
|
556
678
|
*out = repo;
|
|
@@ -561,18 +683,18 @@ int git_clone(
|
|
|
561
683
|
git_repository **out,
|
|
562
684
|
const char *url,
|
|
563
685
|
const char *local_path,
|
|
564
|
-
const git_clone_options *
|
|
686
|
+
const git_clone_options *options)
|
|
565
687
|
{
|
|
566
|
-
return
|
|
688
|
+
return clone_repo(out, url, local_path, options, 0);
|
|
567
689
|
}
|
|
568
690
|
|
|
569
691
|
int git_clone__submodule(
|
|
570
692
|
git_repository **out,
|
|
571
693
|
const char *url,
|
|
572
694
|
const char *local_path,
|
|
573
|
-
const git_clone_options *
|
|
695
|
+
const git_clone_options *options)
|
|
574
696
|
{
|
|
575
|
-
return
|
|
697
|
+
return clone_repo(out, url, local_path, options, 1);
|
|
576
698
|
}
|
|
577
699
|
|
|
578
700
|
int git_clone_options_init(git_clone_options *opts, unsigned int version)
|
|
@@ -588,99 +710,3 @@ int git_clone_init_options(git_clone_options *opts, unsigned int version)
|
|
|
588
710
|
return git_clone_options_init(opts, version);
|
|
589
711
|
}
|
|
590
712
|
#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
|
-
}
|
|
@@ -15,6 +15,9 @@ extern int git_clone__submodule(git_repository **out,
|
|
|
15
15
|
const char *url, const char *local_path,
|
|
16
16
|
const git_clone_options *_options);
|
|
17
17
|
|
|
18
|
-
extern int git_clone__should_clone_local(
|
|
18
|
+
extern int git_clone__should_clone_local(
|
|
19
|
+
bool *out,
|
|
20
|
+
const char *url,
|
|
21
|
+
git_clone_local_t local);
|
|
19
22
|
|
|
20
23
|
#endif
|
|
@@ -340,7 +340,7 @@ int git_commit_amend(
|
|
|
340
340
|
{
|
|
341
341
|
git_repository *repo;
|
|
342
342
|
git_oid tree_id;
|
|
343
|
-
git_reference *ref;
|
|
343
|
+
git_reference *ref = NULL;
|
|
344
344
|
int error;
|
|
345
345
|
|
|
346
346
|
GIT_ASSERT_ARG(id);
|
|
@@ -1086,6 +1086,83 @@ cleanup:
|
|
|
1086
1086
|
return error;
|
|
1087
1087
|
}
|
|
1088
1088
|
|
|
1089
|
+
int git_commit_create_from_stage(
|
|
1090
|
+
git_oid *out,
|
|
1091
|
+
git_repository *repo,
|
|
1092
|
+
const char *message,
|
|
1093
|
+
const git_commit_create_options *given_opts)
|
|
1094
|
+
{
|
|
1095
|
+
git_commit_create_options opts = GIT_COMMIT_CREATE_OPTIONS_INIT;
|
|
1096
|
+
git_signature *default_signature = NULL;
|
|
1097
|
+
const git_signature *author, *committer;
|
|
1098
|
+
git_index *index = NULL;
|
|
1099
|
+
git_diff *diff = NULL;
|
|
1100
|
+
git_oid tree_id;
|
|
1101
|
+
git_tree *head_tree = NULL, *tree = NULL;
|
|
1102
|
+
git_commitarray parents = { 0 };
|
|
1103
|
+
int error = -1;
|
|
1104
|
+
|
|
1105
|
+
GIT_ASSERT_ARG(out && repo);
|
|
1106
|
+
|
|
1107
|
+
if (given_opts)
|
|
1108
|
+
memcpy(&opts, given_opts, sizeof(git_commit_create_options));
|
|
1109
|
+
|
|
1110
|
+
author = opts.author;
|
|
1111
|
+
committer = opts.committer;
|
|
1112
|
+
|
|
1113
|
+
if (!author || !committer) {
|
|
1114
|
+
if (git_signature_default(&default_signature, repo) < 0)
|
|
1115
|
+
goto done;
|
|
1116
|
+
|
|
1117
|
+
if (!author)
|
|
1118
|
+
author = default_signature;
|
|
1119
|
+
|
|
1120
|
+
if (!committer)
|
|
1121
|
+
committer = default_signature;
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
if (git_repository_index(&index, repo) < 0)
|
|
1125
|
+
goto done;
|
|
1126
|
+
|
|
1127
|
+
if (!opts.allow_empty_commit) {
|
|
1128
|
+
error = git_repository_head_tree(&head_tree, repo);
|
|
1129
|
+
|
|
1130
|
+
if (error && error != GIT_EUNBORNBRANCH)
|
|
1131
|
+
goto done;
|
|
1132
|
+
|
|
1133
|
+
error = -1;
|
|
1134
|
+
|
|
1135
|
+
if (git_diff_tree_to_index(&diff, repo, head_tree, index, NULL) < 0)
|
|
1136
|
+
goto done;
|
|
1137
|
+
|
|
1138
|
+
if (git_diff_num_deltas(diff) == 0) {
|
|
1139
|
+
git_error_set(GIT_ERROR_REPOSITORY,
|
|
1140
|
+
"no changes are staged for commit");
|
|
1141
|
+
error = GIT_EUNCHANGED;
|
|
1142
|
+
goto done;
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
if (git_index_write_tree(&tree_id, index) < 0 ||
|
|
1147
|
+
git_tree_lookup(&tree, repo, &tree_id) < 0 ||
|
|
1148
|
+
git_repository_commit_parents(&parents, repo) < 0)
|
|
1149
|
+
goto done;
|
|
1150
|
+
|
|
1151
|
+
error = git_commit_create(out, repo, "HEAD", author, committer,
|
|
1152
|
+
opts.message_encoding, message,
|
|
1153
|
+
tree, parents.count,
|
|
1154
|
+
(const git_commit **)parents.commits);
|
|
1155
|
+
|
|
1156
|
+
done:
|
|
1157
|
+
git_commitarray_dispose(&parents);
|
|
1158
|
+
git_signature_free(default_signature);
|
|
1159
|
+
git_tree_free(tree);
|
|
1160
|
+
git_tree_free(head_tree);
|
|
1161
|
+
git_diff_free(diff);
|
|
1162
|
+
git_index_free(index);
|
|
1163
|
+
return error;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1089
1166
|
int git_commit_committer_with_mailmap(
|
|
1090
1167
|
git_signature **out, const git_commit *commit, const git_mailmap *mailmap)
|
|
1091
1168
|
{
|
|
@@ -1097,3 +1174,18 @@ int git_commit_author_with_mailmap(
|
|
|
1097
1174
|
{
|
|
1098
1175
|
return git_mailmap_resolve_signature(out, mailmap, commit->author);
|
|
1099
1176
|
}
|
|
1177
|
+
|
|
1178
|
+
void git_commitarray_dispose(git_commitarray *array)
|
|
1179
|
+
{
|
|
1180
|
+
size_t i;
|
|
1181
|
+
|
|
1182
|
+
if (array == NULL)
|
|
1183
|
+
return;
|
|
1184
|
+
|
|
1185
|
+
for (i = 0; i < array->count; i++)
|
|
1186
|
+
git_commit_free(array->commits[i]);
|
|
1187
|
+
|
|
1188
|
+
git__free((git_commit **)array->commits);
|
|
1189
|
+
|
|
1190
|
+
memset(array, 0, sizeof(*array));
|
|
1191
|
+
}
|