rugged 0.26.7 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/ext/rugged/rugged_blame.c +6 -3
- data/ext/rugged/rugged_branch_collection.c +3 -6
- data/ext/rugged/rugged_commit.c +56 -0
- data/ext/rugged/rugged_config.c +44 -9
- data/ext/rugged/rugged_diff.c +3 -14
- data/ext/rugged/rugged_diff_hunk.c +1 -3
- data/ext/rugged/rugged_index.c +1 -5
- data/ext/rugged/rugged_note.c +1 -4
- data/ext/rugged/rugged_patch.c +1 -4
- data/ext/rugged/rugged_reference_collection.c +1 -7
- data/ext/rugged/rugged_remote.c +5 -8
- data/ext/rugged/rugged_remote_collection.c +1 -6
- data/ext/rugged/rugged_repo.c +16 -48
- data/ext/rugged/rugged_revwalk.c +7 -16
- data/ext/rugged/rugged_settings.c +28 -0
- data/ext/rugged/rugged_submodule_collection.c +3 -4
- data/ext/rugged/rugged_tag_collection.c +1 -5
- data/ext/rugged/rugged_tree.c +2 -3
- data/lib/rugged/repository.rb +43 -0
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +1 -0
- data/vendor/libgit2/CMakeLists.txt +61 -510
- data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +14 -0
- data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +25 -8
- data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +27 -8
- data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +20 -0
- data/vendor/libgit2/cmake/Modules/IdeSplitSources.cmake +22 -0
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +3 -0
- data/vendor/libgit2/deps/regex/CMakeLists.txt +2 -0
- data/vendor/libgit2/deps/winhttp/CMakeLists.txt +26 -0
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +4 -0
- data/vendor/libgit2/include/git2/config.h +29 -2
- data/vendor/libgit2/include/git2/describe.h +1 -1
- data/vendor/libgit2/include/git2/diff.h +59 -8
- data/vendor/libgit2/include/git2/graph.h +3 -0
- data/vendor/libgit2/include/git2/merge.h +6 -0
- data/vendor/libgit2/include/git2/message.h +43 -3
- data/vendor/libgit2/include/git2/notes.h +89 -0
- data/vendor/libgit2/include/git2/odb.h +8 -1
- data/vendor/libgit2/include/git2/patch.h +2 -2
- data/vendor/libgit2/include/git2/pathspec.h +35 -18
- data/vendor/libgit2/include/git2/refs.h +3 -0
- data/vendor/libgit2/include/git2/remote.h +34 -4
- data/vendor/libgit2/include/git2/repository.h +6 -6
- data/vendor/libgit2/include/git2/reset.h +4 -4
- data/vendor/libgit2/include/git2/status.h +4 -0
- data/vendor/libgit2/include/git2/sys/config.h +4 -1
- data/vendor/libgit2/include/git2/sys/odb_backend.h +2 -1
- data/vendor/libgit2/include/git2/tree.h +4 -3
- data/vendor/libgit2/include/git2/types.h +1 -0
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2/worktree.h +1 -1
- data/vendor/libgit2/src/CMakeLists.txt +463 -0
- data/vendor/libgit2/src/annotated_commit.c +1 -1
- data/vendor/libgit2/src/annotated_commit.h +2 -0
- data/vendor/libgit2/src/apply.c +2 -1
- data/vendor/libgit2/src/apply.h +2 -0
- data/vendor/libgit2/src/attr.c +24 -4
- data/vendor/libgit2/src/attr.h +2 -0
- data/vendor/libgit2/src/attr_file.c +9 -2
- data/vendor/libgit2/src/attr_file.h +2 -0
- data/vendor/libgit2/src/attrcache.c +9 -1
- data/vendor/libgit2/src/attrcache.h +2 -0
- data/vendor/libgit2/src/blame.c +1 -0
- data/vendor/libgit2/src/blame.h +2 -1
- data/vendor/libgit2/src/blame_git.c +1 -0
- data/vendor/libgit2/src/blame_git.h +2 -0
- data/vendor/libgit2/src/blob.c +2 -2
- data/vendor/libgit2/src/blob.h +2 -0
- data/vendor/libgit2/src/branch.c +8 -1
- data/vendor/libgit2/src/branch.h +2 -0
- data/vendor/libgit2/src/buf_text.c +7 -7
- data/vendor/libgit2/src/buf_text.h +3 -3
- data/vendor/libgit2/src/buffer.c +31 -1
- data/vendor/libgit2/src/buffer.h +3 -0
- data/vendor/libgit2/src/cache.c +2 -2
- data/vendor/libgit2/src/cache.h +2 -0
- data/vendor/libgit2/src/cc-compat.h +3 -3
- data/vendor/libgit2/src/checkout.c +30 -19
- data/vendor/libgit2/src/checkout.h +2 -0
- data/vendor/libgit2/src/cherrypick.c +1 -0
- data/vendor/libgit2/src/clone.c +2 -1
- data/vendor/libgit2/src/clone.h +4 -0
- data/vendor/libgit2/src/commit.c +2 -1
- data/vendor/libgit2/src/commit.h +2 -0
- data/vendor/libgit2/src/commit_list.c +1 -1
- data/vendor/libgit2/src/commit_list.h +2 -0
- data/vendor/libgit2/src/common.h +11 -5
- data/vendor/libgit2/src/config.c +12 -10
- data/vendor/libgit2/src/config.h +2 -0
- data/vendor/libgit2/src/config_cache.c +1 -0
- data/vendor/libgit2/src/config_file.c +287 -786
- data/vendor/libgit2/src/config_file.h +4 -3
- data/vendor/libgit2/src/config_parse.c +525 -0
- data/vendor/libgit2/src/config_parse.h +64 -0
- data/vendor/libgit2/src/crlf.c +2 -1
- data/vendor/libgit2/src/delta.c +28 -30
- data/vendor/libgit2/src/delta.h +1 -0
- data/vendor/libgit2/src/describe.c +3 -1
- data/vendor/libgit2/src/diff.c +148 -2
- data/vendor/libgit2/src/diff.h +3 -1
- data/vendor/libgit2/src/diff_driver.c +12 -9
- data/vendor/libgit2/src/diff_driver.h +4 -1
- data/vendor/libgit2/src/diff_file.c +7 -4
- data/vendor/libgit2/src/diff_file.h +1 -0
- data/vendor/libgit2/src/diff_generate.c +6 -3
- data/vendor/libgit2/src/diff_generate.h +6 -1
- data/vendor/libgit2/src/diff_parse.c +5 -4
- data/vendor/libgit2/src/diff_parse.h +2 -0
- data/vendor/libgit2/src/diff_print.c +2 -0
- data/vendor/libgit2/src/diff_stats.c +2 -0
- data/vendor/libgit2/src/diff_tform.c +2 -1
- data/vendor/libgit2/src/diff_tform.h +4 -1
- data/vendor/libgit2/src/diff_xdiff.c +5 -2
- data/vendor/libgit2/src/diff_xdiff.h +2 -0
- data/vendor/libgit2/src/errors.c +2 -0
- data/vendor/libgit2/src/features.h.in +36 -0
- data/vendor/libgit2/src/fetch.c +2 -2
- data/vendor/libgit2/src/fetch.h +4 -0
- data/vendor/libgit2/src/fetchhead.c +3 -3
- data/vendor/libgit2/src/fetchhead.h +3 -0
- data/vendor/libgit2/src/filebuf.c +2 -1
- data/vendor/libgit2/src/filebuf.h +2 -0
- data/vendor/libgit2/src/fileops.c +12 -1
- data/vendor/libgit2/src/fileops.h +7 -1
- data/vendor/libgit2/src/filter.c +2 -1
- data/vendor/libgit2/src/filter.h +1 -0
- data/vendor/libgit2/src/fnmatch.c +2 -2
- data/vendor/libgit2/src/fnmatch.h +3 -4
- data/vendor/libgit2/src/global.c +4 -3
- data/vendor/libgit2/src/global.h +1 -5
- data/vendor/libgit2/src/graph.c +2 -0
- data/vendor/libgit2/src/hash.c +0 -1
- data/vendor/libgit2/src/hash.h +3 -1
- data/vendor/libgit2/src/hash/hash_collisiondetect.h +3 -3
- data/vendor/libgit2/src/hash/hash_common_crypto.h +18 -5
- data/vendor/libgit2/src/hash/hash_generic.c +2 -2
- data/vendor/libgit2/src/hash/hash_generic.h +5 -3
- data/vendor/libgit2/src/hash/hash_openssl.h +3 -3
- data/vendor/libgit2/src/hash/hash_win32.c +57 -14
- data/vendor/libgit2/src/hash/hash_win32.h +4 -3
- data/vendor/libgit2/src/hashsig.c +3 -0
- data/vendor/libgit2/src/ident.c +2 -0
- data/vendor/libgit2/src/idxmap.h +2 -1
- data/vendor/libgit2/src/ignore.c +14 -2
- data/vendor/libgit2/src/ignore.h +2 -0
- data/vendor/libgit2/src/index.c +20 -40
- data/vendor/libgit2/src/index.h +2 -0
- data/vendor/libgit2/src/indexer.c +13 -5
- data/vendor/libgit2/src/indexer.h +5 -1
- data/vendor/libgit2/src/integer.h +1 -1
- data/vendor/libgit2/src/iterator.c +44 -3
- data/vendor/libgit2/src/iterator.h +3 -0
- data/vendor/libgit2/src/map.h +1 -1
- data/vendor/libgit2/src/merge.c +155 -33
- data/vendor/libgit2/src/merge.h +2 -0
- data/vendor/libgit2/src/merge_driver.c +2 -2
- data/vendor/libgit2/src/merge_driver.h +2 -0
- data/vendor/libgit2/src/merge_file.c +3 -0
- data/vendor/libgit2/src/message.h +3 -1
- data/vendor/libgit2/src/mwindow.c +1 -1
- data/vendor/libgit2/src/mwindow.h +2 -0
- data/vendor/libgit2/src/netops.c +75 -62
- data/vendor/libgit2/src/netops.h +2 -1
- data/vendor/libgit2/src/notes.c +164 -48
- data/vendor/libgit2/src/notes.h +1 -1
- data/vendor/libgit2/src/object.c +14 -3
- data/vendor/libgit2/src/object.h +4 -0
- data/vendor/libgit2/src/object_api.c +3 -2
- data/vendor/libgit2/src/odb.c +104 -38
- data/vendor/libgit2/src/odb.h +3 -1
- data/vendor/libgit2/src/odb_loose.c +414 -267
- data/vendor/libgit2/src/odb_mempack.c +1 -0
- data/vendor/libgit2/src/odb_pack.c +2 -1
- data/vendor/libgit2/src/offmap.h +1 -0
- data/vendor/libgit2/src/oid.c +2 -1
- data/vendor/libgit2/src/oid.h +3 -8
- data/vendor/libgit2/src/oidarray.c +2 -1
- data/vendor/libgit2/src/oidarray.h +1 -0
- data/vendor/libgit2/src/oidmap.h +1 -0
- data/vendor/libgit2/src/pack-objects.c +5 -1
- data/vendor/libgit2/src/pack-objects.h +1 -1
- data/vendor/libgit2/src/pack.c +2 -6
- data/vendor/libgit2/src/pack.h +2 -1
- data/vendor/libgit2/src/parse.c +121 -0
- data/vendor/libgit2/src/parse.h +61 -0
- data/vendor/libgit2/src/patch.c +9 -2
- data/vendor/libgit2/src/patch.h +2 -0
- data/vendor/libgit2/src/patch_generate.c +6 -5
- data/vendor/libgit2/src/patch_generate.h +1 -0
- data/vendor/libgit2/src/patch_parse.c +265 -276
- data/vendor/libgit2/src/patch_parse.h +6 -11
- data/vendor/libgit2/src/path.c +24 -181
- data/vendor/libgit2/src/path.h +14 -73
- data/vendor/libgit2/src/pathspec.c +2 -1
- data/vendor/libgit2/src/pathspec.h +2 -1
- data/vendor/libgit2/src/pool.c +8 -0
- data/vendor/libgit2/src/pool.h +1 -0
- data/vendor/libgit2/src/posix.c +2 -1
- data/vendor/libgit2/src/posix.h +1 -0
- data/vendor/libgit2/src/pqueue.c +1 -0
- data/vendor/libgit2/src/pqueue.h +2 -0
- data/vendor/libgit2/src/proxy.c +2 -1
- data/vendor/libgit2/src/proxy.h +3 -1
- data/vendor/libgit2/src/push.c +4 -171
- data/vendor/libgit2/src/push.h +2 -0
- data/vendor/libgit2/src/rebase.c +1 -0
- data/vendor/libgit2/src/refdb.c +2 -3
- data/vendor/libgit2/src/refdb.h +2 -0
- data/vendor/libgit2/src/refdb_fs.c +5 -3
- data/vendor/libgit2/src/refdb_fs.h +4 -0
- data/vendor/libgit2/src/reflog.c +1 -0
- data/vendor/libgit2/src/reflog.h +2 -1
- data/vendor/libgit2/src/refs.c +1 -0
- data/vendor/libgit2/src/refs.h +2 -1
- data/vendor/libgit2/src/refspec.c +2 -2
- data/vendor/libgit2/src/refspec.h +2 -0
- data/vendor/libgit2/src/remote.c +56 -10
- data/vendor/libgit2/src/remote.h +2 -0
- data/vendor/libgit2/src/repository.c +16 -14
- data/vendor/libgit2/src/repository.h +2 -0
- data/vendor/libgit2/src/reset.c +6 -5
- data/vendor/libgit2/src/revert.c +1 -0
- data/vendor/libgit2/src/revparse.c +3 -5
- data/vendor/libgit2/src/revwalk.c +2 -2
- data/vendor/libgit2/src/revwalk.h +2 -0
- data/vendor/libgit2/src/settings.c +6 -8
- data/vendor/libgit2/src/sha1_lookup.c +2 -216
- data/vendor/libgit2/src/sha1_lookup.h +2 -6
- data/vendor/libgit2/src/signature.c +8 -3
- data/vendor/libgit2/src/signature.h +2 -0
- data/vendor/libgit2/src/sortedcache.c +7 -0
- data/vendor/libgit2/src/sortedcache.h +2 -0
- data/vendor/libgit2/src/stash.c +1 -0
- data/vendor/libgit2/src/status.c +14 -9
- data/vendor/libgit2/src/status.h +2 -0
- data/vendor/libgit2/src/{curl_stream.c → streams/curl.c} +2 -0
- data/vendor/libgit2/src/{curl_stream.h → streams/curl.h} +4 -2
- data/vendor/libgit2/src/{openssl_stream.c → streams/openssl.c} +47 -18
- data/vendor/libgit2/src/{openssl_stream.h → streams/openssl.h} +6 -2
- data/vendor/libgit2/src/{socket_stream.c → streams/socket.c} +2 -2
- data/vendor/libgit2/src/{socket_stream.h → streams/socket.h} +4 -2
- data/vendor/libgit2/src/{stransport_stream.c → streams/stransport.c} +4 -2
- data/vendor/libgit2/src/{stransport_stream.h → streams/stransport.h} +4 -2
- data/vendor/libgit2/src/{tls_stream.c → streams/tls.c} +4 -3
- data/vendor/libgit2/src/{tls_stream.h → streams/tls.h} +4 -2
- data/vendor/libgit2/src/submodule.c +28 -80
- data/vendor/libgit2/src/submodule.h +2 -13
- data/vendor/libgit2/src/sysdir.c +75 -8
- data/vendor/libgit2/src/sysdir.h +2 -1
- data/vendor/libgit2/src/tag.c +2 -2
- data/vendor/libgit2/src/tag.h +2 -0
- data/vendor/libgit2/src/thread-utils.c +1 -0
- data/vendor/libgit2/src/thread-utils.h +1 -1
- data/vendor/libgit2/src/trace.c +2 -2
- data/vendor/libgit2/src/trace.h +2 -0
- data/vendor/libgit2/src/trailer.c +416 -0
- data/vendor/libgit2/src/transaction.c +2 -1
- data/vendor/libgit2/src/transport.c +2 -0
- data/vendor/libgit2/src/transports/auth.c +2 -1
- data/vendor/libgit2/src/transports/auth.h +4 -3
- data/vendor/libgit2/src/transports/auth_negotiate.c +2 -1
- data/vendor/libgit2/src/transports/auth_negotiate.h +3 -3
- data/vendor/libgit2/src/transports/cred.c +2 -0
- data/vendor/libgit2/src/transports/cred.h +4 -2
- data/vendor/libgit2/src/transports/cred_helpers.c +1 -0
- data/vendor/libgit2/src/transports/git.c +3 -1
- data/vendor/libgit2/src/transports/http.c +10 -14
- data/vendor/libgit2/src/transports/http.h +23 -0
- data/vendor/libgit2/src/transports/local.c +23 -5
- data/vendor/libgit2/src/transports/smart.c +3 -1
- data/vendor/libgit2/src/transports/smart.h +23 -16
- data/vendor/libgit2/src/transports/smart_pkt.c +114 -130
- data/vendor/libgit2/src/transports/smart_protocol.c +26 -22
- data/vendor/libgit2/src/transports/ssh.c +12 -7
- data/vendor/libgit2/src/transports/ssh.h +4 -2
- data/vendor/libgit2/src/transports/winhttp.c +19 -21
- data/vendor/libgit2/src/tree-cache.c +1 -0
- data/vendor/libgit2/src/tree-cache.h +1 -0
- data/vendor/libgit2/src/tree.c +20 -14
- data/vendor/libgit2/src/tree.h +2 -0
- data/vendor/libgit2/src/tsort.c +0 -1
- data/vendor/libgit2/src/unix/map.c +4 -1
- data/vendor/libgit2/src/unix/posix.h +8 -4
- data/vendor/libgit2/src/unix/pthread.h +1 -1
- data/vendor/libgit2/src/unix/realpath.c +4 -1
- data/vendor/libgit2/src/util.c +6 -5
- data/vendor/libgit2/src/util.h +39 -111
- data/vendor/libgit2/src/varint.c +0 -1
- data/vendor/libgit2/src/varint.h +2 -0
- data/vendor/libgit2/src/vector.c +1 -1
- data/vendor/libgit2/src/win32/dir.c +3 -0
- data/vendor/libgit2/src/win32/dir.h +4 -3
- data/vendor/libgit2/src/win32/error.c +1 -1
- data/vendor/libgit2/src/win32/error.h +4 -2
- data/vendor/libgit2/src/win32/findfile.c +2 -1
- data/vendor/libgit2/src/win32/findfile.h +4 -2
- data/vendor/libgit2/src/win32/map.c +2 -0
- data/vendor/libgit2/src/win32/mingw-compat.h +3 -3
- data/vendor/libgit2/src/win32/msvc-compat.h +3 -3
- data/vendor/libgit2/src/win32/path_w32.c +7 -12
- data/vendor/libgit2/src/win32/path_w32.h +3 -2
- data/vendor/libgit2/src/win32/posix.h +2 -2
- data/vendor/libgit2/src/win32/posix_w32.c +11 -5
- data/vendor/libgit2/src/win32/precompiled.h +2 -1
- data/vendor/libgit2/src/win32/reparse.h +2 -2
- data/vendor/libgit2/src/win32/thread.c +1 -0
- data/vendor/libgit2/src/win32/thread.h +2 -2
- data/vendor/libgit2/src/win32/utf-conv.c +0 -1
- data/vendor/libgit2/src/win32/utf-conv.h +4 -3
- data/vendor/libgit2/src/win32/w32_buffer.c +1 -1
- data/vendor/libgit2/src/win32/w32_buffer.h +4 -2
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +2 -1
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +85 -2
- data/vendor/libgit2/src/win32/w32_stack.c +2 -1
- data/vendor/libgit2/src/win32/w32_stack.h +5 -3
- data/vendor/libgit2/src/win32/w32_util.h +4 -2
- data/vendor/libgit2/src/win32/win32-compat.h +3 -3
- data/vendor/libgit2/src/worktree.c +4 -5
- data/vendor/libgit2/src/worktree.h +2 -0
- data/vendor/libgit2/src/xdiff/xdiff.h +22 -13
- data/vendor/libgit2/src/xdiff/xdiffi.c +523 -81
- data/vendor/libgit2/src/xdiff/xdiffi.h +2 -2
- data/vendor/libgit2/src/xdiff/xemit.c +63 -39
- data/vendor/libgit2/src/xdiff/xemit.h +2 -2
- data/vendor/libgit2/src/xdiff/xhistogram.c +0 -1
- data/vendor/libgit2/src/xdiff/xinclude.h +3 -2
- data/vendor/libgit2/src/xdiff/xmacros.h +2 -2
- data/vendor/libgit2/src/xdiff/xmerge.c +80 -20
- data/vendor/libgit2/src/xdiff/xpatience.c +41 -9
- data/vendor/libgit2/src/xdiff/xprepare.c +2 -2
- data/vendor/libgit2/src/xdiff/xprepare.h +2 -2
- data/vendor/libgit2/src/xdiff/xtypes.h +2 -2
- data/vendor/libgit2/src/xdiff/xutils.c +47 -27
- data/vendor/libgit2/src/xdiff/xutils.h +2 -5
- data/vendor/libgit2/src/zstream.c +65 -45
- data/vendor/libgit2/src/zstream.h +9 -2
- metadata +27 -13
- data/vendor/libgit2/include/git2/sys/remote.h +0 -16
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* LibXDiff by Davide Libenzi ( File Differential Library )
|
|
3
|
-
* Copyright (C) 2003-
|
|
3
|
+
* Copyright (C) 2003-2016 Davide Libenzi, Johannes E. Schindelin
|
|
4
4
|
*
|
|
5
5
|
* This library is free software; you can redistribute it and/or
|
|
6
6
|
* modify it under the terms of the GNU Lesser General Public
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* Lesser General Public License for more details.
|
|
14
14
|
*
|
|
15
15
|
* You should have received a copy of the GNU Lesser General Public
|
|
16
|
-
* License along with this library; if not,
|
|
17
|
-
*
|
|
16
|
+
* License along with this library; if not, see
|
|
17
|
+
* <http://www.gnu.org/licenses/>.
|
|
18
18
|
*
|
|
19
19
|
* Davide Libenzi <davidel@xmailserver.org>
|
|
20
20
|
*
|
|
@@ -62,6 +62,12 @@ struct hashmap {
|
|
|
62
62
|
* initially, "next" reflects only the order in file1.
|
|
63
63
|
*/
|
|
64
64
|
struct entry *next, *previous;
|
|
65
|
+
|
|
66
|
+
/*
|
|
67
|
+
* If 1, this entry can serve as an anchor. See
|
|
68
|
+
* Documentation/diff-options.txt for more information.
|
|
69
|
+
*/
|
|
70
|
+
unsigned anchor : 1;
|
|
65
71
|
} *entries, *first, *last;
|
|
66
72
|
/* were common records found? */
|
|
67
73
|
unsigned long has_matches;
|
|
@@ -70,8 +76,19 @@ struct hashmap {
|
|
|
70
76
|
xpparam_t const *xpp;
|
|
71
77
|
};
|
|
72
78
|
|
|
79
|
+
static int is_anchor(xpparam_t const *xpp, const char *line)
|
|
80
|
+
{
|
|
81
|
+
unsigned long i;
|
|
82
|
+
for (i = 0; i < xpp->anchors_nr; i++) {
|
|
83
|
+
if (!strncmp(line, xpp->anchors[i], strlen(xpp->anchors[i])))
|
|
84
|
+
return 1;
|
|
85
|
+
}
|
|
86
|
+
return 0;
|
|
87
|
+
}
|
|
88
|
+
|
|
73
89
|
/* The argument "pass" is 1 for the first file, 2 for the second. */
|
|
74
|
-
static void insert_record(int line, struct hashmap *map,
|
|
90
|
+
static void insert_record(xpparam_t const *xpp, int line, struct hashmap *map,
|
|
91
|
+
int pass)
|
|
75
92
|
{
|
|
76
93
|
xrecord_t **records = pass == 1 ?
|
|
77
94
|
map->env->xdf1.recs : map->env->xdf2.recs;
|
|
@@ -110,6 +127,7 @@ static void insert_record(int line, struct hashmap *map, int pass)
|
|
|
110
127
|
return;
|
|
111
128
|
map->entries[index].line1 = line;
|
|
112
129
|
map->entries[index].hash = record->ha;
|
|
130
|
+
map->entries[index].anchor = is_anchor(xpp, map->env->xdf1.recs[line - 1]->ptr);
|
|
113
131
|
if (!map->first)
|
|
114
132
|
map->first = map->entries + index;
|
|
115
133
|
if (map->last) {
|
|
@@ -147,11 +165,11 @@ static int fill_hashmap(mmfile_t *file1, mmfile_t *file2,
|
|
|
147
165
|
|
|
148
166
|
/* First, fill with entries from the first file */
|
|
149
167
|
while (count1--)
|
|
150
|
-
insert_record(line1++, result, 1);
|
|
168
|
+
insert_record(xpp, line1++, result, 1);
|
|
151
169
|
|
|
152
170
|
/* Then search for matches in the second file */
|
|
153
171
|
while (count2--)
|
|
154
|
-
insert_record(line2++, result, 2);
|
|
172
|
+
insert_record(xpp, line2++, result, 2);
|
|
155
173
|
|
|
156
174
|
return 0;
|
|
157
175
|
}
|
|
@@ -166,7 +184,7 @@ static int binary_search(struct entry **sequence, int longest,
|
|
|
166
184
|
int left = -1, right = longest;
|
|
167
185
|
|
|
168
186
|
while (left + 1 < right) {
|
|
169
|
-
int middle =
|
|
187
|
+
int middle = left + (right - left) / 2;
|
|
170
188
|
/* by construction, no two entries can be equal */
|
|
171
189
|
if (sequence[middle]->line2 > entry->line2)
|
|
172
190
|
right = middle;
|
|
@@ -192,14 +210,28 @@ static struct entry *find_longest_common_sequence(struct hashmap *map)
|
|
|
192
210
|
int longest = 0, i;
|
|
193
211
|
struct entry *entry;
|
|
194
212
|
|
|
213
|
+
/*
|
|
214
|
+
* If not -1, this entry in sequence must never be overridden.
|
|
215
|
+
* Therefore, overriding entries before this has no effect, so
|
|
216
|
+
* do not do that either.
|
|
217
|
+
*/
|
|
218
|
+
int anchor_i = -1;
|
|
219
|
+
|
|
195
220
|
for (entry = map->first; entry; entry = entry->next) {
|
|
196
221
|
if (!entry->line2 || entry->line2 == NON_UNIQUE)
|
|
197
222
|
continue;
|
|
198
223
|
i = binary_search(sequence, longest, entry);
|
|
199
224
|
entry->previous = i < 0 ? NULL : sequence[i];
|
|
200
|
-
|
|
201
|
-
if (i
|
|
225
|
+
++i;
|
|
226
|
+
if (i <= anchor_i)
|
|
227
|
+
continue;
|
|
228
|
+
sequence[i] = entry;
|
|
229
|
+
if (entry->anchor) {
|
|
230
|
+
anchor_i = i;
|
|
231
|
+
longest = anchor_i + 1;
|
|
232
|
+
} else if (i == longest) {
|
|
202
233
|
longest++;
|
|
234
|
+
}
|
|
203
235
|
}
|
|
204
236
|
|
|
205
237
|
/* No common unique lines were found */
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* Lesser General Public License for more details.
|
|
14
14
|
*
|
|
15
15
|
* You should have received a copy of the GNU Lesser General Public
|
|
16
|
-
* License along with this library; if not,
|
|
17
|
-
*
|
|
16
|
+
* License along with this library; if not, see
|
|
17
|
+
* <http://www.gnu.org/licenses/>.
|
|
18
18
|
*
|
|
19
19
|
* Davide Libenzi <davidel@xmailserver.org>
|
|
20
20
|
*
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* Lesser General Public License for more details.
|
|
14
14
|
*
|
|
15
15
|
* You should have received a copy of the GNU Lesser General Public
|
|
16
|
-
* License along with this library; if not,
|
|
17
|
-
*
|
|
16
|
+
* License along with this library; if not, see
|
|
17
|
+
* <http://www.gnu.org/licenses/>.
|
|
18
18
|
*
|
|
19
19
|
* Davide Libenzi <davidel@xmailserver.org>
|
|
20
20
|
*
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* Lesser General Public License for more details.
|
|
14
14
|
*
|
|
15
15
|
* You should have received a copy of the GNU Lesser General Public
|
|
16
|
-
* License along with this library; if not,
|
|
17
|
-
*
|
|
16
|
+
* License along with this library; if not, see
|
|
17
|
+
* <http://www.gnu.org/licenses/>.
|
|
18
18
|
*
|
|
19
19
|
* Davide Libenzi <davidel@xmailserver.org>
|
|
20
20
|
*
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* Lesser General Public License for more details.
|
|
14
14
|
*
|
|
15
15
|
* You should have received a copy of the GNU Lesser General Public
|
|
16
|
-
* License along with this library; if not,
|
|
17
|
-
*
|
|
16
|
+
* License along with this library; if not, see
|
|
17
|
+
* <http://www.gnu.org/licenses/>.
|
|
18
18
|
*
|
|
19
19
|
* Davide Libenzi <davidel@xmailserver.org>
|
|
20
20
|
*
|
|
@@ -62,14 +62,14 @@ int xdl_emit_diffrec(char const *rec, long size, char const *pre, long psize,
|
|
|
62
62
|
|
|
63
63
|
void *xdl_mmfile_first(mmfile_t *mmf, long *size)
|
|
64
64
|
{
|
|
65
|
-
*size =
|
|
65
|
+
*size = mmf->size;
|
|
66
66
|
return mmf->ptr;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
long xdl_mmfile_size(mmfile_t *mmf)
|
|
71
71
|
{
|
|
72
|
-
return
|
|
72
|
+
return mmf->size;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
|
|
@@ -154,6 +154,24 @@ int xdl_blankline(const char *line, long size, long flags)
|
|
|
154
154
|
return (i == size);
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
+
/*
|
|
158
|
+
* Have we eaten everything on the line, except for an optional
|
|
159
|
+
* CR at the very end?
|
|
160
|
+
*/
|
|
161
|
+
static int ends_with_optional_cr(const char *l, long s, long i)
|
|
162
|
+
{
|
|
163
|
+
int complete = s && l[s-1] == '\n';
|
|
164
|
+
|
|
165
|
+
if (complete)
|
|
166
|
+
s--;
|
|
167
|
+
if (s == i)
|
|
168
|
+
return 1;
|
|
169
|
+
/* do not ignore CR at the end of an incomplete line */
|
|
170
|
+
if (complete && s == i + 1 && l[i] == '\r')
|
|
171
|
+
return 1;
|
|
172
|
+
return 0;
|
|
173
|
+
}
|
|
174
|
+
|
|
157
175
|
int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long flags)
|
|
158
176
|
{
|
|
159
177
|
int i1, i2;
|
|
@@ -168,7 +186,8 @@ int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long flags)
|
|
|
168
186
|
|
|
169
187
|
/*
|
|
170
188
|
* -w matches everything that matches with -b, and -b in turn
|
|
171
|
-
* matches everything that matches with --ignore-space-at-eol
|
|
189
|
+
* matches everything that matches with --ignore-space-at-eol,
|
|
190
|
+
* which in turn matches everything that matches with --ignore-cr-at-eol.
|
|
172
191
|
*
|
|
173
192
|
* Each flavor of ignoring needs different logic to skip whitespaces
|
|
174
193
|
* while we have both sides to compare.
|
|
@@ -198,8 +217,18 @@ int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long flags)
|
|
|
198
217
|
return 0;
|
|
199
218
|
}
|
|
200
219
|
} else if (flags & XDF_IGNORE_WHITESPACE_AT_EOL) {
|
|
201
|
-
while (i1 < s1 && i2 < s2 && l1[i1
|
|
202
|
-
|
|
220
|
+
while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) {
|
|
221
|
+
i1++;
|
|
222
|
+
i2++;
|
|
223
|
+
}
|
|
224
|
+
} else if (flags & XDF_IGNORE_CR_AT_EOL) {
|
|
225
|
+
/* Find the first difference and see how the line ends */
|
|
226
|
+
while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) {
|
|
227
|
+
i1++;
|
|
228
|
+
i2++;
|
|
229
|
+
}
|
|
230
|
+
return (ends_with_optional_cr(l1, s1, i1) &&
|
|
231
|
+
ends_with_optional_cr(l2, s2, i2));
|
|
203
232
|
}
|
|
204
233
|
|
|
205
234
|
/*
|
|
@@ -226,9 +255,16 @@ static unsigned long xdl_hash_record_with_whitespace(char const **data,
|
|
|
226
255
|
char const *top, long flags) {
|
|
227
256
|
unsigned long ha = 5381;
|
|
228
257
|
char const *ptr = *data;
|
|
258
|
+
int cr_at_eol_only = (flags & XDF_WHITESPACE_FLAGS) == XDF_IGNORE_CR_AT_EOL;
|
|
229
259
|
|
|
230
260
|
for (; ptr < top && *ptr != '\n'; ptr++) {
|
|
231
|
-
if (
|
|
261
|
+
if (cr_at_eol_only) {
|
|
262
|
+
/* do not ignore CR at the end of an incomplete line */
|
|
263
|
+
if (*ptr == '\r' &&
|
|
264
|
+
(ptr + 1 < top && ptr[1] == '\n'))
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
else if (XDL_ISSPACE(*ptr)) {
|
|
232
268
|
const char *ptr2 = ptr;
|
|
233
269
|
int at_eol;
|
|
234
270
|
while (ptr + 1 < top && XDL_ISSPACE(ptr[1])
|
|
@@ -260,7 +296,6 @@ static unsigned long xdl_hash_record_with_whitespace(char const **data,
|
|
|
260
296
|
return ha;
|
|
261
297
|
}
|
|
262
298
|
|
|
263
|
-
|
|
264
299
|
unsigned long xdl_hash_record(char const **data, char const *top, long flags) {
|
|
265
300
|
unsigned long ha = 5381;
|
|
266
301
|
char const *ptr = *data;
|
|
@@ -277,7 +312,6 @@ unsigned long xdl_hash_record(char const **data, char const *top, long flags) {
|
|
|
277
312
|
return ha;
|
|
278
313
|
}
|
|
279
314
|
|
|
280
|
-
|
|
281
315
|
unsigned int xdl_hashbits(unsigned int size) {
|
|
282
316
|
unsigned int val = 1, bits = 0;
|
|
283
317
|
|
|
@@ -305,23 +339,9 @@ int xdl_num_out(char *out, long val) {
|
|
|
305
339
|
*str++ = '0';
|
|
306
340
|
*str = '\0';
|
|
307
341
|
|
|
308
|
-
return
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
long xdl_atol(char const *str, char const **next) {
|
|
313
|
-
long val, base;
|
|
314
|
-
char const *top;
|
|
315
|
-
|
|
316
|
-
for (top = str; XDL_ISDIGIT(*top); top++);
|
|
317
|
-
if (next)
|
|
318
|
-
*next = top;
|
|
319
|
-
for (val = 0, base = 1, top--; top >= str; top--, base *= 10)
|
|
320
|
-
val += base * (long)(*top - '0');
|
|
321
|
-
return val;
|
|
342
|
+
return str - out;
|
|
322
343
|
}
|
|
323
344
|
|
|
324
|
-
|
|
325
345
|
int xdl_emit_hunk_hdr(long s1, long c1, long s2, long c2,
|
|
326
346
|
const char *func, long funclen, xdemitcb_t *ecb) {
|
|
327
347
|
int nb = 0;
|
|
@@ -356,8 +376,8 @@ int xdl_emit_hunk_hdr(long s1, long c1, long s2, long c2,
|
|
|
356
376
|
nb += 3;
|
|
357
377
|
if (func && funclen) {
|
|
358
378
|
buf[nb++] = ' ';
|
|
359
|
-
if (funclen > (long)sizeof(buf) - nb - 1)
|
|
360
|
-
funclen =
|
|
379
|
+
if (funclen > (long)(sizeof(buf) - nb - 1))
|
|
380
|
+
funclen = sizeof(buf) - nb - 1;
|
|
361
381
|
memcpy(buf + nb, func, funclen);
|
|
362
382
|
nb += funclen;
|
|
363
383
|
}
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* Lesser General Public License for more details.
|
|
14
14
|
*
|
|
15
15
|
* You should have received a copy of the GNU Lesser General Public
|
|
16
|
-
* License along with this library; if not,
|
|
17
|
-
*
|
|
16
|
+
* License along with this library; if not, see
|
|
17
|
+
* <http://www.gnu.org/licenses/>.
|
|
18
18
|
*
|
|
19
19
|
* Davide Libenzi <davidel@xmailserver.org>
|
|
20
20
|
*
|
|
@@ -31,15 +31,12 @@ int xdl_emit_diffrec(char const *rec, long size, char const *pre, long psize,
|
|
|
31
31
|
int xdl_cha_init(chastore_t *cha, long isize, long icount);
|
|
32
32
|
void xdl_cha_free(chastore_t *cha);
|
|
33
33
|
void *xdl_cha_alloc(chastore_t *cha);
|
|
34
|
-
void *xdl_cha_first(chastore_t *cha);
|
|
35
|
-
void *xdl_cha_next(chastore_t *cha);
|
|
36
34
|
long xdl_guess_lines(mmfile_t *mf, long sample);
|
|
37
35
|
int xdl_blankline(const char *line, long size, long flags);
|
|
38
36
|
int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long flags);
|
|
39
37
|
unsigned long xdl_hash_record(char const **data, char const *top, long flags);
|
|
40
38
|
unsigned int xdl_hashbits(unsigned int size);
|
|
41
39
|
int xdl_num_out(char *out, long val);
|
|
42
|
-
long xdl_atol(char const *str, char const **next);
|
|
43
40
|
int xdl_emit_hunk_hdr(long s1, long c1, long s2, long c2,
|
|
44
41
|
const char *func, long funclen, xdemitcb_t *ecb);
|
|
45
42
|
int xdl_fall_back_diff(xdfenv_t *diff_env, xpparam_t const *xpp,
|
|
@@ -5,25 +5,31 @@
|
|
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
#include "zstream.h"
|
|
9
|
+
|
|
8
10
|
#include <zlib.h>
|
|
9
11
|
|
|
10
|
-
#include "zstream.h"
|
|
11
12
|
#include "buffer.h"
|
|
12
13
|
|
|
13
14
|
#define ZSTREAM_BUFFER_SIZE (1024 * 1024)
|
|
14
15
|
#define ZSTREAM_BUFFER_MIN_EXTRA 8
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
GIT_INLINE(int) zstream_seterr(git_zstream *zs)
|
|
17
18
|
{
|
|
18
|
-
|
|
19
|
+
switch (zs->zerr) {
|
|
20
|
+
case Z_OK:
|
|
21
|
+
case Z_STREAM_END:
|
|
22
|
+
case Z_BUF_ERROR: /* not fatal; we retry with a larger buffer */
|
|
19
23
|
return 0;
|
|
20
|
-
|
|
21
|
-
if (zs->zerr == Z_MEM_ERROR)
|
|
24
|
+
case Z_MEM_ERROR:
|
|
22
25
|
giterr_set_oom();
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
break;
|
|
27
|
+
default:
|
|
28
|
+
if (zs->z.msg)
|
|
29
|
+
giterr_set_str(GITERR_ZLIB, zs->z.msg);
|
|
30
|
+
else
|
|
31
|
+
giterr_set(GITERR_ZLIB, "unknown compression error");
|
|
32
|
+
}
|
|
27
33
|
|
|
28
34
|
return -1;
|
|
29
35
|
}
|
|
@@ -81,9 +87,52 @@ size_t git_zstream_suggest_output_len(git_zstream *zstream)
|
|
|
81
87
|
return ZSTREAM_BUFFER_MIN_EXTRA;
|
|
82
88
|
}
|
|
83
89
|
|
|
90
|
+
int git_zstream_get_output_chunk(
|
|
91
|
+
void *out, size_t *out_len, git_zstream *zstream)
|
|
92
|
+
{
|
|
93
|
+
size_t in_queued, in_used, out_queued;
|
|
94
|
+
|
|
95
|
+
/* set up input data */
|
|
96
|
+
zstream->z.next_in = (Bytef *)zstream->in;
|
|
97
|
+
|
|
98
|
+
/* feed as much data to zlib as it can consume, at most UINT_MAX */
|
|
99
|
+
if (zstream->in_len > UINT_MAX) {
|
|
100
|
+
zstream->z.avail_in = UINT_MAX;
|
|
101
|
+
zstream->flush = Z_NO_FLUSH;
|
|
102
|
+
} else {
|
|
103
|
+
zstream->z.avail_in = (uInt)zstream->in_len;
|
|
104
|
+
zstream->flush = Z_FINISH;
|
|
105
|
+
}
|
|
106
|
+
in_queued = (size_t)zstream->z.avail_in;
|
|
107
|
+
|
|
108
|
+
/* set up output data */
|
|
109
|
+
zstream->z.next_out = out;
|
|
110
|
+
zstream->z.avail_out = (uInt)*out_len;
|
|
111
|
+
|
|
112
|
+
if ((size_t)zstream->z.avail_out != *out_len)
|
|
113
|
+
zstream->z.avail_out = UINT_MAX;
|
|
114
|
+
out_queued = (size_t)zstream->z.avail_out;
|
|
115
|
+
|
|
116
|
+
/* compress next chunk */
|
|
117
|
+
if (zstream->type == GIT_ZSTREAM_INFLATE)
|
|
118
|
+
zstream->zerr = inflate(&zstream->z, zstream->flush);
|
|
119
|
+
else
|
|
120
|
+
zstream->zerr = deflate(&zstream->z, zstream->flush);
|
|
121
|
+
|
|
122
|
+
if (zstream_seterr(zstream))
|
|
123
|
+
return -1;
|
|
124
|
+
|
|
125
|
+
in_used = (in_queued - zstream->z.avail_in);
|
|
126
|
+
zstream->in_len -= in_used;
|
|
127
|
+
zstream->in += in_used;
|
|
128
|
+
|
|
129
|
+
*out_len = (out_queued - zstream->z.avail_out);
|
|
130
|
+
|
|
131
|
+
return 0;
|
|
132
|
+
}
|
|
133
|
+
|
|
84
134
|
int git_zstream_get_output(void *out, size_t *out_len, git_zstream *zstream)
|
|
85
135
|
{
|
|
86
|
-
int zflush = Z_FINISH;
|
|
87
136
|
size_t out_remain = *out_len;
|
|
88
137
|
|
|
89
138
|
if (zstream->in_len && zstream->zerr == Z_STREAM_END) {
|
|
@@ -92,46 +141,17 @@ int git_zstream_get_output(void *out, size_t *out_len, git_zstream *zstream)
|
|
|
92
141
|
}
|
|
93
142
|
|
|
94
143
|
while (out_remain > 0 && zstream->zerr != Z_STREAM_END) {
|
|
95
|
-
size_t
|
|
96
|
-
|
|
97
|
-
/* set up in data */
|
|
98
|
-
zstream->z.next_in = (Bytef *)zstream->in;
|
|
99
|
-
zstream->z.avail_in = (uInt)zstream->in_len;
|
|
100
|
-
if ((size_t)zstream->z.avail_in != zstream->in_len) {
|
|
101
|
-
zstream->z.avail_in = INT_MAX;
|
|
102
|
-
zflush = Z_NO_FLUSH;
|
|
103
|
-
} else {
|
|
104
|
-
zflush = Z_FINISH;
|
|
105
|
-
}
|
|
106
|
-
in_queued = (size_t)zstream->z.avail_in;
|
|
107
|
-
|
|
108
|
-
/* set up out data */
|
|
109
|
-
zstream->z.next_out = out;
|
|
110
|
-
zstream->z.avail_out = (uInt)out_remain;
|
|
111
|
-
if ((size_t)zstream->z.avail_out != out_remain)
|
|
112
|
-
zstream->z.avail_out = INT_MAX;
|
|
113
|
-
out_queued = (size_t)zstream->z.avail_out;
|
|
114
|
-
|
|
115
|
-
/* compress next chunk */
|
|
116
|
-
if (zstream->type == GIT_ZSTREAM_INFLATE)
|
|
117
|
-
zstream->zerr = inflate(&zstream->z, zflush);
|
|
118
|
-
else
|
|
119
|
-
zstream->zerr = deflate(&zstream->z, zflush);
|
|
120
|
-
|
|
121
|
-
if (zstream->zerr == Z_STREAM_ERROR)
|
|
122
|
-
return zstream_seterr(zstream);
|
|
144
|
+
size_t out_written = out_remain;
|
|
123
145
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
out = ((char *)out) + out_used;
|
|
146
|
+
if (git_zstream_get_output_chunk(out, &out_written, zstream) < 0)
|
|
147
|
+
return -1;
|
|
127
148
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
zstream->in += in_used;
|
|
149
|
+
out_remain -= out_written;
|
|
150
|
+
out = ((char *)out) + out_written;
|
|
131
151
|
}
|
|
132
152
|
|
|
133
153
|
/* either we finished the input or we did not flush the data */
|
|
134
|
-
assert(zstream->in_len > 0 ||
|
|
154
|
+
assert(zstream->in_len > 0 || zstream->flush == Z_FINISH);
|
|
135
155
|
|
|
136
156
|
/* set out_size to number of bytes actually written to output */
|
|
137
157
|
*out_len = *out_len - out_remain;
|