rugged 0.21.0 → 0.21.1b0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -5
- data/ext/rugged/extconf.rb +8 -8
- data/ext/rugged/rugged.h +1 -1
- data/ext/rugged/rugged_cred.c +23 -0
- data/ext/rugged/rugged_index.c +5 -1
- data/ext/rugged/rugged_remote.c +68 -0
- data/ext/rugged/rugged_repo.c +287 -5
- data/ext/rugged/rugged_tag_collection.c +70 -2
- data/ext/rugged/rugged_tree.c +29 -10
- data/lib/rugged.rb +1 -0
- data/lib/rugged/attributes.rb +41 -0
- data/lib/rugged/diff.rb +0 -1
- data/lib/rugged/diff/line.rb +1 -3
- data/lib/rugged/patch.rb +12 -2
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +11 -0
- data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +324 -0
- data/vendor/libgit2/deps/http-parser/http_parser.h +2 -0
- data/vendor/libgit2/deps/zlib/adler32.c +39 -29
- data/vendor/libgit2/deps/zlib/crc32.c +33 -50
- data/vendor/libgit2/deps/zlib/crc32.h +1 -1
- data/vendor/libgit2/deps/zlib/deflate.c +198 -65
- data/vendor/libgit2/deps/zlib/deflate.h +8 -4
- data/vendor/libgit2/deps/zlib/infback.c +640 -0
- data/vendor/libgit2/deps/zlib/inffast.c +3 -3
- data/vendor/libgit2/deps/zlib/inffixed.h +3 -3
- data/vendor/libgit2/deps/zlib/inflate.c +84 -52
- data/vendor/libgit2/deps/zlib/inftrees.c +15 -39
- data/vendor/libgit2/deps/zlib/trees.c +18 -36
- data/vendor/libgit2/deps/zlib/zconf.h +4 -0
- data/vendor/libgit2/deps/zlib/zlib.h +250 -95
- data/vendor/libgit2/deps/zlib/zutil.c +13 -10
- data/vendor/libgit2/deps/zlib/zutil.h +41 -62
- data/vendor/libgit2/include/git2/attr.h +16 -13
- data/vendor/libgit2/include/git2/buffer.h +16 -0
- data/vendor/libgit2/include/git2/checkout.h +12 -12
- data/vendor/libgit2/include/git2/cherrypick.h +15 -15
- data/vendor/libgit2/include/git2/clone.h +77 -69
- data/vendor/libgit2/include/git2/diff.h +7 -0
- data/vendor/libgit2/include/git2/errors.h +1 -0
- data/vendor/libgit2/include/git2/merge.h +16 -0
- data/vendor/libgit2/include/git2/oid.h +8 -4
- data/vendor/libgit2/include/git2/oidarray.h +40 -0
- data/vendor/libgit2/include/git2/remote.h +5 -24
- data/vendor/libgit2/include/git2/repository.h +4 -1
- data/vendor/libgit2/include/git2/reset.h +4 -0
- data/vendor/libgit2/include/git2/status.h +17 -14
- data/vendor/libgit2/include/git2/submodule.h +18 -0
- data/vendor/libgit2/include/git2/sys/transport.h +354 -0
- data/vendor/libgit2/include/git2/transport.h +34 -327
- data/vendor/libgit2/include/git2/types.h +16 -6
- data/vendor/libgit2/src/array.h +1 -1
- data/vendor/libgit2/src/attr_file.c +14 -1
- data/vendor/libgit2/src/blame.c +0 -1
- data/vendor/libgit2/src/buffer.c +67 -10
- data/vendor/libgit2/src/buffer.h +4 -2
- data/vendor/libgit2/src/cache.c +9 -9
- data/vendor/libgit2/src/cache.h +1 -1
- data/vendor/libgit2/src/checkout.c +118 -23
- data/vendor/libgit2/src/cherrypick.c +41 -44
- data/vendor/libgit2/src/clone.c +94 -56
- data/vendor/libgit2/src/config_file.c +4 -4
- data/vendor/libgit2/src/diff.c +21 -0
- data/vendor/libgit2/src/diff_file.c +1 -0
- data/vendor/libgit2/src/diff_print.c +11 -9
- data/vendor/libgit2/src/diff_tform.c +3 -1
- data/vendor/libgit2/src/errors.c +9 -7
- data/vendor/libgit2/src/fileops.c +5 -3
- data/vendor/libgit2/src/global.c +9 -1
- data/vendor/libgit2/src/global.h +1 -0
- data/vendor/libgit2/src/graph.c +2 -2
- data/vendor/libgit2/src/indexer.c +6 -1
- data/vendor/libgit2/src/merge.c +98 -144
- data/vendor/libgit2/src/merge.h +1 -1
- data/vendor/libgit2/src/netops.c +4 -0
- data/vendor/libgit2/src/oid.c +8 -0
- data/vendor/libgit2/src/oid.h +11 -0
- data/vendor/libgit2/src/oidarray.c +21 -0
- data/vendor/libgit2/src/oidarray.h +18 -0
- data/vendor/libgit2/src/pack.c +1 -4
- data/vendor/libgit2/src/path.c +93 -33
- data/vendor/libgit2/src/path.h +21 -0
- data/vendor/libgit2/src/pool.c +1 -1
- data/vendor/libgit2/src/posix.h +46 -28
- data/vendor/libgit2/src/refs.h +2 -2
- data/vendor/libgit2/src/refspec.c +54 -18
- data/vendor/libgit2/src/remote.c +31 -8
- data/vendor/libgit2/src/remote.h +3 -0
- data/vendor/libgit2/src/repository.c +27 -11
- data/vendor/libgit2/src/revert.c +4 -6
- data/vendor/libgit2/src/revparse.c +15 -18
- data/vendor/libgit2/src/revwalk.c +0 -3
- data/vendor/libgit2/src/signature.c +2 -2
- data/vendor/libgit2/src/stash.c +2 -1
- data/vendor/libgit2/src/status.c +11 -2
- data/vendor/libgit2/src/strnlen.h +2 -1
- data/vendor/libgit2/src/submodule.c +73 -33
- data/vendor/libgit2/src/thread-utils.h +0 -7
- data/vendor/libgit2/src/trace.h +9 -1
- data/vendor/libgit2/src/transport.c +93 -90
- data/vendor/libgit2/src/transports/auth.c +71 -0
- data/vendor/libgit2/src/transports/auth.h +63 -0
- data/vendor/libgit2/src/transports/auth_negotiate.c +275 -0
- data/vendor/libgit2/src/transports/auth_negotiate.h +27 -0
- data/vendor/libgit2/src/transports/cred.c +58 -0
- data/vendor/libgit2/src/transports/cred.h +14 -0
- data/vendor/libgit2/src/transports/cred_helpers.c +3 -0
- data/vendor/libgit2/src/transports/git.c +1 -0
- data/vendor/libgit2/src/transports/http.c +168 -76
- data/vendor/libgit2/src/transports/smart.h +1 -0
- data/vendor/libgit2/src/transports/smart_protocol.c +4 -2
- data/vendor/libgit2/src/transports/ssh.c +214 -38
- data/vendor/libgit2/src/transports/winhttp.c +26 -6
- data/vendor/libgit2/src/unix/posix.h +23 -9
- data/vendor/libgit2/src/unix/realpath.c +8 -7
- data/vendor/libgit2/src/util.c +2 -1
- data/vendor/libgit2/src/util.h +3 -3
- data/vendor/libgit2/src/win32/mingw-compat.h +5 -12
- data/vendor/libgit2/src/win32/msvc-compat.h +3 -32
- data/vendor/libgit2/src/win32/posix.h +20 -31
- data/vendor/libgit2/src/win32/posix_w32.c +33 -4
- metadata +81 -69
data/vendor/libgit2/src/refs.h
CHANGED
@@ -35,7 +35,7 @@
|
|
35
35
|
#define GIT_FETCH_HEAD_FILE "FETCH_HEAD"
|
36
36
|
#define GIT_MERGE_HEAD_FILE "MERGE_HEAD"
|
37
37
|
#define GIT_REVERT_HEAD_FILE "REVERT_HEAD"
|
38
|
-
#define
|
38
|
+
#define GIT_CHERRYPICK_HEAD_FILE "CHERRY_PICK_HEAD"
|
39
39
|
#define GIT_BISECT_LOG_FILE "BISECT_LOG"
|
40
40
|
#define GIT_REBASE_MERGE_DIR "rebase-merge/"
|
41
41
|
#define GIT_REBASE_MERGE_INTERACTIVE_FILE GIT_REBASE_MERGE_DIR "interactive"
|
@@ -63,7 +63,7 @@ struct git_reference {
|
|
63
63
|
} target;
|
64
64
|
|
65
65
|
git_oid peel;
|
66
|
-
char name[
|
66
|
+
char name[GIT_FLEX_ARRAY];
|
67
67
|
};
|
68
68
|
|
69
69
|
git_reference *git_reference__set_name(git_reference *ref, const char *name);
|
@@ -181,39 +181,75 @@ int git_refspec_dst_matches(const git_refspec *refspec, const char *refname)
|
|
181
181
|
static int refspec_transform(
|
182
182
|
git_buf *out, const char *from, const char *to, const char *name)
|
183
183
|
{
|
184
|
-
|
185
|
-
|
186
|
-
size_t
|
184
|
+
const char *from_star, *to_star;
|
185
|
+
const char *name_slash, *from_slash;
|
186
|
+
size_t replacement_len, star_offset;
|
187
187
|
|
188
188
|
git_buf_sanitize(out);
|
189
|
+
git_buf_clear(out);
|
189
190
|
|
190
|
-
|
191
|
-
|
191
|
+
/*
|
192
|
+
* There are two parts to each side of a refspec, the bit
|
193
|
+
* before the star and the bit after it. The star can be in
|
194
|
+
* the middle of the pattern, so we need to look at each bit
|
195
|
+
* individually.
|
196
|
+
*/
|
197
|
+
from_star = strchr(from, '*');
|
198
|
+
to_star = strchr(to, '*');
|
192
199
|
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
if (out->ptr[to_len - 1] != '*')
|
198
|
-
return 0;
|
199
|
-
git_buf_shorten(out, 1); /* remove trailing '*' copied from 'to' */
|
200
|
-
}
|
200
|
+
assert(from_star && to_star);
|
201
|
+
|
202
|
+
/* star offset, both in 'from' and in 'name' */
|
203
|
+
star_offset = from_star - from;
|
201
204
|
|
202
|
-
|
203
|
-
|
204
|
-
if (from_len > name_len)
|
205
|
-
from_len = name_len;
|
205
|
+
/* the first half is copied over */
|
206
|
+
git_buf_put(out, to, to_star - to);
|
206
207
|
|
207
|
-
|
208
|
+
/* then we copy over the replacement, from the star's offset to the next slash in 'name' */
|
209
|
+
name_slash = strchr(name + star_offset, '/');
|
210
|
+
if (!name_slash)
|
211
|
+
name_slash = strrchr(name, '\0');
|
212
|
+
|
213
|
+
/* if there is no slash after the star in 'from', we want to copy everything over */
|
214
|
+
from_slash = strchr(from + star_offset, '/');
|
215
|
+
if (!from_slash)
|
216
|
+
name_slash = strrchr(name, '\0');
|
217
|
+
|
218
|
+
replacement_len = (name_slash - name) - star_offset;
|
219
|
+
git_buf_put(out, name + star_offset, replacement_len);
|
220
|
+
|
221
|
+
return git_buf_puts(out, to_star + 1);
|
208
222
|
}
|
209
223
|
|
210
224
|
int git_refspec_transform(git_buf *out, const git_refspec *spec, const char *name)
|
211
225
|
{
|
226
|
+
assert(out && spec && name);
|
227
|
+
git_buf_sanitize(out);
|
228
|
+
|
229
|
+
if (!git_refspec_src_matches(spec, name)) {
|
230
|
+
giterr_set(GITERR_INVALID, "ref '%s' doesn't match the source", name);
|
231
|
+
return -1;
|
232
|
+
}
|
233
|
+
|
234
|
+
if (!spec->pattern)
|
235
|
+
return git_buf_puts(out, spec->dst);
|
236
|
+
|
212
237
|
return refspec_transform(out, spec->src, spec->dst, name);
|
213
238
|
}
|
214
239
|
|
215
240
|
int git_refspec_rtransform(git_buf *out, const git_refspec *spec, const char *name)
|
216
241
|
{
|
242
|
+
assert(out && spec && name);
|
243
|
+
git_buf_sanitize(out);
|
244
|
+
|
245
|
+
if (!git_refspec_dst_matches(spec, name)) {
|
246
|
+
giterr_set(GITERR_INVALID, "ref '%s' doesn't match the destination", name);
|
247
|
+
return -1;
|
248
|
+
}
|
249
|
+
|
250
|
+
if (!spec->pattern)
|
251
|
+
return git_buf_puts(out, spec->src);
|
252
|
+
|
217
253
|
return refspec_transform(out, spec->dst, spec->src, name);
|
218
254
|
}
|
219
255
|
|
data/vendor/libgit2/src/remote.c
CHANGED
@@ -267,9 +267,11 @@ int git_remote_dup(git_remote **dest, git_remote *source)
|
|
267
267
|
|
268
268
|
if (source->pushurl != NULL) {
|
269
269
|
remote->pushurl = git__strdup(source->pushurl);
|
270
|
-
GITERR_CHECK_ALLOC(remote->pushurl);
|
270
|
+
GITERR_CHECK_ALLOC(remote->pushurl);
|
271
271
|
}
|
272
272
|
|
273
|
+
remote->transport_cb = source->transport_cb;
|
274
|
+
remote->transport_cb_payload = source->transport_cb_payload;
|
273
275
|
remote->repo = source->repo;
|
274
276
|
remote->download_tags = source->download_tags;
|
275
277
|
remote->check_cert = source->check_cert;
|
@@ -659,8 +661,14 @@ int git_remote_connect(git_remote *remote, git_direction direction)
|
|
659
661
|
return -1;
|
660
662
|
}
|
661
663
|
|
662
|
-
/*
|
663
|
-
*
|
664
|
+
/* If we don't have a transport object yet, and the caller specified a
|
665
|
+
* custom transport factory, use that */
|
666
|
+
if (!t && remote->transport_cb &&
|
667
|
+
(error = remote->transport_cb(&t, remote, remote->transport_cb_payload)) < 0)
|
668
|
+
return error;
|
669
|
+
|
670
|
+
/* If we still don't have a transport, then use the global
|
671
|
+
* transport registrations which map URI schemes to transport factories */
|
664
672
|
if (!t && (error = git_transport_new(&t, remote, url)) < 0)
|
665
673
|
return error;
|
666
674
|
|
@@ -691,6 +699,11 @@ int git_remote_ls(const git_remote_head ***out, size_t *size, git_remote *remote
|
|
691
699
|
{
|
692
700
|
assert(remote);
|
693
701
|
|
702
|
+
if (!remote->transport) {
|
703
|
+
giterr_set(GITERR_NET, "No transport bound to this remote");
|
704
|
+
return -1;
|
705
|
+
}
|
706
|
+
|
694
707
|
return remote->transport->ls(out, size, remote->transport);
|
695
708
|
}
|
696
709
|
|
@@ -1262,18 +1275,20 @@ const git_remote_callbacks *git_remote_get_callbacks(git_remote *remote)
|
|
1262
1275
|
return &remote->callbacks;
|
1263
1276
|
}
|
1264
1277
|
|
1265
|
-
int git_remote_set_transport(
|
1278
|
+
int git_remote_set_transport(
|
1279
|
+
git_remote *remote,
|
1280
|
+
git_transport_cb transport_cb,
|
1281
|
+
void *payload)
|
1266
1282
|
{
|
1267
|
-
assert(remote
|
1268
|
-
|
1269
|
-
GITERR_CHECK_VERSION(transport, GIT_TRANSPORT_VERSION, "git_transport");
|
1283
|
+
assert(remote);
|
1270
1284
|
|
1271
1285
|
if (remote->transport) {
|
1272
1286
|
giterr_set(GITERR_NET, "A transport is already bound to this remote");
|
1273
1287
|
return -1;
|
1274
1288
|
}
|
1275
1289
|
|
1276
|
-
remote->
|
1290
|
+
remote->transport_cb = transport_cb;
|
1291
|
+
remote->transport_cb_payload = payload;
|
1277
1292
|
return 0;
|
1278
1293
|
}
|
1279
1294
|
|
@@ -1932,12 +1947,17 @@ int git_remote_default_branch(git_buf *out, git_remote *remote)
|
|
1932
1947
|
size_t heads_len, i;
|
1933
1948
|
int error;
|
1934
1949
|
|
1950
|
+
assert(out);
|
1951
|
+
|
1935
1952
|
if ((error = git_remote_ls(&heads, &heads_len, remote)) < 0)
|
1936
1953
|
return error;
|
1937
1954
|
|
1938
1955
|
if (heads_len == 0)
|
1939
1956
|
return GIT_ENOTFOUND;
|
1940
1957
|
|
1958
|
+
if (strcmp(heads[0]->name, GIT_HEAD_FILE))
|
1959
|
+
return GIT_ENOTFOUND;
|
1960
|
+
|
1941
1961
|
git_buf_sanitize(out);
|
1942
1962
|
/* the first one must be HEAD so if that has the symref info, we're done */
|
1943
1963
|
if (heads[0]->symref_target)
|
@@ -1954,6 +1974,9 @@ int git_remote_default_branch(git_buf *out, git_remote *remote)
|
|
1954
1974
|
if (git_oid_cmp(head_id, &heads[i]->oid))
|
1955
1975
|
continue;
|
1956
1976
|
|
1977
|
+
if (git__prefixcmp(heads[i]->name, GIT_REFS_HEADS_DIR))
|
1978
|
+
continue;
|
1979
|
+
|
1957
1980
|
if (!guess) {
|
1958
1981
|
guess = heads[i];
|
1959
1982
|
continue;
|
data/vendor/libgit2/src/remote.h
CHANGED
@@ -9,6 +9,7 @@
|
|
9
9
|
|
10
10
|
#include "git2/remote.h"
|
11
11
|
#include "git2/transport.h"
|
12
|
+
#include "git2/sys/transport.h"
|
12
13
|
|
13
14
|
#include "refspec.h"
|
14
15
|
#include "vector.h"
|
@@ -22,6 +23,8 @@ struct git_remote {
|
|
22
23
|
git_vector refs;
|
23
24
|
git_vector refspecs;
|
24
25
|
git_vector active_refspecs;
|
26
|
+
git_transport_cb transport_cb;
|
27
|
+
void *transport_cb_payload;
|
25
28
|
git_transport *transport;
|
26
29
|
git_repository *repo;
|
27
30
|
git_remote_callbacks callbacks;
|
@@ -994,7 +994,7 @@ static int repo_init_config(
|
|
994
994
|
uint32_t mode)
|
995
995
|
{
|
996
996
|
int error = 0;
|
997
|
-
git_buf cfg_path = GIT_BUF_INIT;
|
997
|
+
git_buf cfg_path = GIT_BUF_INIT, worktree_path = GIT_BUF_INIT;
|
998
998
|
git_config *config = NULL;
|
999
999
|
bool is_bare = ((flags & GIT_REPOSITORY_INIT_BARE) != 0);
|
1000
1000
|
bool is_reinit = ((flags & GIT_REPOSITORY_INIT__IS_REINIT) != 0);
|
@@ -1019,9 +1019,16 @@ static int repo_init_config(
|
|
1019
1019
|
if (!is_bare) {
|
1020
1020
|
SET_REPO_CONFIG(bool, "core.logallrefupdates", true);
|
1021
1021
|
|
1022
|
-
if (!(flags & GIT_REPOSITORY_INIT__NATURAL_WD))
|
1023
|
-
|
1024
|
-
|
1022
|
+
if (!(flags & GIT_REPOSITORY_INIT__NATURAL_WD)) {
|
1023
|
+
if ((error = git_buf_sets(&worktree_path, work_dir)) < 0)
|
1024
|
+
goto cleanup;
|
1025
|
+
|
1026
|
+
if ((flags & GIT_REPOSITORY_INIT_RELATIVE_GITLINK))
|
1027
|
+
if ((error = git_path_make_relative(&worktree_path, repo_dir)) < 0)
|
1028
|
+
goto cleanup;
|
1029
|
+
|
1030
|
+
SET_REPO_CONFIG(string, "core.worktree", worktree_path.ptr);
|
1031
|
+
} else if (is_reinit) {
|
1025
1032
|
if (git_config_delete_entry(config, "core.worktree") < 0)
|
1026
1033
|
giterr_clear();
|
1027
1034
|
}
|
@@ -1038,6 +1045,7 @@ static int repo_init_config(
|
|
1038
1045
|
|
1039
1046
|
cleanup:
|
1040
1047
|
git_buf_free(&cfg_path);
|
1048
|
+
git_buf_free(&worktree_path);
|
1041
1049
|
git_config_free(config);
|
1042
1050
|
|
1043
1051
|
return error;
|
@@ -1126,10 +1134,11 @@ static int repo_write_template(
|
|
1126
1134
|
}
|
1127
1135
|
|
1128
1136
|
static int repo_write_gitlink(
|
1129
|
-
const char *in_dir, const char *to_repo)
|
1137
|
+
const char *in_dir, const char *to_repo, bool use_relative_path)
|
1130
1138
|
{
|
1131
1139
|
int error;
|
1132
1140
|
git_buf buf = GIT_BUF_INIT;
|
1141
|
+
git_buf path_to_repo = GIT_BUF_INIT;
|
1133
1142
|
struct stat st;
|
1134
1143
|
|
1135
1144
|
git_path_dirname_r(&buf, to_repo);
|
@@ -1157,13 +1166,20 @@ static int repo_write_gitlink(
|
|
1157
1166
|
|
1158
1167
|
git_buf_clear(&buf);
|
1159
1168
|
|
1160
|
-
error =
|
1169
|
+
error = git_buf_sets(&path_to_repo, to_repo);
|
1170
|
+
|
1171
|
+
if (!error && use_relative_path)
|
1172
|
+
error = git_path_make_relative(&path_to_repo, in_dir);
|
1173
|
+
|
1174
|
+
if (!error)
|
1175
|
+
error = git_buf_join(&buf, ' ', GIT_FILE_CONTENT_PREFIX, path_to_repo.ptr);
|
1161
1176
|
|
1162
1177
|
if (!error)
|
1163
1178
|
error = repo_write_template(in_dir, true, DOT_GIT, 0666, true, buf.ptr);
|
1164
1179
|
|
1165
1180
|
cleanup:
|
1166
1181
|
git_buf_free(&buf);
|
1182
|
+
git_buf_free(&path_to_repo);
|
1167
1183
|
return error;
|
1168
1184
|
}
|
1169
1185
|
|
@@ -1207,7 +1223,7 @@ static int repo_init_structure(
|
|
1207
1223
|
if ((opts->flags & GIT_REPOSITORY_INIT_BARE) == 0 &&
|
1208
1224
|
(opts->flags & GIT_REPOSITORY_INIT__NATURAL_WD) == 0)
|
1209
1225
|
{
|
1210
|
-
if (repo_write_gitlink(work_dir, repo_dir) < 0)
|
1226
|
+
if (repo_write_gitlink(work_dir, repo_dir, opts->flags & GIT_REPOSITORY_INIT_RELATIVE_GITLINK) < 0)
|
1211
1227
|
return -1;
|
1212
1228
|
}
|
1213
1229
|
|
@@ -1635,7 +1651,7 @@ int git_repository_set_workdir(
|
|
1635
1651
|
if (git_repository_config__weakptr(&config, repo) < 0)
|
1636
1652
|
return -1;
|
1637
1653
|
|
1638
|
-
error = repo_write_gitlink(path.ptr, git_repository_path(repo));
|
1654
|
+
error = repo_write_gitlink(path.ptr, git_repository_path(repo), false);
|
1639
1655
|
|
1640
1656
|
/* passthrough error means gitlink is unnecessary */
|
1641
1657
|
if (error == GIT_PASSTHROUGH)
|
@@ -1915,8 +1931,8 @@ int git_repository_state(git_repository *repo)
|
|
1915
1931
|
state = GIT_REPOSITORY_STATE_MERGE;
|
1916
1932
|
else if(git_path_contains_file(&repo_path, GIT_REVERT_HEAD_FILE))
|
1917
1933
|
state = GIT_REPOSITORY_STATE_REVERT;
|
1918
|
-
else if(git_path_contains_file(&repo_path,
|
1919
|
-
state =
|
1934
|
+
else if(git_path_contains_file(&repo_path, GIT_CHERRYPICK_HEAD_FILE))
|
1935
|
+
state = GIT_REPOSITORY_STATE_CHERRYPICK;
|
1920
1936
|
else if(git_path_contains_file(&repo_path, GIT_BISECT_LOG_FILE))
|
1921
1937
|
state = GIT_REPOSITORY_STATE_BISECT;
|
1922
1938
|
|
@@ -1958,7 +1974,7 @@ static const char *state_files[] = {
|
|
1958
1974
|
GIT_MERGE_MODE_FILE,
|
1959
1975
|
GIT_MERGE_MSG_FILE,
|
1960
1976
|
GIT_REVERT_HEAD_FILE,
|
1961
|
-
|
1977
|
+
GIT_CHERRYPICK_HEAD_FILE,
|
1962
1978
|
GIT_BISECT_LOG_FILE,
|
1963
1979
|
GIT_REBASE_MERGE_DIR,
|
1964
1980
|
GIT_REBASE_APPLY_DIR,
|
data/vendor/libgit2/src/revert.c
CHANGED
@@ -174,7 +174,7 @@ int git_revert(
|
|
174
174
|
char commit_oidstr[GIT_OID_HEXSZ + 1];
|
175
175
|
const char *commit_msg;
|
176
176
|
git_buf their_label = GIT_BUF_INIT;
|
177
|
-
git_index *index_new = NULL
|
177
|
+
git_index *index_new = NULL;
|
178
178
|
int error;
|
179
179
|
|
180
180
|
assert(repo && commit);
|
@@ -199,10 +199,9 @@ int git_revert(
|
|
199
199
|
(error = git_repository_head(&our_ref, repo)) < 0 ||
|
200
200
|
(error = git_reference_peel((git_object **)&our_commit, our_ref, GIT_OBJ_COMMIT)) < 0 ||
|
201
201
|
(error = git_revert_commit(&index_new, repo, commit, our_commit, opts.mainline, &opts.merge_opts)) < 0 ||
|
202
|
-
(error =
|
203
|
-
(error =
|
204
|
-
(error =
|
205
|
-
(error = git_checkout_index(repo, index_repo, &opts.checkout_opts)) < 0)
|
202
|
+
(error = git_merge__check_result(repo, index_new)) < 0 ||
|
203
|
+
(error = git_merge__append_conflicts_to_merge_msg(repo, index_new)) < 0 ||
|
204
|
+
(error = git_checkout_index(repo, index_new, &opts.checkout_opts)) < 0)
|
206
205
|
goto on_error;
|
207
206
|
|
208
207
|
goto done;
|
@@ -212,7 +211,6 @@ on_error:
|
|
212
211
|
|
213
212
|
done:
|
214
213
|
git_index_free(index_new);
|
215
|
-
git_index_free(index_repo);
|
216
214
|
git_commit_free(our_commit);
|
217
215
|
git_reference_free(our_ref);
|
218
216
|
git_buf_free(&their_label);
|
@@ -205,7 +205,6 @@ cleanup:
|
|
205
205
|
static int retrieve_oid_from_reflog(git_oid *oid, git_reference *ref, size_t identifier)
|
206
206
|
{
|
207
207
|
git_reflog *reflog;
|
208
|
-
int error = -1;
|
209
208
|
size_t numentries;
|
210
209
|
const git_reflog_entry *entry;
|
211
210
|
bool search_by_pos = (identifier <= 100000000);
|
@@ -216,21 +215,11 @@ static int retrieve_oid_from_reflog(git_oid *oid, git_reference *ref, size_t ide
|
|
216
215
|
numentries = git_reflog_entrycount(reflog);
|
217
216
|
|
218
217
|
if (search_by_pos) {
|
219
|
-
if (numentries < identifier + 1)
|
220
|
-
|
221
|
-
GITERR_REFERENCE,
|
222
|
-
"Reflog for '%s' has only %"PRIuZ" entries, asked for %"PRIuZ,
|
223
|
-
git_reference_name(ref), numentries, identifier);
|
224
|
-
|
225
|
-
error = GIT_ENOTFOUND;
|
226
|
-
goto cleanup;
|
227
|
-
}
|
218
|
+
if (numentries < identifier + 1)
|
219
|
+
goto notfound;
|
228
220
|
|
229
221
|
entry = git_reflog_entry_byindex(reflog, identifier);
|
230
222
|
git_oid_cpy(oid, git_reflog_entry_id_new(entry));
|
231
|
-
error = 0;
|
232
|
-
goto cleanup;
|
233
|
-
|
234
223
|
} else {
|
235
224
|
size_t i;
|
236
225
|
git_time commit_time;
|
@@ -243,16 +232,24 @@ static int retrieve_oid_from_reflog(git_oid *oid, git_reference *ref, size_t ide
|
|
243
232
|
continue;
|
244
233
|
|
245
234
|
git_oid_cpy(oid, git_reflog_entry_id_new(entry));
|
246
|
-
|
247
|
-
goto cleanup;
|
235
|
+
break;
|
248
236
|
}
|
249
237
|
|
250
|
-
|
238
|
+
if (i == numentries)
|
239
|
+
goto notfound;
|
251
240
|
}
|
252
241
|
|
253
|
-
cleanup:
|
254
242
|
git_reflog_free(reflog);
|
255
|
-
return
|
243
|
+
return 0;
|
244
|
+
|
245
|
+
notfound:
|
246
|
+
giterr_set(
|
247
|
+
GITERR_REFERENCE,
|
248
|
+
"Reflog for '%s' has only %"PRIuZ" entries, asked for %"PRIuZ,
|
249
|
+
git_reference_name(ref), numentries, identifier);
|
250
|
+
|
251
|
+
git_reflog_free(reflog);
|
252
|
+
return GIT_ENOTFOUND;
|
256
253
|
}
|
257
254
|
|
258
255
|
static int retrieve_revobject_from_reflog(git_object **out, git_reference **base_ref, git_repository *repo, const char *identifier, size_t position)
|
@@ -70,9 +70,9 @@ int git_signature_new(git_signature **sig_out, const char *name, const char *ema
|
|
70
70
|
if (p->name == NULL || p->email == NULL)
|
71
71
|
return -1; /* oom */
|
72
72
|
|
73
|
-
if (p->name[0] == '\0') {
|
73
|
+
if (p->name[0] == '\0' || p->email[0] == '\0') {
|
74
74
|
git_signature_free(p);
|
75
|
-
return signature_error("Signature cannot have an empty name");
|
75
|
+
return signature_error("Signature cannot have an empty name or email");
|
76
76
|
}
|
77
77
|
|
78
78
|
p->when.time = time;
|
data/vendor/libgit2/src/stash.c
CHANGED
@@ -634,7 +634,8 @@ int git_stash_drop(
|
|
634
634
|
entry = git_reflog_entry_byindex(reflog, 0);
|
635
635
|
|
636
636
|
git_reference_free(stash);
|
637
|
-
|
637
|
+
error = git_reference_create(&stash, repo, GIT_REFS_STASH_FILE, &entry->oid_cur, 1, NULL, NULL);
|
638
|
+
if (error < 0)
|
638
639
|
goto cleanup;
|
639
640
|
|
640
641
|
/* We need to undo the writing that we just did */
|