rugged 1.3.2.3 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/rugged/extconf.rb +1 -1
- data/ext/rugged/rugged_config.c +7 -2
- data/ext/rugged/rugged_remote.c +17 -0
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +103 -276
- data/vendor/libgit2/COPYING +36 -19
- data/vendor/libgit2/cmake/AddCFlagIfSupported.cmake +21 -21
- data/vendor/libgit2/cmake/DefaultCFlags.cmake +154 -0
- data/vendor/libgit2/cmake/EnableWarnings.cmake +13 -13
- 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 +13 -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 +39 -49
- 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 +31 -31
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +1 -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 +0 -7
- data/vendor/libgit2/deps/zlib/crc32.c +288 -975
- data/vendor/libgit2/deps/zlib/crc32.h +436 -9441
- data/vendor/libgit2/deps/zlib/deflate.c +31 -83
- data/vendor/libgit2/deps/zlib/deflate.h +15 -12
- data/vendor/libgit2/deps/zlib/gzguts.h +2 -3
- data/vendor/libgit2/deps/zlib/infback.c +1 -2
- data/vendor/libgit2/deps/zlib/inffast.c +14 -14
- data/vendor/libgit2/deps/zlib/inflate.c +8 -39
- data/vendor/libgit2/deps/zlib/inflate.h +2 -3
- data/vendor/libgit2/deps/zlib/inftrees.c +3 -3
- data/vendor/libgit2/deps/zlib/trees.c +48 -27
- data/vendor/libgit2/deps/zlib/zlib.h +100 -126
- data/vendor/libgit2/deps/zlib/zutil.c +2 -2
- data/vendor/libgit2/deps/zlib/zutil.h +9 -12
- 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 +2 -0
- 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 +5 -12
- data/vendor/libgit2/include/git2/config.h +19 -3
- 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 +1 -1
- data/vendor/libgit2/include/git2/describe.h +7 -2
- data/vendor/libgit2/include/git2/diff.h +17 -9
- data/vendor/libgit2/include/git2/email.h +1 -1
- data/vendor/libgit2/include/git2/errors.h +1 -2
- 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 +19 -0
- data/vendor/libgit2/include/git2/merge.h +23 -3
- data/vendor/libgit2/include/git2/message.h +2 -0
- data/vendor/libgit2/include/git2/object.h +23 -0
- data/vendor/libgit2/include/git2/odb.h +37 -7
- data/vendor/libgit2/include/git2/odb_backend.h +1 -1
- 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 +14 -9
- 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 +3 -3
- data/vendor/libgit2/include/git2/status.h +9 -3
- 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 +2 -5
- data/vendor/libgit2/include/git2/sys/remote.h +31 -0
- data/vendor/libgit2/include/git2/sys/stream.h +1 -1
- data/vendor/libgit2/include/git2/sys/transport.h +25 -34
- 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 +3 -3
- data/vendor/libgit2/include/git2/worktree.h +12 -2
- data/vendor/libgit2/src/CMakeLists.txt +189 -315
- data/vendor/libgit2/src/annotated_commit.h +1 -1
- data/vendor/libgit2/src/apply.c +18 -18
- data/vendor/libgit2/src/apply.h +2 -2
- data/vendor/libgit2/src/attr.c +18 -18
- data/vendor/libgit2/src/attr_file.c +17 -17
- data/vendor/libgit2/src/attr_file.h +4 -4
- data/vendor/libgit2/src/attrcache.c +17 -12
- data/vendor/libgit2/src/blame_git.c +1 -1
- data/vendor/libgit2/src/blob.c +33 -26
- data/vendor/libgit2/src/blob.h +1 -1
- data/vendor/libgit2/src/branch.c +150 -109
- data/vendor/libgit2/src/branch.h +15 -3
- data/vendor/libgit2/src/buf.c +126 -0
- data/vendor/libgit2/src/buf.h +50 -0
- data/vendor/libgit2/src/cc-compat.h +1 -1
- data/vendor/libgit2/src/checkout.c +74 -68
- data/vendor/libgit2/src/cherrypick.c +10 -10
- data/vendor/libgit2/src/clone.c +66 -66
- data/vendor/libgit2/src/commit.c +128 -58
- data/vendor/libgit2/src/commit.h +24 -1
- data/vendor/libgit2/src/commit_graph.c +68 -53
- data/vendor/libgit2/src/commit_graph.h +10 -3
- data/vendor/libgit2/src/commit_list.c +2 -3
- data/vendor/libgit2/src/common.h +10 -3
- data/vendor/libgit2/src/config.c +99 -77
- data/vendor/libgit2/src/config.h +15 -2
- data/vendor/libgit2/src/config_file.c +103 -91
- data/vendor/libgit2/src/config_mem.c +9 -9
- data/vendor/libgit2/src/config_parse.c +27 -23
- data/vendor/libgit2/src/crlf.c +24 -21
- data/vendor/libgit2/src/date.c +10 -17
- data/vendor/libgit2/src/date.h +33 -0
- data/vendor/libgit2/src/describe.c +27 -19
- data/vendor/libgit2/src/diff.c +25 -8
- data/vendor/libgit2/src/diff.h +2 -4
- data/vendor/libgit2/src/diff_driver.c +34 -36
- data/vendor/libgit2/src/diff_driver.h +3 -3
- data/vendor/libgit2/src/diff_file.c +29 -20
- data/vendor/libgit2/src/diff_generate.c +30 -6
- data/vendor/libgit2/src/diff_generate.h +5 -3
- data/vendor/libgit2/src/diff_print.c +102 -95
- data/vendor/libgit2/src/diff_stats.c +40 -29
- data/vendor/libgit2/src/{message.h → diff_stats.h} +7 -6
- data/vendor/libgit2/src/diff_tform.c +9 -8
- data/vendor/libgit2/src/diff_xdiff.c +3 -8
- data/vendor/libgit2/src/email.c +54 -38
- data/vendor/libgit2/src/email.h +1 -1
- data/vendor/libgit2/src/errors.c +18 -18
- data/vendor/libgit2/src/features.h.in +6 -1
- data/vendor/libgit2/src/fetch.c +69 -24
- data/vendor/libgit2/src/fetch.h +1 -1
- data/vendor/libgit2/src/fetchhead.c +19 -19
- data/vendor/libgit2/src/filebuf.c +28 -28
- data/vendor/libgit2/src/filebuf.h +1 -1
- data/vendor/libgit2/src/filter.c +96 -52
- data/vendor/libgit2/src/filter.h +26 -5
- data/vendor/libgit2/src/fs_path.c +1912 -0
- data/vendor/libgit2/src/fs_path.h +752 -0
- data/vendor/libgit2/src/futils.c +91 -85
- data/vendor/libgit2/src/futils.h +26 -14
- data/vendor/libgit2/src/hash/sha1/collisiondetect.c +2 -2
- data/vendor/libgit2/src/hash/sha1/common_crypto.c +2 -2
- data/vendor/libgit2/src/hash/sha1/generic.c +2 -2
- data/vendor/libgit2/src/hash/sha1/mbedtls.c +2 -2
- data/vendor/libgit2/src/hash/sha1/openssl.c +2 -2
- data/vendor/libgit2/src/hash/sha1/sha1dc/sha1.c +1 -1
- data/vendor/libgit2/src/hash/sha1/win32.c +6 -6
- data/vendor/libgit2/src/hash/sha1.h +3 -1
- data/vendor/libgit2/src/hash.c +67 -35
- data/vendor/libgit2/src/hash.h +12 -12
- data/vendor/libgit2/src/ident.c +18 -18
- data/vendor/libgit2/src/ignore.c +35 -34
- data/vendor/libgit2/src/ignore.h +2 -2
- data/vendor/libgit2/src/index.c +79 -80
- data/vendor/libgit2/src/index.h +6 -3
- data/vendor/libgit2/src/indexer.c +75 -57
- data/vendor/libgit2/src/iterator.c +64 -56
- data/vendor/libgit2/src/iterator.h +5 -5
- data/vendor/libgit2/src/khash.h +1 -1
- data/vendor/libgit2/src/libgit2.c +22 -19
- data/vendor/libgit2/src/mailmap.c +38 -36
- data/vendor/libgit2/src/merge.c +27 -27
- data/vendor/libgit2/src/merge.h +1 -14
- data/vendor/libgit2/src/merge_driver.c +2 -2
- data/vendor/libgit2/src/merge_file.c +13 -3
- data/vendor/libgit2/src/message.c +21 -10
- data/vendor/libgit2/src/midx.c +83 -66
- data/vendor/libgit2/src/midx.h +3 -3
- data/vendor/libgit2/src/mwindow.c +1 -1
- data/vendor/libgit2/src/net.c +278 -68
- data/vendor/libgit2/src/net.h +10 -3
- data/vendor/libgit2/src/netops.c +1 -1
- data/vendor/libgit2/src/netops.h +1 -1
- data/vendor/libgit2/src/notes.c +20 -29
- data/vendor/libgit2/src/object.c +49 -9
- data/vendor/libgit2/src/object.h +1 -1
- data/vendor/libgit2/src/odb.c +35 -32
- data/vendor/libgit2/src/odb.h +1 -1
- data/vendor/libgit2/src/odb_loose.c +68 -68
- data/vendor/libgit2/src/odb_mempack.c +18 -5
- data/vendor/libgit2/src/odb_pack.c +43 -43
- data/vendor/libgit2/src/oid.c +11 -4
- data/vendor/libgit2/src/oid.h +15 -0
- data/vendor/libgit2/src/pack-objects.c +41 -26
- data/vendor/libgit2/src/pack-objects.h +11 -6
- data/vendor/libgit2/src/pack.c +10 -10
- data/vendor/libgit2/src/patch.c +3 -3
- data/vendor/libgit2/src/patch.h +1 -0
- data/vendor/libgit2/src/patch_generate.c +27 -11
- data/vendor/libgit2/src/patch_generate.h +5 -5
- data/vendor/libgit2/src/patch_parse.c +24 -24
- data/vendor/libgit2/src/path.c +76 -1951
- data/vendor/libgit2/src/path.h +34 -741
- data/vendor/libgit2/src/pathspec.c +6 -6
- data/vendor/libgit2/src/pathspec.h +2 -2
- data/vendor/libgit2/src/posix.c +3 -3
- data/vendor/libgit2/src/posix.h +1 -0
- data/vendor/libgit2/src/pqueue.h +1 -1
- data/vendor/libgit2/src/proxy.c +4 -1
- data/vendor/libgit2/src/proxy.h +1 -1
- data/vendor/libgit2/src/push.c +30 -35
- data/vendor/libgit2/src/push.h +4 -16
- data/vendor/libgit2/src/rand.c +226 -0
- data/vendor/libgit2/src/rand.h +37 -0
- data/vendor/libgit2/src/reader.c +8 -8
- data/vendor/libgit2/src/reader.h +2 -2
- data/vendor/libgit2/src/rebase.c +89 -88
- data/vendor/libgit2/src/refdb_fs.c +447 -173
- data/vendor/libgit2/src/refs.c +32 -32
- data/vendor/libgit2/src/refs.h +2 -2
- data/vendor/libgit2/src/refspec.c +32 -37
- data/vendor/libgit2/src/refspec.h +5 -2
- data/vendor/libgit2/src/regexp.c +1 -1
- data/vendor/libgit2/src/remote.c +713 -419
- data/vendor/libgit2/src/remote.h +15 -10
- data/vendor/libgit2/src/repository.c +350 -467
- data/vendor/libgit2/src/repository.h +11 -10
- data/vendor/libgit2/src/reset.c +8 -5
- data/vendor/libgit2/src/revert.c +10 -10
- data/vendor/libgit2/src/revparse.c +48 -35
- data/vendor/libgit2/src/revwalk.c +7 -7
- data/vendor/libgit2/src/signature.c +12 -6
- data/vendor/libgit2/src/signature.h +1 -1
- data/vendor/libgit2/src/sortedcache.c +1 -1
- data/vendor/libgit2/src/sortedcache.h +1 -1
- data/vendor/libgit2/src/stash.c +36 -37
- data/vendor/libgit2/src/status.c +4 -1
- data/vendor/libgit2/src/{buffer.c → str.c} +157 -151
- data/vendor/libgit2/src/str.h +357 -0
- data/vendor/libgit2/src/streams/mbedtls.c +8 -6
- data/vendor/libgit2/src/streams/openssl_dynamic.h +3 -3
- data/vendor/libgit2/src/submodule.c +171 -159
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/sysdir.c +68 -52
- data/vendor/libgit2/src/sysdir.h +15 -10
- data/vendor/libgit2/src/tag.c +29 -27
- data/vendor/libgit2/src/thread.h +3 -3
- data/vendor/libgit2/src/threadstate.c +3 -3
- data/vendor/libgit2/src/threadstate.h +1 -1
- data/vendor/libgit2/src/trace.c +1 -14
- data/vendor/libgit2/src/trace.h +5 -22
- data/vendor/libgit2/src/trailer.c +1 -1
- data/vendor/libgit2/src/transaction.c +1 -1
- data/vendor/libgit2/src/transport.c +10 -10
- data/vendor/libgit2/src/transports/auth.c +7 -9
- data/vendor/libgit2/src/transports/auth.h +2 -3
- data/vendor/libgit2/src/transports/auth_negotiate.c +12 -13
- data/vendor/libgit2/src/transports/auth_ntlm.c +10 -10
- data/vendor/libgit2/src/transports/auth_ntlm.h +0 -1
- data/vendor/libgit2/src/transports/git.c +9 -11
- data/vendor/libgit2/src/transports/http.c +37 -17
- data/vendor/libgit2/src/transports/http.h +2 -3
- data/vendor/libgit2/src/transports/httpclient.c +65 -65
- data/vendor/libgit2/src/transports/local.c +124 -116
- data/vendor/libgit2/src/transports/smart.c +51 -139
- data/vendor/libgit2/src/transports/smart.h +25 -31
- data/vendor/libgit2/src/transports/smart_pkt.c +33 -33
- data/vendor/libgit2/src/transports/smart_protocol.c +57 -39
- data/vendor/libgit2/src/transports/ssh.c +47 -112
- data/vendor/libgit2/src/transports/winhttp.c +50 -56
- data/vendor/libgit2/src/tree-cache.c +5 -5
- data/vendor/libgit2/src/tree-cache.h +2 -2
- data/vendor/libgit2/src/tree.c +59 -48
- data/vendor/libgit2/src/tree.h +1 -1
- data/vendor/libgit2/src/unix/map.c +0 -2
- data/vendor/libgit2/src/unix/posix.h +1 -4
- data/vendor/libgit2/src/unix/realpath.c +0 -2
- data/vendor/libgit2/src/util.c +14 -14
- data/vendor/libgit2/src/util.h +2 -28
- data/vendor/libgit2/src/vector.h +1 -1
- data/vendor/libgit2/src/win32/findfile.c +172 -116
- data/vendor/libgit2/src/win32/findfile.h +7 -4
- data/vendor/libgit2/src/win32/path_w32.c +140 -9
- data/vendor/libgit2/src/win32/path_w32.h +2 -0
- data/vendor/libgit2/src/win32/posix.h +0 -1
- data/vendor/libgit2/src/win32/posix_w32.c +11 -27
- data/vendor/libgit2/src/win32/w32_buffer.c +2 -3
- data/vendor/libgit2/src/win32/w32_buffer.h +2 -3
- data/vendor/libgit2/src/win32/w32_leakcheck.c +1 -1
- data/vendor/libgit2/src/worktree.c +116 -94
- data/vendor/libgit2/src/worktree.h +1 -1
- data/vendor/libgit2/src/xdiff/git-xdiff.h +53 -0
- data/vendor/libgit2/src/xdiff/xdiff.h +15 -15
- data/vendor/libgit2/src/xdiff/xdiffi.c +134 -108
- data/vendor/libgit2/src/xdiff/xemit.c +23 -7
- data/vendor/libgit2/src/xdiff/xhistogram.c +87 -78
- data/vendor/libgit2/src/xdiff/xinclude.h +1 -12
- data/vendor/libgit2/src/xdiff/xmerge.c +104 -117
- data/vendor/libgit2/src/xdiff/xpatience.c +6 -17
- data/vendor/libgit2/src/xdiff/xprepare.c +15 -20
- data/vendor/libgit2/src/xdiff/xutils.c +18 -7
- data/vendor/libgit2/src/zstream.c +5 -5
- data/vendor/libgit2/src/zstream.h +4 -4
- metadata +25 -10
- data/vendor/libgit2/src/buffer.h +0 -374
|
@@ -21,7 +21,7 @@ typedef enum {
|
|
|
21
21
|
DIFF_DRIVER_AUTO = 0,
|
|
22
22
|
DIFF_DRIVER_BINARY = 1,
|
|
23
23
|
DIFF_DRIVER_TEXT = 2,
|
|
24
|
-
DIFF_DRIVER_PATTERNLIST = 3
|
|
24
|
+
DIFF_DRIVER_PATTERNLIST = 3
|
|
25
25
|
} git_diff_driver_t;
|
|
26
26
|
|
|
27
27
|
typedef struct {
|
|
@@ -51,11 +51,9 @@ struct git_diff_driver_registry {
|
|
|
51
51
|
|
|
52
52
|
#define FORCE_DIFFABLE (GIT_DIFF_FORCE_TEXT | GIT_DIFF_FORCE_BINARY)
|
|
53
53
|
|
|
54
|
-
static git_diff_driver
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
{ DIFF_DRIVER_TEXT, GIT_DIFF_FORCE_TEXT, 0 },
|
|
58
|
-
};
|
|
54
|
+
static git_diff_driver diff_driver_auto = { DIFF_DRIVER_AUTO, 0, 0 };
|
|
55
|
+
static git_diff_driver diff_driver_binary = { DIFF_DRIVER_BINARY, GIT_DIFF_FORCE_BINARY, 0 };
|
|
56
|
+
static git_diff_driver diff_driver_text = { DIFF_DRIVER_TEXT, GIT_DIFF_FORCE_TEXT, 0 };
|
|
59
57
|
|
|
60
58
|
git_diff_driver_registry *git_diff_driver_registry_new(void)
|
|
61
59
|
{
|
|
@@ -90,7 +88,7 @@ static int diff_driver_add_patterns(
|
|
|
90
88
|
int error = 0;
|
|
91
89
|
const char *scan, *end;
|
|
92
90
|
git_diff_driver_pattern *pat = NULL;
|
|
93
|
-
|
|
91
|
+
git_str buf = GIT_STR_INIT;
|
|
94
92
|
|
|
95
93
|
for (scan = regex_str; scan; scan = end) {
|
|
96
94
|
/* get pattern to fill in */
|
|
@@ -105,10 +103,10 @@ static int diff_driver_add_patterns(
|
|
|
105
103
|
}
|
|
106
104
|
|
|
107
105
|
if ((end = strchr(scan, '\n')) != NULL) {
|
|
108
|
-
error =
|
|
106
|
+
error = git_str_set(&buf, scan, end - scan);
|
|
109
107
|
end++;
|
|
110
108
|
} else {
|
|
111
|
-
error =
|
|
109
|
+
error = git_str_sets(&buf, scan);
|
|
112
110
|
}
|
|
113
111
|
if (error < 0)
|
|
114
112
|
break;
|
|
@@ -122,7 +120,7 @@ static int diff_driver_add_patterns(
|
|
|
122
120
|
|
|
123
121
|
if (error && pat != NULL)
|
|
124
122
|
(void)git_array_pop(drv->fn_patterns); /* release last item */
|
|
125
|
-
|
|
123
|
+
git_str_dispose(&buf);
|
|
126
124
|
|
|
127
125
|
/* We want to ignore bad patterns, so return success regardless */
|
|
128
126
|
return 0;
|
|
@@ -237,7 +235,7 @@ static int git_diff_driver_load(
|
|
|
237
235
|
git_diff_driver *drv;
|
|
238
236
|
size_t namelen;
|
|
239
237
|
git_config *cfg = NULL;
|
|
240
|
-
|
|
238
|
+
git_str name = GIT_STR_INIT;
|
|
241
239
|
git_config_entry *ce = NULL;
|
|
242
240
|
bool found_driver = false;
|
|
243
241
|
|
|
@@ -260,13 +258,13 @@ static int git_diff_driver_load(
|
|
|
260
258
|
goto done;
|
|
261
259
|
}
|
|
262
260
|
|
|
263
|
-
if ((error =
|
|
261
|
+
if ((error = git_str_printf(&name, "diff.%s.binary", driver_name)) < 0)
|
|
264
262
|
goto done;
|
|
265
263
|
|
|
266
264
|
switch (git_config__get_bool_force(cfg, name.ptr, -1)) {
|
|
267
265
|
case true:
|
|
268
266
|
/* if diff.<driver>.binary is true, just return the binary driver */
|
|
269
|
-
*out = &
|
|
267
|
+
*out = &diff_driver_binary;
|
|
270
268
|
goto done;
|
|
271
269
|
case false:
|
|
272
270
|
/* if diff.<driver>.binary is false, force binary checks off */
|
|
@@ -281,8 +279,8 @@ static int git_diff_driver_load(
|
|
|
281
279
|
|
|
282
280
|
/* TODO: warn if diff.<name>.command or diff.<name>.textconv are set */
|
|
283
281
|
|
|
284
|
-
|
|
285
|
-
if ((error =
|
|
282
|
+
git_str_truncate(&name, namelen + strlen("diff.."));
|
|
283
|
+
if ((error = git_str_PUTS(&name, "xfuncname")) < 0)
|
|
286
284
|
goto done;
|
|
287
285
|
|
|
288
286
|
if ((error = git_config_get_multivar_foreach(
|
|
@@ -292,8 +290,8 @@ static int git_diff_driver_load(
|
|
|
292
290
|
git_error_clear(); /* no diff.<driver>.xfuncname, so just continue */
|
|
293
291
|
}
|
|
294
292
|
|
|
295
|
-
|
|
296
|
-
if ((error =
|
|
293
|
+
git_str_truncate(&name, namelen + strlen("diff.."));
|
|
294
|
+
if ((error = git_str_PUTS(&name, "funcname")) < 0)
|
|
297
295
|
goto done;
|
|
298
296
|
|
|
299
297
|
if ((error = git_config_get_multivar_foreach(
|
|
@@ -309,8 +307,8 @@ static int git_diff_driver_load(
|
|
|
309
307
|
found_driver = true;
|
|
310
308
|
}
|
|
311
309
|
|
|
312
|
-
|
|
313
|
-
if ((error =
|
|
310
|
+
git_str_truncate(&name, namelen + strlen("diff.."));
|
|
311
|
+
if ((error = git_str_PUTS(&name, "wordregex")) < 0)
|
|
314
312
|
goto done;
|
|
315
313
|
|
|
316
314
|
if ((error = git_config__lookup_entry(&ce, cfg, name.ptr, false)) < 0)
|
|
@@ -340,7 +338,7 @@ static int git_diff_driver_load(
|
|
|
340
338
|
|
|
341
339
|
done:
|
|
342
340
|
git_config_entry_free(ce);
|
|
343
|
-
|
|
341
|
+
git_str_dispose(&name);
|
|
344
342
|
git_config_free(cfg);
|
|
345
343
|
|
|
346
344
|
if (!*out) {
|
|
@@ -374,9 +372,9 @@ int git_diff_driver_lookup(
|
|
|
374
372
|
else if (GIT_ATTR_IS_UNSPECIFIED(values[0]))
|
|
375
373
|
/* just use the auto value */;
|
|
376
374
|
else if (GIT_ATTR_IS_FALSE(values[0]))
|
|
377
|
-
*out = &
|
|
375
|
+
*out = &diff_driver_binary;
|
|
378
376
|
else if (GIT_ATTR_IS_TRUE(values[0]))
|
|
379
|
-
*out = &
|
|
377
|
+
*out = &diff_driver_text;
|
|
380
378
|
|
|
381
379
|
/* otherwise look for driver information in config and build driver */
|
|
382
380
|
else if ((error = git_diff_driver_load(out, repo, values[0])) < 0) {
|
|
@@ -387,7 +385,7 @@ int git_diff_driver_lookup(
|
|
|
387
385
|
}
|
|
388
386
|
|
|
389
387
|
if (!*out)
|
|
390
|
-
*out = &
|
|
388
|
+
*out = &diff_driver_auto;
|
|
391
389
|
|
|
392
390
|
return error;
|
|
393
391
|
}
|
|
@@ -420,11 +418,11 @@ void git_diff_driver_update_options(
|
|
|
420
418
|
int git_diff_driver_content_is_binary(
|
|
421
419
|
git_diff_driver *driver, const char *content, size_t content_len)
|
|
422
420
|
{
|
|
423
|
-
|
|
421
|
+
git_str search = GIT_STR_INIT;
|
|
424
422
|
|
|
425
423
|
GIT_UNUSED(driver);
|
|
426
424
|
|
|
427
|
-
|
|
425
|
+
git_str_attach_notowned(&search, content,
|
|
428
426
|
min(content_len, GIT_FILTER_BYTES_TO_CHECK_NUL));
|
|
429
427
|
|
|
430
428
|
/* TODO: provide encoding / binary detection callbacks that can
|
|
@@ -432,15 +430,15 @@ int git_diff_driver_content_is_binary(
|
|
|
432
430
|
* let's just use the simple NUL-byte detection that core git uses.
|
|
433
431
|
*/
|
|
434
432
|
|
|
435
|
-
/* previously was: if (
|
|
436
|
-
if (
|
|
433
|
+
/* previously was: if (git_str_is_binary(&search)) */
|
|
434
|
+
if (git_str_contains_nul(&search))
|
|
437
435
|
return 1;
|
|
438
436
|
|
|
439
437
|
return 0;
|
|
440
438
|
}
|
|
441
439
|
|
|
442
440
|
static int diff_context_line__simple(
|
|
443
|
-
git_diff_driver *driver,
|
|
441
|
+
git_diff_driver *driver, git_str *line)
|
|
444
442
|
{
|
|
445
443
|
char firstch = line->ptr[0];
|
|
446
444
|
GIT_UNUSED(driver);
|
|
@@ -448,7 +446,7 @@ static int diff_context_line__simple(
|
|
|
448
446
|
}
|
|
449
447
|
|
|
450
448
|
static int diff_context_line__pattern_match(
|
|
451
|
-
git_diff_driver *driver,
|
|
449
|
+
git_diff_driver *driver, git_str *line)
|
|
452
450
|
{
|
|
453
451
|
size_t i, maxi = git_array_size(driver->fn_patterns);
|
|
454
452
|
git_regmatch pmatch[2];
|
|
@@ -462,9 +460,9 @@ static int diff_context_line__pattern_match(
|
|
|
462
460
|
|
|
463
461
|
/* use pmatch data to trim line data */
|
|
464
462
|
i = (pmatch[1].start >= 0) ? 1 : 0;
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
463
|
+
git_str_consume(line, git_str_cstr(line) + pmatch[i].start);
|
|
464
|
+
git_str_truncate(line, pmatch[i].end - pmatch[i].start);
|
|
465
|
+
git_str_rtrim(line);
|
|
468
466
|
|
|
469
467
|
return true;
|
|
470
468
|
}
|
|
@@ -482,9 +480,9 @@ static long diff_context_find(
|
|
|
482
480
|
{
|
|
483
481
|
git_diff_find_context_payload *ctxt = payload;
|
|
484
482
|
|
|
485
|
-
if (
|
|
483
|
+
if (git_str_set(&ctxt->line, line, (size_t)line_len) < 0)
|
|
486
484
|
return -1;
|
|
487
|
-
|
|
485
|
+
git_str_rtrim(&ctxt->line);
|
|
488
486
|
|
|
489
487
|
if (!ctxt->line.size)
|
|
490
488
|
return -1;
|
|
@@ -511,14 +509,14 @@ void git_diff_find_context_init(
|
|
|
511
509
|
payload_out->driver = driver;
|
|
512
510
|
payload_out->match_line = (driver->type == DIFF_DRIVER_PATTERNLIST) ?
|
|
513
511
|
diff_context_line__pattern_match : diff_context_line__simple;
|
|
514
|
-
|
|
512
|
+
git_str_init(&payload_out->line, 0);
|
|
515
513
|
}
|
|
516
514
|
}
|
|
517
515
|
|
|
518
516
|
void git_diff_find_context_clear(git_diff_find_context_payload *payload)
|
|
519
517
|
{
|
|
520
518
|
if (payload) {
|
|
521
|
-
|
|
519
|
+
git_str_dispose(&payload->line);
|
|
522
520
|
payload->driver = NULL;
|
|
523
521
|
}
|
|
524
522
|
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
#include "common.h"
|
|
11
11
|
|
|
12
12
|
#include "attr_file.h"
|
|
13
|
-
#include "
|
|
13
|
+
#include "str.h"
|
|
14
14
|
|
|
15
15
|
typedef struct git_diff_driver_registry git_diff_driver_registry;
|
|
16
16
|
|
|
@@ -34,12 +34,12 @@ typedef long (*git_diff_find_context_fn)(
|
|
|
34
34
|
const char *, long, char *, long, void *);
|
|
35
35
|
|
|
36
36
|
typedef int (*git_diff_find_context_line)(
|
|
37
|
-
git_diff_driver *,
|
|
37
|
+
git_diff_driver *, git_str *);
|
|
38
38
|
|
|
39
39
|
typedef struct {
|
|
40
40
|
git_diff_driver *driver;
|
|
41
41
|
git_diff_find_context_line match_line;
|
|
42
|
-
|
|
42
|
+
git_str line;
|
|
43
43
|
} git_diff_find_context_payload;
|
|
44
44
|
|
|
45
45
|
void git_diff_find_context_init(
|
|
@@ -178,7 +178,7 @@ static int diff_file_content_commit_to_str(
|
|
|
178
178
|
git_diff_file_content *fc, bool check_status)
|
|
179
179
|
{
|
|
180
180
|
char oid[GIT_OID_HEXSZ+1];
|
|
181
|
-
|
|
181
|
+
git_str content = GIT_STR_INIT;
|
|
182
182
|
const char *status = "";
|
|
183
183
|
|
|
184
184
|
if (check_status) {
|
|
@@ -217,11 +217,11 @@ static int diff_file_content_commit_to_str(
|
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
git_oid_tostr(oid, sizeof(oid), &fc->file->id);
|
|
220
|
-
if (
|
|
220
|
+
if (git_str_printf(&content, "Subproject commit %s%s\n", oid, status) < 0)
|
|
221
221
|
return -1;
|
|
222
222
|
|
|
223
|
-
fc->map.len =
|
|
224
|
-
fc->map.data =
|
|
223
|
+
fc->map.len = git_str_len(&content);
|
|
224
|
+
fc->map.data = git_str_detach(&content);
|
|
225
225
|
fc->flags |= GIT_DIFF_FLAG__FREE_DATA;
|
|
226
226
|
|
|
227
227
|
return 0;
|
|
@@ -270,24 +270,24 @@ static int diff_file_content_load_blob(
|
|
|
270
270
|
}
|
|
271
271
|
|
|
272
272
|
static int diff_file_content_load_workdir_symlink_fake(
|
|
273
|
-
git_diff_file_content *fc,
|
|
273
|
+
git_diff_file_content *fc, git_str *path)
|
|
274
274
|
{
|
|
275
|
-
|
|
275
|
+
git_str target = GIT_STR_INIT;
|
|
276
276
|
int error;
|
|
277
277
|
|
|
278
278
|
if ((error = git_futils_readbuffer(&target, path->ptr)) < 0)
|
|
279
279
|
return error;
|
|
280
280
|
|
|
281
|
-
fc->map.len =
|
|
282
|
-
fc->map.data =
|
|
281
|
+
fc->map.len = git_str_len(&target);
|
|
282
|
+
fc->map.data = git_str_detach(&target);
|
|
283
283
|
fc->flags |= GIT_DIFF_FLAG__FREE_DATA;
|
|
284
284
|
|
|
285
|
-
|
|
285
|
+
git_str_dispose(&target);
|
|
286
286
|
return error;
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
static int diff_file_content_load_workdir_symlink(
|
|
290
|
-
git_diff_file_content *fc,
|
|
290
|
+
git_diff_file_content *fc, git_str *path)
|
|
291
291
|
{
|
|
292
292
|
ssize_t alloc_len, read_len;
|
|
293
293
|
int symlink_supported, error;
|
|
@@ -309,7 +309,7 @@ static int diff_file_content_load_workdir_symlink(
|
|
|
309
309
|
|
|
310
310
|
fc->flags |= GIT_DIFF_FLAG__FREE_DATA;
|
|
311
311
|
|
|
312
|
-
read_len = p_readlink(
|
|
312
|
+
read_len = p_readlink(git_str_cstr(path), fc->map.data, alloc_len);
|
|
313
313
|
if (read_len < 0) {
|
|
314
314
|
git_error_set(GIT_ERROR_OS, "failed to read symlink '%s'", fc->file->path);
|
|
315
315
|
return -1;
|
|
@@ -321,23 +321,32 @@ static int diff_file_content_load_workdir_symlink(
|
|
|
321
321
|
|
|
322
322
|
static int diff_file_content_load_workdir_file(
|
|
323
323
|
git_diff_file_content *fc,
|
|
324
|
-
|
|
324
|
+
git_str *path,
|
|
325
325
|
git_diff_options *diff_opts)
|
|
326
326
|
{
|
|
327
327
|
int error = 0;
|
|
328
328
|
git_filter_list *fl = NULL;
|
|
329
|
-
git_file fd = git_futils_open_ro(
|
|
330
|
-
|
|
329
|
+
git_file fd = git_futils_open_ro(git_str_cstr(path));
|
|
330
|
+
git_str raw = GIT_STR_INIT;
|
|
331
|
+
git_object_size_t new_file_size = 0;
|
|
331
332
|
|
|
332
333
|
if (fd < 0)
|
|
333
334
|
return fd;
|
|
334
335
|
|
|
335
|
-
|
|
336
|
-
error = git_futils_filesize(&fc->file->size, fd);
|
|
336
|
+
error = git_futils_filesize(&new_file_size, fd);
|
|
337
337
|
|
|
338
|
-
if (error < 0
|
|
338
|
+
if (error < 0)
|
|
339
339
|
goto cleanup;
|
|
340
340
|
|
|
341
|
+
if (!(fc->file->flags & GIT_DIFF_FLAG_VALID_SIZE)) {
|
|
342
|
+
fc->file->size = new_file_size;
|
|
343
|
+
fc->file->flags |= GIT_DIFF_FLAG_VALID_SIZE;
|
|
344
|
+
} else if (fc->file->size != new_file_size) {
|
|
345
|
+
git_error_set(GIT_ERROR_FILESYSTEM, "file changed before we could read it");
|
|
346
|
+
error = -1;
|
|
347
|
+
goto cleanup;
|
|
348
|
+
}
|
|
349
|
+
|
|
341
350
|
if ((diff_opts->flags & GIT_DIFF_SHOW_BINARY) == 0 &&
|
|
342
351
|
diff_file_content_binary_by_size(fc))
|
|
343
352
|
goto cleanup;
|
|
@@ -360,7 +369,7 @@ static int diff_file_content_load_workdir_file(
|
|
|
360
369
|
}
|
|
361
370
|
|
|
362
371
|
if (!(error = git_futils_readbuffer_fd(&raw, fd, (size_t)fc->file->size))) {
|
|
363
|
-
|
|
372
|
+
git_str out = GIT_STR_INIT;
|
|
364
373
|
|
|
365
374
|
error = git_filter_list__convert_buf(&out, fl, &raw);
|
|
366
375
|
|
|
@@ -383,7 +392,7 @@ static int diff_file_content_load_workdir(
|
|
|
383
392
|
git_diff_options *diff_opts)
|
|
384
393
|
{
|
|
385
394
|
int error = 0;
|
|
386
|
-
|
|
395
|
+
git_str path = GIT_STR_INIT;
|
|
387
396
|
|
|
388
397
|
if (fc->file->mode == GIT_FILEMODE_COMMIT)
|
|
389
398
|
return diff_file_content_commit_to_str(fc, true);
|
|
@@ -406,7 +415,7 @@ static int diff_file_content_load_workdir(
|
|
|
406
415
|
fc->file->flags |= GIT_DIFF_FLAG_VALID_ID;
|
|
407
416
|
}
|
|
408
417
|
|
|
409
|
-
|
|
418
|
+
git_str_dispose(&path);
|
|
410
419
|
return error;
|
|
411
420
|
}
|
|
412
421
|
|
|
@@ -117,6 +117,26 @@ static bool diff_pathspec_match(
|
|
|
117
117
|
matched_pathspec, NULL);
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
static void diff_delta__flag_known_size(git_diff_file *file)
|
|
121
|
+
{
|
|
122
|
+
/*
|
|
123
|
+
* If we don't know the ID, that can only come from the workdir
|
|
124
|
+
* iterator, which means we *do* know the file size. This is a
|
|
125
|
+
* leaky abstraction, but alas. Otherwise, we test against the
|
|
126
|
+
* empty blob id.
|
|
127
|
+
*/
|
|
128
|
+
if (file->size ||
|
|
129
|
+
!(file->flags & GIT_DIFF_FLAG_VALID_ID) ||
|
|
130
|
+
git_oid_equal(&file->id, &git_oid__empty_blob_sha1))
|
|
131
|
+
file->flags |= GIT_DIFF_FLAG_VALID_SIZE;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
static void diff_delta__flag_known_sizes(git_diff_delta *delta)
|
|
135
|
+
{
|
|
136
|
+
diff_delta__flag_known_size(&delta->old_file);
|
|
137
|
+
diff_delta__flag_known_size(&delta->new_file);
|
|
138
|
+
}
|
|
139
|
+
|
|
120
140
|
static int diff_delta__from_one(
|
|
121
141
|
git_diff_generated *diff,
|
|
122
142
|
git_delta_t status,
|
|
@@ -182,6 +202,8 @@ static int diff_delta__from_one(
|
|
|
182
202
|
if (has_old || !git_oid_is_zero(&delta->new_file.id))
|
|
183
203
|
delta->new_file.flags |= GIT_DIFF_FLAG_VALID_ID;
|
|
184
204
|
|
|
205
|
+
diff_delta__flag_known_sizes(delta);
|
|
206
|
+
|
|
185
207
|
return diff_insert_delta(diff, delta, matched_pathspec);
|
|
186
208
|
}
|
|
187
209
|
|
|
@@ -244,6 +266,8 @@ static int diff_delta__from_two(
|
|
|
244
266
|
delta->new_file.flags |= GIT_DIFF_FLAG_VALID_ID;
|
|
245
267
|
}
|
|
246
268
|
|
|
269
|
+
diff_delta__flag_known_sizes(delta);
|
|
270
|
+
|
|
247
271
|
return diff_insert_delta(diff, delta, matched_pathspec);
|
|
248
272
|
}
|
|
249
273
|
|
|
@@ -586,7 +610,7 @@ int git_diff__oid_for_entry(
|
|
|
586
610
|
const git_oid *update_match)
|
|
587
611
|
{
|
|
588
612
|
git_diff_generated *diff;
|
|
589
|
-
|
|
613
|
+
git_str full_path = GIT_STR_INIT;
|
|
590
614
|
git_index_entry entry = *src;
|
|
591
615
|
git_filter_list *fl = NULL;
|
|
592
616
|
int error = 0;
|
|
@@ -605,8 +629,8 @@ int git_diff__oid_for_entry(
|
|
|
605
629
|
diff->base.perf.stat_calls++;
|
|
606
630
|
|
|
607
631
|
if (p_stat(full_path.ptr, &st) < 0) {
|
|
608
|
-
error =
|
|
609
|
-
|
|
632
|
+
error = git_fs_path_set_error(errno, entry.path, "stat");
|
|
633
|
+
git_str_dispose(&full_path);
|
|
610
634
|
return error;
|
|
611
635
|
}
|
|
612
636
|
|
|
@@ -669,7 +693,7 @@ int git_diff__oid_for_entry(
|
|
|
669
693
|
}
|
|
670
694
|
}
|
|
671
695
|
|
|
672
|
-
|
|
696
|
+
git_str_dispose(&full_path);
|
|
673
697
|
return error;
|
|
674
698
|
}
|
|
675
699
|
|
|
@@ -1023,10 +1047,10 @@ static int handle_unmatched_new_item(
|
|
|
1023
1047
|
|
|
1024
1048
|
/* do not advance into directories that contain a .git file */
|
|
1025
1049
|
if (recurse_into_dir && !contains_oitem) {
|
|
1026
|
-
|
|
1050
|
+
git_str *full = NULL;
|
|
1027
1051
|
if (git_iterator_current_workdir_path(&full, info->new_iter) < 0)
|
|
1028
1052
|
return -1;
|
|
1029
|
-
if (full &&
|
|
1053
|
+
if (full && git_fs_path_contains(full, DOT_GIT)) {
|
|
1030
1054
|
/* TODO: warning if not a valid git repository */
|
|
1031
1055
|
recurse_into_dir = false;
|
|
1032
1056
|
}
|
|
@@ -18,7 +18,7 @@ enum {
|
|
|
18
18
|
GIT_DIFFCAPS_IGNORE_STAT = (1 << 1), /* use stat? */
|
|
19
19
|
GIT_DIFFCAPS_TRUST_MODE_BITS = (1 << 2), /* use st_mode? */
|
|
20
20
|
GIT_DIFFCAPS_TRUST_CTIME = (1 << 3), /* use st_ctime? */
|
|
21
|
-
GIT_DIFFCAPS_USE_DEV = (1 << 4)
|
|
21
|
+
GIT_DIFFCAPS_USE_DEV = (1 << 4) /* use st_dev? */
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
#define DIFF_FLAGS_KNOWN_BINARY (GIT_DIFF_FLAG_BINARY|GIT_DIFF_FLAG_NOT_BINARY)
|
|
@@ -36,7 +36,7 @@ enum {
|
|
|
36
36
|
GIT_DIFF_FLAG__TO_SPLIT = (1 << 17), /* split entry during rename det. */
|
|
37
37
|
GIT_DIFF_FLAG__IS_RENAME_TARGET = (1 << 18),
|
|
38
38
|
GIT_DIFF_FLAG__IS_RENAME_SOURCE = (1 << 19),
|
|
39
|
-
GIT_DIFF_FLAG__HAS_SELF_SIMILARITY = (1 << 20)
|
|
39
|
+
GIT_DIFF_FLAG__HAS_SELF_SIMILARITY = (1 << 20)
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
#define GIT_DIFF_FLAG__CLEAR_INTERNAL(F) (F) = ((F) & 0x00FFFF)
|
|
@@ -119,8 +119,10 @@ GIT_INLINE(int) git_diff_file__resolve_zero_size(
|
|
|
119
119
|
|
|
120
120
|
git_odb_free(odb);
|
|
121
121
|
|
|
122
|
-
if (!error)
|
|
122
|
+
if (!error) {
|
|
123
123
|
file->size = (git_object_size_t)len;
|
|
124
|
+
file->flags |= GIT_DIFF_FLAG_VALID_SIZE;
|
|
125
|
+
}
|
|
124
126
|
|
|
125
127
|
return error;
|
|
126
128
|
}
|