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
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
#include "config_backend.h"
|
|
9
9
|
|
|
10
10
|
#include "config.h"
|
|
11
|
-
#include "
|
|
11
|
+
#include "config_list.h"
|
|
12
12
|
|
|
13
13
|
typedef struct {
|
|
14
14
|
git_config_backend parent;
|
|
15
15
|
git_mutex values_mutex;
|
|
16
|
-
|
|
16
|
+
git_config_list *config_list;
|
|
17
17
|
git_config_backend *source;
|
|
18
18
|
} config_snapshot_backend;
|
|
19
19
|
|
|
@@ -28,31 +28,27 @@ static int config_snapshot_iterator(
|
|
|
28
28
|
struct git_config_backend *backend)
|
|
29
29
|
{
|
|
30
30
|
config_snapshot_backend *b = GIT_CONTAINER_OF(backend, config_snapshot_backend, parent);
|
|
31
|
-
|
|
31
|
+
git_config_list *config_list = NULL;
|
|
32
32
|
int error;
|
|
33
33
|
|
|
34
|
-
if ((error =
|
|
35
|
-
(error =
|
|
34
|
+
if ((error = git_config_list_dup(&config_list, b->config_list)) < 0 ||
|
|
35
|
+
(error = git_config_list_iterator_new(iter, config_list)) < 0)
|
|
36
36
|
goto out;
|
|
37
37
|
|
|
38
38
|
out:
|
|
39
|
-
/* Let iterator delete duplicated
|
|
40
|
-
|
|
39
|
+
/* Let iterator delete duplicated config_list when it's done */
|
|
40
|
+
git_config_list_free(config_list);
|
|
41
41
|
return error;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
git_config_entries_free(entries);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
static int config_snapshot_get(git_config_backend *cfg, const char *key, git_config_entry **out)
|
|
44
|
+
static int config_snapshot_get(
|
|
45
|
+
git_config_backend *cfg,
|
|
46
|
+
const char *key,
|
|
47
|
+
git_config_backend_entry **out)
|
|
52
48
|
{
|
|
53
49
|
config_snapshot_backend *b = GIT_CONTAINER_OF(cfg, config_snapshot_backend, parent);
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
git_config_list *config_list = NULL;
|
|
51
|
+
git_config_list_entry *entry;
|
|
56
52
|
int error = 0;
|
|
57
53
|
|
|
58
54
|
if (git_mutex_lock(&b->values_mutex) < 0) {
|
|
@@ -60,19 +56,16 @@ static int config_snapshot_get(git_config_backend *cfg, const char *key, git_con
|
|
|
60
56
|
return -1;
|
|
61
57
|
}
|
|
62
58
|
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
config_list = b->config_list;
|
|
60
|
+
git_config_list_incref(config_list);
|
|
65
61
|
git_mutex_unlock(&b->values_mutex);
|
|
66
62
|
|
|
67
|
-
if ((error = (
|
|
68
|
-
|
|
63
|
+
if ((error = (git_config_list_get(&entry, config_list, key))) < 0) {
|
|
64
|
+
git_config_list_free(config_list);
|
|
69
65
|
return error;
|
|
70
66
|
}
|
|
71
67
|
|
|
72
|
-
|
|
73
|
-
entry->payload = entries;
|
|
74
|
-
*out = entry;
|
|
75
|
-
|
|
68
|
+
*out = &entry->base;
|
|
76
69
|
return 0;
|
|
77
70
|
}
|
|
78
71
|
|
|
@@ -135,7 +128,7 @@ static void config_snapshot_free(git_config_backend *_backend)
|
|
|
135
128
|
if (backend == NULL)
|
|
136
129
|
return;
|
|
137
130
|
|
|
138
|
-
|
|
131
|
+
git_config_list_free(backend->config_list);
|
|
139
132
|
git_mutex_free(&backend->values_mutex);
|
|
140
133
|
git__free(backend);
|
|
141
134
|
}
|
|
@@ -143,7 +136,7 @@ static void config_snapshot_free(git_config_backend *_backend)
|
|
|
143
136
|
static int config_snapshot_open(git_config_backend *cfg, git_config_level_t level, const git_repository *repo)
|
|
144
137
|
{
|
|
145
138
|
config_snapshot_backend *b = GIT_CONTAINER_OF(cfg, config_snapshot_backend, parent);
|
|
146
|
-
|
|
139
|
+
git_config_list *config_list = NULL;
|
|
147
140
|
git_config_iterator *it = NULL;
|
|
148
141
|
git_config_entry *entry;
|
|
149
142
|
int error;
|
|
@@ -152,12 +145,12 @@ static int config_snapshot_open(git_config_backend *cfg, git_config_level_t leve
|
|
|
152
145
|
GIT_UNUSED(level);
|
|
153
146
|
GIT_UNUSED(repo);
|
|
154
147
|
|
|
155
|
-
if ((error =
|
|
148
|
+
if ((error = git_config_list_new(&config_list)) < 0 ||
|
|
156
149
|
(error = b->source->iterator(&it, b->source)) < 0)
|
|
157
150
|
goto out;
|
|
158
151
|
|
|
159
152
|
while ((error = git_config_next(&entry, it)) == 0)
|
|
160
|
-
if ((error =
|
|
153
|
+
if ((error = git_config_list_dup_entry(config_list, entry)) < 0)
|
|
161
154
|
goto out;
|
|
162
155
|
|
|
163
156
|
if (error < 0) {
|
|
@@ -166,12 +159,12 @@ static int config_snapshot_open(git_config_backend *cfg, git_config_level_t leve
|
|
|
166
159
|
error = 0;
|
|
167
160
|
}
|
|
168
161
|
|
|
169
|
-
b->
|
|
162
|
+
b->config_list = config_list;
|
|
170
163
|
|
|
171
164
|
out:
|
|
172
165
|
git_config_iterator_free(it);
|
|
173
166
|
if (error)
|
|
174
|
-
|
|
167
|
+
git_config_list_free(config_list);
|
|
175
168
|
return error;
|
|
176
169
|
}
|
|
177
170
|
|
|
@@ -477,8 +477,12 @@ static int hdr_sz(
|
|
|
477
477
|
return -1;
|
|
478
478
|
}
|
|
479
479
|
|
|
480
|
+
if (shift >= (sizeof(size_t) * 8)) {
|
|
481
|
+
git_error_set(GIT_ERROR_INVALID, "delta header overflow");
|
|
482
|
+
return -1;
|
|
483
|
+
}
|
|
480
484
|
c = *d++;
|
|
481
|
-
r |= (c & 0x7f) << shift;
|
|
485
|
+
r |= ((size_t)(c & 0x7f)) << shift;
|
|
482
486
|
shift += 7;
|
|
483
487
|
} while (c & 0x80);
|
|
484
488
|
*delta = d;
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
#include "buf.h"
|
|
15
15
|
#include "commit.h"
|
|
16
16
|
#include "commit_list.h"
|
|
17
|
-
#include "oidmap.h"
|
|
18
17
|
#include "refs.h"
|
|
19
18
|
#include "repository.h"
|
|
20
19
|
#include "revwalk.h"
|
|
@@ -22,6 +21,7 @@
|
|
|
22
21
|
#include "tag.h"
|
|
23
22
|
#include "vector.h"
|
|
24
23
|
#include "wildmatch.h"
|
|
24
|
+
#include "hashmap_oid.h"
|
|
25
25
|
|
|
26
26
|
/* Ported from https://github.com/git/git/blob/89dde7882f71f846ccd0359756d27bebc31108de/builtin/describe.c */
|
|
27
27
|
|
|
@@ -32,20 +32,22 @@ struct commit_name {
|
|
|
32
32
|
git_oid sha1;
|
|
33
33
|
char *path;
|
|
34
34
|
|
|
35
|
-
/*
|
|
35
|
+
/* The original key for the hashmap */
|
|
36
36
|
git_oid peeled;
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
{
|
|
41
|
-
return git_oidmap_get(map, key);
|
|
42
|
-
}
|
|
39
|
+
GIT_HASHMAP_OID_SETUP(git_describe_oidmap, struct commit_name *);
|
|
43
40
|
|
|
44
41
|
static struct commit_name *find_commit_name(
|
|
45
|
-
|
|
42
|
+
git_describe_oidmap *names,
|
|
46
43
|
const git_oid *peeled)
|
|
47
44
|
{
|
|
48
|
-
|
|
45
|
+
struct commit_name *result;
|
|
46
|
+
|
|
47
|
+
if (git_describe_oidmap_get(&result, names, peeled) == 0)
|
|
48
|
+
return result;
|
|
49
|
+
|
|
50
|
+
return NULL;
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
static int replace_name(
|
|
@@ -92,7 +94,7 @@ static int replace_name(
|
|
|
92
94
|
|
|
93
95
|
static int add_to_known_names(
|
|
94
96
|
git_repository *repo,
|
|
95
|
-
|
|
97
|
+
git_describe_oidmap *names,
|
|
96
98
|
const char *path,
|
|
97
99
|
const git_oid *peeled,
|
|
98
100
|
unsigned int prio,
|
|
@@ -121,7 +123,7 @@ static int add_to_known_names(
|
|
|
121
123
|
e->path = git__strdup(path);
|
|
122
124
|
git_oid_cpy(&e->peeled, peeled);
|
|
123
125
|
|
|
124
|
-
if (!found &&
|
|
126
|
+
if (!found && git_describe_oidmap_put(names, &e->peeled, e) < 0)
|
|
125
127
|
return -1;
|
|
126
128
|
}
|
|
127
129
|
else
|
|
@@ -174,7 +176,7 @@ struct get_name_data
|
|
|
174
176
|
{
|
|
175
177
|
git_describe_options *opts;
|
|
176
178
|
git_repository *repo;
|
|
177
|
-
|
|
179
|
+
git_describe_oidmap names;
|
|
178
180
|
git_describe_result *result;
|
|
179
181
|
};
|
|
180
182
|
|
|
@@ -240,7 +242,7 @@ static int get_name(const char *refname, void *payload)
|
|
|
240
242
|
else
|
|
241
243
|
prio = 0;
|
|
242
244
|
|
|
243
|
-
add_to_known_names(data->repo, data->names,
|
|
245
|
+
add_to_known_names(data->repo, &data->names,
|
|
244
246
|
all ? refname + strlen(GIT_REFS_DIR) : refname + strlen(GIT_REFS_TAGS_DIR),
|
|
245
247
|
&peeled, prio, &sha1);
|
|
246
248
|
return 0;
|
|
@@ -451,7 +453,7 @@ static int describe(
|
|
|
451
453
|
|
|
452
454
|
git_oid_cpy(&data->result->commit_id, git_commit_id(commit));
|
|
453
455
|
|
|
454
|
-
n = find_commit_name(data->names, git_commit_id(commit));
|
|
456
|
+
n = find_commit_name(&data->names, git_commit_id(commit));
|
|
455
457
|
if (n && (tags || all || n->prio == 2)) {
|
|
456
458
|
/*
|
|
457
459
|
* Exact match to an existing ref.
|
|
@@ -492,7 +494,7 @@ static int describe(
|
|
|
492
494
|
git_commit_list_node *c = (git_commit_list_node *)git_pqueue_pop(&list);
|
|
493
495
|
seen_commits++;
|
|
494
496
|
|
|
495
|
-
n = find_commit_name(data->names, &c->oid);
|
|
497
|
+
n = find_commit_name(&data->names, &c->oid);
|
|
496
498
|
|
|
497
499
|
if (n) {
|
|
498
500
|
if (!tags && !all && n->prio < 2) {
|
|
@@ -627,7 +629,7 @@ cleanup:
|
|
|
627
629
|
git__free(match);
|
|
628
630
|
}
|
|
629
631
|
}
|
|
630
|
-
|
|
632
|
+
git_vector_dispose(&all_matches);
|
|
631
633
|
git_pqueue_free(&list);
|
|
632
634
|
git_revwalk_free(walk);
|
|
633
635
|
return error;
|
|
@@ -653,11 +655,12 @@ int git_describe_commit(
|
|
|
653
655
|
git_object *committish,
|
|
654
656
|
git_describe_options *opts)
|
|
655
657
|
{
|
|
656
|
-
struct get_name_data data;
|
|
658
|
+
struct get_name_data data = {0};
|
|
657
659
|
struct commit_name *name;
|
|
658
660
|
git_commit *commit;
|
|
659
|
-
int error = -1;
|
|
660
661
|
git_describe_options normalized;
|
|
662
|
+
git_hashmap_iter_t iter = GIT_HASHMAP_INIT;
|
|
663
|
+
int error = -1;
|
|
661
664
|
|
|
662
665
|
GIT_ASSERT_ARG(result);
|
|
663
666
|
GIT_ASSERT_ARG(committish);
|
|
@@ -677,9 +680,6 @@ int git_describe_commit(
|
|
|
677
680
|
"git_describe_options");
|
|
678
681
|
data.opts = &normalized;
|
|
679
682
|
|
|
680
|
-
if ((error = git_oidmap_new(&data.names)) < 0)
|
|
681
|
-
return error;
|
|
682
|
-
|
|
683
683
|
/** TODO: contains to be implemented */
|
|
684
684
|
|
|
685
685
|
if ((error = git_object_peel((git_object **)(&commit), committish, GIT_OBJECT_COMMIT)) < 0)
|
|
@@ -690,7 +690,7 @@ int git_describe_commit(
|
|
|
690
690
|
get_name, &data)) < 0)
|
|
691
691
|
goto cleanup;
|
|
692
692
|
|
|
693
|
-
if (
|
|
693
|
+
if (git_describe_oidmap_size(&data.names) == 0 && !normalized.show_commit_oid_as_fallback) {
|
|
694
694
|
git_error_set(GIT_ERROR_DESCRIBE, "cannot describe - "
|
|
695
695
|
"no reference found, cannot describe anything.");
|
|
696
696
|
error = -1;
|
|
@@ -703,13 +703,13 @@ int git_describe_commit(
|
|
|
703
703
|
cleanup:
|
|
704
704
|
git_commit_free(commit);
|
|
705
705
|
|
|
706
|
-
|
|
706
|
+
while (git_describe_oidmap_iterate(&iter, NULL, &name, &data.names) == 0) {
|
|
707
707
|
git_tag_free(name->tag);
|
|
708
708
|
git__free(name->path);
|
|
709
709
|
git__free(name);
|
|
710
|
-
}
|
|
710
|
+
}
|
|
711
711
|
|
|
712
|
-
|
|
712
|
+
git_describe_oidmap_dispose(&data.names);
|
|
713
713
|
|
|
714
714
|
if (error < 0)
|
|
715
715
|
git_describe_result_free(data.result);
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
|
|
12
12
|
#include "common.h"
|
|
13
13
|
#include "diff.h"
|
|
14
|
-
#include "strmap.h"
|
|
15
14
|
#include "map.h"
|
|
16
15
|
#include "config.h"
|
|
17
16
|
#include "regexp.h"
|
|
18
17
|
#include "repository.h"
|
|
18
|
+
#include "userdiff.h"
|
|
19
19
|
|
|
20
20
|
typedef enum {
|
|
21
21
|
DIFF_DRIVER_AUTO = 0,
|
|
@@ -43,10 +43,10 @@ struct git_diff_driver {
|
|
|
43
43
|
char name[GIT_FLEX_ARRAY];
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
GIT_HASHMAP_STR_SETUP(git_diff_driver_map, git_diff_driver *);
|
|
47
47
|
|
|
48
48
|
struct git_diff_driver_registry {
|
|
49
|
-
|
|
49
|
+
git_diff_driver_map map;
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
#define FORCE_DIFFABLE (GIT_DIFF_FORCE_TEXT | GIT_DIFF_FORCE_BINARY)
|
|
@@ -57,28 +57,21 @@ static git_diff_driver diff_driver_text = { DIFF_DRIVER_TEXT, GIT_DIFF_FORCE
|
|
|
57
57
|
|
|
58
58
|
git_diff_driver_registry *git_diff_driver_registry_new(void)
|
|
59
59
|
{
|
|
60
|
-
|
|
61
|
-
git__calloc(1, sizeof(git_diff_driver_registry));
|
|
62
|
-
if (!reg)
|
|
63
|
-
return NULL;
|
|
64
|
-
|
|
65
|
-
if (git_strmap_new(®->drivers) < 0) {
|
|
66
|
-
git_diff_driver_registry_free(reg);
|
|
67
|
-
return NULL;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return reg;
|
|
60
|
+
return git__calloc(1, sizeof(git_diff_driver_registry));
|
|
71
61
|
}
|
|
72
62
|
|
|
73
63
|
void git_diff_driver_registry_free(git_diff_driver_registry *reg)
|
|
74
64
|
{
|
|
75
65
|
git_diff_driver *drv;
|
|
66
|
+
git_hashmap_iter_t iter = 0;
|
|
76
67
|
|
|
77
68
|
if (!reg)
|
|
78
69
|
return;
|
|
79
70
|
|
|
80
|
-
|
|
81
|
-
|
|
71
|
+
while (git_diff_driver_map_iterate(&iter, NULL, &drv, ®->map) == 0)
|
|
72
|
+
git_diff_driver_free(drv);
|
|
73
|
+
|
|
74
|
+
git_diff_driver_map_dispose(®->map);
|
|
82
75
|
git__free(reg);
|
|
83
76
|
}
|
|
84
77
|
|
|
@@ -215,7 +208,7 @@ static int git_diff_driver_builtin(
|
|
|
215
208
|
(error = git_regexp_compile(&drv->word_pattern, ddef->words, ddef->flags)) < 0)
|
|
216
209
|
goto done;
|
|
217
210
|
|
|
218
|
-
if ((error =
|
|
211
|
+
if ((error = git_diff_driver_map_put(®->map, drv->name, drv)) < 0)
|
|
219
212
|
goto done;
|
|
220
213
|
|
|
221
214
|
done:
|
|
@@ -232,7 +225,7 @@ static int git_diff_driver_load(
|
|
|
232
225
|
{
|
|
233
226
|
int error = 0;
|
|
234
227
|
git_diff_driver_registry *reg;
|
|
235
|
-
git_diff_driver *drv;
|
|
228
|
+
git_diff_driver *drv = NULL;
|
|
236
229
|
size_t namelen;
|
|
237
230
|
git_config *cfg = NULL;
|
|
238
231
|
git_str name = GIT_STR_INIT;
|
|
@@ -242,7 +235,7 @@ static int git_diff_driver_load(
|
|
|
242
235
|
if ((reg = git_repository_driver_registry(repo)) == NULL)
|
|
243
236
|
return -1;
|
|
244
237
|
|
|
245
|
-
if ((drv
|
|
238
|
+
if (git_diff_driver_map_get(&drv, ®->map, driver_name) == 0) {
|
|
246
239
|
*out = drv;
|
|
247
240
|
return 0;
|
|
248
241
|
}
|
|
@@ -331,7 +324,7 @@ static int git_diff_driver_load(
|
|
|
331
324
|
goto done;
|
|
332
325
|
|
|
333
326
|
/* store driver in registry */
|
|
334
|
-
if ((error =
|
|
327
|
+
if ((error = git_diff_driver_map_put(®->map, drv->name, drv)) < 0)
|
|
335
328
|
goto done;
|
|
336
329
|
|
|
337
330
|
*out = drv;
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
|
|
12
12
|
#include "attr_file.h"
|
|
13
13
|
#include "str.h"
|
|
14
|
+
#include "hashmap.h"
|
|
14
15
|
|
|
16
|
+
typedef struct git_diff_driver git_diff_driver;
|
|
15
17
|
typedef struct git_diff_driver_registry git_diff_driver_registry;
|
|
16
18
|
|
|
17
19
|
git_diff_driver_registry *git_diff_driver_registry_new(void);
|
|
18
20
|
void git_diff_driver_registry_free(git_diff_driver_registry *);
|
|
19
21
|
|
|
20
|
-
typedef struct git_diff_driver git_diff_driver;
|
|
21
|
-
|
|
22
22
|
int git_diff_driver_lookup(git_diff_driver **, git_repository *,
|
|
23
23
|
git_attr_session *attrsession, const char *);
|
|
24
24
|
void git_diff_driver_free(git_diff_driver *);
|
|
@@ -429,7 +429,7 @@ static void diff_generated_free(git_diff *d)
|
|
|
429
429
|
git_diff_generated *diff = (git_diff_generated *)d;
|
|
430
430
|
|
|
431
431
|
git_attr_session__free(&diff->base.attrsession);
|
|
432
|
-
|
|
432
|
+
git_vector_dispose_deep(&diff->base.deltas);
|
|
433
433
|
|
|
434
434
|
git_pathspec__vfree(&diff->pathspec);
|
|
435
435
|
git_pool_clear(&diff->base.pool);
|
|
@@ -729,7 +729,7 @@ typedef struct {
|
|
|
729
729
|
git_iterator *new_iter;
|
|
730
730
|
const git_index_entry *oitem;
|
|
731
731
|
const git_index_entry *nitem;
|
|
732
|
-
|
|
732
|
+
git_submodule_cache *submodule_cache;
|
|
733
733
|
bool submodule_cache_initialized;
|
|
734
734
|
} diff_in_progress;
|
|
735
735
|
|
|
@@ -745,7 +745,7 @@ static int maybe_modified_submodule(
|
|
|
745
745
|
git_submodule *sub;
|
|
746
746
|
unsigned int sm_status = 0;
|
|
747
747
|
git_submodule_ignore_t ign = diff->base.opts.ignore_submodules;
|
|
748
|
-
|
|
748
|
+
git_submodule_cache *submodule_cache = NULL;
|
|
749
749
|
|
|
750
750
|
*status = GIT_DELTA_UNMODIFIED;
|
|
751
751
|
|
|
@@ -20,9 +20,9 @@ static void diff_parsed_free(git_diff *d)
|
|
|
20
20
|
git_vector_foreach(&diff->patches, i, patch)
|
|
21
21
|
git_patch_free(patch);
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
git_vector_dispose(&diff->patches);
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
git_vector_dispose(&diff->base.deltas);
|
|
26
26
|
git_pool_clear(&diff->base.pool);
|
|
27
27
|
|
|
28
28
|
git__memzero(diff, sizeof(*diff));
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
#include "zstream.h"
|
|
16
16
|
#include "blob.h"
|
|
17
17
|
#include "delta.h"
|
|
18
|
+
#include "repository.h"
|
|
18
19
|
#include "git2/sys/diff.h"
|
|
19
20
|
|
|
20
21
|
typedef struct {
|
|
@@ -29,6 +30,7 @@ typedef struct {
|
|
|
29
30
|
const char *new_prefix;
|
|
30
31
|
uint32_t flags;
|
|
31
32
|
int id_strlen;
|
|
33
|
+
unsigned int sent_file_header;
|
|
32
34
|
git_oid_t oid_type;
|
|
33
35
|
|
|
34
36
|
int (*strcomp)(const char *, const char *);
|
|
@@ -52,14 +54,10 @@ static int diff_print_info_init__common(
|
|
|
52
54
|
if (!pi->id_strlen) {
|
|
53
55
|
if (!repo)
|
|
54
56
|
pi->id_strlen = GIT_ABBREV_DEFAULT;
|
|
55
|
-
else if (
|
|
57
|
+
else if (git_repository__abbrev_length(&pi->id_strlen, repo) < 0)
|
|
56
58
|
return -1;
|
|
57
59
|
}
|
|
58
60
|
|
|
59
|
-
if (pi->id_strlen > 0 &&
|
|
60
|
-
(size_t)pi->id_strlen > git_oid_hexsize(pi->oid_type))
|
|
61
|
-
pi->id_strlen = (int)git_oid_hexsize(pi->oid_type);
|
|
62
|
-
|
|
63
61
|
memset(&pi->line, 0, sizeof(pi->line));
|
|
64
62
|
pi->line.old_lineno = -1;
|
|
65
63
|
pi->line.new_lineno = -1;
|
|
@@ -579,6 +577,30 @@ static int diff_print_patch_file_binary(
|
|
|
579
577
|
return error;
|
|
580
578
|
}
|
|
581
579
|
|
|
580
|
+
GIT_INLINE(int) should_force_header(const git_diff_delta *delta)
|
|
581
|
+
{
|
|
582
|
+
if (delta->old_file.mode != delta->new_file.mode)
|
|
583
|
+
return 1;
|
|
584
|
+
|
|
585
|
+
if (delta->status == GIT_DELTA_RENAMED || delta->status == GIT_DELTA_COPIED)
|
|
586
|
+
return 1;
|
|
587
|
+
|
|
588
|
+
return 0;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
GIT_INLINE(int) flush_file_header(const git_diff_delta *delta, diff_print_info *pi)
|
|
592
|
+
{
|
|
593
|
+
if (pi->sent_file_header)
|
|
594
|
+
return 0;
|
|
595
|
+
|
|
596
|
+
pi->line.origin = GIT_DIFF_LINE_FILE_HDR;
|
|
597
|
+
pi->line.content = git_str_cstr(pi->buf);
|
|
598
|
+
pi->line.content_len = git_str_len(pi->buf);
|
|
599
|
+
pi->sent_file_header = 1;
|
|
600
|
+
|
|
601
|
+
return pi->print_cb(delta, NULL, &pi->line, pi->payload);
|
|
602
|
+
}
|
|
603
|
+
|
|
582
604
|
static int diff_print_patch_file(
|
|
583
605
|
const git_diff_delta *delta, float progress, void *data)
|
|
584
606
|
{
|
|
@@ -609,15 +631,22 @@ static int diff_print_patch_file(
|
|
|
609
631
|
(pi->flags & GIT_DIFF_SHOW_UNTRACKED_CONTENT) == 0))
|
|
610
632
|
return 0;
|
|
611
633
|
|
|
634
|
+
pi->sent_file_header = 0;
|
|
635
|
+
|
|
612
636
|
if ((error = git_diff_delta__format_file_header(pi->buf, delta, oldpfx, newpfx,
|
|
613
637
|
id_strlen, print_index)) < 0)
|
|
614
638
|
return error;
|
|
615
639
|
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
640
|
+
/*
|
|
641
|
+
* pi->buf now contains the file header data. Go ahead and send it
|
|
642
|
+
* if there's useful data in there, like similarity. Otherwise, we
|
|
643
|
+
* should queue it to send when we see the first hunk. This prevents
|
|
644
|
+
* us from sending a header when all hunks were ignored.
|
|
645
|
+
*/
|
|
646
|
+
if (should_force_header(delta) && (error = flush_file_header(delta, pi)) < 0)
|
|
647
|
+
return error;
|
|
619
648
|
|
|
620
|
-
return
|
|
649
|
+
return 0;
|
|
621
650
|
}
|
|
622
651
|
|
|
623
652
|
static int diff_print_patch_binary(
|
|
@@ -632,6 +661,16 @@ static int diff_print_patch_binary(
|
|
|
632
661
|
pi->new_prefix ? pi->new_prefix : DIFF_NEW_PREFIX_DEFAULT;
|
|
633
662
|
int error;
|
|
634
663
|
|
|
664
|
+
if ((error = flush_file_header(delta, pi)) < 0)
|
|
665
|
+
return error;
|
|
666
|
+
|
|
667
|
+
/*
|
|
668
|
+
* If the caller only wants the header, we just needed to make sure to
|
|
669
|
+
* call flush_file_header
|
|
670
|
+
*/
|
|
671
|
+
if (pi->format == GIT_DIFF_FORMAT_PATCH_HEADER)
|
|
672
|
+
return 0;
|
|
673
|
+
|
|
635
674
|
git_str_clear(pi->buf);
|
|
636
675
|
|
|
637
676
|
if ((error = diff_print_patch_file_binary(
|
|
@@ -651,10 +690,21 @@ static int diff_print_patch_hunk(
|
|
|
651
690
|
void *data)
|
|
652
691
|
{
|
|
653
692
|
diff_print_info *pi = data;
|
|
693
|
+
int error;
|
|
654
694
|
|
|
655
695
|
if (S_ISDIR(d->new_file.mode))
|
|
656
696
|
return 0;
|
|
657
697
|
|
|
698
|
+
if ((error = flush_file_header(d, pi)) < 0)
|
|
699
|
+
return error;
|
|
700
|
+
|
|
701
|
+
/*
|
|
702
|
+
* If the caller only wants the header, we just needed to make sure to
|
|
703
|
+
* call flush_file_header
|
|
704
|
+
*/
|
|
705
|
+
if (pi->format == GIT_DIFF_FORMAT_PATCH_HEADER)
|
|
706
|
+
return 0;
|
|
707
|
+
|
|
658
708
|
pi->line.origin = GIT_DIFF_LINE_HUNK_HDR;
|
|
659
709
|
pi->line.content = h->header;
|
|
660
710
|
pi->line.content_len = h->header_len;
|
|
@@ -669,10 +719,14 @@ static int diff_print_patch_line(
|
|
|
669
719
|
void *data)
|
|
670
720
|
{
|
|
671
721
|
diff_print_info *pi = data;
|
|
722
|
+
int error;
|
|
672
723
|
|
|
673
724
|
if (S_ISDIR(delta->new_file.mode))
|
|
674
725
|
return 0;
|
|
675
726
|
|
|
727
|
+
if ((error = flush_file_header(delta, pi)) < 0)
|
|
728
|
+
return error;
|
|
729
|
+
|
|
676
730
|
return pi->print_cb(delta, hunk, line, pi->payload);
|
|
677
731
|
}
|
|
678
732
|
|
|
@@ -705,6 +759,8 @@ int git_diff_print(
|
|
|
705
759
|
break;
|
|
706
760
|
case GIT_DIFF_FORMAT_PATCH_HEADER:
|
|
707
761
|
print_file = diff_print_patch_file;
|
|
762
|
+
print_binary = diff_print_patch_binary;
|
|
763
|
+
print_hunk = diff_print_patch_hunk;
|
|
708
764
|
break;
|
|
709
765
|
case GIT_DIFF_FORMAT_RAW:
|
|
710
766
|
print_file = diff_print_one_raw;
|
|
@@ -28,7 +28,6 @@ struct git_diff_stats {
|
|
|
28
28
|
size_t files_changed;
|
|
29
29
|
size_t insertions;
|
|
30
30
|
size_t deletions;
|
|
31
|
-
size_t renames;
|
|
32
31
|
|
|
33
32
|
size_t max_name;
|
|
34
33
|
size_t max_filestat;
|
|
@@ -68,17 +67,19 @@ static int diff_file_stats_full_to_buf(
|
|
|
68
67
|
size_t common_dirlen;
|
|
69
68
|
int error;
|
|
70
69
|
|
|
71
|
-
padding = stats->max_name - strlen(old_path) - strlen(new_path);
|
|
72
|
-
|
|
73
70
|
if ((common_dirlen = git_fs_path_common_dirlen(old_path, new_path)) &&
|
|
74
71
|
common_dirlen <= INT_MAX) {
|
|
75
72
|
error = git_str_printf(out, " %.*s{%s"DIFF_RENAME_FILE_SEPARATOR"%s}",
|
|
76
73
|
(int) common_dirlen, old_path,
|
|
77
74
|
old_path + common_dirlen,
|
|
78
75
|
new_path + common_dirlen);
|
|
76
|
+
padding = stats->max_name + common_dirlen - strlen(old_path)
|
|
77
|
+
- strlen(new_path) - 2 - strlen(DIFF_RENAME_FILE_SEPARATOR);
|
|
79
78
|
} else {
|
|
80
79
|
error = git_str_printf(out, " %s" DIFF_RENAME_FILE_SEPARATOR "%s",
|
|
81
80
|
old_path, new_path);
|
|
81
|
+
padding = stats->max_name - strlen(old_path)
|
|
82
|
+
- strlen(new_path) - strlen(DIFF_RENAME_FILE_SEPARATOR);
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
if (error < 0)
|
|
@@ -89,9 +90,6 @@ static int diff_file_stats_full_to_buf(
|
|
|
89
90
|
goto on_error;
|
|
90
91
|
|
|
91
92
|
padding = stats->max_name - strlen(adddel_path);
|
|
92
|
-
|
|
93
|
-
if (stats->renames > 0)
|
|
94
|
-
padding += strlen(DIFF_RENAME_FILE_SEPARATOR);
|
|
95
93
|
}
|
|
96
94
|
|
|
97
95
|
if (git_str_putcn(out, ' ', padding) < 0 ||
|
|
@@ -210,14 +208,23 @@ int git_diff_get_stats(
|
|
|
210
208
|
if ((error = git_patch_from_diff(&patch, diff, i)) < 0)
|
|
211
209
|
break;
|
|
212
210
|
|
|
213
|
-
/*
|
|
211
|
+
/* Length calculation for renames mirrors the actual presentation format
|
|
212
|
+
* generated in diff_file_stats_full_to_buf; namelen is the full length of
|
|
213
|
+
* what will be printed, taking into account renames and common prefixes.
|
|
214
|
+
*/
|
|
214
215
|
delta = patch->delta;
|
|
215
|
-
|
|
216
|
-
/* TODO ugh */
|
|
217
216
|
namelen = strlen(delta->new_file.path);
|
|
218
|
-
if (delta->old_file.path &&
|
|
219
|
-
|
|
220
|
-
|
|
217
|
+
if (delta->old_file.path &&
|
|
218
|
+
strcmp(delta->old_file.path, delta->new_file.path) != 0) {
|
|
219
|
+
size_t common_dirlen;
|
|
220
|
+
if ((common_dirlen = git_fs_path_common_dirlen(delta->old_file.path, delta->new_file.path)) &&
|
|
221
|
+
common_dirlen <= INT_MAX) {
|
|
222
|
+
namelen += strlen(delta->old_file.path) + 2 +
|
|
223
|
+
strlen(DIFF_RENAME_FILE_SEPARATOR) - common_dirlen;
|
|
224
|
+
} else {
|
|
225
|
+
namelen += strlen(delta->old_file.path) +
|
|
226
|
+
strlen(DIFF_RENAME_FILE_SEPARATOR);
|
|
227
|
+
}
|
|
221
228
|
}
|
|
222
229
|
|
|
223
230
|
/* and, of course, count the line stats */
|