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
|
@@ -8,13 +8,15 @@
|
|
|
8
8
|
#include "mailmap.h"
|
|
9
9
|
|
|
10
10
|
#include "common.h"
|
|
11
|
-
#include "
|
|
11
|
+
#include "config.h"
|
|
12
|
+
#include "fs_path.h"
|
|
12
13
|
#include "repository.h"
|
|
13
14
|
#include "signature.h"
|
|
14
15
|
#include "git2/config.h"
|
|
15
16
|
#include "git2/revparse.h"
|
|
16
17
|
#include "blob.h"
|
|
17
18
|
#include "parse.h"
|
|
19
|
+
#include "path.h"
|
|
18
20
|
|
|
19
21
|
#define MM_FILE ".mailmap"
|
|
20
22
|
#define MM_FILE_CONFIG "mailmap.file"
|
|
@@ -90,21 +92,21 @@ static int advance_until(
|
|
|
90
92
|
/*
|
|
91
93
|
* Parse a single entry from a mailmap file.
|
|
92
94
|
*
|
|
93
|
-
* The output
|
|
95
|
+
* The output git_strs will be non-owning, and should be copied before being
|
|
94
96
|
* persisted.
|
|
95
97
|
*/
|
|
96
98
|
static int parse_mailmap_entry(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
+
git_str *real_name, git_str *real_email,
|
|
100
|
+
git_str *replace_name, git_str *replace_email,
|
|
99
101
|
git_parse_ctx *ctx)
|
|
100
102
|
{
|
|
101
103
|
const char *start;
|
|
102
104
|
size_t len;
|
|
103
105
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
git_str_clear(real_name);
|
|
107
|
+
git_str_clear(real_email);
|
|
108
|
+
git_str_clear(replace_name);
|
|
109
|
+
git_str_clear(replace_email);
|
|
108
110
|
|
|
109
111
|
git_parse_advance_ws(ctx);
|
|
110
112
|
if (is_eol(ctx))
|
|
@@ -114,8 +116,8 @@ static int parse_mailmap_entry(
|
|
|
114
116
|
if (advance_until(&start, &len, ctx, '<') < 0)
|
|
115
117
|
return -1;
|
|
116
118
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
+
git_str_attach_notowned(real_name, start, len);
|
|
120
|
+
git_str_rtrim(real_name);
|
|
119
121
|
|
|
120
122
|
/*
|
|
121
123
|
* If this is the last email in the line, this is the email to replace,
|
|
@@ -126,19 +128,19 @@ static int parse_mailmap_entry(
|
|
|
126
128
|
|
|
127
129
|
/* If we aren't at the end of the line, parse a second name and email */
|
|
128
130
|
if (!is_eol(ctx)) {
|
|
129
|
-
|
|
131
|
+
git_str_attach_notowned(real_email, start, len);
|
|
130
132
|
|
|
131
133
|
git_parse_advance_ws(ctx);
|
|
132
134
|
if (advance_until(&start, &len, ctx, '<') < 0)
|
|
133
135
|
return -1;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
+
git_str_attach_notowned(replace_name, start, len);
|
|
137
|
+
git_str_rtrim(replace_name);
|
|
136
138
|
|
|
137
139
|
if (advance_until(&start, &len, ctx, '>') < 0)
|
|
138
140
|
return -1;
|
|
139
141
|
}
|
|
140
142
|
|
|
141
|
-
|
|
143
|
+
git_str_attach_notowned(replace_email, start, len);
|
|
142
144
|
|
|
143
145
|
if (!is_eol(ctx))
|
|
144
146
|
return -1;
|
|
@@ -231,10 +233,10 @@ static int mailmap_add_buffer(git_mailmap *mm, const char *buf, size_t len)
|
|
|
231
233
|
git_parse_ctx ctx;
|
|
232
234
|
|
|
233
235
|
/* Scratch buffers containing the real parsed names & emails */
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
236
|
+
git_str real_name = GIT_STR_INIT;
|
|
237
|
+
git_str real_email = GIT_STR_INIT;
|
|
238
|
+
git_str replace_name = GIT_STR_INIT;
|
|
239
|
+
git_str replace_email = GIT_STR_INIT;
|
|
238
240
|
|
|
239
241
|
/* Buffers may not contain '\0's. */
|
|
240
242
|
if (memchr(buf, '\0', len) != NULL)
|
|
@@ -263,10 +265,10 @@ static int mailmap_add_buffer(git_mailmap *mm, const char *buf, size_t len)
|
|
|
263
265
|
}
|
|
264
266
|
|
|
265
267
|
cleanup:
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
268
|
+
git_str_dispose(&real_name);
|
|
269
|
+
git_str_dispose(&real_email);
|
|
270
|
+
git_str_dispose(&replace_name);
|
|
271
|
+
git_str_dispose(&replace_email);
|
|
270
272
|
return error;
|
|
271
273
|
}
|
|
272
274
|
|
|
@@ -289,7 +291,7 @@ static int mailmap_add_blob(
|
|
|
289
291
|
{
|
|
290
292
|
git_object *object = NULL;
|
|
291
293
|
git_blob *blob = NULL;
|
|
292
|
-
|
|
294
|
+
git_str content = GIT_STR_INIT;
|
|
293
295
|
int error;
|
|
294
296
|
|
|
295
297
|
GIT_ASSERT_ARG(mm);
|
|
@@ -312,7 +314,7 @@ static int mailmap_add_blob(
|
|
|
312
314
|
goto cleanup;
|
|
313
315
|
|
|
314
316
|
cleanup:
|
|
315
|
-
|
|
317
|
+
git_str_dispose(&content);
|
|
316
318
|
git_blob_free(blob);
|
|
317
319
|
git_object_free(object);
|
|
318
320
|
return error;
|
|
@@ -322,15 +324,15 @@ static int mailmap_add_file_ondisk(
|
|
|
322
324
|
git_mailmap *mm, const char *path, git_repository *repo)
|
|
323
325
|
{
|
|
324
326
|
const char *base = repo ? git_repository_workdir(repo) : NULL;
|
|
325
|
-
|
|
326
|
-
|
|
327
|
+
git_str fullpath = GIT_STR_INIT;
|
|
328
|
+
git_str content = GIT_STR_INIT;
|
|
327
329
|
int error;
|
|
328
330
|
|
|
329
|
-
error =
|
|
331
|
+
error = git_fs_path_join_unrooted(&fullpath, path, base, NULL);
|
|
330
332
|
if (error < 0)
|
|
331
333
|
goto cleanup;
|
|
332
334
|
|
|
333
|
-
error =
|
|
335
|
+
error = git_path_validate_str_length(repo, &fullpath);
|
|
334
336
|
if (error < 0)
|
|
335
337
|
goto cleanup;
|
|
336
338
|
|
|
@@ -343,8 +345,8 @@ static int mailmap_add_file_ondisk(
|
|
|
343
345
|
goto cleanup;
|
|
344
346
|
|
|
345
347
|
cleanup:
|
|
346
|
-
|
|
347
|
-
|
|
348
|
+
git_str_dispose(&fullpath);
|
|
349
|
+
git_str_dispose(&content);
|
|
348
350
|
return error;
|
|
349
351
|
}
|
|
350
352
|
|
|
@@ -352,8 +354,8 @@ cleanup:
|
|
|
352
354
|
static void mailmap_add_from_repository(git_mailmap *mm, git_repository *repo)
|
|
353
355
|
{
|
|
354
356
|
git_config *config = NULL;
|
|
355
|
-
|
|
356
|
-
|
|
357
|
+
git_str rev_buf = GIT_STR_INIT;
|
|
358
|
+
git_str path_buf = GIT_STR_INIT;
|
|
357
359
|
const char *rev = NULL;
|
|
358
360
|
const char *path = NULL;
|
|
359
361
|
|
|
@@ -363,9 +365,9 @@ static void mailmap_add_from_repository(git_mailmap *mm, git_repository *repo)
|
|
|
363
365
|
|
|
364
366
|
/* Try to load 'mailmap.file' and 'mailmap.blob' cfgs from the repo */
|
|
365
367
|
if (git_repository_config(&config, repo) == 0) {
|
|
366
|
-
if (
|
|
368
|
+
if (git_config__get_string_buf(&rev_buf, config, MM_BLOB_CONFIG) == 0)
|
|
367
369
|
rev = rev_buf.ptr;
|
|
368
|
-
if (
|
|
370
|
+
if (git_config__get_path(&path_buf, config, MM_FILE_CONFIG) == 0)
|
|
369
371
|
path = path_buf.ptr;
|
|
370
372
|
}
|
|
371
373
|
|
|
@@ -387,8 +389,8 @@ static void mailmap_add_from_repository(git_mailmap *mm, git_repository *repo)
|
|
|
387
389
|
if (path != NULL)
|
|
388
390
|
mailmap_add_file_ondisk(mm, path, repo);
|
|
389
391
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
+
git_str_dispose(&rev_buf);
|
|
393
|
+
git_str_dispose(&path_buf);
|
|
392
394
|
git_config_free(config);
|
|
393
395
|
}
|
|
394
396
|
|
data/vendor/libgit2/src/merge.c
CHANGED
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
#include "merge.h"
|
|
9
9
|
|
|
10
10
|
#include "posix.h"
|
|
11
|
-
#include "
|
|
11
|
+
#include "str.h"
|
|
12
12
|
#include "repository.h"
|
|
13
13
|
#include "revwalk.h"
|
|
14
14
|
#include "commit_list.h"
|
|
15
|
-
#include "
|
|
15
|
+
#include "fs_path.h"
|
|
16
16
|
#include "refs.h"
|
|
17
17
|
#include "object.h"
|
|
18
18
|
#include "iterator.h"
|
|
@@ -591,7 +591,7 @@ int git_repository_mergehead_foreach(
|
|
|
591
591
|
git_repository_mergehead_foreach_cb cb,
|
|
592
592
|
void *payload)
|
|
593
593
|
{
|
|
594
|
-
|
|
594
|
+
git_str merge_head_path = GIT_STR_INIT, merge_head_file = GIT_STR_INIT;
|
|
595
595
|
char *buffer, *line;
|
|
596
596
|
size_t line_num = 1;
|
|
597
597
|
git_oid oid;
|
|
@@ -600,12 +600,12 @@ int git_repository_mergehead_foreach(
|
|
|
600
600
|
GIT_ASSERT_ARG(repo);
|
|
601
601
|
GIT_ASSERT_ARG(cb);
|
|
602
602
|
|
|
603
|
-
if ((error =
|
|
603
|
+
if ((error = git_str_joinpath(&merge_head_path, repo->gitdir,
|
|
604
604
|
GIT_MERGE_HEAD_FILE)) < 0)
|
|
605
605
|
return error;
|
|
606
606
|
|
|
607
607
|
if ((error = git_futils_readbuffer(&merge_head_file,
|
|
608
|
-
|
|
608
|
+
git_str_cstr(&merge_head_path))) < 0)
|
|
609
609
|
goto cleanup;
|
|
610
610
|
|
|
611
611
|
buffer = merge_head_file.ptr;
|
|
@@ -635,8 +635,8 @@ int git_repository_mergehead_foreach(
|
|
|
635
635
|
}
|
|
636
636
|
|
|
637
637
|
cleanup:
|
|
638
|
-
|
|
639
|
-
|
|
638
|
+
git_str_dispose(&merge_head_path);
|
|
639
|
+
git_str_dispose(&merge_head_file);
|
|
640
640
|
|
|
641
641
|
return error;
|
|
642
642
|
}
|
|
@@ -893,7 +893,7 @@ static int merge_conflict_invoke_driver(
|
|
|
893
893
|
git_merge_driver_source *src)
|
|
894
894
|
{
|
|
895
895
|
git_index_entry *result;
|
|
896
|
-
git_buf buf =
|
|
896
|
+
git_buf buf = {0};
|
|
897
897
|
const char *path;
|
|
898
898
|
uint32_t mode;
|
|
899
899
|
git_odb *odb = NULL;
|
|
@@ -2116,11 +2116,11 @@ int git_merge__iterators(
|
|
|
2116
2116
|
file_opts.flags = opts.file_flags;
|
|
2117
2117
|
|
|
2118
2118
|
/* use the git-inspired labels when virtual base building */
|
|
2119
|
-
if (opts.flags &
|
|
2119
|
+
if (opts.flags & GIT_MERGE_VIRTUAL_BASE) {
|
|
2120
2120
|
file_opts.ancestor_label = "merged common ancestors";
|
|
2121
2121
|
file_opts.our_label = "Temporary merge branch 1";
|
|
2122
2122
|
file_opts.their_label = "Temporary merge branch 2";
|
|
2123
|
-
file_opts.flags |=
|
|
2123
|
+
file_opts.flags |= GIT_MERGE_FILE_ACCEPT_CONFLICTS;
|
|
2124
2124
|
file_opts.marker_size = GIT_MERGE_CONFLICT_MARKER_SIZE + 2;
|
|
2125
2125
|
}
|
|
2126
2126
|
|
|
@@ -2280,7 +2280,7 @@ static int create_virtual_base(
|
|
|
2280
2280
|
memcpy(&virtual_opts, opts, sizeof(git_merge_options));
|
|
2281
2281
|
|
|
2282
2282
|
virtual_opts.flags &= ~GIT_MERGE_FAIL_ON_CONFLICT;
|
|
2283
|
-
virtual_opts.flags |=
|
|
2283
|
+
virtual_opts.flags |= GIT_MERGE_VIRTUAL_BASE;
|
|
2284
2284
|
|
|
2285
2285
|
if ((merge_annotated_commits(&index, NULL, repo, one, two,
|
|
2286
2286
|
recursion_level + 1, &virtual_opts)) < 0)
|
|
@@ -2473,14 +2473,14 @@ static int write_merge_head(
|
|
|
2473
2473
|
size_t heads_len)
|
|
2474
2474
|
{
|
|
2475
2475
|
git_filebuf file = GIT_FILEBUF_INIT;
|
|
2476
|
-
|
|
2476
|
+
git_str file_path = GIT_STR_INIT;
|
|
2477
2477
|
size_t i;
|
|
2478
2478
|
int error = 0;
|
|
2479
2479
|
|
|
2480
2480
|
GIT_ASSERT_ARG(repo);
|
|
2481
2481
|
GIT_ASSERT_ARG(heads);
|
|
2482
2482
|
|
|
2483
|
-
if ((error =
|
|
2483
|
+
if ((error = git_str_joinpath(&file_path, repo->gitdir, GIT_MERGE_HEAD_FILE)) < 0 ||
|
|
2484
2484
|
(error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_CREATE_LEADING_DIRS, GIT_MERGE_FILE_MODE)) < 0)
|
|
2485
2485
|
goto cleanup;
|
|
2486
2486
|
|
|
@@ -2495,7 +2495,7 @@ cleanup:
|
|
|
2495
2495
|
if (error < 0)
|
|
2496
2496
|
git_filebuf_cleanup(&file);
|
|
2497
2497
|
|
|
2498
|
-
|
|
2498
|
+
git_str_dispose(&file_path);
|
|
2499
2499
|
|
|
2500
2500
|
return error;
|
|
2501
2501
|
}
|
|
@@ -2503,12 +2503,12 @@ cleanup:
|
|
|
2503
2503
|
static int write_merge_mode(git_repository *repo)
|
|
2504
2504
|
{
|
|
2505
2505
|
git_filebuf file = GIT_FILEBUF_INIT;
|
|
2506
|
-
|
|
2506
|
+
git_str file_path = GIT_STR_INIT;
|
|
2507
2507
|
int error = 0;
|
|
2508
2508
|
|
|
2509
2509
|
GIT_ASSERT_ARG(repo);
|
|
2510
2510
|
|
|
2511
|
-
if ((error =
|
|
2511
|
+
if ((error = git_str_joinpath(&file_path, repo->gitdir, GIT_MERGE_MODE_FILE)) < 0 ||
|
|
2512
2512
|
(error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_CREATE_LEADING_DIRS, GIT_MERGE_FILE_MODE)) < 0)
|
|
2513
2513
|
goto cleanup;
|
|
2514
2514
|
|
|
@@ -2521,7 +2521,7 @@ cleanup:
|
|
|
2521
2521
|
if (error < 0)
|
|
2522
2522
|
git_filebuf_cleanup(&file);
|
|
2523
2523
|
|
|
2524
|
-
|
|
2524
|
+
git_str_dispose(&file_path);
|
|
2525
2525
|
|
|
2526
2526
|
return error;
|
|
2527
2527
|
}
|
|
@@ -2719,7 +2719,7 @@ static int write_merge_msg(
|
|
|
2719
2719
|
size_t heads_len)
|
|
2720
2720
|
{
|
|
2721
2721
|
git_filebuf file = GIT_FILEBUF_INIT;
|
|
2722
|
-
|
|
2722
|
+
git_str file_path = GIT_STR_INIT;
|
|
2723
2723
|
struct merge_msg_entry *entries;
|
|
2724
2724
|
git_vector matching = GIT_VECTOR_INIT;
|
|
2725
2725
|
size_t i;
|
|
@@ -2740,7 +2740,7 @@ static int write_merge_msg(
|
|
|
2740
2740
|
for (i = 0; i < heads_len; i++)
|
|
2741
2741
|
entries[i].merge_head = heads[i];
|
|
2742
2742
|
|
|
2743
|
-
if ((error =
|
|
2743
|
+
if ((error = git_str_joinpath(&file_path, repo->gitdir, GIT_MERGE_MSG_FILE)) < 0 ||
|
|
2744
2744
|
(error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_CREATE_LEADING_DIRS, GIT_MERGE_FILE_MODE)) < 0 ||
|
|
2745
2745
|
(error = git_filebuf_write(&file, "Merge ", 6)) < 0)
|
|
2746
2746
|
goto cleanup;
|
|
@@ -2822,7 +2822,7 @@ cleanup:
|
|
|
2822
2822
|
if (error < 0)
|
|
2823
2823
|
git_filebuf_cleanup(&file);
|
|
2824
2824
|
|
|
2825
|
-
|
|
2825
|
+
git_str_dispose(&file_path);
|
|
2826
2826
|
|
|
2827
2827
|
git_vector_free(&matching);
|
|
2828
2828
|
git__free(entries);
|
|
@@ -3019,10 +3019,10 @@ static int merge_check_workdir(size_t *conflicts, git_repository *repo, git_inde
|
|
|
3019
3019
|
*conflicts = 0;
|
|
3020
3020
|
|
|
3021
3021
|
/* We need to have merged at least 1 file for the possibility to exist to
|
|
3022
|
-
* have conflicts with the workdir. Passing 0 as the pathspec count
|
|
3022
|
+
* have conflicts with the workdir. Passing 0 as the pathspec count parameter
|
|
3023
3023
|
* will consider all files in the working directory, that is, we may detect
|
|
3024
3024
|
* a conflict if there were untracked files in the workdir prior to starting
|
|
3025
|
-
* the merge. This typically happens when cherry-picking a
|
|
3025
|
+
* the merge. This typically happens when cherry-picking a commit whose
|
|
3026
3026
|
* changes have already been applied.
|
|
3027
3027
|
*/
|
|
3028
3028
|
if (merged_paths->length == 0)
|
|
@@ -3114,7 +3114,7 @@ int git_merge__append_conflicts_to_merge_msg(
|
|
|
3114
3114
|
git_index *index)
|
|
3115
3115
|
{
|
|
3116
3116
|
git_filebuf file = GIT_FILEBUF_INIT;
|
|
3117
|
-
|
|
3117
|
+
git_str file_path = GIT_STR_INIT;
|
|
3118
3118
|
const char *last = NULL;
|
|
3119
3119
|
size_t i;
|
|
3120
3120
|
int error;
|
|
@@ -3122,11 +3122,11 @@ int git_merge__append_conflicts_to_merge_msg(
|
|
|
3122
3122
|
if (!git_index_has_conflicts(index))
|
|
3123
3123
|
return 0;
|
|
3124
3124
|
|
|
3125
|
-
if ((error =
|
|
3125
|
+
if ((error = git_str_joinpath(&file_path, repo->gitdir, GIT_MERGE_MSG_FILE)) < 0 ||
|
|
3126
3126
|
(error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_APPEND, GIT_MERGE_FILE_MODE)) < 0)
|
|
3127
3127
|
goto cleanup;
|
|
3128
3128
|
|
|
3129
|
-
git_filebuf_printf(&file, "\
|
|
3129
|
+
git_filebuf_printf(&file, "\n#Conflicts:\n");
|
|
3130
3130
|
|
|
3131
3131
|
for (i = 0; i < git_index_entrycount(index); i++) {
|
|
3132
3132
|
const git_index_entry *e = git_index_get_byindex(index, i);
|
|
@@ -3135,7 +3135,7 @@ int git_merge__append_conflicts_to_merge_msg(
|
|
|
3135
3135
|
continue;
|
|
3136
3136
|
|
|
3137
3137
|
if (last == NULL || strcmp(e->path, last) != 0)
|
|
3138
|
-
git_filebuf_printf(&file, "
|
|
3138
|
+
git_filebuf_printf(&file, "#\t%s\n", e->path);
|
|
3139
3139
|
|
|
3140
3140
|
last = e->path;
|
|
3141
3141
|
}
|
|
@@ -3146,7 +3146,7 @@ cleanup:
|
|
|
3146
3146
|
if (error < 0)
|
|
3147
3147
|
git_filebuf_cleanup(&file);
|
|
3148
3148
|
|
|
3149
|
-
|
|
3149
|
+
git_str_dispose(&file_path);
|
|
3150
3150
|
|
|
3151
3151
|
return error;
|
|
3152
3152
|
}
|
data/vendor/libgit2/src/merge.h
CHANGED
|
@@ -25,19 +25,6 @@
|
|
|
25
25
|
#define GIT_MERGE_DEFAULT_RENAME_THRESHOLD 50
|
|
26
26
|
#define GIT_MERGE_DEFAULT_TARGET_LIMIT 1000
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
/** Internal merge flags. */
|
|
30
|
-
enum {
|
|
31
|
-
/** The merge is for a virtual base in a recursive merge. */
|
|
32
|
-
GIT_MERGE__VIRTUAL_BASE = (1 << 31),
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
enum {
|
|
36
|
-
/** Accept the conflict file, staging it as the merge result. */
|
|
37
|
-
GIT_MERGE_FILE_FAVOR__CONFLICTED = 4,
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
|
|
41
28
|
/** Types of changes when files are merged from branch to branch. */
|
|
42
29
|
typedef enum {
|
|
43
30
|
/* No conflict - a change only occurs in one branch. */
|
|
@@ -83,7 +70,7 @@ typedef enum {
|
|
|
83
70
|
GIT_MERGE_DIFF_DIRECTORY_FILE = (1 << 10),
|
|
84
71
|
|
|
85
72
|
/* The child of a folder that is in a directory/file conflict. */
|
|
86
|
-
GIT_MERGE_DIFF_DF_CHILD = (1 << 11)
|
|
73
|
+
GIT_MERGE_DIFF_DF_CHILD = (1 << 11)
|
|
87
74
|
} git_merge_diff_t;
|
|
88
75
|
|
|
89
76
|
typedef struct {
|
|
@@ -93,7 +93,7 @@ int git_merge_driver__builtin_apply(
|
|
|
93
93
|
goto done;
|
|
94
94
|
|
|
95
95
|
if (!result.automergeable &&
|
|
96
|
-
!(file_opts.flags &
|
|
96
|
+
!(file_opts.flags & GIT_MERGE_FILE_ACCEPT_CONFLICTS)) {
|
|
97
97
|
error = GIT_EMERGECONFLICT;
|
|
98
98
|
goto done;
|
|
99
99
|
}
|
|
@@ -110,7 +110,7 @@ int git_merge_driver__builtin_apply(
|
|
|
110
110
|
|
|
111
111
|
merged_out->ptr = (char *)result.ptr;
|
|
112
112
|
merged_out->size = result.len;
|
|
113
|
-
merged_out->
|
|
113
|
+
merged_out->reserved = 0;
|
|
114
114
|
result.ptr = NULL;
|
|
115
115
|
|
|
116
116
|
done:
|
|
@@ -86,22 +86,30 @@ static int merge_file__xdiff(
|
|
|
86
86
|
|
|
87
87
|
memset(&xmparam, 0x0, sizeof(xmparam_t));
|
|
88
88
|
|
|
89
|
+
if (ours->size > LONG_MAX ||
|
|
90
|
+
theirs->size > LONG_MAX ||
|
|
91
|
+
(ancestor && ancestor->size > LONG_MAX)) {
|
|
92
|
+
git_error_set(GIT_ERROR_MERGE, "failed to merge files");
|
|
93
|
+
error = -1;
|
|
94
|
+
goto done;
|
|
95
|
+
}
|
|
96
|
+
|
|
89
97
|
if (ancestor) {
|
|
90
98
|
xmparam.ancestor = (options.ancestor_label) ?
|
|
91
99
|
options.ancestor_label : ancestor->path;
|
|
92
100
|
ancestor_mmfile.ptr = (char *)ancestor->ptr;
|
|
93
|
-
ancestor_mmfile.size = ancestor->size;
|
|
101
|
+
ancestor_mmfile.size = (long)ancestor->size;
|
|
94
102
|
}
|
|
95
103
|
|
|
96
104
|
xmparam.file1 = (options.our_label) ?
|
|
97
105
|
options.our_label : ours->path;
|
|
98
106
|
our_mmfile.ptr = (char *)ours->ptr;
|
|
99
|
-
our_mmfile.size = ours->size;
|
|
107
|
+
our_mmfile.size = (long)ours->size;
|
|
100
108
|
|
|
101
109
|
xmparam.file2 = (options.their_label) ?
|
|
102
110
|
options.their_label : theirs->path;
|
|
103
111
|
their_mmfile.ptr = (char *)theirs->ptr;
|
|
104
|
-
their_mmfile.size = theirs->size;
|
|
112
|
+
their_mmfile.size = (long)theirs->size;
|
|
105
113
|
|
|
106
114
|
if (options.favor == GIT_MERGE_FILE_FAVOR_OURS)
|
|
107
115
|
xmparam.favor = XDL_MERGE_FAVOR_OURS;
|
|
@@ -115,6 +123,8 @@ static int merge_file__xdiff(
|
|
|
115
123
|
|
|
116
124
|
if (options.flags & GIT_MERGE_FILE_STYLE_DIFF3)
|
|
117
125
|
xmparam.style = XDL_MERGE_DIFF3;
|
|
126
|
+
if (options.flags & GIT_MERGE_FILE_STYLE_ZDIFF3)
|
|
127
|
+
xmparam.style = XDL_MERGE_ZEALOUS_DIFF3;
|
|
118
128
|
|
|
119
129
|
if (options.flags & GIT_MERGE_FILE_IGNORE_WHITESPACE)
|
|
120
130
|
xmparam.xpp.flags |= XDF_IGNORE_WHITESPACE;
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
#include "
|
|
8
|
+
#include "buf.h"
|
|
9
|
+
|
|
10
|
+
#include "git2/message.h"
|
|
9
11
|
|
|
10
12
|
static size_t line_length_without_trailing_spaces(const char *line, size_t len)
|
|
11
13
|
{
|
|
@@ -21,17 +23,17 @@ static size_t line_length_without_trailing_spaces(const char *line, size_t len)
|
|
|
21
23
|
|
|
22
24
|
/* Greatly inspired from git.git "stripspace" */
|
|
23
25
|
/* see https://github.com/git/git/blob/497215d8811ac7b8955693ceaad0899ecd894ed2/builtin/stripspace.c#L4-67 */
|
|
24
|
-
int
|
|
26
|
+
static int git_message__prettify(
|
|
27
|
+
git_str *message_out,
|
|
28
|
+
const char *message,
|
|
29
|
+
int strip_comments,
|
|
30
|
+
char comment_char)
|
|
25
31
|
{
|
|
26
32
|
const size_t message_len = strlen(message);
|
|
27
33
|
|
|
28
34
|
int consecutive_empty_lines = 0;
|
|
29
35
|
size_t i, line_length, rtrimmed_line_length;
|
|
30
36
|
char *next_newline;
|
|
31
|
-
int error;
|
|
32
|
-
|
|
33
|
-
if ((error = git_buf_sanitize(message_out)) < 0)
|
|
34
|
-
return error;
|
|
35
37
|
|
|
36
38
|
for (i = 0; i < strlen(message); i += line_length) {
|
|
37
39
|
next_newline = memchr(message + i, '\n', message_len - i);
|
|
@@ -53,12 +55,21 @@ int git_message_prettify(git_buf *message_out, const char *message, int strip_co
|
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
if (consecutive_empty_lines > 0 && message_out->size > 0)
|
|
56
|
-
|
|
58
|
+
git_str_putc(message_out, '\n');
|
|
57
59
|
|
|
58
60
|
consecutive_empty_lines = 0;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
git_str_put(message_out, message + i, rtrimmed_line_length);
|
|
62
|
+
git_str_putc(message_out, '\n');
|
|
61
63
|
}
|
|
62
64
|
|
|
63
|
-
return
|
|
65
|
+
return git_str_oom(message_out) ? -1 : 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
int git_message_prettify(
|
|
69
|
+
git_buf *message_out,
|
|
70
|
+
const char *message,
|
|
71
|
+
int strip_comments,
|
|
72
|
+
char comment_char)
|
|
73
|
+
{
|
|
74
|
+
GIT_BUF_WRAP_PRIVATE(message_out, git_message__prettify, message, strip_comments, comment_char);
|
|
64
75
|
}
|