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
@@ -47,12 +47,24 @@
|
|
47
47
|
|
48
48
|
/* Define the printf format specifer to use for size_t output */
|
49
49
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
50
|
-
|
51
|
-
|
52
|
-
#
|
50
|
+
|
51
|
+
/* The first block is needed to avoid warnings on MingW amd64 */
|
52
|
+
# if (SIZE_MAX == ULLONG_MAX)
|
53
|
+
# define PRIuZ "I64u"
|
54
|
+
# define PRIxZ "I64x"
|
55
|
+
# define PRIXZ "I64X"
|
56
|
+
# define PRIdZ "I64d"
|
57
|
+
# else
|
58
|
+
# define PRIuZ "Iu"
|
59
|
+
# define PRIxZ "Ix"
|
60
|
+
# define PRIXZ "IX"
|
61
|
+
# define PRIdZ "Id"
|
62
|
+
# endif
|
63
|
+
|
53
64
|
#else
|
54
65
|
# define PRIuZ "zu"
|
55
66
|
# define PRIxZ "zx"
|
67
|
+
# define PRIXZ "zX"
|
56
68
|
# define PRIdZ "zd"
|
57
69
|
#endif
|
58
70
|
|
@@ -146,7 +146,7 @@ static int checkout_notify(
|
|
146
146
|
int error = data->opts.notify_cb(
|
147
147
|
why, path, baseline, target, workdir, data->opts.notify_payload);
|
148
148
|
|
149
|
-
return
|
149
|
+
return git_error_set_after_callback_function(
|
150
150
|
error, "git_checkout notification");
|
151
151
|
}
|
152
152
|
}
|
@@ -193,7 +193,7 @@ static bool checkout_is_workdir_modified(
|
|
193
193
|
bool rval = false;
|
194
194
|
|
195
195
|
if (git_submodule_lookup(&sm, data->repo, wditem->path) < 0) {
|
196
|
-
|
196
|
+
git_error_clear();
|
197
197
|
return true;
|
198
198
|
}
|
199
199
|
|
@@ -354,7 +354,7 @@ static bool wd_item_is_removable(
|
|
354
354
|
static int checkout_queue_remove(checkout_data *data, const char *path)
|
355
355
|
{
|
356
356
|
char *copy = git_pool_strdup(&data->pool, path);
|
357
|
-
|
357
|
+
GIT_ERROR_CHECK_ALLOC(copy);
|
358
358
|
return git_vector_insert(&data->removes, copy);
|
359
359
|
}
|
360
360
|
|
@@ -492,7 +492,7 @@ static int checkout_action_with_wd(
|
|
492
492
|
switch (delta->status) {
|
493
493
|
case GIT_DELTA_UNMODIFIED: /* case 14/15 or 33 */
|
494
494
|
if (checkout_is_workdir_modified(data, &delta->old_file, &delta->new_file, wd)) {
|
495
|
-
|
495
|
+
GIT_ERROR_CHECK_ERROR(
|
496
496
|
checkout_notify(data, GIT_CHECKOUT_NOTIFY_DIRTY, delta, wd) );
|
497
497
|
*action = CHECKOUT_ACTION_IF(FORCE, UPDATE_BLOB, NONE);
|
498
498
|
}
|
@@ -561,7 +561,7 @@ static int checkout_action_with_wd_blocker(
|
|
561
561
|
switch (delta->status) {
|
562
562
|
case GIT_DELTA_UNMODIFIED:
|
563
563
|
/* should show delta as dirty / deleted */
|
564
|
-
|
564
|
+
GIT_ERROR_CHECK_ERROR(
|
565
565
|
checkout_notify(data, GIT_CHECKOUT_NOTIFY_DIRTY, delta, wd) );
|
566
566
|
*action = CHECKOUT_ACTION_IF(FORCE, REMOVE_AND_UPDATE, NONE);
|
567
567
|
break;
|
@@ -594,9 +594,9 @@ static int checkout_action_with_wd_dir(
|
|
594
594
|
|
595
595
|
switch (delta->status) {
|
596
596
|
case GIT_DELTA_UNMODIFIED: /* case 19 or 24 (or 34 but not really) */
|
597
|
-
|
597
|
+
GIT_ERROR_CHECK_ERROR(
|
598
598
|
checkout_notify(data, GIT_CHECKOUT_NOTIFY_DIRTY, delta, NULL));
|
599
|
-
|
599
|
+
GIT_ERROR_CHECK_ERROR(
|
600
600
|
checkout_notify(data, GIT_CHECKOUT_NOTIFY_UNTRACKED, NULL, wd));
|
601
601
|
*action = CHECKOUT_ACTION_IF(FORCE, REMOVE_AND_UPDATE, NONE);
|
602
602
|
break;
|
@@ -611,7 +611,7 @@ static int checkout_action_with_wd_dir(
|
|
611
611
|
break;
|
612
612
|
case GIT_DELTA_DELETED: /* case 11 (and 27 for dir) */
|
613
613
|
if (delta->old_file.mode != GIT_FILEMODE_TREE)
|
614
|
-
|
614
|
+
GIT_ERROR_CHECK_ERROR(
|
615
615
|
checkout_notify(data, GIT_CHECKOUT_NOTIFY_UNTRACKED, NULL, wd));
|
616
616
|
break;
|
617
617
|
case GIT_DELTA_TYPECHANGE: /* case 24 or 31 */
|
@@ -902,7 +902,7 @@ static int checkout_conflict_append_update(
|
|
902
902
|
int error;
|
903
903
|
|
904
904
|
conflict = git__calloc(1, sizeof(checkout_conflictdata));
|
905
|
-
|
905
|
+
GIT_ERROR_CHECK_ALLOC(conflict);
|
906
906
|
|
907
907
|
conflict->ancestor = ancestor;
|
908
908
|
conflict->ours = ours;
|
@@ -1044,20 +1044,20 @@ static int checkout_conflicts_load_byname_entry(
|
|
1044
1044
|
*theirs_out = NULL;
|
1045
1045
|
|
1046
1046
|
if (!name_entry->ancestor) {
|
1047
|
-
|
1047
|
+
git_error_set(GIT_ERROR_INDEX, "a NAME entry exists without an ancestor");
|
1048
1048
|
error = -1;
|
1049
1049
|
goto done;
|
1050
1050
|
}
|
1051
1051
|
|
1052
1052
|
if (!name_entry->ours && !name_entry->theirs) {
|
1053
|
-
|
1053
|
+
git_error_set(GIT_ERROR_INDEX, "a NAME entry exists without an ours or theirs");
|
1054
1054
|
error = -1;
|
1055
1055
|
goto done;
|
1056
1056
|
}
|
1057
1057
|
|
1058
1058
|
if ((ancestor = checkout_conflicts_search_ancestor(data,
|
1059
1059
|
name_entry->ancestor)) == NULL) {
|
1060
|
-
|
1060
|
+
git_error_set(GIT_ERROR_INDEX,
|
1061
1061
|
"a NAME entry referenced ancestor entry '%s' which does not exist in the main index",
|
1062
1062
|
name_entry->ancestor);
|
1063
1063
|
error = -1;
|
@@ -1069,7 +1069,7 @@ static int checkout_conflicts_load_byname_entry(
|
|
1069
1069
|
ours = ancestor;
|
1070
1070
|
else if ((ours = checkout_conflicts_search_branch(data, name_entry->ours)) == NULL ||
|
1071
1071
|
ours->ours == NULL) {
|
1072
|
-
|
1072
|
+
git_error_set(GIT_ERROR_INDEX,
|
1073
1073
|
"a NAME entry referenced our entry '%s' which does not exist in the main index",
|
1074
1074
|
name_entry->ours);
|
1075
1075
|
error = -1;
|
@@ -1084,7 +1084,7 @@ static int checkout_conflicts_load_byname_entry(
|
|
1084
1084
|
theirs = ours;
|
1085
1085
|
else if ((theirs = checkout_conflicts_search_branch(data, name_entry->theirs)) == NULL ||
|
1086
1086
|
theirs->theirs == NULL) {
|
1087
|
-
|
1087
|
+
git_error_set(GIT_ERROR_INDEX,
|
1088
1088
|
"a NAME entry referenced their entry '%s' which does not exist in the main index",
|
1089
1089
|
name_entry->theirs);
|
1090
1090
|
error = -1;
|
@@ -1183,7 +1183,7 @@ static int checkout_conflicts_mark_directoryfile(
|
|
1183
1183
|
|
1184
1184
|
if ((error = git_index_find(&j, index, path)) < 0) {
|
1185
1185
|
if (error == GIT_ENOTFOUND)
|
1186
|
-
|
1186
|
+
git_error_set(GIT_ERROR_INDEX,
|
1187
1187
|
"index inconsistency, could not find entry for expected conflict '%s'", path);
|
1188
1188
|
|
1189
1189
|
goto done;
|
@@ -1191,7 +1191,7 @@ static int checkout_conflicts_mark_directoryfile(
|
|
1191
1191
|
|
1192
1192
|
for (; j < len; j++) {
|
1193
1193
|
if ((entry = git_index_get_byindex(index, j)) == NULL) {
|
1194
|
-
|
1194
|
+
git_error_set(GIT_ERROR_INDEX,
|
1195
1195
|
"index inconsistency, truncated index while loading expected conflict '%s'", path);
|
1196
1196
|
error = -1;
|
1197
1197
|
goto done;
|
@@ -1252,7 +1252,7 @@ static int checkout_conflict_append_remove(
|
|
1252
1252
|
else
|
1253
1253
|
abort();
|
1254
1254
|
|
1255
|
-
|
1255
|
+
GIT_ERROR_CHECK_ALLOC(name);
|
1256
1256
|
|
1257
1257
|
return git_vector_insert(&data->remove_conflicts, (char *)name);
|
1258
1258
|
}
|
@@ -1277,14 +1277,14 @@ static int checkout_verify_paths(
|
|
1277
1277
|
|
1278
1278
|
if (action & CHECKOUT_ACTION__REMOVE) {
|
1279
1279
|
if (!git_path_isvalid(repo, delta->old_file.path, delta->old_file.mode, flags)) {
|
1280
|
-
|
1280
|
+
git_error_set(GIT_ERROR_CHECKOUT, "cannot remove invalid path '%s'", delta->old_file.path);
|
1281
1281
|
return -1;
|
1282
1282
|
}
|
1283
1283
|
}
|
1284
1284
|
|
1285
1285
|
if (action & ~CHECKOUT_ACTION__REMOVE) {
|
1286
1286
|
if (!git_path_isvalid(repo, delta->new_file.path, delta->new_file.mode, flags)) {
|
1287
|
-
|
1287
|
+
git_error_set(GIT_ERROR_CHECKOUT, "cannot checkout to invalid path '%s'", delta->new_file.path);
|
1288
1288
|
return -1;
|
1289
1289
|
}
|
1290
1290
|
}
|
@@ -1354,7 +1354,7 @@ static int checkout_get_actions(
|
|
1354
1354
|
if (counts[CHECKOUT_ACTION__CONFLICT] > 0 &&
|
1355
1355
|
(data->strategy & GIT_CHECKOUT_ALLOW_CONFLICTS) == 0)
|
1356
1356
|
{
|
1357
|
-
|
1357
|
+
git_error_set(GIT_ERROR_CHECKOUT, "%"PRIuZ" %s checkout",
|
1358
1358
|
counts[CHECKOUT_ACTION__CONFLICT],
|
1359
1359
|
counts[CHECKOUT_ACTION__CONFLICT] == 1 ?
|
1360
1360
|
"conflict prevents" : "conflicts prevent");
|
@@ -1453,10 +1453,10 @@ static int mkpath2file(
|
|
1453
1453
|
*/
|
1454
1454
|
error = git_futils_rmdir_r(path, NULL, GIT_RMDIR_REMOVE_FILES);
|
1455
1455
|
} else if (errno != ENOENT) {
|
1456
|
-
|
1456
|
+
git_error_set(GIT_ERROR_OS, "failed to stat '%s'", path);
|
1457
1457
|
return GIT_EEXISTS;
|
1458
1458
|
} else {
|
1459
|
-
|
1459
|
+
git_error_clear();
|
1460
1460
|
}
|
1461
1461
|
}
|
1462
1462
|
|
@@ -1477,7 +1477,7 @@ static int checkout_stream_write(
|
|
1477
1477
|
int ret;
|
1478
1478
|
|
1479
1479
|
if ((ret = p_write(stream->fd, buffer, len)) < 0)
|
1480
|
-
|
1480
|
+
git_error_set(GIT_ERROR_OS, "could not write to '%s'", stream->path);
|
1481
1481
|
|
1482
1482
|
return ret;
|
1483
1483
|
}
|
@@ -1526,7 +1526,7 @@ static int blob_content_to_file(
|
|
1526
1526
|
mode = GIT_FILEMODE_BLOB;
|
1527
1527
|
|
1528
1528
|
if ((fd = p_open(path, flags, mode)) < 0) {
|
1529
|
-
|
1529
|
+
git_error_set(GIT_ERROR_OS, "could not open '%s' for writing", path);
|
1530
1530
|
return fd;
|
1531
1531
|
}
|
1532
1532
|
|
@@ -1563,7 +1563,7 @@ static int blob_content_to_file(
|
|
1563
1563
|
data->perfdata.stat_calls++;
|
1564
1564
|
|
1565
1565
|
if ((error = p_stat(path, st)) < 0) {
|
1566
|
-
|
1566
|
+
git_error_set(GIT_ERROR_OS, "failed to stat '%s'", path);
|
1567
1567
|
return error;
|
1568
1568
|
}
|
1569
1569
|
|
@@ -1590,7 +1590,7 @@ static int blob_content_to_link(
|
|
1590
1590
|
|
1591
1591
|
if (data->can_symlink) {
|
1592
1592
|
if ((error = p_symlink(git_buf_cstr(&linktarget), path)) < 0)
|
1593
|
-
|
1593
|
+
git_error_set(GIT_ERROR_OS, "could not create symlink %s", path);
|
1594
1594
|
} else {
|
1595
1595
|
error = git_futils_fake_symlink(git_buf_cstr(&linktarget), path);
|
1596
1596
|
}
|
@@ -1599,12 +1599,12 @@ static int blob_content_to_link(
|
|
1599
1599
|
data->perfdata.stat_calls++;
|
1600
1600
|
|
1601
1601
|
if ((error = p_lstat(path, st)) < 0)
|
1602
|
-
|
1602
|
+
git_error_set(GIT_ERROR_CHECKOUT, "could not stat symlink %s", path);
|
1603
1603
|
|
1604
1604
|
st->st_mode = GIT_FILEMODE_LINK;
|
1605
1605
|
}
|
1606
1606
|
|
1607
|
-
|
1607
|
+
git_buf_dispose(&linktarget);
|
1608
1608
|
|
1609
1609
|
return error;
|
1610
1610
|
}
|
@@ -1643,8 +1643,8 @@ static int checkout_submodule_update_index(
|
|
1643
1643
|
|
1644
1644
|
data->perfdata.stat_calls++;
|
1645
1645
|
if (p_stat(fullpath->ptr, &st) < 0) {
|
1646
|
-
|
1647
|
-
|
1646
|
+
git_error_set(
|
1647
|
+
GIT_ERROR_CHECKOUT, "could not stat submodule %s\n", file->path);
|
1648
1648
|
return GIT_ENOTFOUND;
|
1649
1649
|
}
|
1650
1650
|
|
@@ -1675,7 +1675,7 @@ static int checkout_submodule(
|
|
1675
1675
|
* have a .gitmodules - core Git just makes an empty directory
|
1676
1676
|
*/
|
1677
1677
|
if (error == GIT_ENOTFOUND) {
|
1678
|
-
|
1678
|
+
git_error_clear();
|
1679
1679
|
return checkout_submodule_update_index(data, file);
|
1680
1680
|
}
|
1681
1681
|
|
@@ -1717,7 +1717,7 @@ static int checkout_safe_for_update_only(
|
|
1717
1717
|
return 0;
|
1718
1718
|
|
1719
1719
|
/* otherwise, stat error and no update */
|
1720
|
-
|
1720
|
+
git_error_set(GIT_ERROR_OS, "failed to stat '%s'", path);
|
1721
1721
|
return -1;
|
1722
1722
|
}
|
1723
1723
|
|
@@ -1756,7 +1756,7 @@ static int checkout_write_content(
|
|
1756
1756
|
if ((data->strategy & GIT_CHECKOUT_ALLOW_CONFLICTS) != 0 &&
|
1757
1757
|
(error == GIT_ENOTFOUND || error == GIT_EEXISTS))
|
1758
1758
|
{
|
1759
|
-
|
1759
|
+
git_error_clear();
|
1760
1760
|
error = 0;
|
1761
1761
|
}
|
1762
1762
|
|
@@ -1863,7 +1863,7 @@ static int checkout_deferred_remove(git_repository *repo, const char *path)
|
|
1863
1863
|
|
1864
1864
|
if (error == GIT_ENOTFOUND) {
|
1865
1865
|
error = 0;
|
1866
|
-
|
1866
|
+
git_error_clear();
|
1867
1867
|
}
|
1868
1868
|
|
1869
1869
|
return error;
|
@@ -1944,7 +1944,7 @@ static int checkout_lookup_head_tree(git_tree **out, git_repository *repo)
|
|
1944
1944
|
git_object *head;
|
1945
1945
|
|
1946
1946
|
if (!(error = git_repository_head(&ref, repo)) &&
|
1947
|
-
!(error = git_reference_peel(&head, ref,
|
1947
|
+
!(error = git_reference_peel(&head, ref, GIT_OBJECT_TREE)))
|
1948
1948
|
*out = (git_tree *)head;
|
1949
1949
|
|
1950
1950
|
git_reference_free(ref);
|
@@ -1989,7 +1989,7 @@ static int checkout_path_suffixed(git_buf *path, const char *suffix)
|
|
1989
1989
|
if (i == INT_MAX) {
|
1990
1990
|
git_buf_truncate(path, path_len);
|
1991
1991
|
|
1992
|
-
|
1992
|
+
git_error_set(GIT_ERROR_CHECKOUT, "could not write '%s': working directory file exists", path->ptr);
|
1993
1993
|
return GIT_EEXISTS;
|
1994
1994
|
}
|
1995
1995
|
|
@@ -2123,7 +2123,7 @@ static int checkout_write_merge(
|
|
2123
2123
|
goto done;
|
2124
2124
|
|
2125
2125
|
if (result.path == NULL || result.mode == 0) {
|
2126
|
-
|
2126
|
+
git_error_set(GIT_ERROR_CHECKOUT, "could not merge contents of file");
|
2127
2127
|
error = GIT_ECONFLICT;
|
2128
2128
|
goto done;
|
2129
2129
|
}
|
@@ -2161,13 +2161,13 @@ static int checkout_write_merge(
|
|
2161
2161
|
done:
|
2162
2162
|
git_filter_list_free(fl);
|
2163
2163
|
|
2164
|
-
|
2165
|
-
|
2166
|
-
|
2164
|
+
git_buf_dispose(&out_data);
|
2165
|
+
git_buf_dispose(&our_label);
|
2166
|
+
git_buf_dispose(&their_label);
|
2167
2167
|
|
2168
2168
|
git_merge_file_result_free(&result);
|
2169
|
-
|
2170
|
-
|
2169
|
+
git_buf_dispose(&path_workdir);
|
2170
|
+
git_buf_dispose(&path_suffixed);
|
2171
2171
|
|
2172
2172
|
return error;
|
2173
2173
|
}
|
@@ -2179,7 +2179,7 @@ static int checkout_conflict_add(
|
|
2179
2179
|
int error = git_index_remove(data->index, conflict->path, 0);
|
2180
2180
|
|
2181
2181
|
if (error == GIT_ENOTFOUND)
|
2182
|
-
|
2182
|
+
git_error_clear();
|
2183
2183
|
else if (error < 0)
|
2184
2184
|
return error;
|
2185
2185
|
|
@@ -2347,8 +2347,8 @@ static void checkout_data_clear(checkout_data *data)
|
|
2347
2347
|
git__free(data->pfx);
|
2348
2348
|
data->pfx = NULL;
|
2349
2349
|
|
2350
|
-
|
2351
|
-
|
2350
|
+
git_buf_dispose(&data->target_path);
|
2351
|
+
git_buf_dispose(&data->tmp);
|
2352
2352
|
|
2353
2353
|
git_index_free(data->index);
|
2354
2354
|
data->index = NULL;
|
@@ -2370,7 +2370,7 @@ static int checkout_data_init(
|
|
2370
2370
|
memset(data, 0, sizeof(*data));
|
2371
2371
|
|
2372
2372
|
if (!repo) {
|
2373
|
-
|
2373
|
+
git_error_set(GIT_ERROR_CHECKOUT, "cannot checkout nothing");
|
2374
2374
|
return -1;
|
2375
2375
|
}
|
2376
2376
|
|
@@ -2381,7 +2381,7 @@ static int checkout_data_init(
|
|
2381
2381
|
data->repo = repo;
|
2382
2382
|
data->target = target;
|
2383
2383
|
|
2384
|
-
|
2384
|
+
GIT_ERROR_CHECK_VERSION(
|
2385
2385
|
proposed, GIT_CHECKOUT_OPTIONS_VERSION, "git_checkout_options");
|
2386
2386
|
|
2387
2387
|
if (!proposed)
|
@@ -2397,6 +2397,9 @@ static int checkout_data_init(
|
|
2397
2397
|
GIT_DIR_MODE, GIT_MKDIR_VERIFY_DIR)) < 0)
|
2398
2398
|
goto cleanup;
|
2399
2399
|
|
2400
|
+
if ((error = git_repository_index(&data->index, data->repo)) < 0)
|
2401
|
+
goto cleanup;
|
2402
|
+
|
2400
2403
|
/* refresh config and index content unless NO_REFRESH is given */
|
2401
2404
|
if ((data->opts.checkout_strategy & GIT_CHECKOUT_NO_REFRESH) == 0) {
|
2402
2405
|
git_config *cfg;
|
@@ -2404,24 +2407,30 @@ static int checkout_data_init(
|
|
2404
2407
|
if ((error = git_repository_config__weakptr(&cfg, repo)) < 0)
|
2405
2408
|
goto cleanup;
|
2406
2409
|
|
2407
|
-
/*
|
2408
|
-
*
|
2409
|
-
*
|
2410
|
+
/* Reload the repository index (unless we're checking out the
|
2411
|
+
* index; then it has the changes we're trying to check out
|
2412
|
+
* and those should not be overwritten.)
|
2410
2413
|
*/
|
2411
|
-
if ((error = git_repository_index(&data->index, data->repo)) < 0)
|
2412
|
-
goto cleanup;
|
2413
|
-
|
2414
2414
|
if (data->index != git_iterator_index(target)) {
|
2415
|
-
if (
|
2416
|
-
|
2417
|
-
|
2418
|
-
|
2419
|
-
|
2420
|
-
|
2421
|
-
|
2422
|
-
|
2423
|
-
|
2424
|
-
|
2415
|
+
if (data->opts.checkout_strategy & GIT_CHECKOUT_FORCE) {
|
2416
|
+
/* When forcing, we can blindly re-read the index */
|
2417
|
+
if ((error = git_index_read(data->index, false)) < 0)
|
2418
|
+
goto cleanup;
|
2419
|
+
} else {
|
2420
|
+
/*
|
2421
|
+
* When not being forced, we need to check for unresolved
|
2422
|
+
* conflicts and unsaved changes in the index before
|
2423
|
+
* proceeding.
|
2424
|
+
*/
|
2425
|
+
if (git_index_has_conflicts(data->index)) {
|
2426
|
+
error = GIT_ECONFLICT;
|
2427
|
+
git_error_set(GIT_ERROR_CHECKOUT,
|
2428
|
+
"unresolved conflicts exist in the index");
|
2429
|
+
goto cleanup;
|
2430
|
+
}
|
2431
|
+
|
2432
|
+
if ((error = git_index_read_safely(data->index)) < 0)
|
2433
|
+
goto cleanup;
|
2425
2434
|
}
|
2426
2435
|
|
2427
2436
|
/* clean conflict data in the current index */
|
@@ -2474,7 +2483,7 @@ static int checkout_data_init(
|
|
2474
2483
|
|
2475
2484
|
if (error == GIT_EUNBORNBRANCH) {
|
2476
2485
|
error = 0;
|
2477
|
-
|
2486
|
+
git_error_clear();
|
2478
2487
|
}
|
2479
2488
|
|
2480
2489
|
if (error < 0)
|
@@ -2497,7 +2506,7 @@ static int checkout_data_init(
|
|
2497
2506
|
else if (strcmp(conflict_style->value, "diff3") == 0)
|
2498
2507
|
data->opts.checkout_strategy |= GIT_CHECKOUT_CONFLICT_STYLE_DIFF3;
|
2499
2508
|
else {
|
2500
|
-
|
2509
|
+
git_error_set(GIT_ERROR_CHECKOUT, "unknown style '%s' given for 'merge.conflictstyle'",
|
2501
2510
|
conflict_style->value);
|
2502
2511
|
error = -1;
|
2503
2512
|
git_config_entry_free(conflict_style);
|
@@ -2679,7 +2688,7 @@ int git_checkout_index(
|
|
2679
2688
|
git_iterator *index_i;
|
2680
2689
|
|
2681
2690
|
if (!index && !repo) {
|
2682
|
-
|
2691
|
+
git_error_set(GIT_ERROR_CHECKOUT,
|
2683
2692
|
"must provide either repository or index to checkout");
|
2684
2693
|
return -1;
|
2685
2694
|
}
|
@@ -2687,7 +2696,7 @@ int git_checkout_index(
|
|
2687
2696
|
if (index && repo &&
|
2688
2697
|
git_index_owner(index) &&
|
2689
2698
|
git_index_owner(index) != repo) {
|
2690
|
-
|
2699
|
+
git_error_set(GIT_ERROR_CHECKOUT,
|
2691
2700
|
"index to checkout does not match repository");
|
2692
2701
|
return -1;
|
2693
2702
|
} else if(index && repo && !git_index_owner(index)) {
|
@@ -2726,12 +2735,12 @@ int git_checkout_tree(
|
|
2726
2735
|
git_iterator_options iter_opts = GIT_ITERATOR_OPTIONS_INIT;
|
2727
2736
|
|
2728
2737
|
if (!treeish && !repo) {
|
2729
|
-
|
2738
|
+
git_error_set(GIT_ERROR_CHECKOUT,
|
2730
2739
|
"must provide either repository or tree to checkout");
|
2731
2740
|
return -1;
|
2732
2741
|
}
|
2733
2742
|
if (treeish && repo && git_object_owner(treeish) != repo) {
|
2734
|
-
|
2743
|
+
git_error_set(GIT_ERROR_CHECKOUT,
|
2735
2744
|
"object to checkout does not match repository");
|
2736
2745
|
return -1;
|
2737
2746
|
}
|
@@ -2740,17 +2749,17 @@ int git_checkout_tree(
|
|
2740
2749
|
repo = git_object_owner(treeish);
|
2741
2750
|
|
2742
2751
|
if (treeish) {
|
2743
|
-
if (git_object_peel((git_object **)&tree, treeish,
|
2744
|
-
|
2745
|
-
|
2752
|
+
if (git_object_peel((git_object **)&tree, treeish, GIT_OBJECT_TREE) < 0) {
|
2753
|
+
git_error_set(
|
2754
|
+
GIT_ERROR_CHECKOUT, "provided object cannot be peeled to a tree");
|
2746
2755
|
return -1;
|
2747
2756
|
}
|
2748
2757
|
}
|
2749
2758
|
else {
|
2750
2759
|
if ((error = checkout_lookup_head_tree(&tree, repo)) < 0) {
|
2751
2760
|
if (error != GIT_EUNBORNBRANCH)
|
2752
|
-
|
2753
|
-
|
2761
|
+
git_error_set(
|
2762
|
+
GIT_ERROR_CHECKOUT,
|
2754
2763
|
"HEAD could not be peeled to a tree and no treeish given");
|
2755
2764
|
return error;
|
2756
2765
|
}
|