rugged 1.3.2 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +34 -2
- data/ext/rugged/extconf.rb +7 -4
- data/ext/rugged/rugged.c +16 -0
- data/ext/rugged/rugged.h +4 -0
- data/ext/rugged/rugged_blame.c +2 -0
- data/ext/rugged/rugged_blob.c +3 -0
- data/ext/rugged/rugged_commit.c +1 -0
- data/ext/rugged/rugged_config.c +9 -2
- data/ext/rugged/rugged_diff.c +1 -0
- data/ext/rugged/rugged_index.c +2 -0
- data/ext/rugged/rugged_patch.c +1 -0
- data/ext/rugged/rugged_rebase.c +1 -0
- data/ext/rugged/rugged_reference.c +1 -0
- data/ext/rugged/rugged_remote.c +28 -10
- data/ext/rugged/rugged_repo.c +7 -9
- data/ext/rugged/rugged_revwalk.c +5 -1
- data/ext/rugged/rugged_settings.c +5 -0
- data/ext/rugged/rugged_submodule.c +1 -0
- data/ext/rugged/rugged_tag.c +1 -0
- data/ext/rugged/rugged_tree.c +4 -0
- data/lib/rugged/index.rb +1 -1
- data/lib/rugged/tree.rb +5 -1
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +132 -288
- data/vendor/libgit2/COPYING +106 -19
- data/vendor/libgit2/cmake/AddCFlagIfSupported.cmake +21 -21
- data/vendor/libgit2/cmake/AddClarTest.cmake +7 -0
- data/vendor/libgit2/cmake/DefaultCFlags.cmake +154 -0
- data/vendor/libgit2/cmake/EnableWarnings.cmake +13 -13
- data/vendor/libgit2/cmake/ExperimentalFeatures.cmake +23 -0
- data/vendor/libgit2/cmake/FindCoreFoundation.cmake +13 -13
- data/vendor/libgit2/cmake/FindGSSAPI.cmake +171 -287
- data/vendor/libgit2/cmake/FindGSSFramework.cmake +13 -13
- data/vendor/libgit2/cmake/{FindHTTP_Parser.cmake → FindHTTPParser.cmake} +17 -17
- data/vendor/libgit2/cmake/FindIconv.cmake +27 -27
- data/vendor/libgit2/cmake/FindLibSSH2.cmake +5 -5
- data/vendor/libgit2/cmake/FindPCRE.cmake +12 -13
- data/vendor/libgit2/cmake/FindPCRE2.cmake +12 -12
- data/vendor/libgit2/cmake/FindPkgLibraries.cmake +19 -19
- data/vendor/libgit2/cmake/FindSecurity.cmake +14 -14
- data/vendor/libgit2/cmake/FindStatNsec.cmake +12 -18
- data/vendor/libgit2/cmake/Findfutimens.cmake +8 -8
- data/vendor/libgit2/cmake/FindmbedTLS.cmake +63 -70
- data/vendor/libgit2/cmake/IdeSplitSources.cmake +18 -18
- data/vendor/libgit2/cmake/PkgBuildConfig.cmake +60 -60
- data/vendor/libgit2/cmake/SanitizeBool.cmake +20 -20
- data/vendor/libgit2/cmake/SelectGSSAPI.cmake +37 -37
- data/vendor/libgit2/cmake/SelectHTTPParser.cmake +19 -0
- data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +100 -100
- data/vendor/libgit2/cmake/SelectHashes.cmake +91 -53
- data/vendor/libgit2/cmake/SelectRegex.cmake +51 -0
- data/vendor/libgit2/cmake/SelectSSH.cmake +41 -0
- data/vendor/libgit2/cmake/SelectWinHTTP.cmake +17 -0
- data/vendor/libgit2/cmake/SelectZlib.cmake +34 -0
- data/vendor/libgit2/deps/chromium-zlib/CMakeLists.txt +6 -6
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +33 -31
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +3 -1
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +4 -4
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +4 -4
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +2 -2
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +88 -88
- data/vendor/libgit2/deps/winhttp/CMakeLists.txt +14 -16
- data/vendor/libgit2/deps/zlib/adler32.c +7 -0
- data/vendor/libgit2/deps/zlib/crc32.c +975 -288
- data/vendor/libgit2/deps/zlib/crc32.h +9441 -436
- data/vendor/libgit2/deps/zlib/deflate.c +83 -31
- data/vendor/libgit2/deps/zlib/deflate.h +12 -15
- data/vendor/libgit2/deps/zlib/gzguts.h +3 -2
- data/vendor/libgit2/deps/zlib/infback.c +2 -1
- data/vendor/libgit2/deps/zlib/inffast.c +14 -14
- data/vendor/libgit2/deps/zlib/inflate.c +39 -8
- data/vendor/libgit2/deps/zlib/inflate.h +3 -2
- data/vendor/libgit2/deps/zlib/inftrees.c +3 -3
- data/vendor/libgit2/deps/zlib/trees.c +27 -48
- data/vendor/libgit2/deps/zlib/zlib.h +126 -100
- data/vendor/libgit2/deps/zlib/zutil.c +2 -2
- data/vendor/libgit2/deps/zlib/zutil.h +12 -9
- data/vendor/libgit2/include/git2/apply.h +16 -2
- data/vendor/libgit2/include/git2/attr.h +11 -2
- data/vendor/libgit2/include/git2/blame.h +4 -1
- data/vendor/libgit2/include/git2/blob.h +14 -1
- data/vendor/libgit2/include/git2/branch.h +4 -2
- data/vendor/libgit2/include/git2/buffer.h +18 -78
- data/vendor/libgit2/include/git2/cert.h +2 -2
- data/vendor/libgit2/include/git2/checkout.h +5 -2
- data/vendor/libgit2/include/git2/clone.h +3 -3
- data/vendor/libgit2/include/git2/commit.h +2 -0
- data/vendor/libgit2/include/git2/common.h +28 -7
- data/vendor/libgit2/include/git2/config.h +25 -9
- data/vendor/libgit2/include/git2/credential.h +2 -1
- data/vendor/libgit2/include/git2/credential_helpers.h +1 -0
- data/vendor/libgit2/include/git2/deprecated.h +9 -1
- data/vendor/libgit2/include/git2/describe.h +7 -2
- data/vendor/libgit2/include/git2/diff.h +18 -10
- data/vendor/libgit2/include/git2/email.h +1 -1
- data/vendor/libgit2/include/git2/errors.h +17 -3
- data/vendor/libgit2/include/git2/experimental.h +20 -0
- data/vendor/libgit2/include/git2/filter.h +7 -2
- data/vendor/libgit2/include/git2/graph.h +1 -0
- data/vendor/libgit2/include/git2/ignore.h +1 -1
- data/vendor/libgit2/include/git2/index.h +11 -5
- data/vendor/libgit2/include/git2/indexer.h +48 -0
- data/vendor/libgit2/include/git2/merge.h +24 -4
- data/vendor/libgit2/include/git2/message.h +2 -0
- data/vendor/libgit2/include/git2/object.h +49 -0
- data/vendor/libgit2/include/git2/odb.h +94 -13
- data/vendor/libgit2/include/git2/odb_backend.h +107 -19
- data/vendor/libgit2/include/git2/oid.h +115 -15
- data/vendor/libgit2/include/git2/pack.h +24 -8
- data/vendor/libgit2/include/git2/patch.h +8 -0
- data/vendor/libgit2/include/git2/pathspec.h +1 -1
- data/vendor/libgit2/include/git2/proxy.h +1 -1
- data/vendor/libgit2/include/git2/rebase.h +9 -1
- data/vendor/libgit2/include/git2/refdb.h +3 -0
- data/vendor/libgit2/include/git2/reflog.h +1 -1
- data/vendor/libgit2/include/git2/refs.h +2 -2
- data/vendor/libgit2/include/git2/remote.h +184 -37
- data/vendor/libgit2/include/git2/repository.h +34 -10
- data/vendor/libgit2/include/git2/reset.h +2 -2
- data/vendor/libgit2/include/git2/revparse.h +1 -1
- data/vendor/libgit2/include/git2/revwalk.h +4 -1
- data/vendor/libgit2/include/git2/signature.h +1 -1
- data/vendor/libgit2/include/git2/stash.h +61 -7
- data/vendor/libgit2/include/git2/status.h +14 -5
- data/vendor/libgit2/include/git2/strarray.h +0 -13
- data/vendor/libgit2/include/git2/submodule.h +7 -2
- data/vendor/libgit2/include/git2/sys/commit_graph.h +1 -1
- data/vendor/libgit2/include/git2/sys/odb_backend.h +3 -6
- data/vendor/libgit2/include/git2/sys/remote.h +46 -0
- data/vendor/libgit2/include/git2/sys/stream.h +1 -1
- data/vendor/libgit2/include/git2/sys/transport.h +46 -39
- data/vendor/libgit2/include/git2/tag.h +1 -0
- data/vendor/libgit2/include/git2/tree.h +4 -3
- data/vendor/libgit2/include/git2/types.h +7 -7
- data/vendor/libgit2/include/git2/version.h +27 -6
- data/vendor/libgit2/include/git2/worktree.h +12 -2
- data/vendor/libgit2/include/git2.h +1 -0
- data/vendor/libgit2/src/CMakeLists.txt +177 -419
- data/vendor/libgit2/src/README.md +12 -0
- data/vendor/libgit2/src/cli/CMakeLists.txt +57 -0
- data/vendor/libgit2/src/cli/README.md +26 -0
- data/vendor/libgit2/src/cli/cli.h +20 -0
- data/vendor/libgit2/src/cli/cmd.c +21 -0
- data/vendor/libgit2/src/cli/cmd.h +33 -0
- data/vendor/libgit2/src/cli/cmd_cat_file.c +204 -0
- data/vendor/libgit2/src/cli/cmd_clone.c +176 -0
- data/vendor/libgit2/src/cli/cmd_hash_object.c +154 -0
- data/vendor/libgit2/src/cli/cmd_help.c +86 -0
- data/vendor/libgit2/src/cli/error.h +51 -0
- data/vendor/libgit2/src/cli/main.c +106 -0
- data/vendor/libgit2/src/cli/opt.c +669 -0
- data/vendor/libgit2/src/cli/opt.h +349 -0
- data/vendor/libgit2/src/cli/opt_usage.c +194 -0
- data/vendor/libgit2/src/cli/opt_usage.h +35 -0
- data/vendor/libgit2/src/cli/progress.c +345 -0
- data/vendor/libgit2/src/cli/progress.h +117 -0
- data/vendor/libgit2/src/cli/sighandler.h +20 -0
- data/vendor/libgit2/src/cli/unix/sighandler.c +36 -0
- data/vendor/libgit2/src/cli/win32/precompiled.h +3 -0
- data/vendor/libgit2/src/cli/win32/sighandler.c +37 -0
- data/vendor/libgit2/src/libgit2/CMakeLists.txt +141 -0
- data/vendor/libgit2/src/{annotated_commit.c → libgit2/annotated_commit.c} +1 -1
- data/vendor/libgit2/src/{annotated_commit.h → libgit2/annotated_commit.h} +2 -2
- data/vendor/libgit2/src/{apply.c → libgit2/apply.c} +18 -18
- data/vendor/libgit2/src/{apply.h → libgit2/apply.h} +2 -2
- data/vendor/libgit2/src/{attr.c → libgit2/attr.c} +18 -18
- data/vendor/libgit2/src/{attr_file.c → libgit2/attr_file.c} +18 -18
- data/vendor/libgit2/src/{attr_file.h → libgit2/attr_file.h} +4 -4
- data/vendor/libgit2/src/{attrcache.c → libgit2/attrcache.c} +18 -13
- data/vendor/libgit2/src/{blame.c → libgit2/blame.c} +2 -0
- data/vendor/libgit2/src/{blame_git.c → libgit2/blame_git.c} +1 -1
- data/vendor/libgit2/src/{blob.c → libgit2/blob.c} +38 -29
- data/vendor/libgit2/src/{blob.h → libgit2/blob.h} +3 -3
- data/vendor/libgit2/src/{branch.c → libgit2/branch.c} +164 -118
- data/vendor/libgit2/src/{branch.h → libgit2/branch.h} +15 -3
- data/vendor/libgit2/src/libgit2/buf.c +126 -0
- data/vendor/libgit2/src/libgit2/buf.h +50 -0
- data/vendor/libgit2/src/{checkout.c → libgit2/checkout.c} +74 -68
- data/vendor/libgit2/src/{cherrypick.c → libgit2/cherrypick.c} +13 -13
- data/vendor/libgit2/src/{clone.c → libgit2/clone.c} +96 -67
- data/vendor/libgit2/src/{commit.c → libgit2/commit.c} +178 -73
- data/vendor/libgit2/src/libgit2/commit.h +87 -0
- data/vendor/libgit2/src/{commit_graph.c → libgit2/commit_graph.c} +122 -89
- data/vendor/libgit2/src/{commit_graph.h → libgit2/commit_graph.h} +14 -4
- data/vendor/libgit2/src/{commit_list.c → libgit2/commit_list.c} +7 -4
- data/vendor/libgit2/src/libgit2/common.h +55 -0
- data/vendor/libgit2/src/{config.c → libgit2/config.c} +101 -69
- data/vendor/libgit2/src/{config.h → libgit2/config.h} +15 -2
- data/vendor/libgit2/src/{config_file.c → libgit2/config_file.c} +105 -93
- data/vendor/libgit2/src/{config_mem.c → libgit2/config_mem.c} +9 -9
- data/vendor/libgit2/src/{config_parse.c → libgit2/config_parse.c} +27 -23
- data/vendor/libgit2/src/{crlf.c → libgit2/crlf.c} +24 -21
- data/vendor/libgit2/src/{describe.c → libgit2/describe.c} +35 -27
- data/vendor/libgit2/src/{diff.c → libgit2/diff.c} +30 -9
- data/vendor/libgit2/src/{diff.h → libgit2/diff.h} +2 -4
- data/vendor/libgit2/src/{diff_driver.c → libgit2/diff_driver.c} +34 -36
- data/vendor/libgit2/src/{diff_driver.h → libgit2/diff_driver.h} +3 -3
- data/vendor/libgit2/src/{diff_file.c → libgit2/diff_file.c} +44 -26
- data/vendor/libgit2/src/{diff_generate.c → libgit2/diff_generate.c} +47 -18
- data/vendor/libgit2/src/{diff_generate.h → libgit2/diff_generate.h} +5 -3
- data/vendor/libgit2/src/{diff_print.c → libgit2/diff_print.c} +112 -100
- data/vendor/libgit2/src/{diff_stats.c → libgit2/diff_stats.c} +40 -29
- data/vendor/libgit2/src/libgit2/diff_stats.h +18 -0
- data/vendor/libgit2/src/{diff_tform.c → libgit2/diff_tform.c} +13 -8
- data/vendor/libgit2/src/{diff_xdiff.c → libgit2/diff_xdiff.c} +4 -8
- data/vendor/libgit2/src/{email.c → libgit2/email.c} +55 -39
- data/vendor/libgit2/src/{email.h → libgit2/email.h} +1 -1
- data/vendor/libgit2/src/{errors.c → libgit2/errors.c} +18 -18
- data/vendor/libgit2/src/{errors.h → libgit2/errors.h} +1 -2
- data/vendor/libgit2/src/libgit2/experimental.h.in +13 -0
- data/vendor/libgit2/src/{fetch.c → libgit2/fetch.c} +72 -27
- data/vendor/libgit2/src/{fetch.h → libgit2/fetch.h} +1 -1
- data/vendor/libgit2/src/{fetchhead.c → libgit2/fetchhead.c} +23 -23
- data/vendor/libgit2/src/{filter.c → libgit2/filter.c} +127 -53
- data/vendor/libgit2/src/{filter.h → libgit2/filter.h} +26 -5
- data/vendor/libgit2/src/{ident.c → libgit2/ident.c} +20 -20
- data/vendor/libgit2/src/{ignore.c → libgit2/ignore.c} +35 -34
- data/vendor/libgit2/src/{ignore.h → libgit2/ignore.h} +2 -2
- data/vendor/libgit2/src/{index.c → libgit2/index.c} +91 -90
- data/vendor/libgit2/src/{index.h → libgit2/index.h} +6 -3
- data/vendor/libgit2/src/{indexer.c → libgit2/indexer.c} +173 -92
- data/vendor/libgit2/src/{iterator.c → libgit2/iterator.c} +71 -61
- data/vendor/libgit2/src/{iterator.h → libgit2/iterator.h} +5 -5
- data/vendor/libgit2/src/{libgit2.c → libgit2/libgit2.c} +46 -11
- data/vendor/libgit2/src/{mailmap.c → libgit2/mailmap.c} +38 -36
- data/vendor/libgit2/src/{merge.c → libgit2/merge.c} +30 -30
- data/vendor/libgit2/src/{merge.h → libgit2/merge.h} +1 -14
- data/vendor/libgit2/src/{merge_driver.c → libgit2/merge_driver.c} +2 -2
- data/vendor/libgit2/src/{merge_file.c → libgit2/merge_file.c} +13 -3
- data/vendor/libgit2/src/{message.c → libgit2/message.c} +21 -10
- data/vendor/libgit2/src/{midx.c → libgit2/midx.c} +112 -92
- data/vendor/libgit2/src/{midx.h → libgit2/midx.h} +5 -4
- data/vendor/libgit2/src/{mwindow.c → libgit2/mwindow.c} +15 -12
- data/vendor/libgit2/src/{mwindow.h → libgit2/mwindow.h} +5 -2
- data/vendor/libgit2/src/{netops.c → libgit2/netops.c} +1 -2
- data/vendor/libgit2/src/{netops.h → libgit2/netops.h} +1 -1
- data/vendor/libgit2/src/{notes.c → libgit2/notes.c} +25 -34
- data/vendor/libgit2/src/{object.c → libgit2/object.c} +135 -30
- data/vendor/libgit2/src/{object.h → libgit2/object.h} +12 -3
- data/vendor/libgit2/src/{odb.c → libgit2/odb.c} +228 -81
- data/vendor/libgit2/src/{odb.h → libgit2/odb.h} +44 -5
- data/vendor/libgit2/src/{odb_loose.c → libgit2/odb_loose.c} +192 -134
- data/vendor/libgit2/src/{odb_mempack.c → libgit2/odb_mempack.c} +18 -5
- data/vendor/libgit2/src/{odb_pack.c → libgit2/odb_pack.c} +137 -85
- data/vendor/libgit2/src/{oid.c → libgit2/oid.c} +136 -90
- data/vendor/libgit2/src/libgit2/oid.h +273 -0
- data/vendor/libgit2/src/{oidmap.c → libgit2/oidmap.c} +1 -1
- data/vendor/libgit2/src/{pack-objects.c → libgit2/pack-objects.c} +56 -30
- data/vendor/libgit2/src/{pack-objects.h → libgit2/pack-objects.h} +11 -6
- data/vendor/libgit2/src/{pack.c → libgit2/pack.c} +114 -84
- data/vendor/libgit2/src/{pack.h → libgit2/pack.h} +31 -16
- data/vendor/libgit2/src/{parse.c → libgit2/parse.c} +4 -3
- data/vendor/libgit2/src/{patch.c → libgit2/patch.c} +3 -3
- data/vendor/libgit2/src/{patch.h → libgit2/patch.h} +1 -0
- data/vendor/libgit2/src/{patch_generate.c → libgit2/patch_generate.c} +27 -11
- data/vendor/libgit2/src/{patch_generate.h → libgit2/patch_generate.h} +5 -5
- data/vendor/libgit2/src/{patch_parse.c → libgit2/patch_parse.c} +29 -29
- data/vendor/libgit2/src/libgit2/path.c +375 -0
- data/vendor/libgit2/src/libgit2/path.h +68 -0
- data/vendor/libgit2/src/{pathspec.c → libgit2/pathspec.c} +6 -6
- data/vendor/libgit2/src/{pathspec.h → libgit2/pathspec.h} +2 -2
- data/vendor/libgit2/src/{proxy.c → libgit2/proxy.c} +4 -1
- data/vendor/libgit2/src/{proxy.h → libgit2/proxy.h} +1 -1
- data/vendor/libgit2/src/{push.c → libgit2/push.c} +43 -38
- data/vendor/libgit2/src/{push.h → libgit2/push.h} +4 -16
- data/vendor/libgit2/src/{reader.c → libgit2/reader.c} +9 -9
- data/vendor/libgit2/src/{reader.h → libgit2/reader.h} +2 -2
- data/vendor/libgit2/src/{rebase.c → libgit2/rebase.c} +119 -107
- data/vendor/libgit2/src/{refdb_fs.c → libgit2/refdb_fs.c} +506 -197
- data/vendor/libgit2/src/{reflog.c → libgit2/reflog.c} +7 -5
- data/vendor/libgit2/src/{reflog.h → libgit2/reflog.h} +1 -2
- data/vendor/libgit2/src/{refs.c → libgit2/refs.c} +34 -32
- data/vendor/libgit2/src/{refs.h → libgit2/refs.h} +2 -2
- data/vendor/libgit2/src/{refspec.c → libgit2/refspec.c} +32 -37
- data/vendor/libgit2/src/{refspec.h → libgit2/refspec.h} +5 -2
- data/vendor/libgit2/src/{remote.c → libgit2/remote.c} +718 -420
- data/vendor/libgit2/src/libgit2/remote.h +100 -0
- data/vendor/libgit2/src/{repository.c → libgit2/repository.c} +629 -386
- data/vendor/libgit2/src/{repository.h → libgit2/repository.h} +20 -9
- data/vendor/libgit2/src/{reset.c → libgit2/reset.c} +8 -5
- data/vendor/libgit2/src/{revert.c → libgit2/revert.c} +14 -14
- data/vendor/libgit2/src/{revparse.c → libgit2/revparse.c} +71 -42
- data/vendor/libgit2/src/{revwalk.c → libgit2/revwalk.c} +12 -8
- data/vendor/libgit2/src/{signature.c → libgit2/signature.c} +12 -6
- data/vendor/libgit2/src/{signature.h → libgit2/signature.h} +1 -1
- data/vendor/libgit2/src/{stash.c → libgit2/stash.c} +235 -61
- data/vendor/libgit2/src/{status.c → libgit2/status.c} +4 -1
- data/vendor/libgit2/src/{strarray.c → libgit2/strarray.c} +1 -0
- data/vendor/libgit2/src/libgit2/strarray.h +25 -0
- data/vendor/libgit2/src/{streams → libgit2/streams}/mbedtls.c +8 -6
- data/vendor/libgit2/src/{streams → libgit2/streams}/openssl.c +1 -1
- data/vendor/libgit2/src/{streams → libgit2/streams}/openssl_dynamic.c +7 -3
- data/vendor/libgit2/src/{streams → libgit2/streams}/openssl_dynamic.h +3 -3
- data/vendor/libgit2/src/{streams → libgit2/streams}/socket.c +4 -1
- data/vendor/libgit2/src/{submodule.c → libgit2/submodule.c} +177 -161
- data/vendor/libgit2/src/{submodule.h → libgit2/submodule.h} +1 -1
- data/vendor/libgit2/src/libgit2/sysdir.c +650 -0
- data/vendor/libgit2/src/{sysdir.h → libgit2/sysdir.h} +53 -18
- data/vendor/libgit2/src/{tag.c → libgit2/tag.c} +73 -42
- data/vendor/libgit2/src/{tag.h → libgit2/tag.h} +2 -2
- data/vendor/libgit2/src/{threadstate.c → libgit2/threadstate.c} +3 -3
- data/vendor/libgit2/src/{threadstate.h → libgit2/threadstate.h} +2 -2
- data/vendor/libgit2/src/{trace.c → libgit2/trace.c} +1 -14
- data/vendor/libgit2/src/{trace.h → libgit2/trace.h} +5 -22
- data/vendor/libgit2/src/{trailer.c → libgit2/trailer.c} +1 -1
- data/vendor/libgit2/src/{transaction.c → libgit2/transaction.c} +1 -1
- data/vendor/libgit2/src/{transport.c → libgit2/transport.c} +10 -10
- data/vendor/libgit2/src/{transports → libgit2/transports}/auth.c +7 -9
- data/vendor/libgit2/src/{transports → libgit2/transports}/auth.h +2 -3
- data/vendor/libgit2/src/{transports → libgit2/transports}/auth_negotiate.c +12 -13
- data/vendor/libgit2/src/{transports → libgit2/transports}/auth_ntlm.c +10 -10
- data/vendor/libgit2/src/{transports → libgit2/transports}/auth_ntlm.h +0 -1
- data/vendor/libgit2/src/{transports → libgit2/transports}/git.c +9 -11
- data/vendor/libgit2/src/{transports → libgit2/transports}/http.c +41 -20
- data/vendor/libgit2/src/{transports → libgit2/transports}/http.h +2 -3
- data/vendor/libgit2/src/{transports → libgit2/transports}/httpclient.c +75 -66
- data/vendor/libgit2/src/{transports → libgit2/transports}/httpclient.h +10 -0
- data/vendor/libgit2/src/{transports → libgit2/transports}/local.c +138 -116
- data/vendor/libgit2/src/{transports → libgit2/transports}/smart.c +92 -133
- data/vendor/libgit2/src/{transports → libgit2/transports}/smart.h +35 -32
- data/vendor/libgit2/src/{transports → libgit2/transports}/smart_pkt.c +177 -65
- data/vendor/libgit2/src/{transports → libgit2/transports}/smart_protocol.c +97 -49
- data/vendor/libgit2/src/{transports → libgit2/transports}/ssh.c +365 -198
- data/vendor/libgit2/src/{transports → libgit2/transports}/winhttp.c +58 -59
- data/vendor/libgit2/src/{tree-cache.c → libgit2/tree-cache.c} +8 -8
- data/vendor/libgit2/src/{tree-cache.h → libgit2/tree-cache.h} +2 -2
- data/vendor/libgit2/src/{tree.c → libgit2/tree.c} +93 -83
- data/vendor/libgit2/src/{tree.h → libgit2/tree.h} +4 -4
- data/vendor/libgit2/src/{worktree.c → libgit2/worktree.c} +121 -94
- data/vendor/libgit2/src/{worktree.h → libgit2/worktree.h} +1 -1
- data/vendor/libgit2/src/libgit2/xdiff/git-xdiff.h +53 -0
- data/vendor/libgit2/src/{xdiff → libgit2/xdiff}/xdiff.h +15 -15
- data/vendor/libgit2/src/{xdiff → libgit2/xdiff}/xdiffi.c +134 -108
- data/vendor/libgit2/src/{xdiff → libgit2/xdiff}/xemit.c +23 -7
- data/vendor/libgit2/src/{xdiff → libgit2/xdiff}/xhistogram.c +87 -78
- data/vendor/libgit2/src/{xdiff → libgit2/xdiff}/xinclude.h +1 -12
- data/vendor/libgit2/src/{xdiff → libgit2/xdiff}/xmerge.c +104 -117
- data/vendor/libgit2/src/{xdiff → libgit2/xdiff}/xpatience.c +6 -17
- data/vendor/libgit2/src/{xdiff → libgit2/xdiff}/xprepare.c +15 -20
- data/vendor/libgit2/src/{xdiff → libgit2/xdiff}/xutils.c +18 -7
- data/vendor/libgit2/src/util/CMakeLists.txt +80 -0
- data/vendor/libgit2/src/{allocators → util/allocators}/failalloc.h +1 -1
- data/vendor/libgit2/src/{allocators → util/allocators}/stdalloc.h +1 -1
- data/vendor/libgit2/src/{allocators → util/allocators}/win32_leakcheck.h +1 -1
- data/vendor/libgit2/src/{array.h → util/array.h} +1 -1
- data/vendor/libgit2/src/{assert_safe.h → util/assert_safe.h} +16 -0
- data/vendor/libgit2/src/{cc-compat.h → util/cc-compat.h} +1 -1
- data/vendor/libgit2/src/{date.c → util/date.c} +14 -20
- data/vendor/libgit2/src/util/date.h +33 -0
- data/vendor/libgit2/src/{filebuf.c → util/filebuf.c} +29 -29
- data/vendor/libgit2/src/{filebuf.h → util/filebuf.h} +2 -2
- data/vendor/libgit2/src/{path.c → util/fs_path.c} +453 -647
- data/vendor/libgit2/src/{path.h → util/fs_path.h} +221 -188
- data/vendor/libgit2/src/{futils.c → util/futils.c} +135 -90
- data/vendor/libgit2/src/{futils.h → util/futils.h} +28 -15
- data/vendor/libgit2/src/{features.h.in → util/git2_features.h.in} +15 -1
- data/vendor/libgit2/src/{common.h → util/git2_util.h} +20 -59
- data/vendor/libgit2/src/util/hash/builtin.c +53 -0
- data/vendor/libgit2/src/{hash/sha1/openssl.h → util/hash/builtin.h} +6 -6
- data/vendor/libgit2/src/{hash/sha1 → util/hash}/collisiondetect.c +3 -3
- data/vendor/libgit2/src/{hash/sha1 → util/hash}/collisiondetect.h +3 -3
- data/vendor/libgit2/src/util/hash/common_crypto.c +112 -0
- data/vendor/libgit2/src/{hash/sha1 → util/hash}/common_crypto.h +11 -3
- data/vendor/libgit2/src/util/hash/mbedtls.c +92 -0
- data/vendor/libgit2/src/{hash/sha1 → util/hash}/mbedtls.h +14 -4
- data/vendor/libgit2/src/util/hash/openssl.c +195 -0
- data/vendor/libgit2/src/util/hash/openssl.h +45 -0
- data/vendor/libgit2/src/util/hash/rfc6234/sha.h +243 -0
- data/vendor/libgit2/src/util/hash/rfc6234/sha224-256.c +601 -0
- data/vendor/libgit2/src/util/hash/sha.h +70 -0
- data/vendor/libgit2/src/{hash/sha1 → util/hash}/sha1dc/sha1.c +1 -1
- data/vendor/libgit2/src/util/hash/win32.c +549 -0
- data/vendor/libgit2/src/util/hash/win32.h +60 -0
- data/vendor/libgit2/src/util/hash.c +158 -0
- data/vendor/libgit2/src/util/hash.h +61 -0
- data/vendor/libgit2/src/{khash.h → util/khash.h} +1 -1
- data/vendor/libgit2/src/{map.h → util/map.h} +1 -1
- data/vendor/libgit2/src/util/net.c +1003 -0
- data/vendor/libgit2/src/{net.h → util/net.h} +18 -4
- data/vendor/libgit2/src/{pool.h → util/pool.h} +1 -1
- data/vendor/libgit2/src/{posix.c → util/posix.c} +3 -3
- data/vendor/libgit2/src/{posix.h → util/posix.h} +4 -1
- data/vendor/libgit2/src/{pqueue.h → util/pqueue.h} +2 -2
- data/vendor/libgit2/src/util/rand.c +234 -0
- data/vendor/libgit2/src/util/rand.h +37 -0
- data/vendor/libgit2/src/{regexp.c → util/regexp.c} +4 -4
- data/vendor/libgit2/src/{regexp.h → util/regexp.h} +1 -1
- data/vendor/libgit2/src/{runtime.c → util/runtime.c} +1 -1
- data/vendor/libgit2/src/{runtime.h → util/runtime.h} +1 -1
- data/vendor/libgit2/src/{sortedcache.c → util/sortedcache.c} +1 -1
- data/vendor/libgit2/src/{sortedcache.h → util/sortedcache.h} +2 -2
- data/vendor/libgit2/src/{buffer.c → util/str.c} +157 -151
- data/vendor/libgit2/src/util/str.h +357 -0
- data/vendor/libgit2/src/{strmap.h → util/strmap.h} +1 -1
- data/vendor/libgit2/src/{thread.c → util/thread.c} +1 -1
- data/vendor/libgit2/src/{thread.h → util/thread.h} +23 -22
- data/vendor/libgit2/src/{tsort.c → util/tsort.c} +1 -1
- data/vendor/libgit2/src/{unix → util/unix}/map.c +1 -3
- data/vendor/libgit2/src/{unix → util/unix}/posix.h +1 -4
- data/vendor/libgit2/src/{unix → util/unix}/realpath.c +1 -3
- data/vendor/libgit2/src/{utf8.c → util/utf8.c} +1 -1
- data/vendor/libgit2/src/{utf8.h → util/utf8.h} +1 -1
- data/vendor/libgit2/src/{util.c → util/util.c} +15 -15
- data/vendor/libgit2/src/{util.h → util/util.h} +4 -29
- data/vendor/libgit2/src/{varint.h → util/varint.h} +1 -1
- data/vendor/libgit2/src/{vector.h → util/vector.h} +2 -2
- data/vendor/libgit2/src/{wildmatch.h → util/wildmatch.h} +1 -1
- data/vendor/libgit2/src/{win32 → util/win32}/dir.h +1 -1
- data/vendor/libgit2/src/{win32 → util/win32}/error.h +1 -1
- data/vendor/libgit2/src/{win32 → util/win32}/map.c +1 -1
- data/vendor/libgit2/src/{win32 → util/win32}/path_w32.c +140 -9
- data/vendor/libgit2/src/{win32 → util/win32}/path_w32.h +3 -1
- data/vendor/libgit2/src/{win32 → util/win32}/posix.h +1 -2
- data/vendor/libgit2/src/{win32 → util/win32}/posix_w32.c +12 -28
- data/vendor/libgit2/src/util/win32/precompiled.c +1 -0
- data/vendor/libgit2/src/{win32 → util/win32}/precompiled.h +1 -1
- data/vendor/libgit2/src/{win32 → util/win32}/thread.h +1 -1
- data/vendor/libgit2/src/{win32 → util/win32}/utf-conv.h +1 -1
- data/vendor/libgit2/src/{win32 → util/win32}/w32_buffer.c +2 -3
- data/vendor/libgit2/src/{win32 → util/win32}/w32_buffer.h +3 -4
- data/vendor/libgit2/src/{win32 → util/win32}/w32_leakcheck.c +1 -1
- data/vendor/libgit2/src/{win32 → util/win32}/w32_leakcheck.h +1 -1
- data/vendor/libgit2/src/{win32 → util/win32}/w32_util.h +1 -1
- data/vendor/libgit2/src/{zstream.c → util/zstream.c} +5 -5
- data/vendor/libgit2/src/{zstream.h → util/zstream.h} +5 -5
- metadata +402 -356
- data/vendor/libgit2/src/buffer.h +0 -374
- data/vendor/libgit2/src/commit.h +0 -46
- data/vendor/libgit2/src/hash/sha1/common_crypto.c +0 -57
- data/vendor/libgit2/src/hash/sha1/generic.c +0 -300
- data/vendor/libgit2/src/hash/sha1/generic.h +0 -19
- data/vendor/libgit2/src/hash/sha1/mbedtls.c +0 -46
- data/vendor/libgit2/src/hash/sha1/openssl.c +0 -59
- data/vendor/libgit2/src/hash/sha1/win32.c +0 -333
- data/vendor/libgit2/src/hash/sha1/win32.h +0 -128
- data/vendor/libgit2/src/hash/sha1.h +0 -38
- data/vendor/libgit2/src/hash.c +0 -110
- data/vendor/libgit2/src/hash.h +0 -46
- data/vendor/libgit2/src/message.h +0 -17
- data/vendor/libgit2/src/net.c +0 -540
- data/vendor/libgit2/src/oid.h +0 -51
- data/vendor/libgit2/src/remote.h +0 -55
- data/vendor/libgit2/src/sysdir.c +0 -347
- data/vendor/libgit2/src/win32/findfile.c +0 -230
- data/vendor/libgit2/src/win32/findfile.h +0 -19
- /data/vendor/libgit2/src/{win32 → cli/win32}/precompiled.c +0 -0
- /data/vendor/libgit2/src/{attr.h → libgit2/attr.h} +0 -0
- /data/vendor/libgit2/src/{attrcache.h → libgit2/attrcache.h} +0 -0
- /data/vendor/libgit2/src/{blame.h → libgit2/blame.h} +0 -0
- /data/vendor/libgit2/src/{blame_git.h → libgit2/blame_git.h} +0 -0
- /data/vendor/libgit2/src/{cache.c → libgit2/cache.c} +0 -0
- /data/vendor/libgit2/src/{cache.h → libgit2/cache.h} +0 -0
- /data/vendor/libgit2/src/{checkout.h → libgit2/checkout.h} +0 -0
- /data/vendor/libgit2/src/{clone.h → libgit2/clone.h} +0 -0
- /data/vendor/libgit2/src/{commit_list.h → libgit2/commit_list.h} +0 -0
- /data/vendor/libgit2/src/{config_backend.h → libgit2/config_backend.h} +0 -0
- /data/vendor/libgit2/src/{config_cache.c → libgit2/config_cache.c} +0 -0
- /data/vendor/libgit2/src/{config_entries.c → libgit2/config_entries.c} +0 -0
- /data/vendor/libgit2/src/{config_entries.h → libgit2/config_entries.h} +0 -0
- /data/vendor/libgit2/src/{config_parse.h → libgit2/config_parse.h} +0 -0
- /data/vendor/libgit2/src/{config_snapshot.c → libgit2/config_snapshot.c} +0 -0
- /data/vendor/libgit2/src/{delta.c → libgit2/delta.c} +0 -0
- /data/vendor/libgit2/src/{delta.h → libgit2/delta.h} +0 -0
- /data/vendor/libgit2/src/{diff_file.h → libgit2/diff_file.h} +0 -0
- /data/vendor/libgit2/src/{diff_parse.c → libgit2/diff_parse.c} +0 -0
- /data/vendor/libgit2/src/{diff_parse.h → libgit2/diff_parse.h} +0 -0
- /data/vendor/libgit2/src/{diff_tform.h → libgit2/diff_tform.h} +0 -0
- /data/vendor/libgit2/src/{diff_xdiff.h → libgit2/diff_xdiff.h} +0 -0
- /data/vendor/libgit2/src/{fetchhead.h → libgit2/fetchhead.h} +0 -0
- /data/vendor/libgit2/src/{win32 → libgit2}/git2.rc +0 -0
- /data/vendor/libgit2/src/{graph.c → libgit2/graph.c} +0 -0
- /data/vendor/libgit2/src/{hashsig.c → libgit2/hashsig.c} +0 -0
- /data/vendor/libgit2/src/{idxmap.c → libgit2/idxmap.c} +0 -0
- /data/vendor/libgit2/src/{idxmap.h → libgit2/idxmap.h} +0 -0
- /data/vendor/libgit2/src/{indexer.h → libgit2/indexer.h} +0 -0
- /data/vendor/libgit2/src/{libgit2.h → libgit2/libgit2.h} +0 -0
- /data/vendor/libgit2/src/{mailmap.h → libgit2/mailmap.h} +0 -0
- /data/vendor/libgit2/src/{merge_driver.h → libgit2/merge_driver.h} +0 -0
- /data/vendor/libgit2/src/{notes.h → libgit2/notes.h} +0 -0
- /data/vendor/libgit2/src/{object_api.c → libgit2/object_api.c} +0 -0
- /data/vendor/libgit2/src/{offmap.c → libgit2/offmap.c} +0 -0
- /data/vendor/libgit2/src/{offmap.h → libgit2/offmap.h} +0 -0
- /data/vendor/libgit2/src/{oidarray.c → libgit2/oidarray.c} +0 -0
- /data/vendor/libgit2/src/{oidarray.h → libgit2/oidarray.h} +0 -0
- /data/vendor/libgit2/src/{oidmap.h → libgit2/oidmap.h} +0 -0
- /data/vendor/libgit2/src/{parse.h → libgit2/parse.h} +0 -0
- /data/vendor/libgit2/src/{patch_parse.h → libgit2/patch_parse.h} +0 -0
- /data/vendor/libgit2/src/{refdb.c → libgit2/refdb.c} +0 -0
- /data/vendor/libgit2/src/{refdb.h → libgit2/refdb.h} +0 -0
- /data/vendor/libgit2/src/{repo_template.h → libgit2/repo_template.h} +0 -0
- /data/vendor/libgit2/src/{revwalk.h → libgit2/revwalk.h} +0 -0
- /data/vendor/libgit2/src/{settings.h → libgit2/settings.h} +0 -0
- /data/vendor/libgit2/src/{status.h → libgit2/status.h} +0 -0
- /data/vendor/libgit2/src/{stream.h → libgit2/stream.h} +0 -0
- /data/vendor/libgit2/src/{streams → libgit2/streams}/mbedtls.h +0 -0
- /data/vendor/libgit2/src/{streams → libgit2/streams}/openssl.h +0 -0
- /data/vendor/libgit2/src/{streams → libgit2/streams}/openssl_legacy.c +0 -0
- /data/vendor/libgit2/src/{streams → libgit2/streams}/openssl_legacy.h +0 -0
- /data/vendor/libgit2/src/{streams → libgit2/streams}/registry.c +0 -0
- /data/vendor/libgit2/src/{streams → libgit2/streams}/registry.h +0 -0
- /data/vendor/libgit2/src/{streams → libgit2/streams}/socket.h +0 -0
- /data/vendor/libgit2/src/{streams → libgit2/streams}/stransport.c +0 -0
- /data/vendor/libgit2/src/{streams → libgit2/streams}/stransport.h +0 -0
- /data/vendor/libgit2/src/{streams → libgit2/streams}/tls.c +0 -0
- /data/vendor/libgit2/src/{streams → libgit2/streams}/tls.h +0 -0
- /data/vendor/libgit2/src/{transaction.h → libgit2/transaction.h} +0 -0
- /data/vendor/libgit2/src/{transports → libgit2/transports}/auth_negotiate.h +0 -0
- /data/vendor/libgit2/src/{transports → libgit2/transports}/credential.c +0 -0
- /data/vendor/libgit2/src/{transports → libgit2/transports}/credential_helpers.c +0 -0
- /data/vendor/libgit2/src/{transports → libgit2/transports}/ssh.h +0 -0
- /data/vendor/libgit2/src/{userdiff.h → libgit2/userdiff.h} +0 -0
- /data/vendor/libgit2/src/{xdiff → libgit2/xdiff}/xdiffi.h +0 -0
- /data/vendor/libgit2/src/{xdiff → libgit2/xdiff}/xemit.h +0 -0
- /data/vendor/libgit2/src/{xdiff → libgit2/xdiff}/xmacros.h +0 -0
- /data/vendor/libgit2/src/{xdiff → libgit2/xdiff}/xprepare.h +0 -0
- /data/vendor/libgit2/src/{xdiff → libgit2/xdiff}/xtypes.h +0 -0
- /data/vendor/libgit2/src/{xdiff → libgit2/xdiff}/xutils.h +0 -0
- /data/vendor/libgit2/src/{alloc.c → util/alloc.c} +0 -0
- /data/vendor/libgit2/src/{alloc.h → util/alloc.h} +0 -0
- /data/vendor/libgit2/src/{allocators → util/allocators}/failalloc.c +0 -0
- /data/vendor/libgit2/src/{allocators → util/allocators}/stdalloc.c +0 -0
- /data/vendor/libgit2/src/{allocators → util/allocators}/win32_leakcheck.c +0 -0
- /data/vendor/libgit2/src/{bitvec.h → util/bitvec.h} +0 -0
- /data/vendor/libgit2/src/{hash/sha1 → util/hash}/sha1dc/sha1.h +0 -0
- /data/vendor/libgit2/src/{hash/sha1 → util/hash}/sha1dc/ubc_check.c +0 -0
- /data/vendor/libgit2/src/{hash/sha1 → util/hash}/sha1dc/ubc_check.h +0 -0
- /data/vendor/libgit2/src/{integer.h → util/integer.h} +0 -0
- /data/vendor/libgit2/src/{pool.c → util/pool.c} +0 -0
- /data/vendor/libgit2/src/{pqueue.c → util/pqueue.c} +0 -0
- /data/vendor/libgit2/src/{strmap.c → util/strmap.c} +0 -0
- /data/vendor/libgit2/src/{strnlen.h → util/strnlen.h} +0 -0
- /data/vendor/libgit2/src/{unix → util/unix}/pthread.h +0 -0
- /data/vendor/libgit2/src/{varint.c → util/varint.c} +0 -0
- /data/vendor/libgit2/src/{vector.c → util/vector.c} +0 -0
- /data/vendor/libgit2/src/{wildmatch.c → util/wildmatch.c} +0 -0
- /data/vendor/libgit2/src/{win32 → util/win32}/dir.c +0 -0
- /data/vendor/libgit2/src/{win32 → util/win32}/error.c +0 -0
- /data/vendor/libgit2/src/{win32 → util/win32}/mingw-compat.h +0 -0
- /data/vendor/libgit2/src/{win32 → util/win32}/msvc-compat.h +0 -0
- /data/vendor/libgit2/src/{win32 → util/win32}/reparse.h +0 -0
- /data/vendor/libgit2/src/{win32 → util/win32}/thread.c +0 -0
- /data/vendor/libgit2/src/{win32 → util/win32}/utf-conv.c +0 -0
- /data/vendor/libgit2/src/{win32 → util/win32}/version.h +0 -0
- /data/vendor/libgit2/src/{win32 → util/win32}/w32_common.h +0 -0
- /data/vendor/libgit2/src/{win32 → util/win32}/w32_util.c +0 -0
- /data/vendor/libgit2/src/{win32 → util/win32}/win32-compat.h +0 -0
@@ -20,8 +20,6 @@
|
|
20
20
|
*
|
21
21
|
*/
|
22
22
|
#include "xinclude.h"
|
23
|
-
#include "xtypes.h"
|
24
|
-
#include "xdiff.h"
|
25
23
|
|
26
24
|
/*
|
27
25
|
* The basic idea of patience diff is to find lines that are unique in
|
@@ -78,7 +76,7 @@ struct hashmap {
|
|
78
76
|
|
79
77
|
static int is_anchor(xpparam_t const *xpp, const char *line)
|
80
78
|
{
|
81
|
-
|
79
|
+
int i;
|
82
80
|
for (i = 0; i < xpp->anchors_nr; i++) {
|
83
81
|
if (!strncmp(line, xpp->anchors[i], strlen(xpp->anchors[i])))
|
84
82
|
return 1;
|
@@ -92,7 +90,7 @@ static void insert_record(xpparam_t const *xpp, int line, struct hashmap *map,
|
|
92
90
|
{
|
93
91
|
xrecord_t **records = pass == 1 ?
|
94
92
|
map->env->xdf1.recs : map->env->xdf2.recs;
|
95
|
-
xrecord_t *record = records[line - 1]
|
93
|
+
xrecord_t *record = records[line - 1];
|
96
94
|
/*
|
97
95
|
* After xdl_prepare_env() (or more precisely, due to
|
98
96
|
* xdl_classify_record()), the "ha" member of the records (AKA lines)
|
@@ -106,11 +104,7 @@ static void insert_record(xpparam_t const *xpp, int line, struct hashmap *map,
|
|
106
104
|
int index = (int)((record->ha << 1) % map->alloc);
|
107
105
|
|
108
106
|
while (map->entries[index].line1) {
|
109
|
-
|
110
|
-
if (map->entries[index].hash != record->ha ||
|
111
|
-
!xdl_recmatch(record->ptr, record->size,
|
112
|
-
other->ptr, other->size,
|
113
|
-
map->xpp->flags)) {
|
107
|
+
if (map->entries[index].hash != record->ha) {
|
114
108
|
if (++index >= map->alloc)
|
115
109
|
index = 0;
|
116
110
|
continue;
|
@@ -217,9 +211,6 @@ static struct entry *find_longest_common_sequence(struct hashmap *map)
|
|
217
211
|
*/
|
218
212
|
int anchor_i = -1;
|
219
213
|
|
220
|
-
if (!sequence)
|
221
|
-
return NULL;
|
222
|
-
|
223
214
|
for (entry = map->first; entry; entry = entry->next) {
|
224
215
|
if (!entry->line2 || entry->line2 == NON_UNIQUE)
|
225
216
|
continue;
|
@@ -258,8 +249,7 @@ static int match(struct hashmap *map, int line1, int line2)
|
|
258
249
|
{
|
259
250
|
xrecord_t *record1 = map->env->xdf1.recs[line1 - 1];
|
260
251
|
xrecord_t *record2 = map->env->xdf2.recs[line2 - 1];
|
261
|
-
return
|
262
|
-
record2->ptr, record2->size, map->xpp->flags);
|
252
|
+
return record1->ha == record2->ha;
|
263
253
|
}
|
264
254
|
|
265
255
|
static int patience_diff(mmfile_t *file1, mmfile_t *file2,
|
@@ -294,9 +284,6 @@ static int walk_common_sequence(struct hashmap *map, struct entry *first,
|
|
294
284
|
|
295
285
|
/* Recurse */
|
296
286
|
if (next1 > line1 || next2 > line2) {
|
297
|
-
struct hashmap submap;
|
298
|
-
|
299
|
-
memset(&submap, 0, sizeof(submap));
|
300
287
|
if (patience_diff(map->file1, map->file2,
|
301
288
|
map->xpp, map->env,
|
302
289
|
line1, next1 - line1,
|
@@ -323,6 +310,8 @@ static int fall_back_to_classic_diff(struct hashmap *map,
|
|
323
310
|
int line1, int count1, int line2, int count2)
|
324
311
|
{
|
325
312
|
xpparam_t xpp;
|
313
|
+
|
314
|
+
memset(&xpp, 0, sizeof(xpp));
|
326
315
|
xpp.flags = map->xpp->flags & ~XDF_DIFF_ALGORITHM_MASK;
|
327
316
|
|
328
317
|
return xdl_fall_back_diff(map->env, &xpp,
|
@@ -181,15 +181,11 @@ static int xdl_prepare_ctx(unsigned int pass, mmfile_t *mf, long narec, xpparam_
|
|
181
181
|
if (!(recs = (xrecord_t **) xdl_malloc(narec * sizeof(xrecord_t *))))
|
182
182
|
goto abort;
|
183
183
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
if (!(rhash = (xrecord_t **) xdl_malloc(hsize * sizeof(xrecord_t *))))
|
190
|
-
goto abort;
|
191
|
-
memset(rhash, 0, hsize * sizeof(xrecord_t *));
|
192
|
-
}
|
184
|
+
hbits = xdl_hashbits((unsigned int) narec);
|
185
|
+
hsize = 1 << hbits;
|
186
|
+
if (!(rhash = (xrecord_t **) xdl_malloc(hsize * sizeof(xrecord_t *))))
|
187
|
+
goto abort;
|
188
|
+
memset(rhash, 0, hsize * sizeof(xrecord_t *));
|
193
189
|
|
194
190
|
nrec = 0;
|
195
191
|
if ((cur = blk = xdl_mmfile_first(mf, &bsize)) != NULL) {
|
@@ -208,9 +204,7 @@ static int xdl_prepare_ctx(unsigned int pass, mmfile_t *mf, long narec, xpparam_
|
|
208
204
|
crec->size = (long) (cur - prev);
|
209
205
|
crec->ha = hav;
|
210
206
|
recs[nrec++] = crec;
|
211
|
-
|
212
|
-
if ((XDF_DIFF_ALG(xpp->flags) != XDF_HISTOGRAM_DIFF) &&
|
213
|
-
xdl_classify_record(pass, cf, rhash, hbits, crec) < 0)
|
207
|
+
if (xdl_classify_record(pass, cf, rhash, hbits, crec) < 0)
|
214
208
|
goto abort;
|
215
209
|
}
|
216
210
|
}
|
@@ -219,10 +213,13 @@ static int xdl_prepare_ctx(unsigned int pass, mmfile_t *mf, long narec, xpparam_
|
|
219
213
|
goto abort;
|
220
214
|
memset(rchg, 0, (nrec + 2) * sizeof(char));
|
221
215
|
|
222
|
-
if (
|
223
|
-
|
224
|
-
|
225
|
-
|
216
|
+
if ((XDF_DIFF_ALG(xpp->flags) != XDF_PATIENCE_DIFF) &&
|
217
|
+
(XDF_DIFF_ALG(xpp->flags) != XDF_HISTOGRAM_DIFF)) {
|
218
|
+
if (!(rindex = xdl_malloc((nrec + 1) * sizeof(*rindex))))
|
219
|
+
goto abort;
|
220
|
+
if (!(ha = xdl_malloc((nrec + 1) * sizeof(*ha))))
|
221
|
+
goto abort;
|
222
|
+
}
|
226
223
|
|
227
224
|
xdf->nrec = nrec;
|
228
225
|
xdf->recs = recs;
|
@@ -279,8 +276,7 @@ int xdl_prepare_env(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
|
|
279
276
|
enl1 = xdl_guess_lines(mf1, sample) + 1;
|
280
277
|
enl2 = xdl_guess_lines(mf2, sample) + 1;
|
281
278
|
|
282
|
-
if (
|
283
|
-
xdl_init_classifier(&cf, enl1 + enl2 + 1, xpp->flags) < 0)
|
279
|
+
if (xdl_init_classifier(&cf, enl1 + enl2 + 1, xpp->flags) < 0)
|
284
280
|
return -1;
|
285
281
|
|
286
282
|
if (xdl_prepare_ctx(1, mf1, enl1, xpp, &cf, &xe->xdf1) < 0) {
|
@@ -305,8 +301,7 @@ int xdl_prepare_env(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
|
|
305
301
|
return -1;
|
306
302
|
}
|
307
303
|
|
308
|
-
|
309
|
-
xdl_free_classifier(&cf);
|
304
|
+
xdl_free_classifier(&cf);
|
310
305
|
|
311
306
|
return 0;
|
312
307
|
}
|
@@ -23,8 +23,6 @@
|
|
23
23
|
#include "xinclude.h"
|
24
24
|
|
25
25
|
|
26
|
-
|
27
|
-
|
28
26
|
long xdl_bogosqrt(long n) {
|
29
27
|
long i;
|
30
28
|
|
@@ -52,7 +50,7 @@ int xdl_emit_diffrec(char const *rec, long size, char const *pre, long psize,
|
|
52
50
|
mb[2].size = strlen(mb[2].ptr);
|
53
51
|
i++;
|
54
52
|
}
|
55
|
-
if (ecb->
|
53
|
+
if (ecb->out_line(ecb->priv, mb, i) < 0) {
|
56
54
|
|
57
55
|
return -1;
|
58
56
|
}
|
@@ -342,8 +340,9 @@ int xdl_num_out(char *out, long val) {
|
|
342
340
|
return str - out;
|
343
341
|
}
|
344
342
|
|
345
|
-
int
|
346
|
-
|
343
|
+
static int xdl_format_hunk_hdr(long s1, long c1, long s2, long c2,
|
344
|
+
const char *func, long funclen,
|
345
|
+
xdemitcb_t *ecb) {
|
347
346
|
int nb = 0;
|
348
347
|
mmbuffer_t mb;
|
349
348
|
char buf[128];
|
@@ -376,7 +375,7 @@ int xdl_emit_hunk_hdr(long s1, long c1, long s2, long c2,
|
|
376
375
|
nb += 3;
|
377
376
|
if (func && funclen) {
|
378
377
|
buf[nb++] = ' ';
|
379
|
-
if (funclen >
|
378
|
+
if (funclen > sizeof(buf) - nb - 1)
|
380
379
|
funclen = sizeof(buf) - nb - 1;
|
381
380
|
memcpy(buf + nb, func, funclen);
|
382
381
|
nb += funclen;
|
@@ -385,9 +384,21 @@ int xdl_emit_hunk_hdr(long s1, long c1, long s2, long c2,
|
|
385
384
|
|
386
385
|
mb.ptr = buf;
|
387
386
|
mb.size = nb;
|
388
|
-
if (ecb->
|
387
|
+
if (ecb->out_line(ecb->priv, &mb, 1) < 0)
|
389
388
|
return -1;
|
389
|
+
return 0;
|
390
|
+
}
|
390
391
|
|
392
|
+
int xdl_emit_hunk_hdr(long s1, long c1, long s2, long c2,
|
393
|
+
const char *func, long funclen,
|
394
|
+
xdemitcb_t *ecb) {
|
395
|
+
if (!ecb->out_hunk)
|
396
|
+
return xdl_format_hunk_hdr(s1, c1, s2, c2, func, funclen, ecb);
|
397
|
+
if (ecb->out_hunk(ecb->priv,
|
398
|
+
c1 ? s1 : s1 - 1, c1,
|
399
|
+
c2 ? s2 : s2 - 1, c2,
|
400
|
+
func, funclen) < 0)
|
401
|
+
return -1;
|
391
402
|
return 0;
|
392
403
|
}
|
393
404
|
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# util: a shared library for common utility functions for libgit2 projects
|
2
|
+
|
3
|
+
add_library(util OBJECT)
|
4
|
+
set_target_properties(util PROPERTIES C_STANDARD 90)
|
5
|
+
set_target_properties(util PROPERTIES C_EXTENSIONS OFF)
|
6
|
+
|
7
|
+
configure_file(git2_features.h.in git2_features.h)
|
8
|
+
|
9
|
+
set(UTIL_INCLUDES
|
10
|
+
"${PROJECT_BINARY_DIR}/src/util"
|
11
|
+
"${PROJECT_BINARY_DIR}/include"
|
12
|
+
"${PROJECT_BINARY_DIR}/include/git2"
|
13
|
+
"${PROJECT_SOURCE_DIR}/src/util"
|
14
|
+
"${PROJECT_SOURCE_DIR}/include")
|
15
|
+
|
16
|
+
file(GLOB UTIL_SRC *.c *.h allocators/*.c allocators/*.h hash.h)
|
17
|
+
list(SORT UTIL_SRC)
|
18
|
+
|
19
|
+
#
|
20
|
+
# Platform specific sources
|
21
|
+
#
|
22
|
+
|
23
|
+
if(WIN32 AND NOT CYGWIN)
|
24
|
+
file(GLOB UTIL_SRC_OS win32/*.c win32/*.h)
|
25
|
+
list(SORT UTIL_SRC_OS)
|
26
|
+
elseif(NOT AMIGA)
|
27
|
+
file(GLOB UTIL_SRC_OS unix/*.c unix/*.h)
|
28
|
+
list(SORT UTIL_SRC_OS)
|
29
|
+
endif()
|
30
|
+
|
31
|
+
#
|
32
|
+
# Hash backend selection
|
33
|
+
#
|
34
|
+
|
35
|
+
if(USE_SHA1 STREQUAL "CollisionDetection")
|
36
|
+
file(GLOB UTIL_SRC_SHA1 hash/collisiondetect.* hash/sha1dc/*)
|
37
|
+
target_compile_definitions(util PRIVATE SHA1DC_NO_STANDARD_INCLUDES=1)
|
38
|
+
target_compile_definitions(util PRIVATE SHA1DC_CUSTOM_INCLUDE_SHA1_C=\"git2_util.h\")
|
39
|
+
target_compile_definitions(util PRIVATE SHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"git2_util.h\")
|
40
|
+
elseif(USE_SHA1 STREQUAL "OpenSSL" OR USE_SHA1 STREQUAL "OpenSSL-Dynamic")
|
41
|
+
add_definitions(-DOPENSSL_API_COMPAT=0x10100000L)
|
42
|
+
file(GLOB UTIL_SRC_SHA1 hash/openssl.*)
|
43
|
+
elseif(USE_SHA1 STREQUAL "CommonCrypto")
|
44
|
+
file(GLOB UTIL_SRC_SHA1 hash/common_crypto.*)
|
45
|
+
elseif(USE_SHA1 STREQUAL "mbedTLS")
|
46
|
+
file(GLOB UTIL_SRC_SHA1 hash/mbedtls.*)
|
47
|
+
elseif(USE_SHA1 STREQUAL "Win32")
|
48
|
+
file(GLOB UTIL_SRC_SHA1 hash/win32.*)
|
49
|
+
else()
|
50
|
+
message(FATAL_ERROR "Asked for unknown SHA1 backend: ${USE_SHA1}")
|
51
|
+
endif()
|
52
|
+
|
53
|
+
list(SORT UTIL_SRC_SHA1)
|
54
|
+
|
55
|
+
if(USE_SHA256 STREQUAL "Builtin")
|
56
|
+
file(GLOB UTIL_SRC_SHA256 hash/builtin.* hash/rfc6234/*)
|
57
|
+
elseif(USE_SHA256 STREQUAL "OpenSSL" OR USE_SHA256 STREQUAL "OpenSSL-Dynamic")
|
58
|
+
add_definitions(-DOPENSSL_API_COMPAT=0x10100000L)
|
59
|
+
file(GLOB UTIL_SRC_SHA256 hash/openssl.*)
|
60
|
+
elseif(USE_SHA256 STREQUAL "CommonCrypto")
|
61
|
+
file(GLOB UTIL_SRC_SHA256 hash/common_crypto.*)
|
62
|
+
elseif(USE_SHA256 STREQUAL "mbedTLS")
|
63
|
+
file(GLOB UTIL_SRC_SHA256 hash/mbedtls.*)
|
64
|
+
elseif(USE_SHA256 STREQUAL "Win32")
|
65
|
+
file(GLOB UTIL_SRC_SHA256 hash/win32.*)
|
66
|
+
else()
|
67
|
+
message(FATAL_ERROR "Asked for unknown SHA256 backend: ${USE_SHA256}")
|
68
|
+
endif()
|
69
|
+
|
70
|
+
list(SORT UTIL_SRC_SHA256)
|
71
|
+
|
72
|
+
#
|
73
|
+
# Build the library
|
74
|
+
#
|
75
|
+
|
76
|
+
target_sources(util PRIVATE ${UTIL_SRC} ${UTIL_SRC_OS} ${UTIL_SRC_SHA1} ${UTIL_SRC_SHA256})
|
77
|
+
ide_split_sources(util)
|
78
|
+
|
79
|
+
target_include_directories(util PRIVATE ${UTIL_INCLUDES} ${LIBGIT2_DEPENDENCY_INCLUDES} PUBLIC ${libgit2_SOURCE_DIR}/include)
|
80
|
+
target_include_directories(util SYSTEM PRIVATE ${LIBGIT2_SYSTEM_INCLUDES})
|
@@ -8,7 +8,7 @@
|
|
8
8
|
#ifndef INCLUDE_allocators_failalloc_h__
|
9
9
|
#define INCLUDE_allocators_failalloc_h__
|
10
10
|
|
11
|
-
#include "
|
11
|
+
#include "git2_util.h"
|
12
12
|
|
13
13
|
extern void *git_failalloc_malloc(size_t len, const char *file, int line);
|
14
14
|
extern void *git_failalloc_calloc(size_t nelem, size_t elsize, const char *file, int line);
|
@@ -24,6 +24,8 @@
|
|
24
24
|
|
25
25
|
# define GIT_ASSERT_WITH_RETVAL(expr, fail) assert(expr)
|
26
26
|
# define GIT_ASSERT_ARG_WITH_RETVAL(expr, fail) assert(expr)
|
27
|
+
|
28
|
+
# define GIT_ASSERT_WITH_CLEANUP(expr, cleanup) assert(expr)
|
27
29
|
#else
|
28
30
|
|
29
31
|
/** Internal consistency check to stop the function. */
|
@@ -53,6 +55,20 @@
|
|
53
55
|
} \
|
54
56
|
} while(0)
|
55
57
|
|
58
|
+
/**
|
59
|
+
* Go to to the given label on assertion failures; useful when you have
|
60
|
+
* taken a lock or otherwise need to release a resource.
|
61
|
+
*/
|
62
|
+
# define GIT_ASSERT_WITH_CLEANUP(expr, cleanup) \
|
63
|
+
GIT_ASSERT__WITH_CLEANUP(expr, GIT_ERROR_INTERNAL, "unrecoverable internal error", cleanup)
|
64
|
+
|
65
|
+
# define GIT_ASSERT__WITH_CLEANUP(expr, code, msg, cleanup) do { \
|
66
|
+
if (!(expr)) { \
|
67
|
+
git_error_set(code, "%s: '%s'", msg, #expr); \
|
68
|
+
cleanup; \
|
69
|
+
} \
|
70
|
+
} while(0)
|
71
|
+
|
56
72
|
#endif /* GIT_ASSERT_HARD */
|
57
73
|
|
58
74
|
#endif
|
@@ -1,18 +1,19 @@
|
|
1
1
|
/*
|
2
|
-
*
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
3
|
*
|
4
|
-
*
|
4
|
+
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
|
+
* a Linking Exception. For full terms see the included COPYING file.
|
5
6
|
*/
|
6
7
|
|
7
|
-
#include "
|
8
|
+
#include "git2_util.h"
|
8
9
|
|
9
10
|
#ifndef GIT_WIN32
|
10
11
|
#include <sys/time.h>
|
11
12
|
#endif
|
12
13
|
|
13
14
|
#include "util.h"
|
14
|
-
#include "cache.h"
|
15
15
|
#include "posix.h"
|
16
|
+
#include "date.h"
|
16
17
|
|
17
18
|
#include <ctype.h>
|
18
19
|
#include <time.h>
|
@@ -853,11 +854,11 @@ static git_time_t approxidate_str(const char *date,
|
|
853
854
|
}
|
854
855
|
pending_number(&tm, &number);
|
855
856
|
if (!touched)
|
856
|
-
*error_ret = 1;
|
857
|
+
*error_ret = -1;
|
857
858
|
return update_tm(&tm, &now, 0);
|
858
859
|
}
|
859
860
|
|
860
|
-
int
|
861
|
+
int git_date_parse(git_time_t *out, const char *date)
|
861
862
|
{
|
862
863
|
time_t time_sec;
|
863
864
|
git_time_t timestamp;
|
@@ -872,34 +873,27 @@ int git__date_parse(git_time_t *out, const char *date)
|
|
872
873
|
return -1;
|
873
874
|
|
874
875
|
*out = approxidate_str(date, time_sec, &error_ret);
|
875
|
-
|
876
|
+
return error_ret;
|
876
877
|
}
|
877
878
|
|
878
|
-
int
|
879
|
+
int git_date_rfc2822_fmt(git_str *out, git_time_t time, int offset)
|
879
880
|
{
|
880
|
-
int written;
|
881
|
-
struct tm gmt;
|
882
881
|
time_t t;
|
882
|
+
struct tm gmt;
|
883
883
|
|
884
884
|
GIT_ASSERT_ARG(out);
|
885
|
-
GIT_ASSERT_ARG(date);
|
886
885
|
|
887
|
-
t = (time_t) (
|
886
|
+
t = (time_t) (time + offset * 60);
|
888
887
|
|
889
|
-
if (p_gmtime_r
|
888
|
+
if (p_gmtime_r(&t, &gmt) == NULL)
|
890
889
|
return -1;
|
891
890
|
|
892
|
-
|
891
|
+
return git_str_printf(out, "%.3s, %u %.3s %.4u %02u:%02u:%02u %+03d%02d",
|
893
892
|
weekday_names[gmt.tm_wday],
|
894
893
|
gmt.tm_mday,
|
895
894
|
month_names[gmt.tm_mon],
|
896
895
|
gmt.tm_year + 1900,
|
897
896
|
gmt.tm_hour, gmt.tm_min, gmt.tm_sec,
|
898
|
-
|
899
|
-
|
900
|
-
if (written < 0 || (written > (int) len - 1))
|
901
|
-
return -1;
|
902
|
-
|
903
|
-
return 0;
|
897
|
+
offset / 60, offset % 60);
|
904
898
|
}
|
905
899
|
|
@@ -0,0 +1,33 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
|
+
*
|
4
|
+
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
|
+
* a Linking Exception. For full terms see the included COPYING file.
|
6
|
+
*/
|
7
|
+
#ifndef INCLUDE_date_h__
|
8
|
+
#define INCLUDE_date_h__
|
9
|
+
|
10
|
+
#include "util.h"
|
11
|
+
#include "str.h"
|
12
|
+
|
13
|
+
/*
|
14
|
+
* Parse a string into a value as a git_time_t.
|
15
|
+
*
|
16
|
+
* Sample valid input:
|
17
|
+
* - "yesterday"
|
18
|
+
* - "July 17, 2003"
|
19
|
+
* - "2003-7-17 08:23"
|
20
|
+
*/
|
21
|
+
extern int git_date_parse(git_time_t *out, const char *date);
|
22
|
+
|
23
|
+
/*
|
24
|
+
* Format a git_time as a RFC2822 string
|
25
|
+
*
|
26
|
+
* @param out buffer to store formatted date
|
27
|
+
* @param time the time to be formatted
|
28
|
+
* @param offset the timezone offset
|
29
|
+
* @return 0 if successful; -1 on error
|
30
|
+
*/
|
31
|
+
extern int git_date_rfc2822_fmt(git_str *out, git_time_t time, int offset);
|
32
|
+
|
33
|
+
#endif
|
@@ -43,7 +43,7 @@ static int verify_last_error(git_filebuf *file)
|
|
43
43
|
|
44
44
|
static int lock_file(git_filebuf *file, int flags, mode_t mode)
|
45
45
|
{
|
46
|
-
if (
|
46
|
+
if (git_fs_path_exists(file->path_lock) == true) {
|
47
47
|
git_error_clear(); /* actual OS error code just confuses */
|
48
48
|
git_error_set(GIT_ERROR_OS,
|
49
49
|
"failed to lock file '%s' for writing", file->path_lock);
|
@@ -63,9 +63,9 @@ static int lock_file(git_filebuf *file, int flags, mode_t mode)
|
|
63
63
|
|
64
64
|
file->fd_is_open = true;
|
65
65
|
|
66
|
-
if ((flags & GIT_FILEBUF_APPEND) &&
|
66
|
+
if ((flags & GIT_FILEBUF_APPEND) && git_fs_path_exists(file->path_original) == true) {
|
67
67
|
git_file source;
|
68
|
-
char buffer[
|
68
|
+
char buffer[GIT_BUFSIZE_FILEIO];
|
69
69
|
ssize_t read_bytes;
|
70
70
|
int error = 0;
|
71
71
|
|
@@ -103,7 +103,7 @@ void git_filebuf_cleanup(git_filebuf *file)
|
|
103
103
|
if (file->fd_is_open && file->fd >= 0)
|
104
104
|
p_close(file->fd);
|
105
105
|
|
106
|
-
if (file->created_lock && !file->did_rename && file->path_lock &&
|
106
|
+
if (file->created_lock && !file->did_rename && file->path_lock && git_fs_path_exists(file->path_lock))
|
107
107
|
p_unlink(file->path_lock);
|
108
108
|
|
109
109
|
if (file->compute_digest) {
|
@@ -195,21 +195,21 @@ static int write_deflate(git_filebuf *file, void *source, size_t len)
|
|
195
195
|
|
196
196
|
#define MAX_SYMLINK_DEPTH 5
|
197
197
|
|
198
|
-
static int resolve_symlink(
|
198
|
+
static int resolve_symlink(git_str *out, const char *path)
|
199
199
|
{
|
200
200
|
int i, error, root;
|
201
201
|
ssize_t ret;
|
202
202
|
struct stat st;
|
203
|
-
|
203
|
+
git_str curpath = GIT_STR_INIT, target = GIT_STR_INIT;
|
204
204
|
|
205
|
-
if ((error =
|
206
|
-
(error =
|
205
|
+
if ((error = git_str_grow(&target, GIT_PATH_MAX + 1)) < 0 ||
|
206
|
+
(error = git_str_puts(&curpath, path)) < 0)
|
207
207
|
return error;
|
208
208
|
|
209
209
|
for (i = 0; i < MAX_SYMLINK_DEPTH; i++) {
|
210
210
|
error = p_lstat(curpath.ptr, &st);
|
211
211
|
if (error < 0 && errno == ENOENT) {
|
212
|
-
error =
|
212
|
+
error = git_str_puts(out, curpath.ptr);
|
213
213
|
goto cleanup;
|
214
214
|
}
|
215
215
|
|
@@ -220,7 +220,7 @@ static int resolve_symlink(git_buf *out, const char *path)
|
|
220
220
|
}
|
221
221
|
|
222
222
|
if (!S_ISLNK(st.st_mode)) {
|
223
|
-
error =
|
223
|
+
error = git_str_puts(out, curpath.ptr);
|
224
224
|
goto cleanup;
|
225
225
|
}
|
226
226
|
|
@@ -241,20 +241,20 @@ static int resolve_symlink(git_buf *out, const char *path)
|
|
241
241
|
target.ptr[ret] = '\0';
|
242
242
|
target.size = ret;
|
243
243
|
|
244
|
-
root =
|
244
|
+
root = git_fs_path_root(target.ptr);
|
245
245
|
if (root >= 0) {
|
246
|
-
if ((error =
|
246
|
+
if ((error = git_str_sets(&curpath, target.ptr)) < 0)
|
247
247
|
goto cleanup;
|
248
248
|
} else {
|
249
|
-
|
249
|
+
git_str dir = GIT_STR_INIT;
|
250
250
|
|
251
|
-
if ((error =
|
251
|
+
if ((error = git_fs_path_dirname_r(&dir, curpath.ptr)) < 0)
|
252
252
|
goto cleanup;
|
253
253
|
|
254
|
-
|
255
|
-
|
254
|
+
git_str_swap(&curpath, &dir);
|
255
|
+
git_str_dispose(&dir);
|
256
256
|
|
257
|
-
if ((error =
|
257
|
+
if ((error = git_fs_path_apply_relative(&curpath, target.ptr)) < 0)
|
258
258
|
goto cleanup;
|
259
259
|
}
|
260
260
|
}
|
@@ -263,8 +263,8 @@ static int resolve_symlink(git_buf *out, const char *path)
|
|
263
263
|
error = -1;
|
264
264
|
|
265
265
|
cleanup:
|
266
|
-
|
267
|
-
|
266
|
+
git_str_dispose(&curpath);
|
267
|
+
git_str_dispose(&target);
|
268
268
|
return error;
|
269
269
|
}
|
270
270
|
|
@@ -305,7 +305,7 @@ int git_filebuf_open_withsize(git_filebuf *file, const char *path, int flags, mo
|
|
305
305
|
if (flags & GIT_FILEBUF_HASH_CONTENTS) {
|
306
306
|
file->compute_digest = 1;
|
307
307
|
|
308
|
-
if (git_hash_ctx_init(&file->digest) < 0)
|
308
|
+
if (git_hash_ctx_init(&file->digest, GIT_HASH_ALGORITHM_SHA1) < 0)
|
309
309
|
goto cleanup;
|
310
310
|
}
|
311
311
|
|
@@ -332,13 +332,13 @@ int git_filebuf_open_withsize(git_filebuf *file, const char *path, int flags, mo
|
|
332
332
|
|
333
333
|
/* If we are writing to a temp file */
|
334
334
|
if (flags & GIT_FILEBUF_TEMPORARY) {
|
335
|
-
|
335
|
+
git_str tmp_path = GIT_STR_INIT;
|
336
336
|
|
337
337
|
/* Open the file as temporary for locking */
|
338
338
|
file->fd = git_futils_mktmp(&tmp_path, path, mode);
|
339
339
|
|
340
340
|
if (file->fd < 0) {
|
341
|
-
|
341
|
+
git_str_dispose(&tmp_path);
|
342
342
|
goto cleanup;
|
343
343
|
}
|
344
344
|
file->fd_is_open = true;
|
@@ -346,17 +346,17 @@ int git_filebuf_open_withsize(git_filebuf *file, const char *path, int flags, mo
|
|
346
346
|
|
347
347
|
/* No original path */
|
348
348
|
file->path_original = NULL;
|
349
|
-
file->path_lock =
|
349
|
+
file->path_lock = git_str_detach(&tmp_path);
|
350
350
|
GIT_ERROR_CHECK_ALLOC(file->path_lock);
|
351
351
|
} else {
|
352
|
-
|
352
|
+
git_str resolved_path = GIT_STR_INIT;
|
353
353
|
|
354
354
|
if ((error = resolve_symlink(&resolved_path, path)) < 0)
|
355
355
|
goto cleanup;
|
356
356
|
|
357
357
|
/* Save the original path of the file */
|
358
358
|
path_len = resolved_path.size;
|
359
|
-
file->path_original =
|
359
|
+
file->path_original = git_str_detach(&resolved_path);
|
360
360
|
|
361
361
|
/* create the locking path by appending ".lock" to the original */
|
362
362
|
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, path_len, GIT_FILELOCK_EXTLENGTH);
|
@@ -366,7 +366,7 @@ int git_filebuf_open_withsize(git_filebuf *file, const char *path, int flags, mo
|
|
366
366
|
memcpy(file->path_lock, file->path_original, path_len);
|
367
367
|
memcpy(file->path_lock + path_len, GIT_FILELOCK_EXTENSION, GIT_FILELOCK_EXTLENGTH);
|
368
368
|
|
369
|
-
if (
|
369
|
+
if (git_fs_path_isdir(file->path_original)) {
|
370
370
|
git_error_set(GIT_ERROR_FILESYSTEM, "path '%s' is a directory", file->path_original);
|
371
371
|
error = GIT_EDIRECTORY;
|
372
372
|
goto cleanup;
|
@@ -386,9 +386,9 @@ cleanup:
|
|
386
386
|
return error;
|
387
387
|
}
|
388
388
|
|
389
|
-
int git_filebuf_hash(
|
389
|
+
int git_filebuf_hash(unsigned char *out, git_filebuf *file)
|
390
390
|
{
|
391
|
-
GIT_ASSERT_ARG(
|
391
|
+
GIT_ASSERT_ARG(out);
|
392
392
|
GIT_ASSERT_ARG(file);
|
393
393
|
GIT_ASSERT_ARG(file->compute_digest);
|
394
394
|
|
@@ -397,7 +397,7 @@ int git_filebuf_hash(git_oid *oid, git_filebuf *file)
|
|
397
397
|
if (verify_last_error(file) < 0)
|
398
398
|
return -1;
|
399
399
|
|
400
|
-
git_hash_final(
|
400
|
+
git_hash_final(out, &file->digest);
|
401
401
|
git_hash_ctx_cleanup(&file->digest);
|
402
402
|
file->compute_digest = 0;
|
403
403
|
|
@@ -7,7 +7,7 @@
|
|
7
7
|
#ifndef INCLUDE_filebuf_h__
|
8
8
|
#define INCLUDE_filebuf_h__
|
9
9
|
|
10
|
-
#include "
|
10
|
+
#include "git2_util.h"
|
11
11
|
|
12
12
|
#include "futils.h"
|
13
13
|
#include "hash.h"
|
@@ -87,7 +87,7 @@ int git_filebuf_open_withsize(git_filebuf *file, const char *path, int flags, mo
|
|
87
87
|
int git_filebuf_commit(git_filebuf *lock);
|
88
88
|
int git_filebuf_commit_at(git_filebuf *lock, const char *path);
|
89
89
|
void git_filebuf_cleanup(git_filebuf *lock);
|
90
|
-
int git_filebuf_hash(
|
90
|
+
int git_filebuf_hash(unsigned char *out, git_filebuf *file);
|
91
91
|
int git_filebuf_flush(git_filebuf *file);
|
92
92
|
int git_filebuf_stats(time_t *mtime, size_t *size, git_filebuf *file);
|
93
93
|
|