rugged 0.26.7 → 0.27.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -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
|
*
|
@@ -22,15 +22,6 @@
|
|
22
22
|
|
23
23
|
#include "xinclude.h"
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
static long xdl_get_rec(xdfile_t *xdf, long ri, char const **rec);
|
29
|
-
static int xdl_emit_record(xdfile_t *xdf, long ri, char const *pre, xdemitcb_t *ecb);
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
25
|
static long xdl_get_rec(xdfile_t *xdf, long ri, char const **rec) {
|
35
26
|
|
36
27
|
*rec = xdf->recs[ri]->ptr;
|
@@ -110,7 +101,7 @@ static long def_ff(const char *rec, long len, char *buf, long sz, void *priv)
|
|
110
101
|
|
111
102
|
if (len > 0 &&
|
112
103
|
(isalpha((unsigned char)*rec) || /* identifier? */
|
113
|
-
*rec == '_' ||
|
104
|
+
*rec == '_' || /* also identifier? */
|
114
105
|
*rec == '$')) { /* identifiers from VMS and other esoterico */
|
115
106
|
if (len > sz)
|
116
107
|
len = sz;
|
@@ -122,22 +113,20 @@ static long def_ff(const char *rec, long len, char *buf, long sz, void *priv)
|
|
122
113
|
return -1;
|
123
114
|
}
|
124
115
|
|
125
|
-
static
|
126
|
-
|
127
|
-
|
128
|
-
const char *
|
129
|
-
long
|
130
|
-
|
131
|
-
|
132
|
-
(
|
116
|
+
static long match_func_rec(xdfile_t *xdf, xdemitconf_t const *xecfg, long ri,
|
117
|
+
char *buf, long sz)
|
118
|
+
{
|
119
|
+
const char *rec;
|
120
|
+
long len = xdl_get_rec(xdf, ri, &rec);
|
121
|
+
if (!xecfg->find_func)
|
122
|
+
return def_ff(rec, len, buf, sz, xecfg->find_func_priv);
|
123
|
+
return xecfg->find_func(rec, len, buf, sz, xecfg->find_func_priv);
|
124
|
+
}
|
133
125
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
return -1;
|
139
|
-
}
|
140
|
-
return 0;
|
126
|
+
static int is_func_rec(xdfile_t *xdf, xdemitconf_t const *xecfg, long ri)
|
127
|
+
{
|
128
|
+
char dummy[1];
|
129
|
+
return match_func_rec(xdf, xecfg, ri, dummy, sizeof(dummy)) >= 0;
|
141
130
|
}
|
142
131
|
|
143
132
|
struct func_line {
|
@@ -148,7 +137,6 @@ struct func_line {
|
|
148
137
|
static long get_func_line(xdfenv_t *xe, xdemitconf_t const *xecfg,
|
149
138
|
struct func_line *func_line, long start, long limit)
|
150
139
|
{
|
151
|
-
find_func_t ff = xecfg->find_func ? xecfg->find_func : def_ff;
|
152
140
|
long l, size, step = (start > limit) ? -1 : 1;
|
153
141
|
char *buf, dummy[1];
|
154
142
|
|
@@ -156,9 +144,7 @@ static long get_func_line(xdfenv_t *xe, xdemitconf_t const *xecfg,
|
|
156
144
|
size = func_line ? sizeof(func_line->buf) : sizeof(dummy);
|
157
145
|
|
158
146
|
for (l = start; l != limit && 0 <= l && l < xe->xdf1.nrec; l += step) {
|
159
|
-
|
160
|
-
long reclen = xdl_get_rec(&xe->xdf1, l, &rec);
|
161
|
-
long len = ff(rec, reclen, buf, size, xecfg->find_func_priv);
|
147
|
+
long len = match_func_rec(&xe->xdf1, xecfg, l, buf, size);
|
162
148
|
if (len >= 0) {
|
163
149
|
if (func_line)
|
164
150
|
func_line->len = len;
|
@@ -168,6 +154,18 @@ static long get_func_line(xdfenv_t *xe, xdemitconf_t const *xecfg,
|
|
168
154
|
return -1;
|
169
155
|
}
|
170
156
|
|
157
|
+
static int is_empty_rec(xdfile_t *xdf, long ri)
|
158
|
+
{
|
159
|
+
const char *rec;
|
160
|
+
long len = xdl_get_rec(xdf, ri, &rec);
|
161
|
+
|
162
|
+
while (len > 0 && XDL_ISSPACE(*rec)) {
|
163
|
+
rec++;
|
164
|
+
len--;
|
165
|
+
}
|
166
|
+
return !len;
|
167
|
+
}
|
168
|
+
|
171
169
|
int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
|
172
170
|
xdemitconf_t const *xecfg) {
|
173
171
|
long s1, s2, e1, e2, lctx;
|
@@ -175,9 +173,6 @@ int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
|
|
175
173
|
long funclineprev = -1;
|
176
174
|
struct func_line func_line = { 0 };
|
177
175
|
|
178
|
-
if (xecfg->flags & XDL_EMIT_COMMON)
|
179
|
-
return xdl_emit_common(xe, xscr, ecb, xecfg);
|
180
|
-
|
181
176
|
for (xch = xscr; xch; xch = xche->next) {
|
182
177
|
xche = xdl_get_hunk(&xch, xecfg);
|
183
178
|
if (!xch)
|
@@ -187,7 +182,33 @@ int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
|
|
187
182
|
s2 = XDL_MAX(xch->i2 - xecfg->ctxlen, 0);
|
188
183
|
|
189
184
|
if (xecfg->flags & XDL_EMIT_FUNCCONTEXT) {
|
190
|
-
long fs1
|
185
|
+
long fs1, i1 = xch->i1;
|
186
|
+
|
187
|
+
/* Appended chunk? */
|
188
|
+
if (i1 >= xe->xdf1.nrec) {
|
189
|
+
long i2 = xch->i2;
|
190
|
+
|
191
|
+
/*
|
192
|
+
* We don't need additional context if
|
193
|
+
* a whole function was added.
|
194
|
+
*/
|
195
|
+
while (i2 < xe->xdf2.nrec) {
|
196
|
+
if (is_func_rec(&xe->xdf2, xecfg, i2))
|
197
|
+
goto post_context_calculation;
|
198
|
+
i2++;
|
199
|
+
}
|
200
|
+
|
201
|
+
/*
|
202
|
+
* Otherwise get more context from the
|
203
|
+
* pre-image.
|
204
|
+
*/
|
205
|
+
i1 = xe->xdf1.nrec - 1;
|
206
|
+
}
|
207
|
+
|
208
|
+
fs1 = get_func_line(xe, xecfg, NULL, i1, -1);
|
209
|
+
while (fs1 > 0 && !is_empty_rec(&xe->xdf1, fs1 - 1) &&
|
210
|
+
!is_func_rec(&xe->xdf1, xecfg, fs1 - 1))
|
211
|
+
fs1--;
|
191
212
|
if (fs1 < 0)
|
192
213
|
fs1 = 0;
|
193
214
|
if (fs1 < s1) {
|
@@ -196,7 +217,7 @@ int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
|
|
196
217
|
}
|
197
218
|
}
|
198
219
|
|
199
|
-
|
220
|
+
post_context_calculation:
|
200
221
|
lctx = xecfg->ctxlen;
|
201
222
|
lctx = XDL_MIN(lctx, xe->xdf1.nrec - (xche->i1 + xche->chg1));
|
202
223
|
lctx = XDL_MIN(lctx, xe->xdf2.nrec - (xche->i2 + xche->chg2));
|
@@ -208,6 +229,8 @@ int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
|
|
208
229
|
long fe1 = get_func_line(xe, xecfg, NULL,
|
209
230
|
xche->i1 + xche->chg1,
|
210
231
|
xe->xdf1.nrec);
|
232
|
+
while (fe1 > 0 && is_empty_rec(&xe->xdf1, fe1 - 1))
|
233
|
+
fe1--;
|
211
234
|
if (fe1 < 0)
|
212
235
|
fe1 = xe->xdf1.nrec;
|
213
236
|
if (fe1 > e1) {
|
@@ -221,11 +244,12 @@ int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
|
|
221
244
|
* its new end.
|
222
245
|
*/
|
223
246
|
if (xche->next) {
|
224
|
-
long l = xche->next->i1
|
225
|
-
|
247
|
+
long l = XDL_MIN(xche->next->i1,
|
248
|
+
xe->xdf1.nrec - 1);
|
249
|
+
if (l - xecfg->ctxlen <= e1 ||
|
226
250
|
get_func_line(xe, xecfg, NULL, l, e1) < 0) {
|
227
251
|
xche = xche->next;
|
228
|
-
goto
|
252
|
+
goto post_context_calculation;
|
229
253
|
}
|
230
254
|
}
|
231
255
|
}
|
@@ -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
|
*
|
@@ -42,5 +42,6 @@
|
|
42
42
|
#include "xdiffi.h"
|
43
43
|
#include "xemit.h"
|
44
44
|
|
45
|
+
#include "common.h"
|
45
46
|
|
46
47
|
#endif /* #if !defined(XINCLUDE_H) */
|
@@ -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,15 +13,14 @@
|
|
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
|
*
|
21
21
|
*/
|
22
22
|
|
23
23
|
#include "xinclude.h"
|
24
|
-
#include "common.h"
|
25
24
|
|
26
25
|
typedef struct s_xdmerge {
|
27
26
|
struct s_xdmerge *next;
|
@@ -110,7 +109,7 @@ static int xdl_merge_cmp_lines(xdfenv_t *xe1, int i1, xdfenv_t *xe2, int i2,
|
|
110
109
|
return 0;
|
111
110
|
}
|
112
111
|
|
113
|
-
static int xdl_recs_copy_0(size_t *out, int use_orig, xdfenv_t *xe, int i, int count, int add_nl, char *dest)
|
112
|
+
static int xdl_recs_copy_0(size_t *out, int use_orig, xdfenv_t *xe, int i, int count, int needs_cr, int add_nl, char *dest)
|
114
113
|
{
|
115
114
|
xrecord_t **recs;
|
116
115
|
size_t size = 0;
|
@@ -132,6 +131,12 @@ static int xdl_recs_copy_0(size_t *out, int use_orig, xdfenv_t *xe, int i, int c
|
|
132
131
|
if (add_nl) {
|
133
132
|
i = recs[count - 1]->size;
|
134
133
|
if (i == 0 || recs[count - 1]->ptr[i - 1] != '\n') {
|
134
|
+
if (needs_cr) {
|
135
|
+
if (dest)
|
136
|
+
dest[size] = '\r';
|
137
|
+
GITERR_CHECK_ALLOC_ADD(&size, size, 1);
|
138
|
+
}
|
139
|
+
|
135
140
|
if (dest)
|
136
141
|
dest[size] = '\n';
|
137
142
|
|
@@ -143,14 +148,58 @@ static int xdl_recs_copy_0(size_t *out, int use_orig, xdfenv_t *xe, int i, int c
|
|
143
148
|
return 0;
|
144
149
|
}
|
145
150
|
|
146
|
-
static int xdl_recs_copy(size_t *out, xdfenv_t *xe, int i, int count, int add_nl, char *dest)
|
151
|
+
static int xdl_recs_copy(size_t *out, xdfenv_t *xe, int i, int count, int needs_cr, int add_nl, char *dest)
|
147
152
|
{
|
148
|
-
return xdl_recs_copy_0(out, 0, xe, i, count, add_nl, dest);
|
153
|
+
return xdl_recs_copy_0(out, 0, xe, i, count, needs_cr, add_nl, dest);
|
149
154
|
}
|
150
155
|
|
151
|
-
static int xdl_orig_copy(size_t *out, xdfenv_t *xe, int i, int count, int add_nl, char *dest)
|
156
|
+
static int xdl_orig_copy(size_t *out, xdfenv_t *xe, int i, int count, int needs_cr, int add_nl, char *dest)
|
152
157
|
{
|
153
|
-
return xdl_recs_copy_0(out, 1, xe, i, count, add_nl, dest);
|
158
|
+
return xdl_recs_copy_0(out, 1, xe, i, count, needs_cr, add_nl, dest);
|
159
|
+
}
|
160
|
+
|
161
|
+
/*
|
162
|
+
* Returns 1 if the i'th line ends in CR/LF (if it is the last line and
|
163
|
+
* has no eol, the preceding line, if any), 0 if it ends in LF-only, and
|
164
|
+
* -1 if the line ending cannot be determined.
|
165
|
+
*/
|
166
|
+
static int is_eol_crlf(xdfile_t *file, int i)
|
167
|
+
{
|
168
|
+
long size;
|
169
|
+
|
170
|
+
if (i < file->nrec - 1)
|
171
|
+
/* All lines before the last *must* end in LF */
|
172
|
+
return (size = file->recs[i]->size) > 1 &&
|
173
|
+
file->recs[i]->ptr[size - 2] == '\r';
|
174
|
+
if (!file->nrec)
|
175
|
+
/* Cannot determine eol style from empty file */
|
176
|
+
return -1;
|
177
|
+
if ((size = file->recs[i]->size) &&
|
178
|
+
file->recs[i]->ptr[size - 1] == '\n')
|
179
|
+
/* Last line; ends in LF; Is it CR/LF? */
|
180
|
+
return size > 1 &&
|
181
|
+
file->recs[i]->ptr[size - 2] == '\r';
|
182
|
+
if (!i)
|
183
|
+
/* The only line has no eol */
|
184
|
+
return -1;
|
185
|
+
/* Determine eol from second-to-last line */
|
186
|
+
return (size = file->recs[i - 1]->size) > 1 &&
|
187
|
+
file->recs[i - 1]->ptr[size - 2] == '\r';
|
188
|
+
}
|
189
|
+
|
190
|
+
static int is_cr_needed(xdfenv_t *xe1, xdfenv_t *xe2, xdmerge_t *m)
|
191
|
+
{
|
192
|
+
int needs_cr;
|
193
|
+
|
194
|
+
/* Match post-images' preceding, or first, lines' end-of-line style */
|
195
|
+
needs_cr = is_eol_crlf(&xe1->xdf2, m->i1 ? m->i1 - 1 : 0);
|
196
|
+
if (needs_cr)
|
197
|
+
needs_cr = is_eol_crlf(&xe2->xdf2, m->i2 ? m->i2 - 1 : 0);
|
198
|
+
/* Look at pre-image's first line, unless we already settled on LF */
|
199
|
+
if (needs_cr)
|
200
|
+
needs_cr = is_eol_crlf(&xe1->xdf1, 0);
|
201
|
+
/* If still undecided, use LF-only */
|
202
|
+
return needs_cr < 0 ? 0 : needs_cr;
|
154
203
|
}
|
155
204
|
|
156
205
|
static int fill_conflict_hunk(size_t *out, xdfenv_t *xe1, const char *name1,
|
@@ -162,6 +211,7 @@ static int fill_conflict_hunk(size_t *out, xdfenv_t *xe1, const char *name1,
|
|
162
211
|
int marker1_size = (name1 ? (int)strlen(name1) + 1 : 0);
|
163
212
|
int marker2_size = (name2 ? (int)strlen(name2) + 1 : 0);
|
164
213
|
int marker3_size = (name3 ? (int)strlen(name3) + 1 : 0);
|
214
|
+
int needs_cr = is_cr_needed(xe1, xe2, m);
|
165
215
|
size_t copied;
|
166
216
|
|
167
217
|
*out = 0;
|
@@ -170,14 +220,14 @@ static int fill_conflict_hunk(size_t *out, xdfenv_t *xe1, const char *name1,
|
|
170
220
|
marker_size = DEFAULT_CONFLICT_MARKER_SIZE;
|
171
221
|
|
172
222
|
/* Before conflicting part */
|
173
|
-
if (xdl_recs_copy(&copied, xe1, i, m->i1 - i, 0,
|
223
|
+
if (xdl_recs_copy(&copied, xe1, i, m->i1 - i, 0, 0,
|
174
224
|
dest ? dest + size : NULL) < 0)
|
175
225
|
return -1;
|
176
226
|
|
177
227
|
GITERR_CHECK_ALLOC_ADD(&size, size, copied);
|
178
228
|
|
179
229
|
if (!dest) {
|
180
|
-
|
230
|
+
GITERR_CHECK_ALLOC_ADD5(&size, size, marker_size, 1, needs_cr, marker1_size);
|
181
231
|
} else {
|
182
232
|
memset(dest + size, '<', marker_size);
|
183
233
|
size += marker_size;
|
@@ -186,11 +236,13 @@ static int fill_conflict_hunk(size_t *out, xdfenv_t *xe1, const char *name1,
|
|
186
236
|
memcpy(dest + size + 1, name1, marker1_size - 1);
|
187
237
|
size += marker1_size;
|
188
238
|
}
|
239
|
+
if (needs_cr)
|
240
|
+
dest[size++] = '\r';
|
189
241
|
dest[size++] = '\n';
|
190
242
|
}
|
191
243
|
|
192
244
|
/* Postimage from side #1 */
|
193
|
-
if (xdl_recs_copy(&copied, xe1, m->i1, m->chg1, 1,
|
245
|
+
if (xdl_recs_copy(&copied, xe1, m->i1, m->chg1, needs_cr, 1,
|
194
246
|
dest ? dest + size : NULL) < 0)
|
195
247
|
return -1;
|
196
248
|
|
@@ -199,7 +251,7 @@ static int fill_conflict_hunk(size_t *out, xdfenv_t *xe1, const char *name1,
|
|
199
251
|
if (style == XDL_MERGE_DIFF3) {
|
200
252
|
/* Shared preimage */
|
201
253
|
if (!dest) {
|
202
|
-
|
254
|
+
GITERR_CHECK_ALLOC_ADD5(&size, size, marker_size, 1, needs_cr, marker3_size);
|
203
255
|
} else {
|
204
256
|
memset(dest + size, '|', marker_size);
|
205
257
|
size += marker_size;
|
@@ -208,32 +260,36 @@ static int fill_conflict_hunk(size_t *out, xdfenv_t *xe1, const char *name1,
|
|
208
260
|
memcpy(dest + size + 1, name3, marker3_size - 1);
|
209
261
|
size += marker3_size;
|
210
262
|
}
|
263
|
+
if (needs_cr)
|
264
|
+
dest[size++] = '\r';
|
211
265
|
dest[size++] = '\n';
|
212
266
|
}
|
213
267
|
|
214
|
-
if (xdl_orig_copy(&copied, xe1, m->i0, m->chg0, 1,
|
268
|
+
if (xdl_orig_copy(&copied, xe1, m->i0, m->chg0, needs_cr, 1,
|
215
269
|
dest ? dest + size : NULL) < 0)
|
216
270
|
return -1;
|
217
271
|
GITERR_CHECK_ALLOC_ADD(&size, size, copied);
|
218
272
|
}
|
219
273
|
|
220
274
|
if (!dest) {
|
221
|
-
|
275
|
+
GITERR_CHECK_ALLOC_ADD4(&size, size, marker_size, 1, needs_cr);
|
222
276
|
} else {
|
223
277
|
memset(dest + size, '=', marker_size);
|
224
278
|
size += marker_size;
|
279
|
+
if (needs_cr)
|
280
|
+
dest[size++] = '\r';
|
225
281
|
dest[size++] = '\n';
|
226
282
|
}
|
227
283
|
|
228
284
|
/* Postimage from side #2 */
|
229
285
|
|
230
|
-
if (xdl_recs_copy(&copied, xe2, m->i2, m->chg2, 1,
|
286
|
+
if (xdl_recs_copy(&copied, xe2, m->i2, m->chg2, needs_cr, 1,
|
231
287
|
dest ? dest + size : NULL) < 0)
|
232
288
|
return -1;
|
233
289
|
GITERR_CHECK_ALLOC_ADD(&size, size, copied);
|
234
290
|
|
235
291
|
if (!dest) {
|
236
|
-
|
292
|
+
GITERR_CHECK_ALLOC_ADD5(&size, size, marker_size, 1, needs_cr, marker2_size);
|
237
293
|
} else {
|
238
294
|
memset(dest + size, '>', marker_size);
|
239
295
|
size += marker_size;
|
@@ -242,6 +298,8 @@ static int fill_conflict_hunk(size_t *out, xdfenv_t *xe1, const char *name1,
|
|
242
298
|
memcpy(dest + size + 1, name2, marker2_size - 1);
|
243
299
|
size += marker2_size;
|
244
300
|
}
|
301
|
+
if (needs_cr)
|
302
|
+
dest[size++] = '\r';
|
245
303
|
dest[size++] = '\n';
|
246
304
|
}
|
247
305
|
|
@@ -275,14 +333,16 @@ static int xdl_fill_merge_buffer(size_t *out,
|
|
275
333
|
}
|
276
334
|
else if (m->mode & 3) {
|
277
335
|
/* Before conflicting part */
|
278
|
-
if (xdl_recs_copy(&copied, xe1, i, m->i1 - i, 0,
|
336
|
+
if (xdl_recs_copy(&copied, xe1, i, m->i1 - i, 0, 0,
|
279
337
|
dest ? dest + size : NULL) < 0)
|
280
338
|
return -1;
|
281
339
|
GITERR_CHECK_ALLOC_ADD(&size, size, copied);
|
282
340
|
|
283
341
|
/* Postimage from side #1 */
|
284
342
|
if (m->mode & 1) {
|
285
|
-
|
343
|
+
int needs_cr = is_cr_needed(xe1, xe2, m);
|
344
|
+
|
345
|
+
if (xdl_recs_copy(&copied, xe1, m->i1, m->chg1, needs_cr, (m->mode & 2),
|
286
346
|
dest ? dest + size : NULL) < 0)
|
287
347
|
return -1;
|
288
348
|
GITERR_CHECK_ALLOC_ADD(&size, size, copied);
|
@@ -290,7 +350,7 @@ static int xdl_fill_merge_buffer(size_t *out,
|
|
290
350
|
|
291
351
|
/* Postimage from side #2 */
|
292
352
|
if (m->mode & 2) {
|
293
|
-
if (xdl_recs_copy(&copied, xe2, m->i2, m->chg2, 0,
|
353
|
+
if (xdl_recs_copy(&copied, xe2, m->i2, m->chg2, 0, 0,
|
294
354
|
dest ? dest + size : NULL) < 0)
|
295
355
|
return -1;
|
296
356
|
GITERR_CHECK_ALLOC_ADD(&size, size, copied);
|
@@ -300,7 +360,7 @@ static int xdl_fill_merge_buffer(size_t *out,
|
|
300
360
|
i = m->i1 + m->chg1;
|
301
361
|
}
|
302
362
|
|
303
|
-
if (xdl_recs_copy(&copied, xe1, i, xe1->xdf2.nrec - i, 0,
|
363
|
+
if (xdl_recs_copy(&copied, xe1, i, xe1->xdf2.nrec - i, 0, 0,
|
304
364
|
dest ? dest + size : NULL) < 0)
|
305
365
|
return -1;
|
306
366
|
GITERR_CHECK_ALLOC_ADD(&size, size, copied);
|