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
data/vendor/libgit2/src/commit.c
CHANGED
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
#include "git2/mailmap.h"
|
|
15
15
|
#include "git2/sys/commit.h"
|
|
16
16
|
|
|
17
|
+
#include "buf.h"
|
|
17
18
|
#include "odb.h"
|
|
18
19
|
#include "commit.h"
|
|
19
20
|
#include "signature.h"
|
|
20
|
-
#include "message.h"
|
|
21
21
|
#include "refs.h"
|
|
22
22
|
#include "object.h"
|
|
23
23
|
#include "array.h"
|
|
@@ -42,7 +42,7 @@ void git_commit__free(void *_commit)
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
static int git_commit__create_buffer_internal(
|
|
45
|
-
|
|
45
|
+
git_str *out,
|
|
46
46
|
const git_signature *author,
|
|
47
47
|
const git_signature *committer,
|
|
48
48
|
const char *message_encoding,
|
|
@@ -67,17 +67,17 @@ static int git_commit__create_buffer_internal(
|
|
|
67
67
|
git_signature__writebuf(out, "committer ", committer);
|
|
68
68
|
|
|
69
69
|
if (message_encoding != NULL)
|
|
70
|
-
|
|
70
|
+
git_str_printf(out, "encoding %s\n", message_encoding);
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
git_str_putc(out, '\n');
|
|
73
73
|
|
|
74
|
-
if (
|
|
74
|
+
if (git_str_puts(out, message) < 0)
|
|
75
75
|
goto on_error;
|
|
76
76
|
|
|
77
77
|
return 0;
|
|
78
78
|
|
|
79
79
|
on_error:
|
|
80
|
-
|
|
80
|
+
git_str_dispose(out);
|
|
81
81
|
return -1;
|
|
82
82
|
}
|
|
83
83
|
|
|
@@ -136,7 +136,7 @@ static int git_commit__create_internal(
|
|
|
136
136
|
int error;
|
|
137
137
|
git_odb *odb;
|
|
138
138
|
git_reference *ref = NULL;
|
|
139
|
-
|
|
139
|
+
git_str buf = GIT_STR_INIT;
|
|
140
140
|
const git_oid *current_id = NULL;
|
|
141
141
|
git_array_oid_t parents = GIT_ARRAY_INIT;
|
|
142
142
|
|
|
@@ -179,7 +179,7 @@ static int git_commit__create_internal(
|
|
|
179
179
|
cleanup:
|
|
180
180
|
git_array_clear(parents);
|
|
181
181
|
git_reference_free(ref);
|
|
182
|
-
|
|
182
|
+
git_str_dispose(&buf);
|
|
183
183
|
return error;
|
|
184
184
|
}
|
|
185
185
|
|
|
@@ -395,6 +395,7 @@ static int commit_parse(git_commit *commit, const char *data, size_t size, unsig
|
|
|
395
395
|
git_oid parent_id;
|
|
396
396
|
size_t header_len;
|
|
397
397
|
git_signature dummy_sig;
|
|
398
|
+
int error;
|
|
398
399
|
|
|
399
400
|
GIT_ASSERT_ARG(commit);
|
|
400
401
|
GIT_ASSERT_ARG(data);
|
|
@@ -431,14 +432,14 @@ static int commit_parse(git_commit *commit, const char *data, size_t size, unsig
|
|
|
431
432
|
commit->author = git__malloc(sizeof(git_signature));
|
|
432
433
|
GIT_ERROR_CHECK_ALLOC(commit->author);
|
|
433
434
|
|
|
434
|
-
if (git_signature__parse(commit->author, &buffer, buffer_end, "author ", '\n') < 0)
|
|
435
|
-
return
|
|
435
|
+
if ((error = git_signature__parse(commit->author, &buffer, buffer_end, "author ", '\n')) < 0)
|
|
436
|
+
return error;
|
|
436
437
|
}
|
|
437
438
|
|
|
438
439
|
/* Some tools create multiple author fields, ignore the extra ones */
|
|
439
440
|
while (!git__prefixncmp(buffer, buffer_end - buffer, "author ")) {
|
|
440
|
-
if (git_signature__parse(&dummy_sig, &buffer, buffer_end, "author ", '\n') < 0)
|
|
441
|
-
return
|
|
441
|
+
if ((error = git_signature__parse(&dummy_sig, &buffer, buffer_end, "author ", '\n')) < 0)
|
|
442
|
+
return error;
|
|
442
443
|
|
|
443
444
|
git__free(dummy_sig.name);
|
|
444
445
|
git__free(dummy_sig.email);
|
|
@@ -448,8 +449,8 @@ static int commit_parse(git_commit *commit, const char *data, size_t size, unsig
|
|
|
448
449
|
commit->committer = git__malloc(sizeof(git_signature));
|
|
449
450
|
GIT_ERROR_CHECK_ALLOC(commit->committer);
|
|
450
451
|
|
|
451
|
-
if (git_signature__parse(commit->committer, &buffer, buffer_end, "committer ", '\n') < 0)
|
|
452
|
-
return
|
|
452
|
+
if ((error = git_signature__parse(commit->committer, &buffer, buffer_end, "committer ", '\n')) < 0)
|
|
453
|
+
return error;
|
|
453
454
|
|
|
454
455
|
if (flags & GIT_COMMIT_PARSE_QUICK)
|
|
455
456
|
return 0;
|
|
@@ -493,7 +494,7 @@ static int commit_parse(git_commit *commit, const char *data, size_t size, unsig
|
|
|
493
494
|
|
|
494
495
|
bad_buffer:
|
|
495
496
|
git_error_set(GIT_ERROR_OBJECT, "failed to parse bad commit object");
|
|
496
|
-
return
|
|
497
|
+
return GIT_EINVALID;
|
|
497
498
|
}
|
|
498
499
|
|
|
499
500
|
int git_commit__parse_raw(void *commit, const char *data, size_t size)
|
|
@@ -545,8 +546,8 @@ const char *git_commit_message(const git_commit *commit)
|
|
|
545
546
|
|
|
546
547
|
const char *git_commit_summary(git_commit *commit)
|
|
547
548
|
{
|
|
548
|
-
|
|
549
|
-
const char *msg, *space;
|
|
549
|
+
git_str summary = GIT_STR_INIT;
|
|
550
|
+
const char *msg, *space, *next;
|
|
550
551
|
bool space_contains_newline = false;
|
|
551
552
|
|
|
552
553
|
GIT_ASSERT_ARG_WITH_RETVAL(commit, NULL);
|
|
@@ -555,10 +556,21 @@ const char *git_commit_summary(git_commit *commit)
|
|
|
555
556
|
for (msg = git_commit_message(commit), space = NULL; *msg; ++msg) {
|
|
556
557
|
char next_character = msg[0];
|
|
557
558
|
/* stop processing at the end of the first paragraph */
|
|
558
|
-
if (next_character == '\n'
|
|
559
|
-
|
|
559
|
+
if (next_character == '\n') {
|
|
560
|
+
if (!msg[1])
|
|
561
|
+
break;
|
|
562
|
+
if (msg[1] == '\n')
|
|
563
|
+
break;
|
|
564
|
+
/* stop processing if next line contains only whitespace */
|
|
565
|
+
next = msg + 1;
|
|
566
|
+
while (*next && git__isspace_nonlf(*next)) {
|
|
567
|
+
++next;
|
|
568
|
+
}
|
|
569
|
+
if (!*next || *next == '\n')
|
|
570
|
+
break;
|
|
571
|
+
}
|
|
560
572
|
/* record the beginning of contiguous whitespace runs */
|
|
561
|
-
|
|
573
|
+
if (git__isspace(next_character)) {
|
|
562
574
|
if(space == NULL) {
|
|
563
575
|
space = msg;
|
|
564
576
|
space_contains_newline = false;
|
|
@@ -570,17 +582,17 @@ const char *git_commit_summary(git_commit *commit)
|
|
|
570
582
|
/* process any recorded whitespace */
|
|
571
583
|
if (space) {
|
|
572
584
|
if(space_contains_newline)
|
|
573
|
-
|
|
585
|
+
git_str_putc(&summary, ' '); /* if the space contains a newline, collapse to ' ' */
|
|
574
586
|
else
|
|
575
|
-
|
|
587
|
+
git_str_put(&summary, space, (msg - space)); /* otherwise copy it */
|
|
576
588
|
space = NULL;
|
|
577
589
|
}
|
|
578
590
|
/* copy the next character */
|
|
579
|
-
|
|
591
|
+
git_str_putc(&summary, next_character);
|
|
580
592
|
}
|
|
581
593
|
}
|
|
582
594
|
|
|
583
|
-
commit->summary =
|
|
595
|
+
commit->summary = git_str_detach(&summary);
|
|
584
596
|
if (!commit->summary)
|
|
585
597
|
commit->summary = git__strdup("");
|
|
586
598
|
}
|
|
@@ -678,11 +690,22 @@ int git_commit_nth_gen_ancestor(
|
|
|
678
690
|
return 0;
|
|
679
691
|
}
|
|
680
692
|
|
|
681
|
-
int git_commit_header_field(
|
|
693
|
+
int git_commit_header_field(
|
|
694
|
+
git_buf *out,
|
|
695
|
+
const git_commit *commit,
|
|
696
|
+
const char *field)
|
|
697
|
+
{
|
|
698
|
+
GIT_BUF_WRAP_PRIVATE(out, git_commit__header_field, commit, field);
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
int git_commit__header_field(
|
|
702
|
+
git_str *out,
|
|
703
|
+
const git_commit *commit,
|
|
704
|
+
const char *field)
|
|
682
705
|
{
|
|
683
706
|
const char *eol, *buf = commit->raw_header;
|
|
684
707
|
|
|
685
|
-
|
|
708
|
+
git_str_clear(out);
|
|
686
709
|
|
|
687
710
|
while ((eol = strchr(buf, '\n'))) {
|
|
688
711
|
/* We can skip continuations here */
|
|
@@ -706,22 +729,22 @@ int git_commit_header_field(git_buf *out, const git_commit *commit, const char *
|
|
|
706
729
|
|
|
707
730
|
buf++; /* skip the SP */
|
|
708
731
|
|
|
709
|
-
|
|
710
|
-
if (
|
|
732
|
+
git_str_put(out, buf, eol - buf);
|
|
733
|
+
if (git_str_oom(out))
|
|
711
734
|
goto oom;
|
|
712
735
|
|
|
713
736
|
/* If the next line starts with SP, it's multi-line, we must continue */
|
|
714
737
|
while (eol[1] == ' ') {
|
|
715
|
-
|
|
738
|
+
git_str_putc(out, '\n');
|
|
716
739
|
buf = eol + 2;
|
|
717
740
|
eol = strchr(buf, '\n');
|
|
718
741
|
if (!eol)
|
|
719
742
|
goto malformed;
|
|
720
743
|
|
|
721
|
-
|
|
744
|
+
git_str_put(out, buf, eol - buf);
|
|
722
745
|
}
|
|
723
746
|
|
|
724
|
-
if (
|
|
747
|
+
if (git_str_oom(out))
|
|
725
748
|
goto oom;
|
|
726
749
|
|
|
727
750
|
return 0;
|
|
@@ -738,7 +761,35 @@ oom:
|
|
|
738
761
|
return -1;
|
|
739
762
|
}
|
|
740
763
|
|
|
741
|
-
int git_commit_extract_signature(
|
|
764
|
+
int git_commit_extract_signature(
|
|
765
|
+
git_buf *signature_out,
|
|
766
|
+
git_buf *signed_data_out,
|
|
767
|
+
git_repository *repo,
|
|
768
|
+
git_oid *commit_id,
|
|
769
|
+
const char *field)
|
|
770
|
+
{
|
|
771
|
+
git_str signature = GIT_STR_INIT, signed_data = GIT_STR_INIT;
|
|
772
|
+
int error;
|
|
773
|
+
|
|
774
|
+
if ((error = git_buf_tostr(&signature, signature_out)) < 0 ||
|
|
775
|
+
(error = git_buf_tostr(&signed_data, signed_data_out)) < 0 ||
|
|
776
|
+
(error = git_commit__extract_signature(&signature, &signed_data, repo, commit_id, field)) < 0 ||
|
|
777
|
+
(error = git_buf_fromstr(signature_out, &signature)) < 0 ||
|
|
778
|
+
(error = git_buf_fromstr(signed_data_out, &signed_data)) < 0)
|
|
779
|
+
goto done;
|
|
780
|
+
|
|
781
|
+
done:
|
|
782
|
+
git_str_dispose(&signature);
|
|
783
|
+
git_str_dispose(&signed_data);
|
|
784
|
+
return error;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
int git_commit__extract_signature(
|
|
788
|
+
git_str *signature,
|
|
789
|
+
git_str *signed_data,
|
|
790
|
+
git_repository *repo,
|
|
791
|
+
git_oid *commit_id,
|
|
792
|
+
const char *field)
|
|
742
793
|
{
|
|
743
794
|
git_odb_object *obj;
|
|
744
795
|
git_odb *odb;
|
|
@@ -746,8 +797,8 @@ int git_commit_extract_signature(git_buf *signature, git_buf *signed_data, git_r
|
|
|
746
797
|
const char *h, *eol;
|
|
747
798
|
int error;
|
|
748
799
|
|
|
749
|
-
|
|
750
|
-
|
|
800
|
+
git_str_clear(signature);
|
|
801
|
+
git_str_clear(signed_data);
|
|
751
802
|
|
|
752
803
|
if (!field)
|
|
753
804
|
field = "gpgsig";
|
|
@@ -769,7 +820,7 @@ int git_commit_extract_signature(git_buf *signature, git_buf *signed_data, git_r
|
|
|
769
820
|
while ((h = strchr(buf, '\n')) && h[1] != '\0') {
|
|
770
821
|
h++;
|
|
771
822
|
if (git__prefixcmp(buf, field)) {
|
|
772
|
-
if (
|
|
823
|
+
if (git_str_put(signed_data, buf, h - buf) < 0)
|
|
773
824
|
return -1;
|
|
774
825
|
|
|
775
826
|
buf = h;
|
|
@@ -788,25 +839,25 @@ int git_commit_extract_signature(git_buf *signature, git_buf *signed_data, git_r
|
|
|
788
839
|
|
|
789
840
|
h++; /* skip the SP */
|
|
790
841
|
|
|
791
|
-
|
|
792
|
-
if (
|
|
842
|
+
git_str_put(signature, h, eol - h);
|
|
843
|
+
if (git_str_oom(signature))
|
|
793
844
|
goto oom;
|
|
794
845
|
|
|
795
846
|
/* If the next line starts with SP, it's multi-line, we must continue */
|
|
796
847
|
while (eol[1] == ' ') {
|
|
797
|
-
|
|
848
|
+
git_str_putc(signature, '\n');
|
|
798
849
|
h = eol + 2;
|
|
799
850
|
eol = strchr(h, '\n');
|
|
800
851
|
if (!eol)
|
|
801
852
|
goto malformed;
|
|
802
853
|
|
|
803
|
-
|
|
854
|
+
git_str_put(signature, h, eol - h);
|
|
804
855
|
}
|
|
805
856
|
|
|
806
|
-
if (
|
|
857
|
+
if (git_str_oom(signature))
|
|
807
858
|
goto oom;
|
|
808
859
|
|
|
809
|
-
error =
|
|
860
|
+
error = git_str_puts(signed_data, eol+1);
|
|
810
861
|
git_odb_object_free(obj);
|
|
811
862
|
return error;
|
|
812
863
|
}
|
|
@@ -826,12 +877,29 @@ oom:
|
|
|
826
877
|
|
|
827
878
|
cleanup:
|
|
828
879
|
git_odb_object_free(obj);
|
|
829
|
-
|
|
830
|
-
|
|
880
|
+
git_str_clear(signature);
|
|
881
|
+
git_str_clear(signed_data);
|
|
831
882
|
return error;
|
|
832
883
|
}
|
|
833
884
|
|
|
834
|
-
int git_commit_create_buffer(
|
|
885
|
+
int git_commit_create_buffer(
|
|
886
|
+
git_buf *out,
|
|
887
|
+
git_repository *repo,
|
|
888
|
+
const git_signature *author,
|
|
889
|
+
const git_signature *committer,
|
|
890
|
+
const char *message_encoding,
|
|
891
|
+
const char *message,
|
|
892
|
+
const git_tree *tree,
|
|
893
|
+
size_t parent_count,
|
|
894
|
+
const git_commit *parents[])
|
|
895
|
+
{
|
|
896
|
+
GIT_BUF_WRAP_PRIVATE(out, git_commit__create_buffer, repo,
|
|
897
|
+
author, committer, message_encoding, message,
|
|
898
|
+
tree, parent_count, parents);
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
int git_commit__create_buffer(
|
|
902
|
+
git_str *out,
|
|
835
903
|
git_repository *repo,
|
|
836
904
|
const git_signature *author,
|
|
837
905
|
const git_signature *committer,
|
|
@@ -866,7 +934,7 @@ int git_commit_create_buffer(git_buf *out,
|
|
|
866
934
|
/**
|
|
867
935
|
* Append to 'out' properly marking continuations when there's a newline in 'content'
|
|
868
936
|
*/
|
|
869
|
-
static int format_header_field(
|
|
937
|
+
static int format_header_field(git_str *out, const char *field, const char *content)
|
|
870
938
|
{
|
|
871
939
|
const char *lf;
|
|
872
940
|
|
|
@@ -874,19 +942,19 @@ static int format_header_field(git_buf *out, const char *field, const char *cont
|
|
|
874
942
|
GIT_ASSERT_ARG(field);
|
|
875
943
|
GIT_ASSERT_ARG(content);
|
|
876
944
|
|
|
877
|
-
|
|
878
|
-
|
|
945
|
+
git_str_puts(out, field);
|
|
946
|
+
git_str_putc(out, ' ');
|
|
879
947
|
|
|
880
948
|
while ((lf = strchr(content, '\n')) != NULL) {
|
|
881
|
-
|
|
882
|
-
|
|
949
|
+
git_str_put(out, content, lf - content);
|
|
950
|
+
git_str_puts(out, "\n ");
|
|
883
951
|
content = lf + 1;
|
|
884
952
|
}
|
|
885
953
|
|
|
886
|
-
|
|
887
|
-
|
|
954
|
+
git_str_puts(out, content);
|
|
955
|
+
git_str_putc(out, '\n');
|
|
888
956
|
|
|
889
|
-
return
|
|
957
|
+
return git_str_oom(out) ? -1 : 0;
|
|
890
958
|
}
|
|
891
959
|
|
|
892
960
|
static const git_oid *commit_parent_from_commit(size_t n, void *payload)
|
|
@@ -908,15 +976,17 @@ int git_commit_create_with_signature(
|
|
|
908
976
|
int error = 0;
|
|
909
977
|
const char *field;
|
|
910
978
|
const char *header_end;
|
|
911
|
-
|
|
979
|
+
git_str commit = GIT_STR_INIT;
|
|
912
980
|
git_commit *parsed;
|
|
913
981
|
git_array_oid_t parents = GIT_ARRAY_INIT;
|
|
914
982
|
|
|
915
983
|
/* The first step is to verify that all the tree and parents exist */
|
|
916
984
|
parsed = git__calloc(1, sizeof(git_commit));
|
|
917
985
|
GIT_ERROR_CHECK_ALLOC(parsed);
|
|
918
|
-
if (
|
|
986
|
+
if (commit_parse(parsed, commit_content, strlen(commit_content), 0) < 0) {
|
|
987
|
+
error = -1;
|
|
919
988
|
goto cleanup;
|
|
989
|
+
}
|
|
920
990
|
|
|
921
991
|
if ((error = validate_tree_and_parents(&parents, repo, &parsed->tree_id, commit_parent_from_commit, parsed, NULL, true)) < 0)
|
|
922
992
|
goto cleanup;
|
|
@@ -933,7 +1003,7 @@ int git_commit_create_with_signature(
|
|
|
933
1003
|
|
|
934
1004
|
/* The header ends after the first LF */
|
|
935
1005
|
header_end++;
|
|
936
|
-
|
|
1006
|
+
git_str_put(&commit, commit_content, header_end - commit_content);
|
|
937
1007
|
|
|
938
1008
|
if (signature != NULL) {
|
|
939
1009
|
field = signature_field ? signature_field : "gpgsig";
|
|
@@ -942,9 +1012,9 @@ int git_commit_create_with_signature(
|
|
|
942
1012
|
goto cleanup;
|
|
943
1013
|
}
|
|
944
1014
|
|
|
945
|
-
|
|
1015
|
+
git_str_puts(&commit, header_end);
|
|
946
1016
|
|
|
947
|
-
if (
|
|
1017
|
+
if (git_str_oom(&commit))
|
|
948
1018
|
return -1;
|
|
949
1019
|
|
|
950
1020
|
if ((error = git_repository_odb__weakptr(&odb, repo)) < 0)
|
|
@@ -955,7 +1025,7 @@ int git_commit_create_with_signature(
|
|
|
955
1025
|
|
|
956
1026
|
cleanup:
|
|
957
1027
|
git_commit__free(parsed);
|
|
958
|
-
|
|
1028
|
+
git_str_dispose(&commit);
|
|
959
1029
|
return error;
|
|
960
1030
|
}
|
|
961
1031
|
|
data/vendor/libgit2/src/commit.h
CHANGED
|
@@ -33,12 +33,35 @@ struct git_commit {
|
|
|
33
33
|
char *body;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
+
int git_commit__header_field(
|
|
37
|
+
git_str *out,
|
|
38
|
+
const git_commit *commit,
|
|
39
|
+
const char *field);
|
|
40
|
+
|
|
41
|
+
int git_commit__extract_signature(
|
|
42
|
+
git_str *signature,
|
|
43
|
+
git_str *signed_data,
|
|
44
|
+
git_repository *repo,
|
|
45
|
+
git_oid *commit_id,
|
|
46
|
+
const char *field);
|
|
47
|
+
|
|
48
|
+
int git_commit__create_buffer(
|
|
49
|
+
git_str *out,
|
|
50
|
+
git_repository *repo,
|
|
51
|
+
const git_signature *author,
|
|
52
|
+
const git_signature *committer,
|
|
53
|
+
const char *message_encoding,
|
|
54
|
+
const char *message,
|
|
55
|
+
const git_tree *tree,
|
|
56
|
+
size_t parent_count,
|
|
57
|
+
const git_commit *parents[]);
|
|
58
|
+
|
|
36
59
|
void git_commit__free(void *commit);
|
|
37
60
|
int git_commit__parse(void *commit, git_odb_object *obj);
|
|
38
61
|
int git_commit__parse_raw(void *commit, const char *data, size_t size);
|
|
39
62
|
|
|
40
63
|
typedef enum {
|
|
41
|
-
GIT_COMMIT_PARSE_QUICK = (1 << 0)
|
|
64
|
+
GIT_COMMIT_PARSE_QUICK = (1 << 0) /**< Only parse parents and committer info */
|
|
42
65
|
} git_commit__parse_flags;
|
|
43
66
|
|
|
44
67
|
int git_commit__parse_ext(git_commit *commit, git_odb_object *odb_obj, unsigned int flags);
|