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
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
#include "submodule.h"
|
|
35
35
|
#include "worktree.h"
|
|
36
36
|
#include "path.h"
|
|
37
|
-
#include "strmap.h"
|
|
38
37
|
|
|
39
38
|
#ifdef GIT_WIN32
|
|
40
39
|
# include "win32/w32_util.h"
|
|
@@ -62,7 +61,8 @@ static const struct {
|
|
|
62
61
|
{ GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "hooks", true },
|
|
63
62
|
{ GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "logs", true },
|
|
64
63
|
{ GIT_REPOSITORY_ITEM_GITDIR, GIT_REPOSITORY_ITEM__LAST, "modules", true },
|
|
65
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "worktrees", true }
|
|
64
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "worktrees", true },
|
|
65
|
+
{ GIT_REPOSITORY_ITEM_GITDIR, GIT_REPOSITORY_ITEM_GITDIR, "config.worktree", false }
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
static int check_repositoryformatversion(int *version, git_config *config);
|
|
@@ -328,19 +328,34 @@ on_error:
|
|
|
328
328
|
return NULL;
|
|
329
329
|
}
|
|
330
330
|
|
|
331
|
-
int
|
|
331
|
+
int git_repository__new(git_repository **out, git_oid_t oid_type)
|
|
332
332
|
{
|
|
333
333
|
git_repository *repo;
|
|
334
334
|
|
|
335
335
|
*out = repo = repository_alloc();
|
|
336
336
|
GIT_ERROR_CHECK_ALLOC(repo);
|
|
337
337
|
|
|
338
|
+
GIT_ASSERT_ARG(git_oid_type_is_valid(oid_type));
|
|
339
|
+
|
|
338
340
|
repo->is_bare = 1;
|
|
339
341
|
repo->is_worktree = 0;
|
|
342
|
+
repo->oid_type = oid_type;
|
|
340
343
|
|
|
341
344
|
return 0;
|
|
342
345
|
}
|
|
343
346
|
|
|
347
|
+
#ifdef GIT_EXPERIMENTAL_SHA256
|
|
348
|
+
int git_repository_new(git_repository **out, git_repository_new_options *opts)
|
|
349
|
+
{
|
|
350
|
+
return git_repository__new(out, opts && opts->oid_type ? opts->oid_type : GIT_OID_DEFAULT);
|
|
351
|
+
}
|
|
352
|
+
#else
|
|
353
|
+
int git_repository_new(git_repository** out)
|
|
354
|
+
{
|
|
355
|
+
return git_repository__new(out, GIT_OID_SHA1);
|
|
356
|
+
}
|
|
357
|
+
#endif
|
|
358
|
+
|
|
344
359
|
static int load_config_data(git_repository *repo, const git_config *config)
|
|
345
360
|
{
|
|
346
361
|
int is_bare;
|
|
@@ -545,25 +560,39 @@ typedef struct {
|
|
|
545
560
|
static int validate_ownership_cb(const git_config_entry *entry, void *payload)
|
|
546
561
|
{
|
|
547
562
|
validate_ownership_data *data = payload;
|
|
563
|
+
const char *test_path;
|
|
548
564
|
|
|
549
|
-
if (strcmp(entry->value, "") == 0) {
|
|
565
|
+
if (!entry->value || strcmp(entry->value, "") == 0) {
|
|
550
566
|
*data->is_safe = false;
|
|
551
567
|
} else if (strcmp(entry->value, "*") == 0) {
|
|
552
568
|
*data->is_safe = true;
|
|
553
569
|
} else {
|
|
554
|
-
|
|
570
|
+
if (git_str_sets(&data->tmp, entry->value) < 0)
|
|
571
|
+
return -1;
|
|
572
|
+
|
|
573
|
+
if (!git_fs_path_is_root(data->tmp.ptr)) {
|
|
574
|
+
/* Input must not have trailing backslash. */
|
|
575
|
+
if (!data->tmp.size ||
|
|
576
|
+
data->tmp.ptr[data->tmp.size - 1] == '/')
|
|
577
|
+
return 0;
|
|
578
|
+
|
|
579
|
+
if (git_fs_path_to_dir(&data->tmp) < 0)
|
|
580
|
+
return -1;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
test_path = data->tmp.ptr;
|
|
555
584
|
|
|
556
|
-
#ifdef GIT_WIN32
|
|
557
585
|
/*
|
|
558
|
-
* Git for Windows does some
|
|
559
|
-
* paths that start with a
|
|
560
|
-
* to escape that with
|
|
561
|
-
*
|
|
562
|
-
*
|
|
563
|
-
*
|
|
564
|
-
*
|
|
565
|
-
*
|
|
566
|
-
*
|
|
586
|
+
* Git - and especially, Git for Windows - does some
|
|
587
|
+
* truly bizarre things with paths that start with a
|
|
588
|
+
* forward slash; and expects you to escape that with
|
|
589
|
+
* `%(prefix)`. This syntax generally means to add the
|
|
590
|
+
* prefix that Git was installed to (eg `/usr/local`)
|
|
591
|
+
* unless it's an absolute path, in which case the
|
|
592
|
+
* leading `%(prefix)/` is just removed. And Git for
|
|
593
|
+
* Windows expects you to use this syntax for absolute
|
|
594
|
+
* Unix-style paths (in "Git Bash" or Windows Subsystem
|
|
595
|
+
* for Linux).
|
|
567
596
|
*
|
|
568
597
|
* Worse, the behavior used to be that a leading `/` was
|
|
569
598
|
* not absolute. It would indicate that Git for Windows
|
|
@@ -578,13 +607,8 @@ static int validate_ownership_cb(const git_config_entry *entry, void *payload)
|
|
|
578
607
|
*/
|
|
579
608
|
if (strncmp(test_path, "%(prefix)//", strlen("%(prefix)//")) == 0)
|
|
580
609
|
test_path += strlen("%(prefix)/");
|
|
581
|
-
else if (strncmp(test_path, "//", 2) == 0 &&
|
|
582
|
-
strncmp(test_path, "//wsl.localhost/", strlen("//wsl.localhost/")) != 0)
|
|
583
|
-
test_path++;
|
|
584
|
-
#endif
|
|
585
610
|
|
|
586
|
-
if (
|
|
587
|
-
strcmp(data->tmp.ptr, data->repo_path) == 0)
|
|
611
|
+
if (strcmp(test_path, data->repo_path) == 0)
|
|
588
612
|
*data->is_safe = true;
|
|
589
613
|
}
|
|
590
614
|
|
|
@@ -643,7 +667,7 @@ static int validate_ownership_path(bool *is_safe, const char *path)
|
|
|
643
667
|
|
|
644
668
|
static int validate_ownership(git_repository *repo)
|
|
645
669
|
{
|
|
646
|
-
const char *validation_paths[3] = { NULL }, *path;
|
|
670
|
+
const char *validation_paths[3] = { NULL }, *path = NULL;
|
|
647
671
|
size_t validation_len = 0, i;
|
|
648
672
|
bool is_safe = false;
|
|
649
673
|
int error = 0;
|
|
@@ -681,9 +705,12 @@ static int validate_ownership(git_repository *repo)
|
|
|
681
705
|
goto done;
|
|
682
706
|
|
|
683
707
|
if (!is_safe) {
|
|
708
|
+
size_t path_len = git_fs_path_is_root(path) ?
|
|
709
|
+
strlen(path) : git_fs_path_dirlen(path);
|
|
710
|
+
|
|
684
711
|
git_error_set(GIT_ERROR_CONFIG,
|
|
685
|
-
"repository path '
|
|
686
|
-
path);
|
|
712
|
+
"repository path '%.*s' is not owned by current user",
|
|
713
|
+
(int)min(path_len, INT_MAX), path);
|
|
687
714
|
error = GIT_EOWNER;
|
|
688
715
|
}
|
|
689
716
|
|
|
@@ -852,8 +879,30 @@ static int load_grafts(git_repository *repo)
|
|
|
852
879
|
git_str path = GIT_STR_INIT;
|
|
853
880
|
int error;
|
|
854
881
|
|
|
855
|
-
|
|
856
|
-
|
|
882
|
+
/* refresh if they've both been opened previously */
|
|
883
|
+
if (repo->grafts && repo->shallow_grafts) {
|
|
884
|
+
if ((error = git_grafts_refresh(repo->grafts)) < 0 ||
|
|
885
|
+
(error = git_grafts_refresh(repo->shallow_grafts)) < 0)
|
|
886
|
+
return error;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
/* resolve info path, which may not be found for inmemory repository */
|
|
890
|
+
if ((error = git_repository__item_path(&path, repo, GIT_REPOSITORY_ITEM_INFO)) < 0) {
|
|
891
|
+
if (error != GIT_ENOTFOUND)
|
|
892
|
+
return error;
|
|
893
|
+
|
|
894
|
+
/* create empty/inmemory grafts for inmemory repository */
|
|
895
|
+
if (!repo->grafts && (error = git_grafts_new(&repo->grafts, repo->oid_type)) < 0)
|
|
896
|
+
return error;
|
|
897
|
+
|
|
898
|
+
if (!repo->shallow_grafts && (error = git_grafts_new(&repo->shallow_grafts, repo->oid_type)) < 0)
|
|
899
|
+
return error;
|
|
900
|
+
|
|
901
|
+
return 0;
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
/* load grafts from disk */
|
|
905
|
+
if ((error = git_str_joinpath(&path, path.ptr, "grafts")) < 0 ||
|
|
857
906
|
(error = git_grafts_open_or_refresh(&repo->grafts, path.ptr, repo->oid_type)) < 0)
|
|
858
907
|
goto error;
|
|
859
908
|
|
|
@@ -1174,17 +1223,15 @@ out:
|
|
|
1174
1223
|
return err;
|
|
1175
1224
|
}
|
|
1176
1225
|
|
|
1177
|
-
int
|
|
1178
|
-
git_repository **out,
|
|
1179
|
-
git_odb *odb,
|
|
1180
|
-
git_oid_t oid_type)
|
|
1226
|
+
int git_repository_wrap_odb(git_repository **out, git_odb *odb)
|
|
1181
1227
|
{
|
|
1182
1228
|
git_repository *repo;
|
|
1183
1229
|
|
|
1184
1230
|
repo = repository_alloc();
|
|
1185
1231
|
GIT_ERROR_CHECK_ALLOC(repo);
|
|
1186
1232
|
|
|
1187
|
-
|
|
1233
|
+
GIT_ASSERT(git_oid_type_is_valid(odb->options.oid_type));
|
|
1234
|
+
repo->oid_type = odb->options.oid_type;
|
|
1188
1235
|
|
|
1189
1236
|
git_repository_set_odb(repo, odb);
|
|
1190
1237
|
*out = repo;
|
|
@@ -1192,21 +1239,6 @@ int git_repository__wrap_odb(
|
|
|
1192
1239
|
return 0;
|
|
1193
1240
|
}
|
|
1194
1241
|
|
|
1195
|
-
#ifdef GIT_EXPERIMENTAL_SHA256
|
|
1196
|
-
int git_repository_wrap_odb(
|
|
1197
|
-
git_repository **out,
|
|
1198
|
-
git_odb *odb,
|
|
1199
|
-
git_oid_t oid_type)
|
|
1200
|
-
{
|
|
1201
|
-
return git_repository__wrap_odb(out, odb, oid_type);
|
|
1202
|
-
}
|
|
1203
|
-
#else
|
|
1204
|
-
int git_repository_wrap_odb(git_repository **out, git_odb *odb)
|
|
1205
|
-
{
|
|
1206
|
-
return git_repository__wrap_odb(out, odb, GIT_OID_DEFAULT);
|
|
1207
|
-
}
|
|
1208
|
-
#endif
|
|
1209
|
-
|
|
1210
1242
|
int git_repository_discover(
|
|
1211
1243
|
git_buf *out,
|
|
1212
1244
|
const char *start_path,
|
|
@@ -1226,6 +1258,24 @@ int git_repository_discover(
|
|
|
1226
1258
|
return error;
|
|
1227
1259
|
}
|
|
1228
1260
|
|
|
1261
|
+
static int has_config_worktree(bool *out, git_config *cfg)
|
|
1262
|
+
{
|
|
1263
|
+
int worktreeconfig = 0, error;
|
|
1264
|
+
|
|
1265
|
+
*out = false;
|
|
1266
|
+
|
|
1267
|
+
error = git_config_get_bool(&worktreeconfig, cfg, "extensions.worktreeconfig");
|
|
1268
|
+
|
|
1269
|
+
if (error == 0)
|
|
1270
|
+
*out = worktreeconfig;
|
|
1271
|
+
else if (error == GIT_ENOTFOUND)
|
|
1272
|
+
*out = false;
|
|
1273
|
+
else
|
|
1274
|
+
return error;
|
|
1275
|
+
|
|
1276
|
+
return 0;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1229
1279
|
static int load_config(
|
|
1230
1280
|
git_config **out,
|
|
1231
1281
|
git_repository *repo,
|
|
@@ -1234,9 +1284,11 @@ static int load_config(
|
|
|
1234
1284
|
const char *system_config_path,
|
|
1235
1285
|
const char *programdata_path)
|
|
1236
1286
|
{
|
|
1237
|
-
int error;
|
|
1238
1287
|
git_str config_path = GIT_STR_INIT;
|
|
1239
1288
|
git_config *cfg = NULL;
|
|
1289
|
+
git_config_level_t write_order;
|
|
1290
|
+
bool has_worktree;
|
|
1291
|
+
int error;
|
|
1240
1292
|
|
|
1241
1293
|
GIT_ASSERT_ARG(out);
|
|
1242
1294
|
|
|
@@ -1250,6 +1302,14 @@ static int load_config(
|
|
|
1250
1302
|
if (error && error != GIT_ENOTFOUND)
|
|
1251
1303
|
goto on_error;
|
|
1252
1304
|
|
|
1305
|
+
if ((error = has_config_worktree(&has_worktree, cfg)) == 0 &&
|
|
1306
|
+
has_worktree &&
|
|
1307
|
+
(error = git_repository__item_path(&config_path, repo, GIT_REPOSITORY_ITEM_WORKTREE_CONFIG)) == 0)
|
|
1308
|
+
error = git_config_add_file_ondisk(cfg, config_path.ptr, GIT_CONFIG_LEVEL_WORKTREE, repo, 0);
|
|
1309
|
+
|
|
1310
|
+
if (error && error != GIT_ENOTFOUND)
|
|
1311
|
+
goto on_error;
|
|
1312
|
+
|
|
1253
1313
|
git_str_dispose(&config_path);
|
|
1254
1314
|
}
|
|
1255
1315
|
|
|
@@ -1279,6 +1339,11 @@ static int load_config(
|
|
|
1279
1339
|
|
|
1280
1340
|
git_error_clear(); /* clear any lingering ENOTFOUND errors */
|
|
1281
1341
|
|
|
1342
|
+
write_order = GIT_CONFIG_LEVEL_LOCAL;
|
|
1343
|
+
|
|
1344
|
+
if ((error = git_config_set_writeorder(cfg, &write_order, 1)) < 0)
|
|
1345
|
+
goto on_error;
|
|
1346
|
+
|
|
1282
1347
|
*out = cfg;
|
|
1283
1348
|
return 0;
|
|
1284
1349
|
|
|
@@ -1345,7 +1410,7 @@ int git_repository_config__weakptr(git_config **out, git_repository *repo)
|
|
|
1345
1410
|
git_str xdg_buf = GIT_STR_INIT;
|
|
1346
1411
|
git_str programdata_buf = GIT_STR_INIT;
|
|
1347
1412
|
bool use_env = repo->use_env;
|
|
1348
|
-
git_config *config;
|
|
1413
|
+
git_config *config = NULL;
|
|
1349
1414
|
|
|
1350
1415
|
if (!(error = config_path_system(&system_buf, use_env)) &&
|
|
1351
1416
|
!(error = config_path_global(&global_buf, use_env))) {
|
|
@@ -1798,7 +1863,10 @@ static int check_repositoryformatversion(int *version, git_config *config)
|
|
|
1798
1863
|
|
|
1799
1864
|
static const char *builtin_extensions[] = {
|
|
1800
1865
|
"noop",
|
|
1801
|
-
"objectformat"
|
|
1866
|
+
"objectformat",
|
|
1867
|
+
"worktreeconfig",
|
|
1868
|
+
"preciousobjects",
|
|
1869
|
+
"relativeworktrees"
|
|
1802
1870
|
};
|
|
1803
1871
|
|
|
1804
1872
|
static git_vector user_extensions = { 0, git__strcmp_cb };
|
|
@@ -2024,7 +2092,7 @@ int git_repository__set_extensions(const char **extensions, size_t len)
|
|
|
2024
2092
|
|
|
2025
2093
|
void git_repository__free_extensions(void)
|
|
2026
2094
|
{
|
|
2027
|
-
|
|
2095
|
+
git_vector_dispose_deep(&user_extensions);
|
|
2028
2096
|
}
|
|
2029
2097
|
|
|
2030
2098
|
int git_repository_create_head(const char *git_dir, const char *ref_name)
|
|
@@ -2439,7 +2507,7 @@ static int repo_write_gitlink(
|
|
|
2439
2507
|
error = git_fs_path_make_relative(&path_to_repo, in_dir);
|
|
2440
2508
|
|
|
2441
2509
|
if (!error)
|
|
2442
|
-
error =
|
|
2510
|
+
error = git_str_printf(&buf, "%s %s\n", GIT_FILE_CONTENT_PREFIX, path_to_repo.ptr);
|
|
2443
2511
|
|
|
2444
2512
|
if (!error)
|
|
2445
2513
|
error = repo_write_template(in_dir, true, DOT_GIT, 0666, true, buf.ptr);
|
|
@@ -2471,7 +2539,8 @@ static int repo_init_structure(
|
|
|
2471
2539
|
int error = 0;
|
|
2472
2540
|
repo_template_item *tpl;
|
|
2473
2541
|
bool external_tpl =
|
|
2474
|
-
|
|
2542
|
+
opts->template_path != NULL ||
|
|
2543
|
+
(opts->flags & GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE) != 0;
|
|
2475
2544
|
mode_t dmode = pick_dir_mode(opts);
|
|
2476
2545
|
bool chmod = opts->mode != GIT_REPOSITORY_INIT_SHARED_UMASK;
|
|
2477
2546
|
|
|
@@ -2630,6 +2699,8 @@ static int repo_init_directories(
|
|
|
2630
2699
|
if (git_str_joinpath(repo_path, given_repo, add_dotgit ? GIT_DIR : "") < 0)
|
|
2631
2700
|
return -1;
|
|
2632
2701
|
|
|
2702
|
+
git_fs_path_mkposix(repo_path->ptr);
|
|
2703
|
+
|
|
2633
2704
|
has_dotgit = (git__suffixcmp(repo_path->ptr, "/" GIT_DIR) == 0);
|
|
2634
2705
|
if (has_dotgit)
|
|
2635
2706
|
opts->flags |= GIT_REPOSITORY_INIT__HAS_DOTGIT;
|
|
@@ -3197,14 +3268,18 @@ int git_repository_set_workdir(
|
|
|
3197
3268
|
if (git_fs_path_prettify_dir(&path, workdir, NULL) < 0)
|
|
3198
3269
|
return -1;
|
|
3199
3270
|
|
|
3200
|
-
if (repo->workdir && strcmp(repo->workdir, path.ptr) == 0)
|
|
3271
|
+
if (repo->workdir && strcmp(repo->workdir, path.ptr) == 0) {
|
|
3272
|
+
git_str_dispose(&path);
|
|
3201
3273
|
return 0;
|
|
3274
|
+
}
|
|
3202
3275
|
|
|
3203
3276
|
if (update_gitlink) {
|
|
3204
3277
|
git_config *config;
|
|
3205
3278
|
|
|
3206
|
-
if (git_repository_config__weakptr(&config, repo) < 0)
|
|
3279
|
+
if (git_repository_config__weakptr(&config, repo) < 0) {
|
|
3280
|
+
git_str_dispose(&path);
|
|
3207
3281
|
return -1;
|
|
3282
|
+
}
|
|
3208
3283
|
|
|
3209
3284
|
error = repo_write_gitlink(path.ptr, git_repository_path(repo), false);
|
|
3210
3285
|
|
|
@@ -3226,6 +3301,7 @@ int git_repository_set_workdir(
|
|
|
3226
3301
|
|
|
3227
3302
|
git__free(old_workdir);
|
|
3228
3303
|
}
|
|
3304
|
+
git_str_dispose(&path);
|
|
3229
3305
|
|
|
3230
3306
|
return error;
|
|
3231
3307
|
}
|
|
@@ -3268,6 +3344,25 @@ int git_repository_set_bare(git_repository *repo)
|
|
|
3268
3344
|
return 0;
|
|
3269
3345
|
}
|
|
3270
3346
|
|
|
3347
|
+
int git_repository_head_commit(git_commit **commit, git_repository *repo)
|
|
3348
|
+
{
|
|
3349
|
+
git_reference *head;
|
|
3350
|
+
git_object *obj;
|
|
3351
|
+
int error;
|
|
3352
|
+
|
|
3353
|
+
if ((error = git_repository_head(&head, repo)) < 0)
|
|
3354
|
+
return error;
|
|
3355
|
+
|
|
3356
|
+
if ((error = git_reference_peel(&obj, head, GIT_OBJECT_COMMIT)) < 0)
|
|
3357
|
+
goto cleanup;
|
|
3358
|
+
|
|
3359
|
+
*commit = (git_commit *)obj;
|
|
3360
|
+
|
|
3361
|
+
cleanup:
|
|
3362
|
+
git_reference_free(head);
|
|
3363
|
+
return error;
|
|
3364
|
+
}
|
|
3365
|
+
|
|
3271
3366
|
int git_repository_head_tree(git_tree **tree, git_repository *repo)
|
|
3272
3367
|
{
|
|
3273
3368
|
git_reference *head;
|
|
@@ -3839,3 +3934,89 @@ git_oid_t git_repository_oid_type(git_repository *repo)
|
|
|
3839
3934
|
{
|
|
3840
3935
|
return repo ? repo->oid_type : 0;
|
|
3841
3936
|
}
|
|
3937
|
+
|
|
3938
|
+
struct mergehead_data {
|
|
3939
|
+
git_repository *repo;
|
|
3940
|
+
git_vector *parents;
|
|
3941
|
+
};
|
|
3942
|
+
|
|
3943
|
+
static int insert_mergehead(const git_oid *oid, void *payload)
|
|
3944
|
+
{
|
|
3945
|
+
git_commit *commit;
|
|
3946
|
+
struct mergehead_data *data = (struct mergehead_data *)payload;
|
|
3947
|
+
|
|
3948
|
+
if (git_commit_lookup(&commit, data->repo, oid) < 0)
|
|
3949
|
+
return -1;
|
|
3950
|
+
|
|
3951
|
+
return git_vector_insert(data->parents, commit);
|
|
3952
|
+
}
|
|
3953
|
+
|
|
3954
|
+
int git_repository_commit_parents(git_commitarray *out, git_repository *repo)
|
|
3955
|
+
{
|
|
3956
|
+
git_commit *first_parent = NULL, *commit;
|
|
3957
|
+
git_reference *head_ref = NULL;
|
|
3958
|
+
git_vector parents = GIT_VECTOR_INIT;
|
|
3959
|
+
struct mergehead_data data;
|
|
3960
|
+
size_t i;
|
|
3961
|
+
int error;
|
|
3962
|
+
|
|
3963
|
+
GIT_ASSERT_ARG(out && repo);
|
|
3964
|
+
|
|
3965
|
+
out->count = 0;
|
|
3966
|
+
out->commits = NULL;
|
|
3967
|
+
|
|
3968
|
+
error = git_revparse_ext((git_object **)&first_parent, &head_ref, repo, "HEAD");
|
|
3969
|
+
|
|
3970
|
+
if (error != 0) {
|
|
3971
|
+
if (error == GIT_ENOTFOUND)
|
|
3972
|
+
error = 0;
|
|
3973
|
+
|
|
3974
|
+
goto done;
|
|
3975
|
+
}
|
|
3976
|
+
|
|
3977
|
+
if ((error = git_vector_insert(&parents, first_parent)) < 0)
|
|
3978
|
+
goto done;
|
|
3979
|
+
|
|
3980
|
+
data.repo = repo;
|
|
3981
|
+
data.parents = &parents;
|
|
3982
|
+
|
|
3983
|
+
error = git_repository_mergehead_foreach(repo, insert_mergehead, &data);
|
|
3984
|
+
|
|
3985
|
+
if (error == GIT_ENOTFOUND)
|
|
3986
|
+
error = 0;
|
|
3987
|
+
else if (error != 0)
|
|
3988
|
+
goto done;
|
|
3989
|
+
|
|
3990
|
+
out->commits = (git_commit **)git_vector_detach(&out->count, NULL, &parents);
|
|
3991
|
+
|
|
3992
|
+
done:
|
|
3993
|
+
git_vector_foreach(&parents, i, commit)
|
|
3994
|
+
git__free(commit);
|
|
3995
|
+
|
|
3996
|
+
git_reference_free(head_ref);
|
|
3997
|
+
return error;
|
|
3998
|
+
}
|
|
3999
|
+
|
|
4000
|
+
int git_repository__abbrev_length(int *out, git_repository *repo)
|
|
4001
|
+
{
|
|
4002
|
+
size_t oid_hexsize;
|
|
4003
|
+
int len;
|
|
4004
|
+
int error;
|
|
4005
|
+
|
|
4006
|
+
oid_hexsize = git_oid_hexsize(repo->oid_type);
|
|
4007
|
+
|
|
4008
|
+
if ((error = git_repository__configmap_lookup(&len, repo, GIT_CONFIGMAP_ABBREV)) < 0)
|
|
4009
|
+
return error;
|
|
4010
|
+
|
|
4011
|
+
if (len < GIT_ABBREV_MINIMUM) {
|
|
4012
|
+
git_error_set(GIT_ERROR_CONFIG, "invalid oid abbreviation setting: '%d'", len);
|
|
4013
|
+
return -1;
|
|
4014
|
+
}
|
|
4015
|
+
|
|
4016
|
+
if (len == GIT_ABBREV_FALSE || (size_t)len > oid_hexsize)
|
|
4017
|
+
len = (int)oid_hexsize;
|
|
4018
|
+
|
|
4019
|
+
*out = len;
|
|
4020
|
+
|
|
4021
|
+
return error;
|
|
4022
|
+
}
|
|
@@ -102,6 +102,8 @@ typedef enum {
|
|
|
102
102
|
/* core.trustctime */
|
|
103
103
|
GIT_TRUSTCTIME_DEFAULT = GIT_CONFIGMAP_TRUE,
|
|
104
104
|
/* core.abbrev */
|
|
105
|
+
GIT_ABBREV_FALSE = GIT_OID_MAX_HEXSIZE,
|
|
106
|
+
GIT_ABBREV_MINIMUM = 4,
|
|
105
107
|
GIT_ABBREV_DEFAULT = 7,
|
|
106
108
|
/* core.precomposeunicode */
|
|
107
109
|
GIT_PRECOMPOSE_DEFAULT = GIT_CONFIGMAP_FALSE,
|
|
@@ -165,7 +167,7 @@ struct git_repository {
|
|
|
165
167
|
git_atomic32 attr_session_key;
|
|
166
168
|
|
|
167
169
|
intptr_t configmap_cache[GIT_CONFIGMAP_CACHE_MAX];
|
|
168
|
-
|
|
170
|
+
git_submodule_cache *submodule_cache;
|
|
169
171
|
};
|
|
170
172
|
|
|
171
173
|
GIT_INLINE(git_attr_cache *) git_repository_attr_cache(git_repository *repo)
|
|
@@ -173,6 +175,7 @@ GIT_INLINE(git_attr_cache *) git_repository_attr_cache(git_repository *repo)
|
|
|
173
175
|
return repo->attrcache;
|
|
174
176
|
}
|
|
175
177
|
|
|
178
|
+
int git_repository_head_commit(git_commit **commit, git_repository *repo);
|
|
176
179
|
int git_repository_head_tree(git_tree **tree, git_repository *repo);
|
|
177
180
|
int git_repository_create_head(const char *git_dir, const char *ref_name);
|
|
178
181
|
|
|
@@ -196,11 +199,6 @@ int git_repository_index__weakptr(git_index **out, git_repository *repo);
|
|
|
196
199
|
int git_repository_grafts__weakptr(git_grafts **out, git_repository *repo);
|
|
197
200
|
int git_repository_shallow_grafts__weakptr(git_grafts **out, git_repository *repo);
|
|
198
201
|
|
|
199
|
-
int git_repository__wrap_odb(
|
|
200
|
-
git_repository **out,
|
|
201
|
-
git_odb *odb,
|
|
202
|
-
git_oid_t oid_type);
|
|
203
|
-
|
|
204
202
|
/*
|
|
205
203
|
* Configuration map cache
|
|
206
204
|
*
|
|
@@ -210,6 +208,9 @@ int git_repository__wrap_odb(
|
|
|
210
208
|
int git_repository__configmap_lookup(int *out, git_repository *repo, git_configmap_item item);
|
|
211
209
|
void git_repository__configmap_lookup_cache_clear(git_repository *repo);
|
|
212
210
|
|
|
211
|
+
/** Return the length that object names will be abbreviated to. */
|
|
212
|
+
int git_repository__abbrev_length(int *out, git_repository *repo);
|
|
213
|
+
|
|
213
214
|
int git_repository__item_path(git_str *out, const git_repository *repo, git_repository_item_t item);
|
|
214
215
|
|
|
215
216
|
GIT_INLINE(int) git_repository__ensure_not_bare(
|
|
@@ -280,4 +281,7 @@ int git_repository__set_objectformat(
|
|
|
280
281
|
git_repository *repo,
|
|
281
282
|
git_oid_t oid_type);
|
|
282
283
|
|
|
284
|
+
/* SHA256-aware internal functions */
|
|
285
|
+
int git_repository__new(git_repository **out, git_oid_t oid_type);
|
|
286
|
+
|
|
283
287
|
#endif
|
|
@@ -74,8 +74,7 @@ static int revert_normalize_opts(
|
|
|
74
74
|
const char *their_label)
|
|
75
75
|
{
|
|
76
76
|
int error = 0;
|
|
77
|
-
unsigned int default_checkout_strategy =
|
|
78
|
-
GIT_CHECKOUT_ALLOW_CONFLICTS;
|
|
77
|
+
unsigned int default_checkout_strategy = GIT_CHECKOUT_ALLOW_CONFLICTS;
|
|
79
78
|
|
|
80
79
|
GIT_UNUSED(repo);
|
|
81
80
|
|
|
@@ -816,7 +816,7 @@ static int revparse(
|
|
|
816
816
|
if (temp_object != NULL)
|
|
817
817
|
base_rev = temp_object;
|
|
818
818
|
break;
|
|
819
|
-
} else if (spec[pos+1] == '\0') {
|
|
819
|
+
} else if (spec[pos + 1] == '\0' && !pos) {
|
|
820
820
|
spec = "HEAD";
|
|
821
821
|
identifier_len = 4;
|
|
822
822
|
parsed = true;
|
|
@@ -935,7 +935,7 @@ int git_revparse(
|
|
|
935
935
|
* allowed.
|
|
936
936
|
*/
|
|
937
937
|
if (!git__strcmp(spec, "..")) {
|
|
938
|
-
git_error_set(GIT_ERROR_INVALID, "
|
|
938
|
+
git_error_set(GIT_ERROR_INVALID, "invalid pattern '..'");
|
|
939
939
|
return GIT_EINVALIDSPEC;
|
|
940
940
|
}
|
|
941
941
|
|
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
#include "git2/revparse.h"
|
|
15
15
|
#include "merge.h"
|
|
16
16
|
#include "vector.h"
|
|
17
|
+
#include "hashmap_oid.h"
|
|
18
|
+
|
|
19
|
+
GIT_HASHMAP_OID_FUNCTIONS(git_revwalk_oidmap, GIT_HASHMAP_INLINE, git_commit_list_node *);
|
|
17
20
|
|
|
18
21
|
static int get_revision(git_commit_list_node **out, git_revwalk *walk, git_commit_list **list);
|
|
19
22
|
|
|
@@ -23,7 +26,7 @@ git_commit_list_node *git_revwalk__commit_lookup(
|
|
|
23
26
|
git_commit_list_node *commit;
|
|
24
27
|
|
|
25
28
|
/* lookup and reserve space if not already present */
|
|
26
|
-
if ((commit
|
|
29
|
+
if (git_revwalk_oidmap_get(&commit, &walk->commits, oid) == 0)
|
|
27
30
|
return commit;
|
|
28
31
|
|
|
29
32
|
commit = git_commit_list_alloc_node(walk);
|
|
@@ -32,7 +35,7 @@ git_commit_list_node *git_revwalk__commit_lookup(
|
|
|
32
35
|
|
|
33
36
|
git_oid_cpy(&commit->oid, oid);
|
|
34
37
|
|
|
35
|
-
if ((
|
|
38
|
+
if (git_revwalk_oidmap_put(&walk->commits, &commit->oid, commit) < 0)
|
|
36
39
|
return NULL;
|
|
37
40
|
|
|
38
41
|
return commit;
|
|
@@ -623,7 +626,7 @@ static int prepare_walk(git_revwalk *walk)
|
|
|
623
626
|
return GIT_ITEROVER;
|
|
624
627
|
}
|
|
625
628
|
|
|
626
|
-
/*
|
|
629
|
+
/*
|
|
627
630
|
* This is a bit convoluted, but necessary to maintain the order of
|
|
628
631
|
* the commits. This is especially important in situations where
|
|
629
632
|
* git_revwalk__push_glob is called with a git_revwalk__push_options
|
|
@@ -643,13 +646,13 @@ static int prepare_walk(git_revwalk *walk)
|
|
|
643
646
|
git_error_set_oom();
|
|
644
647
|
return -1;
|
|
645
648
|
}
|
|
646
|
-
|
|
649
|
+
|
|
647
650
|
commit->seen = 1;
|
|
648
651
|
if (commits_last == NULL)
|
|
649
652
|
commits = new_list;
|
|
650
653
|
else
|
|
651
654
|
commits_last->next = new_list;
|
|
652
|
-
|
|
655
|
+
|
|
653
656
|
commits_last = new_list;
|
|
654
657
|
}
|
|
655
658
|
}
|
|
@@ -700,8 +703,7 @@ int git_revwalk_new(git_revwalk **revwalk_out, git_repository *repo)
|
|
|
700
703
|
git_revwalk *walk = git__calloc(1, sizeof(git_revwalk));
|
|
701
704
|
GIT_ERROR_CHECK_ALLOC(walk);
|
|
702
705
|
|
|
703
|
-
if (
|
|
704
|
-
git_pqueue_init(&walk->iterator_time, 0, 8, git_commit_list_time_cmp) < 0 ||
|
|
706
|
+
if (git_pqueue_init(&walk->iterator_time, 0, 8, git_commit_list_time_cmp) < 0 ||
|
|
705
707
|
git_pool_init(&walk->commit_pool, COMMIT_ALLOC) < 0)
|
|
706
708
|
return -1;
|
|
707
709
|
|
|
@@ -727,7 +729,7 @@ void git_revwalk_free(git_revwalk *walk)
|
|
|
727
729
|
git_revwalk_reset(walk);
|
|
728
730
|
git_odb_free(walk->odb);
|
|
729
731
|
|
|
730
|
-
|
|
732
|
+
git_revwalk_oidmap_dispose(&walk->commits);
|
|
731
733
|
git_pool_clear(&walk->commit_pool);
|
|
732
734
|
git_pqueue_free(&walk->iterator_time);
|
|
733
735
|
git__free(walk);
|
|
@@ -799,17 +801,18 @@ int git_revwalk_next(git_oid *oid, git_revwalk *walk)
|
|
|
799
801
|
int git_revwalk_reset(git_revwalk *walk)
|
|
800
802
|
{
|
|
801
803
|
git_commit_list_node *commit;
|
|
804
|
+
git_hashmap_iter_t iter = GIT_HASHMAP_ITER_INIT;
|
|
802
805
|
|
|
803
806
|
GIT_ASSERT_ARG(walk);
|
|
804
807
|
|
|
805
|
-
|
|
808
|
+
while (git_revwalk_oidmap_iterate(&iter, NULL, &commit, &walk->commits) == 0) {
|
|
806
809
|
commit->seen = 0;
|
|
807
810
|
commit->in_degree = 0;
|
|
808
811
|
commit->topo_delay = 0;
|
|
809
812
|
commit->uninteresting = 0;
|
|
810
813
|
commit->added = 0;
|
|
811
814
|
commit->flags = 0;
|
|
812
|
-
|
|
815
|
+
}
|
|
813
816
|
|
|
814
817
|
git_pqueue_clear(&walk->iterator_time);
|
|
815
818
|
git_commit_list_free(&walk->iterator_topo);
|
|
@@ -10,19 +10,19 @@
|
|
|
10
10
|
#include "common.h"
|
|
11
11
|
|
|
12
12
|
#include "git2/revwalk.h"
|
|
13
|
-
#include "oidmap.h"
|
|
14
13
|
#include "commit_list.h"
|
|
15
14
|
#include "pqueue.h"
|
|
16
15
|
#include "pool.h"
|
|
17
16
|
#include "vector.h"
|
|
17
|
+
#include "hashmap_oid.h"
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
GIT_HASHMAP_OID_STRUCT(git_revwalk_oidmap, git_commit_list_node *);
|
|
20
20
|
|
|
21
21
|
struct git_revwalk {
|
|
22
22
|
git_repository *repo;
|
|
23
23
|
git_odb *odb;
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
git_revwalk_oidmap commits;
|
|
26
26
|
git_pool commit_pool;
|
|
27
27
|
|
|
28
28
|
git_commit_list *iterator_topo;
|