rugged 1.3.2.3 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -7,6 +7,7 @@
|
|
7
7
|
|
8
8
|
#include "common.h"
|
9
9
|
|
10
|
+
#include "buf.h"
|
10
11
|
#include "diff.h"
|
11
12
|
#include "diff_file.h"
|
12
13
|
#include "patch_generate.h"
|
@@ -21,7 +22,7 @@ typedef struct {
|
|
21
22
|
git_diff_line_cb print_cb;
|
22
23
|
void *payload;
|
23
24
|
|
24
|
-
|
25
|
+
git_str *buf;
|
25
26
|
git_diff_line line;
|
26
27
|
|
27
28
|
const char *old_prefix;
|
@@ -34,7 +35,7 @@ typedef struct {
|
|
34
35
|
|
35
36
|
static int diff_print_info_init__common(
|
36
37
|
diff_print_info *pi,
|
37
|
-
|
38
|
+
git_str *out,
|
38
39
|
git_repository *repo,
|
39
40
|
git_diff_format_t format,
|
40
41
|
git_diff_line_cb cb,
|
@@ -65,7 +66,7 @@ static int diff_print_info_init__common(
|
|
65
66
|
|
66
67
|
static int diff_print_info_init_fromdiff(
|
67
68
|
diff_print_info *pi,
|
68
|
-
|
69
|
+
git_str *out,
|
69
70
|
git_diff *diff,
|
70
71
|
git_diff_format_t format,
|
71
72
|
git_diff_line_cb cb,
|
@@ -89,7 +90,7 @@ static int diff_print_info_init_fromdiff(
|
|
89
90
|
|
90
91
|
static int diff_print_info_init_frompatch(
|
91
92
|
diff_print_info *pi,
|
92
|
-
|
93
|
+
git_str *out,
|
93
94
|
git_patch *patch,
|
94
95
|
git_diff_format_t format,
|
95
96
|
git_diff_line_cb cb,
|
@@ -142,7 +143,7 @@ static int diff_print_one_name_only(
|
|
142
143
|
const git_diff_delta *delta, float progress, void *data)
|
143
144
|
{
|
144
145
|
diff_print_info *pi = data;
|
145
|
-
|
146
|
+
git_str *out = pi->buf;
|
146
147
|
|
147
148
|
GIT_UNUSED(progress);
|
148
149
|
|
@@ -150,15 +151,15 @@ static int diff_print_one_name_only(
|
|
150
151
|
delta->status == GIT_DELTA_UNMODIFIED)
|
151
152
|
return 0;
|
152
153
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
if (
|
154
|
+
git_str_clear(out);
|
155
|
+
git_str_puts(out, delta->new_file.path);
|
156
|
+
git_str_putc(out, '\n');
|
157
|
+
if (git_str_oom(out))
|
157
158
|
return -1;
|
158
159
|
|
159
160
|
pi->line.origin = GIT_DIFF_LINE_FILE_HDR;
|
160
|
-
pi->line.content =
|
161
|
-
pi->line.content_len =
|
161
|
+
pi->line.content = git_str_cstr(out);
|
162
|
+
pi->line.content_len = git_str_len(out);
|
162
163
|
|
163
164
|
return pi->print_cb(delta, NULL, &pi->line, pi->payload);
|
164
165
|
}
|
@@ -167,7 +168,7 @@ static int diff_print_one_name_status(
|
|
167
168
|
const git_diff_delta *delta, float progress, void *data)
|
168
169
|
{
|
169
170
|
diff_print_info *pi = data;
|
170
|
-
|
171
|
+
git_str *out = pi->buf;
|
171
172
|
char old_suffix, new_suffix, code = git_diff_status_char(delta->status);
|
172
173
|
int(*strcomp)(const char *, const char *) = pi->strcomp ?
|
173
174
|
pi->strcomp : git__strcmp;
|
@@ -180,26 +181,26 @@ static int diff_print_one_name_status(
|
|
180
181
|
old_suffix = diff_pick_suffix(delta->old_file.mode);
|
181
182
|
new_suffix = diff_pick_suffix(delta->new_file.mode);
|
182
183
|
|
183
|
-
|
184
|
+
git_str_clear(out);
|
184
185
|
|
185
186
|
if (delta->old_file.path != delta->new_file.path &&
|
186
187
|
strcomp(delta->old_file.path,delta->new_file.path) != 0)
|
187
|
-
|
188
|
+
git_str_printf(out, "%c\t%s%c %s%c\n", code,
|
188
189
|
delta->old_file.path, old_suffix, delta->new_file.path, new_suffix);
|
189
190
|
else if (delta->old_file.mode != delta->new_file.mode &&
|
190
191
|
delta->old_file.mode != 0 && delta->new_file.mode != 0)
|
191
|
-
|
192
|
+
git_str_printf(out, "%c\t%s%c %s%c\n", code,
|
192
193
|
delta->old_file.path, old_suffix, delta->new_file.path, new_suffix);
|
193
194
|
else if (old_suffix != ' ')
|
194
|
-
|
195
|
+
git_str_printf(out, "%c\t%s%c\n", code, delta->old_file.path, old_suffix);
|
195
196
|
else
|
196
|
-
|
197
|
-
if (
|
197
|
+
git_str_printf(out, "%c\t%s\n", code, delta->old_file.path);
|
198
|
+
if (git_str_oom(out))
|
198
199
|
return -1;
|
199
200
|
|
200
201
|
pi->line.origin = GIT_DIFF_LINE_FILE_HDR;
|
201
|
-
pi->line.content =
|
202
|
-
pi->line.content_len =
|
202
|
+
pi->line.content = git_str_cstr(out);
|
203
|
+
pi->line.content_len = git_str_len(out);
|
203
204
|
|
204
205
|
return pi->print_cb(delta, NULL, &pi->line, pi->payload);
|
205
206
|
}
|
@@ -208,7 +209,7 @@ static int diff_print_one_raw(
|
|
208
209
|
const git_diff_delta *delta, float progress, void *data)
|
209
210
|
{
|
210
211
|
diff_print_info *pi = data;
|
211
|
-
|
212
|
+
git_str *out = pi->buf;
|
212
213
|
int id_abbrev;
|
213
214
|
char code = git_diff_status_char(delta->status);
|
214
215
|
char start_oid[GIT_OID_HEXSZ+1], end_oid[GIT_OID_HEXSZ+1];
|
@@ -218,7 +219,7 @@ static int diff_print_one_raw(
|
|
218
219
|
if ((pi->flags & GIT_DIFF_SHOW_UNMODIFIED) == 0 && code == ' ')
|
219
220
|
return 0;
|
220
221
|
|
221
|
-
|
222
|
+
git_str_clear(out);
|
222
223
|
|
223
224
|
id_abbrev = delta->old_file.mode ? delta->old_file.id_abbrev :
|
224
225
|
delta->new_file.id_abbrev;
|
@@ -233,43 +234,43 @@ static int diff_print_one_raw(
|
|
233
234
|
git_oid_tostr(start_oid, pi->id_strlen + 1, &delta->old_file.id);
|
234
235
|
git_oid_tostr(end_oid, pi->id_strlen + 1, &delta->new_file.id);
|
235
236
|
|
236
|
-
|
237
|
+
git_str_printf(
|
237
238
|
out, (pi->id_strlen <= GIT_OID_HEXSZ) ?
|
238
239
|
":%06o %06o %s... %s... %c" : ":%06o %06o %s %s %c",
|
239
240
|
delta->old_file.mode, delta->new_file.mode, start_oid, end_oid, code);
|
240
241
|
|
241
242
|
if (delta->similarity > 0)
|
242
|
-
|
243
|
+
git_str_printf(out, "%03u", delta->similarity);
|
243
244
|
|
244
245
|
if (delta->old_file.path != delta->new_file.path)
|
245
|
-
|
246
|
+
git_str_printf(
|
246
247
|
out, "\t%s %s\n", delta->old_file.path, delta->new_file.path);
|
247
248
|
else
|
248
|
-
|
249
|
+
git_str_printf(
|
249
250
|
out, "\t%s\n", delta->old_file.path ?
|
250
251
|
delta->old_file.path : delta->new_file.path);
|
251
252
|
|
252
|
-
if (
|
253
|
+
if (git_str_oom(out))
|
253
254
|
return -1;
|
254
255
|
|
255
256
|
pi->line.origin = GIT_DIFF_LINE_FILE_HDR;
|
256
|
-
pi->line.content =
|
257
|
-
pi->line.content_len =
|
257
|
+
pi->line.content = git_str_cstr(out);
|
258
|
+
pi->line.content_len = git_str_len(out);
|
258
259
|
|
259
260
|
return pi->print_cb(delta, NULL, &pi->line, pi->payload);
|
260
261
|
}
|
261
262
|
|
262
263
|
static int diff_print_modes(
|
263
|
-
|
264
|
+
git_str *out, const git_diff_delta *delta)
|
264
265
|
{
|
265
|
-
|
266
|
-
|
266
|
+
git_str_printf(out, "old mode %o\n", delta->old_file.mode);
|
267
|
+
git_str_printf(out, "new mode %o\n", delta->new_file.mode);
|
267
268
|
|
268
|
-
return
|
269
|
+
return git_str_oom(out) ? -1 : 0;
|
269
270
|
}
|
270
271
|
|
271
272
|
static int diff_print_oid_range(
|
272
|
-
|
273
|
+
git_str *out, const git_diff_delta *delta, int id_strlen,
|
273
274
|
bool print_index)
|
274
275
|
{
|
275
276
|
char start_oid[GIT_OID_HEXSZ+1], end_oid[GIT_OID_HEXSZ+1];
|
@@ -295,34 +296,34 @@ static int diff_print_oid_range(
|
|
295
296
|
|
296
297
|
if (delta->old_file.mode == delta->new_file.mode) {
|
297
298
|
if (print_index)
|
298
|
-
|
299
|
+
git_str_printf(out, "index %s..%s %o\n",
|
299
300
|
start_oid, end_oid, delta->old_file.mode);
|
300
301
|
} else {
|
301
302
|
if (delta->old_file.mode == 0)
|
302
|
-
|
303
|
+
git_str_printf(out, "new file mode %o\n", delta->new_file.mode);
|
303
304
|
else if (delta->new_file.mode == 0)
|
304
|
-
|
305
|
+
git_str_printf(out, "deleted file mode %o\n", delta->old_file.mode);
|
305
306
|
else
|
306
307
|
diff_print_modes(out, delta);
|
307
308
|
|
308
309
|
if (print_index)
|
309
|
-
|
310
|
+
git_str_printf(out, "index %s..%s\n", start_oid, end_oid);
|
310
311
|
}
|
311
312
|
|
312
|
-
return
|
313
|
+
return git_str_oom(out) ? -1 : 0;
|
313
314
|
}
|
314
315
|
|
315
316
|
static int diff_delta_format_path(
|
316
|
-
|
317
|
+
git_str *out, const char *prefix, const char *filename)
|
317
318
|
{
|
318
|
-
if (
|
319
|
+
if (git_str_joinpath(out, prefix, filename) < 0)
|
319
320
|
return -1;
|
320
321
|
|
321
|
-
return
|
322
|
+
return git_str_quote(out);
|
322
323
|
}
|
323
324
|
|
324
325
|
static int diff_delta_format_with_paths(
|
325
|
-
|
326
|
+
git_str *out,
|
326
327
|
const git_diff_delta *delta,
|
327
328
|
const char *template,
|
328
329
|
const char *oldpath,
|
@@ -334,14 +335,14 @@ static int diff_delta_format_with_paths(
|
|
334
335
|
if (git_oid_is_zero(&delta->new_file.id))
|
335
336
|
newpath = "/dev/null";
|
336
337
|
|
337
|
-
return
|
338
|
+
return git_str_printf(out, template, oldpath, newpath);
|
338
339
|
}
|
339
340
|
|
340
341
|
static int diff_delta_format_similarity_header(
|
341
|
-
|
342
|
+
git_str *out,
|
342
343
|
const git_diff_delta *delta)
|
343
344
|
{
|
344
|
-
|
345
|
+
git_str old_path = GIT_STR_INIT, new_path = GIT_STR_INIT;
|
345
346
|
const char *type;
|
346
347
|
int error = 0;
|
347
348
|
|
@@ -357,13 +358,13 @@ static int diff_delta_format_similarity_header(
|
|
357
358
|
else
|
358
359
|
type = "copy";
|
359
360
|
|
360
|
-
if ((error =
|
361
|
-
(error =
|
362
|
-
(error =
|
363
|
-
(error =
|
361
|
+
if ((error = git_str_puts(&old_path, delta->old_file.path)) < 0 ||
|
362
|
+
(error = git_str_puts(&new_path, delta->new_file.path)) < 0 ||
|
363
|
+
(error = git_str_quote(&old_path)) < 0 ||
|
364
|
+
(error = git_str_quote(&new_path)) < 0)
|
364
365
|
goto done;
|
365
366
|
|
366
|
-
|
367
|
+
git_str_printf(out,
|
367
368
|
"similarity index %d%%\n"
|
368
369
|
"%s from %s\n"
|
369
370
|
"%s to %s\n",
|
@@ -371,12 +372,12 @@ static int diff_delta_format_similarity_header(
|
|
371
372
|
type, old_path.ptr,
|
372
373
|
type, new_path.ptr);
|
373
374
|
|
374
|
-
if (
|
375
|
+
if (git_str_oom(out))
|
375
376
|
error = -1;
|
376
377
|
|
377
378
|
done:
|
378
|
-
|
379
|
-
|
379
|
+
git_str_dispose(&old_path);
|
380
|
+
git_str_dispose(&new_path);
|
380
381
|
|
381
382
|
return error;
|
382
383
|
}
|
@@ -398,14 +399,14 @@ static bool delta_is_unchanged(const git_diff_delta *delta)
|
|
398
399
|
}
|
399
400
|
|
400
401
|
int git_diff_delta__format_file_header(
|
401
|
-
|
402
|
+
git_str *out,
|
402
403
|
const git_diff_delta *delta,
|
403
404
|
const char *oldpfx,
|
404
405
|
const char *newpfx,
|
405
406
|
int id_strlen,
|
406
407
|
bool print_index)
|
407
408
|
{
|
408
|
-
|
409
|
+
git_str old_path = GIT_STR_INIT, new_path = GIT_STR_INIT;
|
409
410
|
bool unchanged = delta_is_unchanged(delta);
|
410
411
|
int error = 0;
|
411
412
|
|
@@ -422,9 +423,9 @@ int git_diff_delta__format_file_header(
|
|
422
423
|
&new_path, newpfx, delta->new_file.path)) < 0)
|
423
424
|
goto done;
|
424
425
|
|
425
|
-
|
426
|
+
git_str_clear(out);
|
426
427
|
|
427
|
-
|
428
|
+
git_str_printf(out, "diff --git %s %s\n",
|
428
429
|
old_path.ptr, new_path.ptr);
|
429
430
|
|
430
431
|
if (unchanged && delta->old_file.mode != delta->new_file.mode)
|
@@ -446,12 +447,12 @@ int git_diff_delta__format_file_header(
|
|
446
447
|
"--- %s\n+++ %s\n", old_path.ptr, new_path.ptr);
|
447
448
|
}
|
448
449
|
|
449
|
-
if (
|
450
|
+
if (git_str_oom(out))
|
450
451
|
error = -1;
|
451
452
|
|
452
453
|
done:
|
453
|
-
|
454
|
-
|
454
|
+
git_str_dispose(&old_path);
|
455
|
+
git_str_dispose(&new_path);
|
455
456
|
|
456
457
|
return error;
|
457
458
|
}
|
@@ -467,7 +468,7 @@ static int format_binary(
|
|
467
468
|
"delta" : "literal";
|
468
469
|
const char *scan, *end;
|
469
470
|
|
470
|
-
|
471
|
+
git_str_printf(pi->buf, "%s %" PRIuZ "\n", typename, inflatedlen);
|
471
472
|
pi->line.num_lines++;
|
472
473
|
|
473
474
|
for (scan = data, end = data + datalen; scan < end; ) {
|
@@ -476,22 +477,22 @@ static int format_binary(
|
|
476
477
|
chunk_len = 52;
|
477
478
|
|
478
479
|
if (chunk_len <= 26)
|
479
|
-
|
480
|
+
git_str_putc(pi->buf, (char)chunk_len + 'A' - 1);
|
480
481
|
else
|
481
|
-
|
482
|
+
git_str_putc(pi->buf, (char)chunk_len - 26 + 'a' - 1);
|
482
483
|
|
483
|
-
|
484
|
-
|
484
|
+
git_str_encode_base85(pi->buf, scan, chunk_len);
|
485
|
+
git_str_putc(pi->buf, '\n');
|
485
486
|
|
486
|
-
if (
|
487
|
+
if (git_str_oom(pi->buf))
|
487
488
|
return -1;
|
488
489
|
|
489
490
|
scan += chunk_len;
|
490
491
|
pi->line.num_lines++;
|
491
492
|
}
|
492
|
-
|
493
|
+
git_str_putc(pi->buf, '\n');
|
493
494
|
|
494
|
-
if (
|
495
|
+
if (git_str_oom(pi->buf))
|
495
496
|
return -1;
|
496
497
|
|
497
498
|
return 0;
|
@@ -501,7 +502,7 @@ static int diff_print_patch_file_binary_noshow(
|
|
501
502
|
diff_print_info *pi, git_diff_delta *delta,
|
502
503
|
const char *old_pfx, const char *new_pfx)
|
503
504
|
{
|
504
|
-
|
505
|
+
git_str old_path = GIT_STR_INIT, new_path = GIT_STR_INIT;
|
505
506
|
int error;
|
506
507
|
|
507
508
|
if ((error = diff_delta_format_path(&old_path, old_pfx, delta->old_file.path)) < 0 ||
|
@@ -513,8 +514,8 @@ static int diff_print_patch_file_binary_noshow(
|
|
513
514
|
pi->line.num_lines = 1;
|
514
515
|
|
515
516
|
done:
|
516
|
-
|
517
|
-
|
517
|
+
git_str_dispose(&old_path);
|
518
|
+
git_str_dispose(&new_path);
|
518
519
|
return error;
|
519
520
|
}
|
520
521
|
|
@@ -534,7 +535,7 @@ static int diff_print_patch_file_binary(
|
|
534
535
|
pi, delta, old_pfx, new_pfx);
|
535
536
|
|
536
537
|
pre_binary_size = pi->buf->size;
|
537
|
-
|
538
|
+
git_str_printf(pi->buf, "GIT binary patch\n");
|
538
539
|
pi->line.num_lines++;
|
539
540
|
|
540
541
|
if ((error = format_binary(pi, binary->new_file.type, binary->new_file.data,
|
@@ -543,7 +544,7 @@ static int diff_print_patch_file_binary(
|
|
543
544
|
binary->old_file.datalen, binary->old_file.inflatedlen)) < 0) {
|
544
545
|
if (error == GIT_EBUFS) {
|
545
546
|
git_error_clear();
|
546
|
-
|
547
|
+
git_str_truncate(pi->buf, pre_binary_size);
|
547
548
|
|
548
549
|
return diff_print_patch_file_binary_noshow(
|
549
550
|
pi, delta, old_pfx, new_pfx);
|
@@ -589,8 +590,8 @@ static int diff_print_patch_file(
|
|
589
590
|
return error;
|
590
591
|
|
591
592
|
pi->line.origin = GIT_DIFF_LINE_FILE_HDR;
|
592
|
-
pi->line.content =
|
593
|
-
pi->line.content_len =
|
593
|
+
pi->line.content = git_str_cstr(pi->buf);
|
594
|
+
pi->line.content_len = git_str_len(pi->buf);
|
594
595
|
|
595
596
|
return pi->print_cb(delta, NULL, &pi->line, pi->payload);
|
596
597
|
}
|
@@ -607,15 +608,15 @@ static int diff_print_patch_binary(
|
|
607
608
|
pi->new_prefix ? pi->new_prefix : DIFF_NEW_PREFIX_DEFAULT;
|
608
609
|
int error;
|
609
610
|
|
610
|
-
|
611
|
+
git_str_clear(pi->buf);
|
611
612
|
|
612
613
|
if ((error = diff_print_patch_file_binary(
|
613
614
|
pi, (git_diff_delta *)delta, old_pfx, new_pfx, binary)) < 0)
|
614
615
|
return error;
|
615
616
|
|
616
617
|
pi->line.origin = GIT_DIFF_LINE_BINARY;
|
617
|
-
pi->line.content =
|
618
|
-
pi->line.content_len =
|
618
|
+
pi->line.content = git_str_cstr(pi->buf);
|
619
|
+
pi->line.content_len = git_str_len(pi->buf);
|
619
620
|
|
620
621
|
return pi->print_cb(delta, NULL, &pi->line, pi->payload);
|
621
622
|
}
|
@@ -659,7 +660,7 @@ int git_diff_print(
|
|
659
660
|
void *payload)
|
660
661
|
{
|
661
662
|
int error;
|
662
|
-
|
663
|
+
git_str buf = GIT_STR_INIT;
|
663
664
|
diff_print_info pi;
|
664
665
|
git_diff_file_cb print_file = NULL;
|
665
666
|
git_diff_binary_cb print_binary = NULL;
|
@@ -704,7 +705,7 @@ int git_diff_print(
|
|
704
705
|
}
|
705
706
|
|
706
707
|
out:
|
707
|
-
|
708
|
+
git_str_dispose(&buf);
|
708
709
|
return error;
|
709
710
|
}
|
710
711
|
|
@@ -714,7 +715,7 @@ int git_diff_print_callback__to_buf(
|
|
714
715
|
const git_diff_line *line,
|
715
716
|
void *payload)
|
716
717
|
{
|
717
|
-
|
718
|
+
git_str *output = payload;
|
718
719
|
GIT_UNUSED(delta); GIT_UNUSED(hunk);
|
719
720
|
|
720
721
|
if (!output) {
|
@@ -725,9 +726,9 @@ int git_diff_print_callback__to_buf(
|
|
725
726
|
if (line->origin == GIT_DIFF_LINE_ADDITION ||
|
726
727
|
line->origin == GIT_DIFF_LINE_DELETION ||
|
727
728
|
line->origin == GIT_DIFF_LINE_CONTEXT)
|
728
|
-
|
729
|
+
git_str_putc(output, line->origin);
|
729
730
|
|
730
|
-
return
|
731
|
+
return git_str_put(output, line->content, line->content_len);
|
731
732
|
}
|
732
733
|
|
733
734
|
int git_diff_print_callback__to_file_handle(
|
@@ -761,18 +762,24 @@ int git_diff_print_callback__to_file_handle(
|
|
761
762
|
return 0;
|
762
763
|
}
|
763
764
|
|
764
|
-
/* print a git_diff to a
|
765
|
+
/* print a git_diff to a git_str */
|
765
766
|
int git_diff_to_buf(git_buf *out, git_diff *diff, git_diff_format_t format)
|
766
767
|
{
|
768
|
+
git_str str = GIT_STR_INIT;
|
767
769
|
int error;
|
768
770
|
|
769
771
|
GIT_ASSERT_ARG(out);
|
770
772
|
GIT_ASSERT_ARG(diff);
|
771
773
|
|
772
|
-
if ((error =
|
773
|
-
|
774
|
+
if ((error = git_buf_tostr(&str, out)) < 0 ||
|
775
|
+
(error = git_diff_print(diff, format, git_diff_print_callback__to_buf, &str)) < 0)
|
776
|
+
goto done;
|
777
|
+
|
778
|
+
error = git_buf_fromstr(out, &str);
|
774
779
|
|
775
|
-
|
780
|
+
done:
|
781
|
+
git_str_dispose(&str);
|
782
|
+
return error;
|
776
783
|
}
|
777
784
|
|
778
785
|
/* print a git_patch to an output callback */
|
@@ -781,7 +788,7 @@ int git_patch_print(
|
|
781
788
|
git_diff_line_cb print_cb,
|
782
789
|
void *payload)
|
783
790
|
{
|
784
|
-
|
791
|
+
git_str temp = GIT_STR_INIT;
|
785
792
|
diff_print_info pi;
|
786
793
|
int error;
|
787
794
|
|
@@ -799,20 +806,20 @@ int git_patch_print(
|
|
799
806
|
}
|
800
807
|
|
801
808
|
out:
|
802
|
-
|
809
|
+
git_str_dispose(&temp);
|
803
810
|
return error;
|
804
811
|
}
|
805
812
|
|
806
|
-
/* print a git_patch to a
|
813
|
+
/* print a git_patch to a git_str */
|
807
814
|
int git_patch_to_buf(git_buf *out, git_patch *patch)
|
808
815
|
{
|
809
|
-
|
816
|
+
GIT_BUF_WRAP_PRIVATE(out, git_patch__to_buf, patch);
|
817
|
+
}
|
810
818
|
|
819
|
+
int git_patch__to_buf(git_str *out, git_patch *patch)
|
820
|
+
{
|
811
821
|
GIT_ASSERT_ARG(out);
|
812
822
|
GIT_ASSERT_ARG(patch);
|
813
823
|
|
814
|
-
if ((error = git_buf_sanitize(out)) < 0)
|
815
|
-
return error;
|
816
|
-
|
817
824
|
return git_patch_print(patch, git_diff_print_callback__to_buf, out);
|
818
825
|
}
|