rugged 0.27.10.1 → 0.28.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/rugged/extconf.rb +23 -2
- data/ext/rugged/rugged.c +48 -2
- data/ext/rugged/rugged.h +5 -0
- data/ext/rugged/rugged_allocator.c +89 -0
- data/ext/rugged/rugged_blob.c +3 -3
- data/ext/rugged/rugged_branch.c +1 -1
- data/ext/rugged/rugged_commit.c +8 -8
- data/ext/rugged/rugged_config.c +1 -1
- data/ext/rugged/rugged_diff.c +24 -4
- data/ext/rugged/rugged_note.c +1 -1
- data/ext/rugged/rugged_repo.c +10 -10
- data/ext/rugged/rugged_settings.c +1 -1
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +69 -47
- data/vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake +15 -1
- data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +5 -8
- data/vendor/libgit2/cmake/Modules/FindmbedTLS.cmake +93 -0
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +2 -0
- data/vendor/libgit2/deps/http-parser/{LICENSE-MIT → COPYING} +0 -0
- data/vendor/libgit2/deps/regex/COPYING +502 -0
- data/vendor/libgit2/deps/winhttp/COPYING.GPL +993 -0
- data/vendor/libgit2/deps/winhttp/COPYING.LGPL +502 -0
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +1 -0
- data/vendor/libgit2/deps/zlib/COPYING +27 -0
- data/vendor/libgit2/include/git2.h +3 -0
- data/vendor/libgit2/include/git2/annotated_commit.h +9 -0
- data/vendor/libgit2/include/git2/apply.h +129 -0
- data/vendor/libgit2/include/git2/attr.h +19 -8
- data/vendor/libgit2/include/git2/blame.h +41 -24
- data/vendor/libgit2/include/git2/blob.h +1 -1
- data/vendor/libgit2/include/git2/branch.h +1 -1
- data/vendor/libgit2/include/git2/buffer.h +2 -2
- data/vendor/libgit2/include/git2/checkout.h +20 -19
- data/vendor/libgit2/include/git2/cherrypick.h +6 -4
- data/vendor/libgit2/include/git2/clone.h +11 -9
- data/vendor/libgit2/include/git2/commit.h +30 -2
- data/vendor/libgit2/include/git2/common.h +54 -4
- data/vendor/libgit2/include/git2/config.h +18 -7
- data/vendor/libgit2/include/git2/deprecated.h +253 -0
- data/vendor/libgit2/include/git2/describe.h +30 -7
- data/vendor/libgit2/include/git2/diff.h +193 -143
- data/vendor/libgit2/include/git2/errors.h +54 -46
- data/vendor/libgit2/include/git2/ignore.h +2 -2
- data/vendor/libgit2/include/git2/index.h +72 -51
- data/vendor/libgit2/include/git2/indexer.h +30 -4
- data/vendor/libgit2/include/git2/mailmap.h +115 -0
- data/vendor/libgit2/include/git2/merge.h +29 -8
- data/vendor/libgit2/include/git2/net.h +1 -1
- data/vendor/libgit2/include/git2/notes.h +1 -1
- data/vendor/libgit2/include/git2/object.h +16 -16
- data/vendor/libgit2/include/git2/odb.h +10 -10
- data/vendor/libgit2/include/git2/odb_backend.h +7 -7
- data/vendor/libgit2/include/git2/oid.h +1 -1
- data/vendor/libgit2/include/git2/pack.h +2 -2
- data/vendor/libgit2/include/git2/proxy.h +9 -5
- data/vendor/libgit2/include/git2/rebase.h +7 -4
- data/vendor/libgit2/include/git2/refs.h +14 -15
- data/vendor/libgit2/include/git2/refspec.h +17 -0
- data/vendor/libgit2/include/git2/remote.h +92 -16
- data/vendor/libgit2/include/git2/repository.h +52 -37
- data/vendor/libgit2/include/git2/revert.h +5 -3
- data/vendor/libgit2/include/git2/revwalk.h +7 -7
- data/vendor/libgit2/include/git2/signature.h +2 -2
- data/vendor/libgit2/include/git2/stash.h +13 -10
- data/vendor/libgit2/include/git2/status.h +8 -4
- data/vendor/libgit2/include/git2/submodule.h +11 -10
- data/vendor/libgit2/include/git2/sys/alloc.h +101 -0
- data/vendor/libgit2/include/git2/sys/commit.h +1 -1
- data/vendor/libgit2/include/git2/sys/config.h +13 -13
- data/vendor/libgit2/include/git2/sys/filter.h +6 -6
- data/vendor/libgit2/include/git2/sys/index.h +3 -0
- data/vendor/libgit2/include/git2/sys/mempack.h +35 -35
- data/vendor/libgit2/include/git2/sys/merge.h +9 -4
- data/vendor/libgit2/include/git2/sys/odb_backend.h +19 -19
- data/vendor/libgit2/include/git2/sys/path.h +64 -0
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +19 -19
- data/vendor/libgit2/include/git2/sys/stream.h +92 -12
- data/vendor/libgit2/include/git2/sys/transport.h +127 -81
- data/vendor/libgit2/include/git2/tag.h +2 -2
- data/vendor/libgit2/include/git2/trace.h +1 -1
- data/vendor/libgit2/include/git2/transaction.h +1 -0
- data/vendor/libgit2/include/git2/transport.h +47 -18
- data/vendor/libgit2/include/git2/tree.h +3 -3
- data/vendor/libgit2/include/git2/types.h +35 -28
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2/worktree.h +47 -12
- data/vendor/libgit2/src/CMakeLists.txt +87 -26
- data/vendor/libgit2/src/alloc.c +55 -0
- data/vendor/libgit2/src/alloc.h +40 -0
- data/vendor/libgit2/src/annotated_commit.c +15 -8
- data/vendor/libgit2/src/apply.c +490 -14
- data/vendor/libgit2/src/apply.h +3 -1
- data/vendor/libgit2/src/array.h +2 -2
- data/vendor/libgit2/src/attr.c +11 -11
- data/vendor/libgit2/src/attr_file.c +20 -15
- data/vendor/libgit2/src/attrcache.c +11 -11
- data/vendor/libgit2/src/blame.c +30 -15
- data/vendor/libgit2/src/blame.h +1 -0
- data/vendor/libgit2/src/blame_git.c +16 -13
- data/vendor/libgit2/src/blob.c +50 -28
- data/vendor/libgit2/src/blob.h +18 -1
- data/vendor/libgit2/src/branch.c +38 -38
- data/vendor/libgit2/src/buf_text.c +7 -6
- data/vendor/libgit2/src/buffer.c +55 -50
- data/vendor/libgit2/src/buffer.h +1 -1
- data/vendor/libgit2/src/cache.c +16 -16
- data/vendor/libgit2/src/cache.h +2 -2
- data/vendor/libgit2/src/cc-compat.h +15 -3
- data/vendor/libgit2/src/checkout.c +83 -74
- data/vendor/libgit2/src/cherrypick.c +6 -6
- data/vendor/libgit2/src/clone.c +20 -20
- data/vendor/libgit2/src/commit.c +53 -33
- data/vendor/libgit2/src/commit.h +1 -0
- data/vendor/libgit2/src/commit_list.c +6 -10
- data/vendor/libgit2/src/common.h +32 -30
- data/vendor/libgit2/src/config.c +167 -147
- data/vendor/libgit2/src/config.h +1 -14
- data/vendor/libgit2/src/config_backend.h +84 -0
- data/vendor/libgit2/src/config_cache.c +7 -1
- data/vendor/libgit2/src/config_entries.c +259 -0
- data/vendor/libgit2/src/config_entries.h +23 -0
- data/vendor/libgit2/src/config_file.c +167 -439
- data/vendor/libgit2/src/config_mem.c +224 -0
- data/vendor/libgit2/src/config_parse.c +69 -38
- data/vendor/libgit2/src/config_parse.h +4 -4
- data/vendor/libgit2/src/crlf.c +215 -186
- data/vendor/libgit2/src/delta.c +25 -18
- data/vendor/libgit2/src/describe.c +23 -23
- data/vendor/libgit2/src/diff.c +12 -12
- data/vendor/libgit2/src/diff_driver.c +14 -15
- data/vendor/libgit2/src/diff_file.c +10 -10
- data/vendor/libgit2/src/diff_generate.c +29 -23
- data/vendor/libgit2/src/diff_generate.h +1 -1
- data/vendor/libgit2/src/diff_parse.c +3 -3
- data/vendor/libgit2/src/diff_print.c +17 -17
- data/vendor/libgit2/src/diff_stats.c +22 -7
- data/vendor/libgit2/src/diff_tform.c +12 -12
- data/vendor/libgit2/src/diff_xdiff.c +15 -3
- data/vendor/libgit2/src/errors.c +42 -20
- data/vendor/libgit2/src/features.h.in +2 -1
- data/vendor/libgit2/src/fetch.c +3 -3
- data/vendor/libgit2/src/fetchhead.c +16 -16
- data/vendor/libgit2/src/filebuf.c +28 -28
- data/vendor/libgit2/src/fileops.c +54 -54
- data/vendor/libgit2/src/fileops.h +1 -1
- data/vendor/libgit2/src/filter.c +30 -30
- data/vendor/libgit2/src/filter.h +0 -10
- data/vendor/libgit2/src/global.c +36 -23
- data/vendor/libgit2/src/hash.h +4 -1
- data/vendor/libgit2/src/hash/hash_collisiondetect.h +6 -2
- data/vendor/libgit2/src/hash/hash_common_crypto.h +5 -1
- data/vendor/libgit2/src/hash/hash_generic.h +5 -1
- data/vendor/libgit2/src/hash/hash_mbedtls.c +38 -0
- data/vendor/libgit2/src/hash/hash_mbedtls.h +24 -0
- data/vendor/libgit2/src/hash/hash_openssl.h +8 -4
- data/vendor/libgit2/src/hash/hash_win32.c +13 -13
- data/vendor/libgit2/src/hashsig.c +4 -4
- data/vendor/libgit2/src/idxmap.c +25 -5
- data/vendor/libgit2/src/idxmap.h +4 -18
- data/vendor/libgit2/src/ignore.c +9 -9
- data/vendor/libgit2/src/index.c +280 -198
- data/vendor/libgit2/src/index.h +16 -0
- data/vendor/libgit2/src/indexer.c +311 -139
- data/vendor/libgit2/src/integer.h +32 -22
- data/vendor/libgit2/src/iterator.c +116 -49
- data/vendor/libgit2/src/iterator.h +15 -0
- data/vendor/libgit2/src/khash.h +3 -1
- data/vendor/libgit2/src/mailmap.c +485 -0
- data/vendor/libgit2/src/mailmap.h +35 -0
- data/vendor/libgit2/src/merge.c +89 -59
- data/vendor/libgit2/src/merge_driver.c +7 -7
- data/vendor/libgit2/src/merge_file.c +1 -1
- data/vendor/libgit2/src/mwindow.c +8 -8
- data/vendor/libgit2/src/netops.c +22 -13
- data/vendor/libgit2/src/netops.h +2 -0
- data/vendor/libgit2/src/notes.c +15 -10
- data/vendor/libgit2/src/object.c +118 -67
- data/vendor/libgit2/src/object.h +20 -9
- data/vendor/libgit2/src/object_api.c +8 -8
- data/vendor/libgit2/src/odb.c +72 -72
- data/vendor/libgit2/src/odb.h +7 -7
- data/vendor/libgit2/src/odb_loose.c +46 -46
- data/vendor/libgit2/src/odb_mempack.c +14 -14
- data/vendor/libgit2/src/odb_pack.c +14 -10
- data/vendor/libgit2/src/offmap.c +30 -0
- data/vendor/libgit2/src/offmap.h +20 -11
- data/vendor/libgit2/src/oid.c +6 -6
- data/vendor/libgit2/src/oidmap.c +20 -0
- data/vendor/libgit2/src/oidmap.h +9 -12
- data/vendor/libgit2/src/pack-objects.c +71 -63
- data/vendor/libgit2/src/pack-objects.h +1 -7
- data/vendor/libgit2/src/pack.c +58 -58
- data/vendor/libgit2/src/pack.h +6 -6
- data/vendor/libgit2/src/parse.h +1 -1
- data/vendor/libgit2/src/patch.c +3 -3
- data/vendor/libgit2/src/patch_generate.c +18 -18
- data/vendor/libgit2/src/patch_parse.c +13 -13
- data/vendor/libgit2/src/path.c +93 -225
- data/vendor/libgit2/src/path.h +2 -84
- data/vendor/libgit2/src/pathspec.c +6 -6
- data/vendor/libgit2/src/posix.c +3 -3
- data/vendor/libgit2/src/proxy.c +1 -1
- data/vendor/libgit2/src/push.c +27 -26
- data/vendor/libgit2/src/push.h +2 -1
- data/vendor/libgit2/src/reader.c +265 -0
- data/vendor/libgit2/src/reader.h +107 -0
- data/vendor/libgit2/src/rebase.c +49 -52
- data/vendor/libgit2/src/refdb.c +3 -3
- data/vendor/libgit2/src/refdb_fs.c +181 -103
- data/vendor/libgit2/src/reflog.c +3 -3
- data/vendor/libgit2/src/refs.c +98 -74
- data/vendor/libgit2/src/refs.h +5 -3
- data/vendor/libgit2/src/refspec.c +47 -21
- data/vendor/libgit2/src/refspec.h +1 -1
- data/vendor/libgit2/src/remote.c +219 -166
- data/vendor/libgit2/src/remote.h +9 -0
- data/vendor/libgit2/src/repository.c +173 -133
- data/vendor/libgit2/src/repository.h +6 -3
- data/vendor/libgit2/src/reset.c +8 -8
- data/vendor/libgit2/src/revert.c +6 -6
- data/vendor/libgit2/src/revparse.c +30 -30
- data/vendor/libgit2/src/revwalk.c +60 -30
- data/vendor/libgit2/src/revwalk.h +2 -1
- data/vendor/libgit2/src/settings.c +42 -10
- data/vendor/libgit2/src/signature.c +11 -11
- data/vendor/libgit2/src/sortedcache.c +13 -13
- data/vendor/libgit2/src/stash.c +91 -45
- data/vendor/libgit2/src/status.c +13 -13
- data/vendor/libgit2/src/stdalloc.c +120 -0
- data/vendor/libgit2/src/{streams/curl.h → stdalloc.h} +6 -6
- data/vendor/libgit2/src/stream.h +17 -2
- data/vendor/libgit2/src/streams/mbedtls.c +483 -0
- data/vendor/libgit2/src/streams/mbedtls.h +23 -0
- data/vendor/libgit2/src/streams/openssl.c +204 -114
- data/vendor/libgit2/src/streams/openssl.h +4 -108
- data/vendor/libgit2/src/streams/registry.c +118 -0
- data/vendor/libgit2/src/streams/registry.h +19 -0
- data/vendor/libgit2/src/streams/socket.c +54 -29
- data/vendor/libgit2/src/streams/stransport.c +57 -32
- data/vendor/libgit2/src/streams/stransport.h +5 -0
- data/vendor/libgit2/src/streams/tls.c +50 -19
- data/vendor/libgit2/src/streams/tls.h +12 -4
- data/vendor/libgit2/src/strmap.c +22 -2
- data/vendor/libgit2/src/strmap.h +18 -15
- data/vendor/libgit2/src/submodule.c +179 -155
- data/vendor/libgit2/src/sysdir.c +18 -18
- data/vendor/libgit2/src/tag.c +31 -26
- data/vendor/libgit2/src/tag.h +2 -1
- data/vendor/libgit2/src/trace.c +1 -1
- data/vendor/libgit2/src/trace.h +1 -1
- data/vendor/libgit2/src/trailer.c +6 -6
- data/vendor/libgit2/src/transaction.c +23 -23
- data/vendor/libgit2/src/transport.c +5 -5
- data/vendor/libgit2/src/transports/auth.c +7 -4
- data/vendor/libgit2/src/transports/auth.h +1 -1
- data/vendor/libgit2/src/transports/auth_negotiate.c +12 -11
- data/vendor/libgit2/src/transports/cred.c +18 -18
- data/vendor/libgit2/src/transports/git.c +15 -15
- data/vendor/libgit2/src/transports/http.c +606 -216
- data/vendor/libgit2/src/transports/http.h +2 -0
- data/vendor/libgit2/src/transports/local.c +26 -26
- data/vendor/libgit2/src/transports/smart.c +54 -31
- data/vendor/libgit2/src/transports/smart.h +1 -2
- data/vendor/libgit2/src/transports/smart_pkt.c +43 -40
- data/vendor/libgit2/src/transports/smart_protocol.c +61 -57
- data/vendor/libgit2/src/transports/ssh.c +34 -33
- data/vendor/libgit2/src/transports/winhttp.c +99 -119
- data/vendor/libgit2/src/tree-cache.c +5 -5
- data/vendor/libgit2/src/tree.c +96 -121
- data/vendor/libgit2/src/tree.h +1 -12
- data/vendor/libgit2/src/unix/map.c +2 -2
- data/vendor/libgit2/src/util.c +22 -6
- data/vendor/libgit2/src/util.h +12 -135
- data/vendor/libgit2/src/vector.c +4 -4
- data/vendor/libgit2/src/win32/dir.c +3 -3
- data/vendor/libgit2/src/win32/findfile.c +3 -3
- data/vendor/libgit2/src/win32/map.c +6 -6
- data/vendor/libgit2/src/win32/msvc-compat.h +6 -0
- data/vendor/libgit2/src/win32/path_w32.c +101 -7
- data/vendor/libgit2/src/win32/path_w32.h +18 -0
- data/vendor/libgit2/src/win32/posix_w32.c +24 -43
- data/vendor/libgit2/src/win32/w32_buffer.c +2 -2
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +96 -2
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +28 -75
- data/vendor/libgit2/src/win32/w32_stack.c +2 -2
- data/vendor/libgit2/src/win32/w32_util.c +1 -69
- data/vendor/libgit2/src/win32/w32_util.h +1 -19
- data/vendor/libgit2/src/worktree.c +75 -54
- data/vendor/libgit2/src/worktree.h +2 -0
- data/vendor/libgit2/src/xdiff/xdiffi.c +7 -5
- data/vendor/libgit2/src/xdiff/xhistogram.c +1 -1
- data/vendor/libgit2/src/xdiff/xmerge.c +15 -15
- data/vendor/libgit2/src/zstream.c +4 -4
- metadata +33 -7
- data/vendor/libgit2/src/config_file.h +0 -73
- data/vendor/libgit2/src/streams/curl.c +0 -385
@@ -0,0 +1,35 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
|
+
*
|
4
|
+
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
|
+
* a Linking Exception. For full terms see the included COPYING file.
|
6
|
+
*/
|
7
|
+
#ifndef INCLUDE_mailmap_h__
|
8
|
+
#define INCLUDE_mailmap_h__
|
9
|
+
|
10
|
+
#include "git2/mailmap.h"
|
11
|
+
#include "vector.h"
|
12
|
+
|
13
|
+
/*
|
14
|
+
* A mailmap is stored as a sorted vector of 'git_mailmap_entry's. These entries
|
15
|
+
* are sorted first by 'replace_email', and then by 'replace_name'. NULL
|
16
|
+
* replace_names are ordered first.
|
17
|
+
*
|
18
|
+
* Looking up a name and email in the mailmap is done with a binary search.
|
19
|
+
*/
|
20
|
+
struct git_mailmap {
|
21
|
+
git_vector entries;
|
22
|
+
};
|
23
|
+
|
24
|
+
/* Single entry parsed from a mailmap */
|
25
|
+
typedef struct git_mailmap_entry {
|
26
|
+
char *real_name; /**< the real name (may be NULL) */
|
27
|
+
char *real_email; /**< the real email (may be NULL) */
|
28
|
+
char *replace_name; /**< the name to replace (may be NULL) */
|
29
|
+
char *replace_email; /**< the email to replace */
|
30
|
+
} git_mailmap_entry;
|
31
|
+
|
32
|
+
const git_mailmap_entry *git_mailmap_entry_lookup(
|
33
|
+
const git_mailmap *mm, const char *name, const char *email);
|
34
|
+
|
35
|
+
#endif
|
data/vendor/libgit2/src/merge.c
CHANGED
@@ -80,7 +80,7 @@ int merge_bases_many(git_commit_list **out, git_revwalk **walk_out, git_reposito
|
|
80
80
|
unsigned int i;
|
81
81
|
|
82
82
|
if (length < 2) {
|
83
|
-
|
83
|
+
git_error_set(GIT_ERROR_INVALID, "at least two commits are required to find an ancestor");
|
84
84
|
return -1;
|
85
85
|
}
|
86
86
|
|
@@ -106,7 +106,7 @@ int merge_bases_many(git_commit_list **out, git_revwalk **walk_out, git_reposito
|
|
106
106
|
goto on_error;
|
107
107
|
|
108
108
|
if (!result) {
|
109
|
-
|
109
|
+
git_error_set(GIT_ERROR_MERGE, "no merge base found");
|
110
110
|
error = GIT_ENOTFOUND;
|
111
111
|
goto on_error;
|
112
112
|
}
|
@@ -186,7 +186,7 @@ int git_merge_base_octopus(git_oid *out, git_repository *repo, size_t length, co
|
|
186
186
|
assert(out && repo && input_array);
|
187
187
|
|
188
188
|
if (length < 2) {
|
189
|
-
|
189
|
+
git_error_set(GIT_ERROR_INVALID, "at least two commits are required to find an ancestor");
|
190
190
|
return -1;
|
191
191
|
}
|
192
192
|
|
@@ -232,7 +232,7 @@ static int merge_bases(git_commit_list **out, git_revwalk **walk_out, git_reposi
|
|
232
232
|
|
233
233
|
if (!result) {
|
234
234
|
git_revwalk_free(walk);
|
235
|
-
|
235
|
+
git_error_set(GIT_ERROR_MERGE, "no merge base found");
|
236
236
|
return GIT_ENOTFOUND;
|
237
237
|
}
|
238
238
|
|
@@ -426,9 +426,9 @@ static int remove_redundant(git_revwalk *walk, git_vector *commits)
|
|
426
426
|
int error = 0;
|
427
427
|
|
428
428
|
redundant = git__calloc(commits->length, 1);
|
429
|
-
|
429
|
+
GIT_ERROR_CHECK_ALLOC(redundant);
|
430
430
|
filled_index = git__calloc((commits->length - 1), sizeof(unsigned int));
|
431
|
-
|
431
|
+
GIT_ERROR_CHECK_ALLOC(filled_index);
|
432
432
|
|
433
433
|
for (i = 0; i < commits->length; ++i) {
|
434
434
|
if ((error = git_commit_list_parse(walk, commits->contents[i])) < 0)
|
@@ -576,7 +576,7 @@ int git_repository_mergehead_foreach(
|
|
576
576
|
|
577
577
|
while ((line = git__strsep(&buffer, "\n")) != NULL) {
|
578
578
|
if (strlen(line) != GIT_OID_HEXSZ) {
|
579
|
-
|
579
|
+
git_error_set(GIT_ERROR_INVALID, "unable to parse OID - invalid length");
|
580
580
|
error = -1;
|
581
581
|
goto cleanup;
|
582
582
|
}
|
@@ -585,7 +585,7 @@ int git_repository_mergehead_foreach(
|
|
585
585
|
goto cleanup;
|
586
586
|
|
587
587
|
if ((error = cb(&oid, payload)) != 0) {
|
588
|
-
|
588
|
+
git_error_set_after_callback(error);
|
589
589
|
goto cleanup;
|
590
590
|
}
|
591
591
|
|
@@ -593,14 +593,14 @@ int git_repository_mergehead_foreach(
|
|
593
593
|
}
|
594
594
|
|
595
595
|
if (*buffer) {
|
596
|
-
|
596
|
+
git_error_set(GIT_ERROR_MERGE, "no EOL at line %"PRIuZ, line_num);
|
597
597
|
error = -1;
|
598
598
|
goto cleanup;
|
599
599
|
}
|
600
600
|
|
601
601
|
cleanup:
|
602
|
-
|
603
|
-
|
602
|
+
git_buf_dispose(&merge_head_path);
|
603
|
+
git_buf_dispose(&merge_head_file);
|
604
604
|
|
605
605
|
return error;
|
606
606
|
}
|
@@ -859,23 +859,23 @@ static int merge_conflict_invoke_driver(
|
|
859
859
|
|
860
860
|
if ((error = driver->apply(driver, &path, &mode, &buf, name, src)) < 0 ||
|
861
861
|
(error = git_repository_odb(&odb, src->repo)) < 0 ||
|
862
|
-
(error = git_odb_write(&oid, odb, buf.ptr, buf.size,
|
862
|
+
(error = git_odb_write(&oid, odb, buf.ptr, buf.size, GIT_OBJECT_BLOB)) < 0)
|
863
863
|
goto done;
|
864
864
|
|
865
865
|
result = git_pool_mallocz(&diff_list->pool, sizeof(git_index_entry));
|
866
|
-
|
866
|
+
GIT_ERROR_CHECK_ALLOC(result);
|
867
867
|
|
868
868
|
git_oid_cpy(&result->id, &oid);
|
869
869
|
result->mode = mode;
|
870
870
|
result->file_size = buf.size;
|
871
871
|
|
872
872
|
result->path = git_pool_strdup(&diff_list->pool, path);
|
873
|
-
|
873
|
+
GIT_ERROR_CHECK_ALLOC(result->path);
|
874
874
|
|
875
875
|
*out = result;
|
876
876
|
|
877
877
|
done:
|
878
|
-
|
878
|
+
git_buf_dispose(&buf);
|
879
879
|
git_odb_free(odb);
|
880
880
|
|
881
881
|
return error;
|
@@ -1084,7 +1084,7 @@ static int index_entry_similarity_inexact(
|
|
1084
1084
|
}
|
1085
1085
|
|
1086
1086
|
/* Tracks deletes by oid for merge_diff_mark_similarity_exact(). This is a
|
1087
|
-
* non-shrinking queue where next_pos is the next position to dequeue.
|
1087
|
+
* non-shrinking queue where next_pos is the next position to dequeue.
|
1088
1088
|
*/
|
1089
1089
|
typedef struct {
|
1090
1090
|
git_array_t(size_t) arr;
|
@@ -1105,7 +1105,7 @@ static void deletes_by_oid_free(git_oidmap *map) {
|
|
1105
1105
|
}
|
1106
1106
|
|
1107
1107
|
static int deletes_by_oid_enqueue(git_oidmap *map, git_pool* pool, const git_oid *id, size_t idx) {
|
1108
|
-
|
1108
|
+
size_t pos;
|
1109
1109
|
deletes_by_oid_queue *queue;
|
1110
1110
|
size_t *array_entry;
|
1111
1111
|
int error;
|
@@ -1113,7 +1113,7 @@ static int deletes_by_oid_enqueue(git_oidmap *map, git_pool* pool, const git_oid
|
|
1113
1113
|
pos = git_oidmap_lookup_index(map, id);
|
1114
1114
|
if (!git_oidmap_valid_index(map, pos)) {
|
1115
1115
|
queue = git_pool_malloc(pool, sizeof(deletes_by_oid_queue));
|
1116
|
-
|
1116
|
+
GIT_ERROR_CHECK_ALLOC(queue);
|
1117
1117
|
|
1118
1118
|
git_array_init(queue->arr);
|
1119
1119
|
queue->next_pos = 0;
|
@@ -1125,7 +1125,7 @@ static int deletes_by_oid_enqueue(git_oidmap *map, git_pool* pool, const git_oid
|
|
1125
1125
|
} else {
|
1126
1126
|
queue = git_oidmap_value_at(map, pos);
|
1127
1127
|
array_entry = git_array_alloc(queue->arr);
|
1128
|
-
|
1128
|
+
GIT_ERROR_CHECK_ALLOC(array_entry);
|
1129
1129
|
*array_entry = idx;
|
1130
1130
|
}
|
1131
1131
|
|
@@ -1133,7 +1133,7 @@ static int deletes_by_oid_enqueue(git_oidmap *map, git_pool* pool, const git_oid
|
|
1133
1133
|
}
|
1134
1134
|
|
1135
1135
|
static int deletes_by_oid_dequeue(size_t *idx, git_oidmap *map, const git_oid *id) {
|
1136
|
-
|
1136
|
+
size_t pos;
|
1137
1137
|
deletes_by_oid_queue *queue;
|
1138
1138
|
size_t *array_entry;
|
1139
1139
|
|
@@ -1143,7 +1143,7 @@ static int deletes_by_oid_dequeue(size_t *idx, git_oidmap *map, const git_oid *i
|
|
1143
1143
|
return GIT_ENOTFOUND;
|
1144
1144
|
|
1145
1145
|
queue = git_oidmap_value_at(map, pos);
|
1146
|
-
|
1146
|
+
|
1147
1147
|
if (queue->next_pos == 0) {
|
1148
1148
|
*idx = queue->first_entry;
|
1149
1149
|
} else {
|
@@ -1510,11 +1510,11 @@ int git_merge_diff_list__find_renames(
|
|
1510
1510
|
|
1511
1511
|
similarity_ours = git__calloc(diff_list->conflicts.length,
|
1512
1512
|
sizeof(struct merge_diff_similarity));
|
1513
|
-
|
1513
|
+
GIT_ERROR_CHECK_ALLOC(similarity_ours);
|
1514
1514
|
|
1515
1515
|
similarity_theirs = git__calloc(diff_list->conflicts.length,
|
1516
1516
|
sizeof(struct merge_diff_similarity));
|
1517
|
-
|
1517
|
+
GIT_ERROR_CHECK_ALLOC(similarity_theirs);
|
1518
1518
|
|
1519
1519
|
/* Calculate similarity between items that were deleted from the ancestor
|
1520
1520
|
* and added in the other branch.
|
@@ -1523,9 +1523,9 @@ int git_merge_diff_list__find_renames(
|
|
1523
1523
|
goto done;
|
1524
1524
|
|
1525
1525
|
if (opts->rename_threshold < 100 && diff_list->conflicts.length <= opts->target_limit) {
|
1526
|
-
|
1526
|
+
GIT_ERROR_CHECK_ALLOC_MULTIPLY(&cache_size, diff_list->conflicts.length, 3);
|
1527
1527
|
cache = git__calloc(cache_size, sizeof(void *));
|
1528
|
-
|
1528
|
+
GIT_ERROR_CHECK_ALLOC(cache);
|
1529
1529
|
|
1530
1530
|
merge_diff_list_count_candidates(diff_list, &src_count, &tgt_count);
|
1531
1531
|
|
@@ -1739,7 +1739,7 @@ static int merge_diff_list_insert_unmodified(
|
|
1739
1739
|
git_index_entry *entry;
|
1740
1740
|
|
1741
1741
|
entry = git_pool_malloc(&diff_list->pool, sizeof(git_index_entry));
|
1742
|
-
|
1742
|
+
GIT_ERROR_CHECK_ALLOC(entry);
|
1743
1743
|
|
1744
1744
|
if ((error = index_entry_dup_pool(entry, &diff_list->pool, tree_items[0])) >= 0)
|
1745
1745
|
error = git_vector_insert(&diff_list->staged, entry);
|
@@ -1846,13 +1846,13 @@ static int merge_normalize_opts(
|
|
1846
1846
|
|
1847
1847
|
if (given && given->default_driver) {
|
1848
1848
|
opts->default_driver = git__strdup(given->default_driver);
|
1849
|
-
|
1849
|
+
GIT_ERROR_CHECK_ALLOC(opts->default_driver);
|
1850
1850
|
} else {
|
1851
1851
|
error = git_config_get_entry(&entry, cfg, "merge.default");
|
1852
1852
|
|
1853
1853
|
if (error == 0) {
|
1854
1854
|
opts->default_driver = git__strdup(entry->value);
|
1855
|
-
|
1855
|
+
GIT_ERROR_CHECK_ALLOC(opts->default_driver);
|
1856
1856
|
} else if (error == GIT_ENOTFOUND) {
|
1857
1857
|
error = 0;
|
1858
1858
|
} else {
|
@@ -1873,7 +1873,7 @@ static int merge_normalize_opts(
|
|
1873
1873
|
/* assign the internal metric with whitespace flag as payload */
|
1874
1874
|
if (!opts->metric) {
|
1875
1875
|
opts->metric = git__malloc(sizeof(git_diff_similarity_metric));
|
1876
|
-
|
1876
|
+
GIT_ERROR_CHECK_ALLOC(opts->metric);
|
1877
1877
|
|
1878
1878
|
opts->metric->file_signature = git_diff_find_similar__hashsig_for_file;
|
1879
1879
|
opts->metric->buffer_signature = git_diff_find_similar__hashsig_for_buf;
|
@@ -2060,7 +2060,7 @@ int git_merge__iterators(
|
|
2060
2060
|
|
2061
2061
|
*out = NULL;
|
2062
2062
|
|
2063
|
-
|
2063
|
+
GIT_ERROR_CHECK_VERSION(
|
2064
2064
|
given_opts, GIT_MERGE_OPTIONS_VERSION, "git_merge_options");
|
2065
2065
|
|
2066
2066
|
if ((error = merge_normalize_opts(repo, &opts, given_opts)) < 0)
|
@@ -2079,7 +2079,7 @@ int git_merge__iterators(
|
|
2079
2079
|
}
|
2080
2080
|
|
2081
2081
|
diff_list = git_merge_diff_list__alloc(repo);
|
2082
|
-
|
2082
|
+
GIT_ERROR_CHECK_ALLOC(diff_list);
|
2083
2083
|
|
2084
2084
|
ancestor_iter = iterator_given_or_empty(&empty_ancestor, ancestor_iter);
|
2085
2085
|
our_iter = iterator_given_or_empty(&empty_ours, our_iter);
|
@@ -2102,7 +2102,7 @@ int git_merge__iterators(
|
|
2102
2102
|
|
2103
2103
|
if (!resolved) {
|
2104
2104
|
if ((opts.flags & GIT_MERGE_FAIL_ON_CONFLICT)) {
|
2105
|
-
|
2105
|
+
git_error_set(GIT_ERROR_MERGE, "merge conflicts exist");
|
2106
2106
|
error = GIT_EMERGECONFLICT;
|
2107
2107
|
goto done;
|
2108
2108
|
}
|
@@ -2199,13 +2199,13 @@ GIT_INLINE(int) insert_head_ids(
|
|
2199
2199
|
|
2200
2200
|
if (annotated_commit->type == GIT_ANNOTATED_COMMIT_REAL) {
|
2201
2201
|
id = git_array_alloc(*ids);
|
2202
|
-
|
2202
|
+
GIT_ERROR_CHECK_ALLOC(id);
|
2203
2203
|
|
2204
2204
|
git_oid_cpy(id, git_commit_id(annotated_commit->commit));
|
2205
2205
|
} else {
|
2206
2206
|
for (i = 0; i < annotated_commit->parents.size; i++) {
|
2207
2207
|
id = git_array_alloc(*ids);
|
2208
|
-
|
2208
|
+
GIT_ERROR_CHECK_ALLOC(id);
|
2209
2209
|
|
2210
2210
|
git_oid_cpy(id, &annotated_commit->parents.ptr[i]);
|
2211
2211
|
}
|
@@ -2240,7 +2240,7 @@ static int create_virtual_base(
|
|
2240
2240
|
return -1;
|
2241
2241
|
|
2242
2242
|
result = git__calloc(1, sizeof(git_annotated_commit));
|
2243
|
-
|
2243
|
+
GIT_ERROR_CHECK_ALLOC(result);
|
2244
2244
|
result->type = GIT_ANNOTATED_COMMIT_VIRTUAL;
|
2245
2245
|
result->index = index;
|
2246
2246
|
|
@@ -2368,7 +2368,7 @@ static int merge_annotated_commits(
|
|
2368
2368
|
if (error != GIT_ENOTFOUND)
|
2369
2369
|
goto done;
|
2370
2370
|
|
2371
|
-
|
2371
|
+
git_error_clear();
|
2372
2372
|
}
|
2373
2373
|
|
2374
2374
|
if ((error = iterator_for_annotated_commit(&base_iter, base)) < 0 ||
|
@@ -2444,7 +2444,7 @@ cleanup:
|
|
2444
2444
|
if (error < 0)
|
2445
2445
|
git_filebuf_cleanup(&file);
|
2446
2446
|
|
2447
|
-
|
2447
|
+
git_buf_dispose(&file_path);
|
2448
2448
|
|
2449
2449
|
return error;
|
2450
2450
|
}
|
@@ -2470,7 +2470,7 @@ cleanup:
|
|
2470
2470
|
if (error < 0)
|
2471
2471
|
git_filebuf_cleanup(&file);
|
2472
2472
|
|
2473
|
-
|
2473
|
+
git_buf_dispose(&file_path);
|
2474
2474
|
|
2475
2475
|
return error;
|
2476
2476
|
}
|
@@ -2678,7 +2678,7 @@ static int write_merge_msg(
|
|
2678
2678
|
assert(repo && heads);
|
2679
2679
|
|
2680
2680
|
entries = git__calloc(heads_len, sizeof(struct merge_msg_entry));
|
2681
|
-
|
2681
|
+
GIT_ERROR_CHECK_ALLOC(entries);
|
2682
2682
|
|
2683
2683
|
if (git_vector_init(&matching, heads_len, NULL) < 0) {
|
2684
2684
|
git__free(entries);
|
@@ -2770,7 +2770,7 @@ cleanup:
|
|
2770
2770
|
if (error < 0)
|
2771
2771
|
git_filebuf_cleanup(&file);
|
2772
2772
|
|
2773
|
-
|
2773
|
+
git_buf_dispose(&file_path);
|
2774
2774
|
|
2775
2775
|
git_vector_free(&matching);
|
2776
2776
|
git__free(entries);
|
@@ -2812,9 +2812,9 @@ static int merge_ancestor_head(
|
|
2812
2812
|
|
2813
2813
|
assert(repo && our_head && their_heads);
|
2814
2814
|
|
2815
|
-
|
2815
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, their_heads_len, 1);
|
2816
2816
|
oids = git__calloc(alloc_len, sizeof(git_oid));
|
2817
|
-
|
2817
|
+
GIT_ERROR_CHECK_ALLOC(oids);
|
2818
2818
|
|
2819
2819
|
git_oid_cpy(&oids[0], git_commit_id(our_head->commit));
|
2820
2820
|
|
@@ -3038,7 +3038,7 @@ int git_merge__check_result(git_repository *repo, git_index *index_new)
|
|
3038
3038
|
goto done;
|
3039
3039
|
|
3040
3040
|
if ((conflicts = index_conflicts + wd_conflicts) > 0) {
|
3041
|
-
|
3041
|
+
git_error_set(GIT_ERROR_MERGE, "%" PRIuZ " uncommitted change%s would be overwritten by merge",
|
3042
3042
|
conflicts, (conflicts != 1) ? "s" : "");
|
3043
3043
|
error = GIT_ECONFLICT;
|
3044
3044
|
}
|
@@ -3090,7 +3090,7 @@ cleanup:
|
|
3090
3090
|
if (error < 0)
|
3091
3091
|
git_filebuf_cleanup(&file);
|
3092
3092
|
|
3093
|
-
|
3093
|
+
git_buf_dispose(&file_path);
|
3094
3094
|
|
3095
3095
|
return error;
|
3096
3096
|
}
|
@@ -3110,11 +3110,11 @@ static int merge_heads(
|
|
3110
3110
|
git_annotated_commit **ancestor_head_out,
|
3111
3111
|
git_annotated_commit **our_head_out,
|
3112
3112
|
git_repository *repo,
|
3113
|
+
git_reference *our_ref,
|
3113
3114
|
const git_annotated_commit **their_heads,
|
3114
3115
|
size_t their_heads_len)
|
3115
3116
|
{
|
3116
3117
|
git_annotated_commit *ancestor_head = NULL, *our_head = NULL;
|
3117
|
-
git_reference *our_ref = NULL;
|
3118
3118
|
int error = 0;
|
3119
3119
|
|
3120
3120
|
*ancestor_head_out = NULL;
|
@@ -3123,15 +3123,14 @@ static int merge_heads(
|
|
3123
3123
|
if ((error = git_repository__ensure_not_bare(repo, "merge")) < 0)
|
3124
3124
|
goto done;
|
3125
3125
|
|
3126
|
-
if ((error =
|
3127
|
-
(error = git_annotated_commit_from_ref(&our_head, repo, our_ref)) < 0)
|
3126
|
+
if ((error = git_annotated_commit_from_ref(&our_head, repo, our_ref)) < 0)
|
3128
3127
|
goto done;
|
3129
3128
|
|
3130
3129
|
if ((error = merge_ancestor_head(&ancestor_head, repo, our_head, their_heads, their_heads_len)) < 0) {
|
3131
3130
|
if (error != GIT_ENOTFOUND)
|
3132
3131
|
goto done;
|
3133
3132
|
|
3134
|
-
|
3133
|
+
git_error_clear();
|
3135
3134
|
error = 0;
|
3136
3135
|
}
|
3137
3136
|
|
@@ -3144,8 +3143,6 @@ done:
|
|
3144
3143
|
git_annotated_commit_free(our_head);
|
3145
3144
|
}
|
3146
3145
|
|
3147
|
-
git_reference_free(our_ref);
|
3148
|
-
|
3149
3146
|
return error;
|
3150
3147
|
}
|
3151
3148
|
|
@@ -3162,7 +3159,7 @@ static int merge_preference(git_merge_preference_t *out, git_repository *repo)
|
|
3162
3159
|
|
3163
3160
|
if ((error = git_config_get_string(&value, config, "merge.ff")) < 0) {
|
3164
3161
|
if (error == GIT_ENOTFOUND) {
|
3165
|
-
|
3162
|
+
git_error_clear();
|
3166
3163
|
error = 0;
|
3167
3164
|
}
|
3168
3165
|
|
@@ -3182,20 +3179,22 @@ done:
|
|
3182
3179
|
return error;
|
3183
3180
|
}
|
3184
3181
|
|
3185
|
-
int
|
3182
|
+
int git_merge_analysis_for_ref(
|
3186
3183
|
git_merge_analysis_t *analysis_out,
|
3187
3184
|
git_merge_preference_t *preference_out,
|
3188
3185
|
git_repository *repo,
|
3186
|
+
git_reference *our_ref,
|
3189
3187
|
const git_annotated_commit **their_heads,
|
3190
3188
|
size_t their_heads_len)
|
3191
3189
|
{
|
3192
3190
|
git_annotated_commit *ancestor_head = NULL, *our_head = NULL;
|
3193
3191
|
int error = 0;
|
3192
|
+
bool unborn;
|
3194
3193
|
|
3195
|
-
assert(analysis_out && preference_out && repo && their_heads);
|
3194
|
+
assert(analysis_out && preference_out && repo && their_heads && their_heads_len > 0);
|
3196
3195
|
|
3197
3196
|
if (their_heads_len != 1) {
|
3198
|
-
|
3197
|
+
git_error_set(GIT_ERROR_MERGE, "can only merge a single branch");
|
3199
3198
|
error = -1;
|
3200
3199
|
goto done;
|
3201
3200
|
}
|
@@ -3205,12 +3204,16 @@ int git_merge_analysis(
|
|
3205
3204
|
if ((error = merge_preference(preference_out, repo)) < 0)
|
3206
3205
|
goto done;
|
3207
3206
|
|
3208
|
-
if (
|
3207
|
+
if ((error = git_reference__is_unborn_head(&unborn, our_ref, repo)) < 0)
|
3208
|
+
goto done;
|
3209
|
+
|
3210
|
+
if (unborn) {
|
3209
3211
|
*analysis_out |= GIT_MERGE_ANALYSIS_FASTFORWARD | GIT_MERGE_ANALYSIS_UNBORN;
|
3212
|
+
error = 0;
|
3210
3213
|
goto done;
|
3211
3214
|
}
|
3212
3215
|
|
3213
|
-
if ((error = merge_heads(&ancestor_head, &our_head, repo, their_heads, their_heads_len)) < 0)
|
3216
|
+
if ((error = merge_heads(&ancestor_head, &our_head, repo, our_ref, their_heads, their_heads_len)) < 0)
|
3214
3217
|
goto done;
|
3215
3218
|
|
3216
3219
|
/* We're up-to-date if we're trying to merge our own common ancestor. */
|
@@ -3233,6 +3236,28 @@ done:
|
|
3233
3236
|
return error;
|
3234
3237
|
}
|
3235
3238
|
|
3239
|
+
int git_merge_analysis(
|
3240
|
+
git_merge_analysis_t *analysis_out,
|
3241
|
+
git_merge_preference_t *preference_out,
|
3242
|
+
git_repository *repo,
|
3243
|
+
const git_annotated_commit **their_heads,
|
3244
|
+
size_t their_heads_len)
|
3245
|
+
{
|
3246
|
+
git_reference *head_ref = NULL;
|
3247
|
+
int error = 0;
|
3248
|
+
|
3249
|
+
if ((error = git_reference_lookup(&head_ref, repo, GIT_HEAD_FILE)) < 0) {
|
3250
|
+
git_error_set(GIT_ERROR_MERGE, "failed to lookup HEAD reference");
|
3251
|
+
return error;
|
3252
|
+
}
|
3253
|
+
|
3254
|
+
error = git_merge_analysis_for_ref(analysis_out, preference_out, repo, head_ref, their_heads, their_heads_len);
|
3255
|
+
|
3256
|
+
git_reference_free(head_ref);
|
3257
|
+
|
3258
|
+
return error;
|
3259
|
+
}
|
3260
|
+
|
3236
3261
|
int git_merge(
|
3237
3262
|
git_repository *repo,
|
3238
3263
|
const git_annotated_commit **their_heads,
|
@@ -3243,15 +3268,15 @@ int git_merge(
|
|
3243
3268
|
git_reference *our_ref = NULL;
|
3244
3269
|
git_checkout_options checkout_opts;
|
3245
3270
|
git_annotated_commit *our_head = NULL, *base = NULL;
|
3246
|
-
git_index *index = NULL;
|
3271
|
+
git_index *repo_index = NULL, *index = NULL;
|
3247
3272
|
git_indexwriter indexwriter = GIT_INDEXWRITER_INIT;
|
3248
3273
|
unsigned int checkout_strategy;
|
3249
3274
|
int error = 0;
|
3250
3275
|
|
3251
|
-
assert(repo && their_heads);
|
3276
|
+
assert(repo && their_heads && their_heads_len > 0);
|
3252
3277
|
|
3253
3278
|
if (their_heads_len != 1) {
|
3254
|
-
|
3279
|
+
git_error_set(GIT_ERROR_MERGE, "can only merge a single branch");
|
3255
3280
|
return -1;
|
3256
3281
|
}
|
3257
3282
|
|
@@ -3266,6 +3291,10 @@ int git_merge(
|
|
3266
3291
|
&checkout_strategy)) < 0)
|
3267
3292
|
goto done;
|
3268
3293
|
|
3294
|
+
if ((error = git_repository_index(&repo_index, repo) < 0) ||
|
3295
|
+
(error = git_index_read(repo_index, 0) < 0))
|
3296
|
+
goto done;
|
3297
|
+
|
3269
3298
|
/* Write the merge setup files to the repository. */
|
3270
3299
|
if ((error = git_annotated_commit_from_head(&our_head, repo)) < 0 ||
|
3271
3300
|
(error = git_merge__setup(repo, our_head, their_heads,
|
@@ -3299,6 +3328,7 @@ done:
|
|
3299
3328
|
git_annotated_commit_free(our_head);
|
3300
3329
|
git_annotated_commit_free(base);
|
3301
3330
|
git_reference_free(our_ref);
|
3331
|
+
git_index_free(repo_index);
|
3302
3332
|
|
3303
3333
|
return error;
|
3304
3334
|
}
|