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/rebase.c
CHANGED
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
#include "common.h"
|
|
9
9
|
|
|
10
|
-
#include "
|
|
10
|
+
#include "str.h"
|
|
11
11
|
#include "repository.h"
|
|
12
12
|
#include "posix.h"
|
|
13
13
|
#include "filebuf.h"
|
|
14
|
+
#include "commit.h"
|
|
14
15
|
#include "merge.h"
|
|
15
16
|
#include "array.h"
|
|
16
17
|
#include "config.h"
|
|
@@ -52,7 +53,7 @@ typedef enum {
|
|
|
52
53
|
GIT_REBASE_NONE = 0,
|
|
53
54
|
GIT_REBASE_APPLY = 1,
|
|
54
55
|
GIT_REBASE_MERGE = 2,
|
|
55
|
-
GIT_REBASE_INTERACTIVE = 3
|
|
56
|
+
GIT_REBASE_INTERACTIVE = 3
|
|
56
57
|
} git_rebase_t;
|
|
57
58
|
|
|
58
59
|
struct git_rebase {
|
|
@@ -63,10 +64,10 @@ struct git_rebase {
|
|
|
63
64
|
git_rebase_t type;
|
|
64
65
|
char *state_path;
|
|
65
66
|
|
|
66
|
-
int head_detached
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
unsigned int head_detached:1,
|
|
68
|
+
inmemory:1,
|
|
69
|
+
quiet:1,
|
|
70
|
+
started:1;
|
|
70
71
|
|
|
71
72
|
git_array_t(git_rebase_operation) operations;
|
|
72
73
|
size_t current;
|
|
@@ -90,22 +91,22 @@ static int rebase_state_type(
|
|
|
90
91
|
char **path_out,
|
|
91
92
|
git_repository *repo)
|
|
92
93
|
{
|
|
93
|
-
|
|
94
|
+
git_str path = GIT_STR_INIT;
|
|
94
95
|
git_rebase_t type = GIT_REBASE_NONE;
|
|
95
96
|
|
|
96
|
-
if (
|
|
97
|
+
if (git_str_joinpath(&path, repo->gitdir, REBASE_APPLY_DIR) < 0)
|
|
97
98
|
return -1;
|
|
98
99
|
|
|
99
|
-
if (
|
|
100
|
+
if (git_fs_path_isdir(git_str_cstr(&path))) {
|
|
100
101
|
type = GIT_REBASE_APPLY;
|
|
101
102
|
goto done;
|
|
102
103
|
}
|
|
103
104
|
|
|
104
|
-
|
|
105
|
-
if (
|
|
105
|
+
git_str_clear(&path);
|
|
106
|
+
if (git_str_joinpath(&path, repo->gitdir, REBASE_MERGE_DIR) < 0)
|
|
106
107
|
return -1;
|
|
107
108
|
|
|
108
|
-
if (
|
|
109
|
+
if (git_fs_path_isdir(git_str_cstr(&path))) {
|
|
109
110
|
type = GIT_REBASE_MERGE;
|
|
110
111
|
goto done;
|
|
111
112
|
}
|
|
@@ -114,36 +115,36 @@ done:
|
|
|
114
115
|
*type_out = type;
|
|
115
116
|
|
|
116
117
|
if (type != GIT_REBASE_NONE && path_out)
|
|
117
|
-
*path_out =
|
|
118
|
+
*path_out = git_str_detach(&path);
|
|
118
119
|
|
|
119
|
-
|
|
120
|
+
git_str_dispose(&path);
|
|
120
121
|
|
|
121
122
|
return 0;
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
GIT_INLINE(int) rebase_readfile(
|
|
125
|
-
|
|
126
|
-
|
|
126
|
+
git_str *out,
|
|
127
|
+
git_str *state_path,
|
|
127
128
|
const char *filename)
|
|
128
129
|
{
|
|
129
130
|
size_t state_path_len = state_path->size;
|
|
130
131
|
int error;
|
|
131
132
|
|
|
132
|
-
|
|
133
|
+
git_str_clear(out);
|
|
133
134
|
|
|
134
|
-
if ((error =
|
|
135
|
+
if ((error = git_str_joinpath(state_path, state_path->ptr, filename)) < 0 ||
|
|
135
136
|
(error = git_futils_readbuffer(out, state_path->ptr)) < 0)
|
|
136
137
|
goto done;
|
|
137
138
|
|
|
138
|
-
|
|
139
|
+
git_str_rtrim(out);
|
|
139
140
|
|
|
140
141
|
done:
|
|
141
|
-
|
|
142
|
+
git_str_truncate(state_path, state_path_len);
|
|
142
143
|
return error;
|
|
143
144
|
}
|
|
144
145
|
|
|
145
146
|
GIT_INLINE(int) rebase_readint(
|
|
146
|
-
size_t *out,
|
|
147
|
+
size_t *out, git_str *asc_out, git_str *state_path, const char *filename)
|
|
147
148
|
{
|
|
148
149
|
int32_t num;
|
|
149
150
|
const char *eol;
|
|
@@ -163,7 +164,7 @@ GIT_INLINE(int) rebase_readint(
|
|
|
163
164
|
}
|
|
164
165
|
|
|
165
166
|
GIT_INLINE(int) rebase_readoid(
|
|
166
|
-
git_oid *out,
|
|
167
|
+
git_oid *out, git_str *str_out, git_str *state_path, const char *filename)
|
|
167
168
|
{
|
|
168
169
|
int error;
|
|
169
170
|
|
|
@@ -201,13 +202,13 @@ static git_rebase_operation *rebase_operation_alloc(
|
|
|
201
202
|
|
|
202
203
|
static int rebase_open_merge(git_rebase *rebase)
|
|
203
204
|
{
|
|
204
|
-
|
|
205
|
+
git_str state_path = GIT_STR_INIT, buf = GIT_STR_INIT, cmt = GIT_STR_INIT;
|
|
205
206
|
git_oid id;
|
|
206
207
|
git_rebase_operation *operation;
|
|
207
208
|
size_t i, msgnum = 0, end;
|
|
208
209
|
int error;
|
|
209
210
|
|
|
210
|
-
if ((error =
|
|
211
|
+
if ((error = git_str_puts(&state_path, rebase->state_path)) < 0)
|
|
211
212
|
goto done;
|
|
212
213
|
|
|
213
214
|
/* Read 'msgnum' if it exists (otherwise, let msgnum = 0) */
|
|
@@ -234,9 +235,9 @@ static int rebase_open_merge(git_rebase *rebase)
|
|
|
234
235
|
GIT_ERROR_CHECK_ARRAY(rebase->operations);
|
|
235
236
|
|
|
236
237
|
for (i = 0; i < end; i++) {
|
|
237
|
-
|
|
238
|
+
git_str_clear(&cmt);
|
|
238
239
|
|
|
239
|
-
if ((error =
|
|
240
|
+
if ((error = git_str_printf(&cmt, "cmt.%" PRIuZ, (i+1))) < 0 ||
|
|
240
241
|
(error = rebase_readoid(&id, &buf, &state_path, cmt.ptr)) < 0)
|
|
241
242
|
goto done;
|
|
242
243
|
|
|
@@ -248,12 +249,12 @@ static int rebase_open_merge(git_rebase *rebase)
|
|
|
248
249
|
if ((error = rebase_readfile(&buf, &state_path, ONTO_NAME_FILE)) < 0)
|
|
249
250
|
goto done;
|
|
250
251
|
|
|
251
|
-
rebase->onto_name =
|
|
252
|
+
rebase->onto_name = git_str_detach(&buf);
|
|
252
253
|
|
|
253
254
|
done:
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
255
|
+
git_str_dispose(&cmt);
|
|
256
|
+
git_str_dispose(&state_path);
|
|
257
|
+
git_str_dispose(&buf);
|
|
257
258
|
|
|
258
259
|
return error;
|
|
259
260
|
}
|
|
@@ -296,8 +297,8 @@ int git_rebase_open(
|
|
|
296
297
|
const git_rebase_options *given_opts)
|
|
297
298
|
{
|
|
298
299
|
git_rebase *rebase;
|
|
299
|
-
|
|
300
|
-
orig_head_id =
|
|
300
|
+
git_str path = GIT_STR_INIT, orig_head_name = GIT_STR_INIT,
|
|
301
|
+
orig_head_id = GIT_STR_INIT, onto_id = GIT_STR_INIT;
|
|
301
302
|
size_t state_path_len;
|
|
302
303
|
int error;
|
|
303
304
|
|
|
@@ -320,54 +321,54 @@ int git_rebase_open(
|
|
|
320
321
|
goto done;
|
|
321
322
|
}
|
|
322
323
|
|
|
323
|
-
if ((error =
|
|
324
|
+
if ((error = git_str_puts(&path, rebase->state_path)) < 0)
|
|
324
325
|
goto done;
|
|
325
326
|
|
|
326
|
-
state_path_len =
|
|
327
|
+
state_path_len = git_str_len(&path);
|
|
327
328
|
|
|
328
|
-
if ((error =
|
|
329
|
+
if ((error = git_str_joinpath(&path, path.ptr, HEAD_NAME_FILE)) < 0 ||
|
|
329
330
|
(error = git_futils_readbuffer(&orig_head_name, path.ptr)) < 0)
|
|
330
331
|
goto done;
|
|
331
332
|
|
|
332
|
-
|
|
333
|
+
git_str_rtrim(&orig_head_name);
|
|
333
334
|
|
|
334
335
|
if (strcmp(ORIG_DETACHED_HEAD, orig_head_name.ptr) == 0)
|
|
335
336
|
rebase->head_detached = 1;
|
|
336
337
|
|
|
337
|
-
|
|
338
|
+
git_str_truncate(&path, state_path_len);
|
|
338
339
|
|
|
339
|
-
if ((error =
|
|
340
|
+
if ((error = git_str_joinpath(&path, path.ptr, ORIG_HEAD_FILE)) < 0)
|
|
340
341
|
goto done;
|
|
341
342
|
|
|
342
|
-
if (!
|
|
343
|
+
if (!git_fs_path_isfile(path.ptr)) {
|
|
343
344
|
/* Previous versions of git.git used 'head' here; support that. */
|
|
344
|
-
|
|
345
|
+
git_str_truncate(&path, state_path_len);
|
|
345
346
|
|
|
346
|
-
if ((error =
|
|
347
|
+
if ((error = git_str_joinpath(&path, path.ptr, HEAD_FILE)) < 0)
|
|
347
348
|
goto done;
|
|
348
349
|
}
|
|
349
350
|
|
|
350
351
|
if ((error = git_futils_readbuffer(&orig_head_id, path.ptr)) < 0)
|
|
351
352
|
goto done;
|
|
352
353
|
|
|
353
|
-
|
|
354
|
+
git_str_rtrim(&orig_head_id);
|
|
354
355
|
|
|
355
356
|
if ((error = git_oid_fromstr(&rebase->orig_head_id, orig_head_id.ptr)) < 0)
|
|
356
357
|
goto done;
|
|
357
358
|
|
|
358
|
-
|
|
359
|
+
git_str_truncate(&path, state_path_len);
|
|
359
360
|
|
|
360
|
-
if ((error =
|
|
361
|
+
if ((error = git_str_joinpath(&path, path.ptr, ONTO_FILE)) < 0 ||
|
|
361
362
|
(error = git_futils_readbuffer(&onto_id, path.ptr)) < 0)
|
|
362
363
|
goto done;
|
|
363
364
|
|
|
364
|
-
|
|
365
|
+
git_str_rtrim(&onto_id);
|
|
365
366
|
|
|
366
367
|
if ((error = git_oid_fromstr(&rebase->onto_id, onto_id.ptr)) < 0)
|
|
367
368
|
goto done;
|
|
368
369
|
|
|
369
370
|
if (!rebase->head_detached)
|
|
370
|
-
rebase->orig_head_name =
|
|
371
|
+
rebase->orig_head_name = git_str_detach(&orig_head_name);
|
|
371
372
|
|
|
372
373
|
switch (rebase->type) {
|
|
373
374
|
case GIT_REBASE_INTERACTIVE:
|
|
@@ -391,10 +392,10 @@ done:
|
|
|
391
392
|
else
|
|
392
393
|
git_rebase_free(rebase);
|
|
393
394
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
395
|
+
git_str_dispose(&path);
|
|
396
|
+
git_str_dispose(&orig_head_name);
|
|
397
|
+
git_str_dispose(&orig_head_id);
|
|
398
|
+
git_str_dispose(&onto_id);
|
|
398
399
|
return error;
|
|
399
400
|
}
|
|
400
401
|
|
|
@@ -403,27 +404,27 @@ static int rebase_cleanup(git_rebase *rebase)
|
|
|
403
404
|
if (!rebase || rebase->inmemory)
|
|
404
405
|
return 0;
|
|
405
406
|
|
|
406
|
-
return
|
|
407
|
+
return git_fs_path_isdir(rebase->state_path) ?
|
|
407
408
|
git_futils_rmdir_r(rebase->state_path, NULL, GIT_RMDIR_REMOVE_FILES) :
|
|
408
409
|
0;
|
|
409
410
|
}
|
|
410
411
|
|
|
411
412
|
static int rebase_setupfile(git_rebase *rebase, const char *filename, int flags, const char *fmt, ...)
|
|
412
413
|
{
|
|
413
|
-
|
|
414
|
-
contents =
|
|
414
|
+
git_str path = GIT_STR_INIT,
|
|
415
|
+
contents = GIT_STR_INIT;
|
|
415
416
|
va_list ap;
|
|
416
417
|
int error;
|
|
417
418
|
|
|
418
419
|
va_start(ap, fmt);
|
|
419
|
-
|
|
420
|
+
git_str_vprintf(&contents, fmt, ap);
|
|
420
421
|
va_end(ap);
|
|
421
422
|
|
|
422
|
-
if ((error =
|
|
423
|
+
if ((error = git_str_joinpath(&path, rebase->state_path, filename)) == 0)
|
|
423
424
|
error = git_futils_writebuffer(&contents, path.ptr, flags, REBASE_FILE_MODE);
|
|
424
425
|
|
|
425
|
-
|
|
426
|
-
|
|
426
|
+
git_str_dispose(&path);
|
|
427
|
+
git_str_dispose(&contents);
|
|
427
428
|
|
|
428
429
|
return error;
|
|
429
430
|
}
|
|
@@ -440,7 +441,7 @@ static const char *rebase_onto_name(const git_annotated_commit *onto)
|
|
|
440
441
|
|
|
441
442
|
static int rebase_setupfiles_merge(git_rebase *rebase)
|
|
442
443
|
{
|
|
443
|
-
|
|
444
|
+
git_str commit_filename = GIT_STR_INIT;
|
|
444
445
|
char id_str[GIT_OID_HEXSZ];
|
|
445
446
|
git_rebase_operation *operation;
|
|
446
447
|
size_t i;
|
|
@@ -453,8 +454,8 @@ static int rebase_setupfiles_merge(git_rebase *rebase)
|
|
|
453
454
|
for (i = 0; i < git_array_size(rebase->operations); i++) {
|
|
454
455
|
operation = git_array_get(rebase->operations, i);
|
|
455
456
|
|
|
456
|
-
|
|
457
|
-
|
|
457
|
+
git_str_clear(&commit_filename);
|
|
458
|
+
git_str_printf(&commit_filename, CMT_FILE_FMT, i+1);
|
|
458
459
|
|
|
459
460
|
git_oid_fmt(id_str, &operation->id);
|
|
460
461
|
|
|
@@ -464,7 +465,7 @@ static int rebase_setupfiles_merge(git_rebase *rebase)
|
|
|
464
465
|
}
|
|
465
466
|
|
|
466
467
|
done:
|
|
467
|
-
|
|
468
|
+
git_str_dispose(&commit_filename);
|
|
468
469
|
return error;
|
|
469
470
|
}
|
|
470
471
|
|
|
@@ -626,16 +627,16 @@ static int rebase_init_merge(
|
|
|
626
627
|
{
|
|
627
628
|
git_reference *head_ref = NULL;
|
|
628
629
|
git_commit *onto_commit = NULL;
|
|
629
|
-
|
|
630
|
-
|
|
630
|
+
git_str reflog = GIT_STR_INIT;
|
|
631
|
+
git_str state_path = GIT_STR_INIT;
|
|
631
632
|
int error;
|
|
632
633
|
|
|
633
634
|
GIT_UNUSED(upstream);
|
|
634
635
|
|
|
635
|
-
if ((error =
|
|
636
|
+
if ((error = git_str_joinpath(&state_path, repo->gitdir, REBASE_MERGE_DIR)) < 0)
|
|
636
637
|
goto done;
|
|
637
638
|
|
|
638
|
-
rebase->state_path =
|
|
639
|
+
rebase->state_path = git_str_detach(&state_path);
|
|
639
640
|
GIT_ERROR_CHECK_ALLOC(rebase->state_path);
|
|
640
641
|
|
|
641
642
|
if (branch->ref_name && strcmp(branch->ref_name, "HEAD")) {
|
|
@@ -654,7 +655,7 @@ static int rebase_init_merge(
|
|
|
654
655
|
git_oid_cpy(&rebase->onto_id, git_annotated_commit_id(onto));
|
|
655
656
|
|
|
656
657
|
if ((error = rebase_setupfiles(rebase)) < 0 ||
|
|
657
|
-
(error =
|
|
658
|
+
(error = git_str_printf(&reflog,
|
|
658
659
|
"rebase: checkout %s", rebase_onto_name(onto))) < 0 ||
|
|
659
660
|
(error = git_commit_lookup(
|
|
660
661
|
&onto_commit, repo, git_annotated_commit_id(onto))) < 0 ||
|
|
@@ -667,8 +668,8 @@ static int rebase_init_merge(
|
|
|
667
668
|
done:
|
|
668
669
|
git_reference_free(head_ref);
|
|
669
670
|
git_commit_free(onto_commit);
|
|
670
|
-
|
|
671
|
-
|
|
671
|
+
git_str_dispose(&reflog);
|
|
672
|
+
git_str_dispose(&state_path);
|
|
672
673
|
|
|
673
674
|
return error;
|
|
674
675
|
}
|
|
@@ -795,7 +796,7 @@ static int rebase_next_merge(
|
|
|
795
796
|
git_rebase_operation **out,
|
|
796
797
|
git_rebase *rebase)
|
|
797
798
|
{
|
|
798
|
-
|
|
799
|
+
git_str path = GIT_STR_INIT;
|
|
799
800
|
git_commit *current_commit = NULL, *parent_commit = NULL;
|
|
800
801
|
git_tree *current_tree = NULL, *head_tree = NULL, *parent_tree = NULL;
|
|
801
802
|
git_index *index = NULL;
|
|
@@ -848,7 +849,7 @@ done:
|
|
|
848
849
|
git_tree_free(parent_tree);
|
|
849
850
|
git_commit_free(parent_commit);
|
|
850
851
|
git_commit_free(current_commit);
|
|
851
|
-
|
|
852
|
+
git_str_dispose(&path);
|
|
852
853
|
|
|
853
854
|
return error;
|
|
854
855
|
}
|
|
@@ -955,14 +956,14 @@ static int create_signed(
|
|
|
955
956
|
size_t parent_count,
|
|
956
957
|
const git_commit **parents)
|
|
957
958
|
{
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
signature_field =
|
|
959
|
+
git_str commit_content = GIT_STR_INIT;
|
|
960
|
+
git_buf commit_signature = { NULL, 0, 0 },
|
|
961
|
+
signature_field = { NULL, 0, 0 };
|
|
961
962
|
int error;
|
|
962
963
|
|
|
963
964
|
git_error_clear();
|
|
964
965
|
|
|
965
|
-
if ((error =
|
|
966
|
+
if ((error = git_commit__create_buffer(&commit_content,
|
|
966
967
|
rebase->repo, author, committer, message_encoding,
|
|
967
968
|
message, tree, parent_count, parents)) < 0)
|
|
968
969
|
goto done;
|
|
@@ -986,7 +987,7 @@ static int create_signed(
|
|
|
986
987
|
done:
|
|
987
988
|
git_buf_dispose(&commit_signature);
|
|
988
989
|
git_buf_dispose(&signature_field);
|
|
989
|
-
|
|
990
|
+
git_str_dispose(&commit_content);
|
|
990
991
|
return error;
|
|
991
992
|
}
|
|
992
993
|
#endif
|
|
@@ -1216,13 +1217,13 @@ done:
|
|
|
1216
1217
|
return error;
|
|
1217
1218
|
}
|
|
1218
1219
|
|
|
1219
|
-
static int notes_ref_lookup(
|
|
1220
|
+
static int notes_ref_lookup(git_str *out, git_rebase *rebase)
|
|
1220
1221
|
{
|
|
1221
1222
|
git_config *config = NULL;
|
|
1222
1223
|
int do_rewrite, error;
|
|
1223
1224
|
|
|
1224
1225
|
if (rebase->options.rewrite_notes_ref) {
|
|
1225
|
-
|
|
1226
|
+
git_str_attach_notowned(out,
|
|
1226
1227
|
rebase->options.rewrite_notes_ref,
|
|
1227
1228
|
strlen(rebase->options.rewrite_notes_ref));
|
|
1228
1229
|
return 0;
|
|
@@ -1239,7 +1240,7 @@ static int notes_ref_lookup(git_buf *out, git_rebase *rebase)
|
|
|
1239
1240
|
}
|
|
1240
1241
|
|
|
1241
1242
|
error = do_rewrite ?
|
|
1242
|
-
|
|
1243
|
+
git_config__get_string_buf(out, config, "notes.rewriteref") :
|
|
1243
1244
|
GIT_ENOTFOUND;
|
|
1244
1245
|
|
|
1245
1246
|
done:
|
|
@@ -1294,7 +1295,7 @@ static int rebase_copy_notes(
|
|
|
1294
1295
|
git_rebase *rebase,
|
|
1295
1296
|
const git_signature *committer)
|
|
1296
1297
|
{
|
|
1297
|
-
|
|
1298
|
+
git_str path = GIT_STR_INIT, rewritten = GIT_STR_INIT, notes_ref = GIT_STR_INIT;
|
|
1298
1299
|
char *pair_list, *fromstr, *tostr, *end;
|
|
1299
1300
|
git_oid from, to;
|
|
1300
1301
|
unsigned int linenum = 1;
|
|
@@ -1309,7 +1310,7 @@ static int rebase_copy_notes(
|
|
|
1309
1310
|
goto done;
|
|
1310
1311
|
}
|
|
1311
1312
|
|
|
1312
|
-
if ((error =
|
|
1313
|
+
if ((error = git_str_joinpath(&path, rebase->state_path, REWRITTEN_FILE)) < 0 ||
|
|
1313
1314
|
(error = git_futils_readbuffer(&rewritten, path.ptr)) < 0)
|
|
1314
1315
|
goto done;
|
|
1315
1316
|
|
|
@@ -1349,9 +1350,9 @@ on_error:
|
|
|
1349
1350
|
error = -1;
|
|
1350
1351
|
|
|
1351
1352
|
done:
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1353
|
+
git_str_dispose(&rewritten);
|
|
1354
|
+
git_str_dispose(&path);
|
|
1355
|
+
git_str_dispose(¬es_ref);
|
|
1355
1356
|
|
|
1356
1357
|
return error;
|
|
1357
1358
|
}
|
|
@@ -1360,16 +1361,16 @@ static int return_to_orig_head(git_rebase *rebase)
|
|
|
1360
1361
|
{
|
|
1361
1362
|
git_reference *terminal_ref = NULL, *branch_ref = NULL, *head_ref = NULL;
|
|
1362
1363
|
git_commit *terminal_commit = NULL;
|
|
1363
|
-
|
|
1364
|
+
git_str branch_msg = GIT_STR_INIT, head_msg = GIT_STR_INIT;
|
|
1364
1365
|
char onto[GIT_OID_HEXSZ];
|
|
1365
1366
|
int error = 0;
|
|
1366
1367
|
|
|
1367
1368
|
git_oid_fmt(onto, &rebase->onto_id);
|
|
1368
1369
|
|
|
1369
|
-
if ((error =
|
|
1370
|
+
if ((error = git_str_printf(&branch_msg,
|
|
1370
1371
|
"rebase finished: %s onto %.*s",
|
|
1371
1372
|
rebase->orig_head_name, GIT_OID_HEXSZ, onto)) == 0 &&
|
|
1372
|
-
(error =
|
|
1373
|
+
(error = git_str_printf(&head_msg,
|
|
1373
1374
|
"rebase finished: returning to %s",
|
|
1374
1375
|
rebase->orig_head_name)) == 0 &&
|
|
1375
1376
|
(error = git_repository_head(&terminal_ref, rebase->repo)) == 0 &&
|
|
@@ -1383,8 +1384,8 @@ static int return_to_orig_head(git_rebase *rebase)
|
|
|
1383
1384
|
rebase->repo, GIT_HEAD_FILE, rebase->orig_head_name, 1,
|
|
1384
1385
|
head_msg.ptr);
|
|
1385
1386
|
|
|
1386
|
-
|
|
1387
|
-
|
|
1387
|
+
git_str_dispose(&head_msg);
|
|
1388
|
+
git_str_dispose(&branch_msg);
|
|
1388
1389
|
git_commit_free(terminal_commit);
|
|
1389
1390
|
git_reference_free(head_ref);
|
|
1390
1391
|
git_reference_free(branch_ref);
|