rugged 0.27.7 → 0.27.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +6 -2
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.c.in +29 -0
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.cmake +96 -0
- data/vendor/libgit2/cmake/Modules/FindIconv.cmake +11 -6
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +0 -2
- data/vendor/libgit2/include/git2.h +0 -1
- data/vendor/libgit2/include/git2/attr.h +7 -18
- data/vendor/libgit2/include/git2/blame.h +22 -39
- 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 -14
- data/vendor/libgit2/include/git2/checkout.h +12 -13
- data/vendor/libgit2/include/git2/cherrypick.h +4 -6
- data/vendor/libgit2/include/git2/clone.h +6 -8
- data/vendor/libgit2/include/git2/commit.h +0 -28
- data/vendor/libgit2/include/git2/common.h +0 -27
- data/vendor/libgit2/include/git2/config.h +0 -1
- data/vendor/libgit2/include/git2/describe.h +7 -30
- data/vendor/libgit2/include/git2/diff.h +22 -32
- data/vendor/libgit2/include/git2/errors.h +0 -1
- data/vendor/libgit2/include/git2/ignore.h +2 -2
- data/vendor/libgit2/include/git2/merge.h +8 -10
- data/vendor/libgit2/include/git2/proxy.h +5 -9
- data/vendor/libgit2/include/git2/rebase.h +4 -7
- data/vendor/libgit2/include/git2/refs.h +1 -1
- data/vendor/libgit2/include/git2/refspec.h +0 -17
- data/vendor/libgit2/include/git2/remote.h +10 -12
- data/vendor/libgit2/include/git2/repository.h +5 -7
- data/vendor/libgit2/include/git2/revert.h +3 -5
- data/vendor/libgit2/include/git2/stash.h +8 -11
- data/vendor/libgit2/include/git2/status.h +3 -7
- data/vendor/libgit2/include/git2/submodule.h +7 -8
- data/vendor/libgit2/include/git2/sys/index.h +0 -3
- data/vendor/libgit2/include/git2/sys/mempack.h +35 -35
- data/vendor/libgit2/include/git2/sys/merge.h +1 -6
- data/vendor/libgit2/include/git2/transaction.h +0 -1
- data/vendor/libgit2/include/git2/types.h +5 -8
- data/vendor/libgit2/include/git2/version.h +2 -2
- data/vendor/libgit2/include/git2/worktree.h +11 -46
- data/vendor/libgit2/src/CMakeLists.txt +28 -91
- data/vendor/libgit2/src/annotated_commit.c +4 -4
- data/vendor/libgit2/src/apply.c +6 -5
- data/vendor/libgit2/src/attr.c +4 -4
- data/vendor/libgit2/src/attr_file.c +5 -5
- data/vendor/libgit2/src/attrcache.c +2 -2
- data/vendor/libgit2/src/blame.c +4 -11
- data/vendor/libgit2/src/blame.h +0 -1
- data/vendor/libgit2/src/blame_git.c +5 -8
- data/vendor/libgit2/src/blob.c +5 -5
- data/vendor/libgit2/src/branch.c +20 -20
- data/vendor/libgit2/src/buffer.c +4 -9
- data/vendor/libgit2/src/buffer.h +1 -1
- data/vendor/libgit2/src/checkout.c +24 -33
- data/vendor/libgit2/src/cherrypick.c +3 -3
- data/vendor/libgit2/src/clone.c +13 -13
- data/vendor/libgit2/src/commit.c +5 -18
- data/vendor/libgit2/src/commit_list.c +9 -3
- data/vendor/libgit2/src/common.h +1 -3
- data/vendor/libgit2/src/config.c +15 -6
- data/vendor/libgit2/src/config_file.c +249 -193
- data/vendor/libgit2/src/config_parse.c +66 -89
- data/vendor/libgit2/src/config_parse.h +2 -2
- data/vendor/libgit2/src/crlf.c +3 -9
- data/vendor/libgit2/src/diff.c +2 -2
- data/vendor/libgit2/src/diff_driver.c +3 -3
- data/vendor/libgit2/src/diff_file.c +3 -3
- data/vendor/libgit2/src/diff_generate.c +3 -4
- data/vendor/libgit2/src/diff_print.c +8 -8
- data/vendor/libgit2/src/diff_tform.c +4 -2
- data/vendor/libgit2/src/diff_xdiff.c +0 -12
- data/vendor/libgit2/src/features.h.in +0 -2
- data/vendor/libgit2/src/fetch.c +2 -2
- data/vendor/libgit2/src/fetchhead.c +5 -5
- data/vendor/libgit2/src/filebuf.c +4 -4
- data/vendor/libgit2/src/fileops.c +10 -10
- data/vendor/libgit2/src/filter.c +9 -3
- data/vendor/libgit2/src/global.c +12 -17
- data/vendor/libgit2/src/hash.h +0 -2
- data/vendor/libgit2/src/ignore.c +5 -5
- data/vendor/libgit2/src/index.c +40 -80
- data/vendor/libgit2/src/index.h +0 -10
- data/vendor/libgit2/src/indexer.c +9 -9
- data/vendor/libgit2/src/iterator.c +8 -8
- data/vendor/libgit2/src/khash.h +1 -3
- data/vendor/libgit2/src/merge.c +7 -7
- data/vendor/libgit2/src/netops.c +5 -5
- data/vendor/libgit2/src/notes.c +2 -2
- data/vendor/libgit2/src/odb.c +9 -9
- data/vendor/libgit2/src/odb_loose.c +22 -18
- data/vendor/libgit2/src/odb_pack.c +3 -3
- data/vendor/libgit2/src/pack-objects.c +3 -3
- data/vendor/libgit2/src/pack.c +5 -5
- data/vendor/libgit2/src/pack.h +1 -1
- data/vendor/libgit2/src/parse.c +7 -4
- data/vendor/libgit2/src/patch.c +1 -1
- data/vendor/libgit2/src/patch_generate.c +2 -2
- data/vendor/libgit2/src/patch_parse.c +4 -24
- data/vendor/libgit2/src/path.c +140 -39
- data/vendor/libgit2/src/path.h +84 -2
- data/vendor/libgit2/src/pathspec.c +1 -1
- data/vendor/libgit2/src/push.c +2 -2
- data/vendor/libgit2/src/rebase.c +23 -20
- data/vendor/libgit2/src/refdb_fs.c +34 -65
- data/vendor/libgit2/src/refs.c +16 -13
- data/vendor/libgit2/src/refspec.c +5 -30
- data/vendor/libgit2/src/refspec.h +1 -1
- data/vendor/libgit2/src/remote.c +43 -43
- data/vendor/libgit2/src/repository.c +56 -56
- data/vendor/libgit2/src/reset.c +1 -1
- data/vendor/libgit2/src/revert.c +3 -3
- data/vendor/libgit2/src/revparse.c +7 -6
- data/vendor/libgit2/src/revwalk.c +20 -48
- data/vendor/libgit2/src/revwalk.h +1 -2
- data/vendor/libgit2/src/settings.c +1 -25
- data/vendor/libgit2/src/signature.c +4 -2
- data/vendor/libgit2/src/stash.c +34 -80
- data/vendor/libgit2/src/status.c +1 -1
- data/vendor/libgit2/src/streams/curl.c +1 -1
- data/vendor/libgit2/src/streams/openssl.c +34 -132
- data/vendor/libgit2/src/streams/openssl.h +107 -0
- data/vendor/libgit2/src/streams/tls.c +0 -3
- data/vendor/libgit2/src/submodule.c +83 -118
- data/vendor/libgit2/src/sysdir.c +4 -4
- data/vendor/libgit2/src/tag.c +12 -12
- data/vendor/libgit2/src/trace.h +1 -1
- data/vendor/libgit2/src/trailer.c +6 -6
- data/vendor/libgit2/src/transport.c +2 -2
- data/vendor/libgit2/src/transports/auth.c +1 -1
- data/vendor/libgit2/src/transports/auth_negotiate.c +2 -2
- data/vendor/libgit2/src/transports/git.c +1 -1
- data/vendor/libgit2/src/transports/http.c +15 -12
- data/vendor/libgit2/src/transports/local.c +7 -7
- data/vendor/libgit2/src/transports/smart.c +15 -20
- data/vendor/libgit2/src/transports/smart.h +5 -5
- data/vendor/libgit2/src/transports/smart_pkt.c +131 -123
- data/vendor/libgit2/src/transports/smart_protocol.c +38 -48
- data/vendor/libgit2/src/transports/ssh.c +1 -1
- data/vendor/libgit2/src/transports/winhttp.c +26 -21
- data/vendor/libgit2/src/tree-cache.c +2 -2
- data/vendor/libgit2/src/tree.c +69 -23
- data/vendor/libgit2/src/tree.h +12 -0
- data/vendor/libgit2/src/util.c +99 -52
- data/vendor/libgit2/src/util.h +138 -14
- data/vendor/libgit2/src/vector.c +13 -8
- data/vendor/libgit2/src/win32/findfile.c +2 -2
- data/vendor/libgit2/src/win32/posix_w32.c +1 -1
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +0 -94
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +75 -28
- data/vendor/libgit2/src/worktree.c +44 -65
- data/vendor/libgit2/src/worktree.h +0 -2
- data/vendor/libgit2/src/xdiff/xdiffi.c +1 -3
- metadata +5 -17
- data/vendor/libgit2/cmake/Modules/FindmbedTLS.cmake +0 -93
- data/vendor/libgit2/include/git2/mailmap.h +0 -115
- data/vendor/libgit2/include/git2/sys/alloc.h +0 -101
- data/vendor/libgit2/include/git2/sys/path.h +0 -55
- data/vendor/libgit2/src/alloc.c +0 -47
- data/vendor/libgit2/src/alloc.h +0 -40
- data/vendor/libgit2/src/hash/hash_mbedtls.c +0 -38
- data/vendor/libgit2/src/hash/hash_mbedtls.h +0 -20
- data/vendor/libgit2/src/mailmap.c +0 -485
- data/vendor/libgit2/src/mailmap.h +0 -35
- data/vendor/libgit2/src/stdalloc.c +0 -120
- data/vendor/libgit2/src/stdalloc.h +0 -17
- data/vendor/libgit2/src/streams/mbedtls.c +0 -463
- data/vendor/libgit2/src/streams/mbedtls.h +0 -20
@@ -11,22 +11,15 @@
|
|
11
11
|
# include <openssl/err.h>
|
12
12
|
#endif
|
13
13
|
|
14
|
-
#ifdef GIT_MBEDTLS
|
15
|
-
# include <mbedtls/error.h>
|
16
|
-
#endif
|
17
|
-
|
18
14
|
#include <git2.h>
|
19
|
-
#include "alloc.h"
|
20
15
|
#include "sysdir.h"
|
21
16
|
#include "cache.h"
|
22
17
|
#include "global.h"
|
23
18
|
#include "object.h"
|
24
19
|
#include "odb.h"
|
25
20
|
#include "refs.h"
|
26
|
-
#include "index.h"
|
27
21
|
#include "transports/smart.h"
|
28
22
|
#include "streams/openssl.h"
|
29
|
-
#include "streams/mbedtls.h"
|
30
23
|
|
31
24
|
void git_libgit2_version(int *major, int *minor, int *rev)
|
32
25
|
{
|
@@ -182,15 +175,6 @@ int git_libgit2_opts(int key, ...)
|
|
182
175
|
const char *path = va_arg(ap, const char *);
|
183
176
|
error = git_openssl__set_cert_location(file, path);
|
184
177
|
}
|
185
|
-
#elif defined(GIT_MBEDTLS)
|
186
|
-
{
|
187
|
-
const char *file = va_arg(ap, const char *);
|
188
|
-
const char *path = va_arg(ap, const char *);
|
189
|
-
if (file)
|
190
|
-
error = git_mbedtls__set_cert_location(file, 0);
|
191
|
-
if (error && path)
|
192
|
-
error = git_mbedtls__set_cert_location(path, 1);
|
193
|
-
}
|
194
178
|
#else
|
195
179
|
giterr_set(GITERR_SSL, "TLS backend doesn't support certificate locations");
|
196
180
|
error = -1;
|
@@ -215,7 +199,7 @@ int git_libgit2_opts(int key, ...)
|
|
215
199
|
break;
|
216
200
|
|
217
201
|
case GIT_OPT_SET_SSL_CIPHERS:
|
218
|
-
#
|
202
|
+
#ifdef GIT_OPENSSL
|
219
203
|
{
|
220
204
|
git__free(git__ssl_ciphers);
|
221
205
|
git__ssl_ciphers = git__strdup(va_arg(ap, const char *));
|
@@ -262,14 +246,6 @@ int git_libgit2_opts(int key, ...)
|
|
262
246
|
git_odb__strict_hash_verification = (va_arg(ap, int) != 0);
|
263
247
|
break;
|
264
248
|
|
265
|
-
case GIT_OPT_SET_ALLOCATOR:
|
266
|
-
error = git_allocator_setup(va_arg(ap, git_allocator *));
|
267
|
-
break;
|
268
|
-
|
269
|
-
case GIT_OPT_ENABLE_UNSAVED_INDEX_SAFETY:
|
270
|
-
git_index__enforce_unsaved_safety = (va_arg(ap, int) != 0);
|
271
|
-
break;
|
272
|
-
|
273
249
|
default:
|
274
250
|
giterr_set(GITERR_INVALID, "invalid option key");
|
275
251
|
error = -1;
|
@@ -231,7 +231,8 @@ int git_signature__parse(git_signature *sig, const char **buffer_out,
|
|
231
231
|
const char *time_start = email_end + 2;
|
232
232
|
const char *time_end;
|
233
233
|
|
234
|
-
if (
|
234
|
+
if (git__strntol64(&sig->when.time, time_start,
|
235
|
+
buffer_end - time_start, &time_end, 10) < 0) {
|
235
236
|
git__free(sig->name);
|
236
237
|
git__free(sig->email);
|
237
238
|
sig->name = sig->email = NULL;
|
@@ -246,7 +247,8 @@ int git_signature__parse(git_signature *sig, const char **buffer_out,
|
|
246
247
|
tz_start = time_end + 1;
|
247
248
|
|
248
249
|
if ((tz_start[0] != '-' && tz_start[0] != '+') ||
|
249
|
-
|
250
|
+
git__strntol32(&offset, tz_start + 1,
|
251
|
+
buffer_end - tz_start - 1, &tz_end, 10) < 0) {
|
250
252
|
/* malformed timezone, just assume it's zero */
|
251
253
|
offset = 0;
|
252
254
|
}
|
data/vendor/libgit2/src/stash.c
CHANGED
@@ -12,7 +12,6 @@
|
|
12
12
|
#include "message.h"
|
13
13
|
#include "tree.h"
|
14
14
|
#include "reflog.h"
|
15
|
-
#include "blob.h"
|
16
15
|
#include "git2/diff.h"
|
17
16
|
#include "git2/stash.h"
|
18
17
|
#include "git2/status.h"
|
@@ -104,23 +103,19 @@ cleanup:
|
|
104
103
|
return error;
|
105
104
|
}
|
106
105
|
|
107
|
-
static int build_tree_from_index(
|
108
|
-
git_tree **out,
|
109
|
-
git_repository *repo,
|
110
|
-
git_index *index)
|
106
|
+
static int build_tree_from_index(git_tree **out, git_index *index)
|
111
107
|
{
|
112
108
|
int error;
|
113
109
|
git_oid i_tree_oid;
|
114
110
|
|
115
|
-
if ((error =
|
111
|
+
if ((error = git_index_write_tree(&i_tree_oid, index)) < 0)
|
116
112
|
return error;
|
117
113
|
|
118
|
-
return git_tree_lookup(out,
|
114
|
+
return git_tree_lookup(out, git_index_owner(index), &i_tree_oid);
|
119
115
|
}
|
120
116
|
|
121
117
|
static int commit_index(
|
122
118
|
git_commit **i_commit,
|
123
|
-
git_repository *repo,
|
124
119
|
git_index *index,
|
125
120
|
const git_signature *stasher,
|
126
121
|
const char *message,
|
@@ -131,7 +126,7 @@ static int commit_index(
|
|
131
126
|
git_buf msg = GIT_BUF_INIT;
|
132
127
|
int error;
|
133
128
|
|
134
|
-
if ((error = build_tree_from_index(&i_tree,
|
129
|
+
if ((error = build_tree_from_index(&i_tree, index)) < 0)
|
135
130
|
goto cleanup;
|
136
131
|
|
137
132
|
if ((error = git_buf_printf(&msg, "index on %s\n", message)) < 0)
|
@@ -154,7 +149,7 @@ static int commit_index(
|
|
154
149
|
|
155
150
|
cleanup:
|
156
151
|
git_tree_free(i_tree);
|
157
|
-
|
152
|
+
git_buf_free(&msg);
|
158
153
|
return error;
|
159
154
|
}
|
160
155
|
|
@@ -164,38 +159,7 @@ struct stash_update_rules {
|
|
164
159
|
bool include_ignored;
|
165
160
|
};
|
166
161
|
|
167
|
-
/*
|
168
|
-
* Similar to git_index_add_bypath but able to operate on any
|
169
|
-
* index without making assumptions about the repository's index
|
170
|
-
*/
|
171
|
-
static int stash_to_index(
|
172
|
-
git_repository *repo,
|
173
|
-
git_index *index,
|
174
|
-
const char *path)
|
175
|
-
{
|
176
|
-
git_index *repo_index;
|
177
|
-
git_index_entry entry = {{0}};
|
178
|
-
struct stat st;
|
179
|
-
int error;
|
180
|
-
|
181
|
-
if (!git_repository_is_bare(repo) &&
|
182
|
-
(error = git_repository_index__weakptr(&repo_index, repo)) < 0)
|
183
|
-
return error;
|
184
|
-
|
185
|
-
if ((error = git_blob__create_from_paths(
|
186
|
-
&entry.id, &st, repo, NULL, path, 0, true)) < 0)
|
187
|
-
return error;
|
188
|
-
|
189
|
-
git_index_entry__init_from_stat(&entry, &st,
|
190
|
-
(repo_index != NULL || !repo_index->distrust_filemode));
|
191
|
-
|
192
|
-
entry.path = path;
|
193
|
-
|
194
|
-
return git_index_add(index, &entry);
|
195
|
-
}
|
196
|
-
|
197
162
|
static int stash_update_index_from_diff(
|
198
|
-
git_repository *repo,
|
199
163
|
git_index *index,
|
200
164
|
const git_diff *diff,
|
201
165
|
struct stash_update_rules *data)
|
@@ -241,7 +205,7 @@ static int stash_update_index_from_diff(
|
|
241
205
|
}
|
242
206
|
|
243
207
|
if (add_path != NULL)
|
244
|
-
error =
|
208
|
+
error = git_index_add_bypath(index, add_path);
|
245
209
|
}
|
246
210
|
|
247
211
|
return error;
|
@@ -249,19 +213,17 @@ static int stash_update_index_from_diff(
|
|
249
213
|
|
250
214
|
static int build_untracked_tree(
|
251
215
|
git_tree **tree_out,
|
252
|
-
|
216
|
+
git_index *index,
|
253
217
|
git_commit *i_commit,
|
254
218
|
uint32_t flags)
|
255
219
|
{
|
256
|
-
git_index *i_index = NULL;
|
257
220
|
git_tree *i_tree = NULL;
|
258
221
|
git_diff *diff = NULL;
|
259
222
|
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
|
260
223
|
struct stash_update_rules data = {0};
|
261
224
|
int error;
|
262
225
|
|
263
|
-
|
264
|
-
goto cleanup;
|
226
|
+
git_index_clear(index);
|
265
227
|
|
266
228
|
if (flags & GIT_STASH_INCLUDE_UNTRACKED) {
|
267
229
|
opts.flags |= GIT_DIFF_INCLUDE_UNTRACKED |
|
@@ -278,24 +240,24 @@ static int build_untracked_tree(
|
|
278
240
|
if ((error = git_commit_tree(&i_tree, i_commit)) < 0)
|
279
241
|
goto cleanup;
|
280
242
|
|
281
|
-
if ((error = git_diff_tree_to_workdir(
|
243
|
+
if ((error = git_diff_tree_to_workdir(
|
244
|
+
&diff, git_index_owner(index), i_tree, &opts)) < 0)
|
282
245
|
goto cleanup;
|
283
246
|
|
284
|
-
if ((error = stash_update_index_from_diff(
|
247
|
+
if ((error = stash_update_index_from_diff(index, diff, &data)) < 0)
|
285
248
|
goto cleanup;
|
286
249
|
|
287
|
-
error = build_tree_from_index(tree_out,
|
250
|
+
error = build_tree_from_index(tree_out, index);
|
288
251
|
|
289
252
|
cleanup:
|
290
253
|
git_diff_free(diff);
|
291
254
|
git_tree_free(i_tree);
|
292
|
-
git_index_free(i_index);
|
293
255
|
return error;
|
294
256
|
}
|
295
257
|
|
296
258
|
static int commit_untracked(
|
297
259
|
git_commit **u_commit,
|
298
|
-
|
260
|
+
git_index *index,
|
299
261
|
const git_signature *stasher,
|
300
262
|
const char *message,
|
301
263
|
git_commit *i_commit,
|
@@ -306,7 +268,7 @@ static int commit_untracked(
|
|
306
268
|
git_buf msg = GIT_BUF_INIT;
|
307
269
|
int error;
|
308
270
|
|
309
|
-
if ((error = build_untracked_tree(&u_tree,
|
271
|
+
if ((error = build_untracked_tree(&u_tree, index, i_commit, flags)) < 0)
|
310
272
|
goto cleanup;
|
311
273
|
|
312
274
|
if ((error = git_buf_printf(&msg, "untracked files on %s\n", message)) < 0)
|
@@ -314,7 +276,7 @@ static int commit_untracked(
|
|
314
276
|
|
315
277
|
if ((error = git_commit_create(
|
316
278
|
&u_commit_oid,
|
317
|
-
|
279
|
+
git_index_owner(index),
|
318
280
|
NULL,
|
319
281
|
stasher,
|
320
282
|
stasher,
|
@@ -325,11 +287,11 @@ static int commit_untracked(
|
|
325
287
|
NULL)) < 0)
|
326
288
|
goto cleanup;
|
327
289
|
|
328
|
-
error = git_commit_lookup(u_commit,
|
290
|
+
error = git_commit_lookup(u_commit, git_index_owner(index), &u_commit_oid);
|
329
291
|
|
330
292
|
cleanup:
|
331
293
|
git_tree_free(u_tree);
|
332
|
-
|
294
|
+
git_buf_free(&msg);
|
333
295
|
return error;
|
334
296
|
}
|
335
297
|
|
@@ -354,10 +316,10 @@ static git_diff_delta *stash_delta_merge(
|
|
354
316
|
|
355
317
|
static int build_workdir_tree(
|
356
318
|
git_tree **tree_out,
|
357
|
-
|
358
|
-
git_index *i_index,
|
319
|
+
git_index *index,
|
359
320
|
git_commit *b_commit)
|
360
321
|
{
|
322
|
+
git_repository *repo = git_index_owner(index);
|
361
323
|
git_tree *b_tree = NULL;
|
362
324
|
git_diff *diff = NULL, *idx_to_wd = NULL;
|
363
325
|
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
|
@@ -369,17 +331,17 @@ static int build_workdir_tree(
|
|
369
331
|
if ((error = git_commit_tree(&b_tree, b_commit)) < 0)
|
370
332
|
goto cleanup;
|
371
333
|
|
372
|
-
if ((error = git_diff_tree_to_index(&diff, repo, b_tree,
|
373
|
-
(error = git_diff_index_to_workdir(&idx_to_wd, repo,
|
334
|
+
if ((error = git_diff_tree_to_index(&diff, repo, b_tree, index, &opts)) < 0 ||
|
335
|
+
(error = git_diff_index_to_workdir(&idx_to_wd, repo, index, &opts)) < 0 ||
|
374
336
|
(error = git_diff__merge(diff, idx_to_wd, stash_delta_merge)) < 0)
|
375
337
|
goto cleanup;
|
376
338
|
|
377
339
|
data.include_changed = true;
|
378
340
|
|
379
|
-
if ((error = stash_update_index_from_diff(
|
341
|
+
if ((error = stash_update_index_from_diff(index, diff, &data)) < 0)
|
380
342
|
goto cleanup;
|
381
343
|
|
382
|
-
error = build_tree_from_index(tree_out,
|
344
|
+
error = build_tree_from_index(tree_out, index);
|
383
345
|
|
384
346
|
cleanup:
|
385
347
|
git_diff_free(idx_to_wd);
|
@@ -391,7 +353,7 @@ cleanup:
|
|
391
353
|
|
392
354
|
static int commit_worktree(
|
393
355
|
git_oid *w_commit_oid,
|
394
|
-
|
356
|
+
git_index *index,
|
395
357
|
const git_signature *stasher,
|
396
358
|
const char *message,
|
397
359
|
git_commit *i_commit,
|
@@ -400,9 +362,7 @@ static int commit_worktree(
|
|
400
362
|
{
|
401
363
|
int error = 0;
|
402
364
|
git_tree *w_tree = NULL, *i_tree = NULL;
|
403
|
-
git_index *i_index = NULL;
|
404
365
|
const git_commit *parents[] = { NULL, NULL, NULL };
|
405
|
-
int ignorecase;
|
406
366
|
|
407
367
|
parents[0] = b_commit;
|
408
368
|
parents[1] = i_commit;
|
@@ -411,21 +371,15 @@ static int commit_worktree(
|
|
411
371
|
if ((error = git_commit_tree(&i_tree, i_commit)) < 0)
|
412
372
|
goto cleanup;
|
413
373
|
|
414
|
-
if ((error =
|
415
|
-
(error = git_repository__cvar(&ignorecase, repo, GIT_CVAR_IGNORECASE)) < 0)
|
416
|
-
goto cleanup;
|
417
|
-
|
418
|
-
git_index__set_ignore_case(i_index, ignorecase);
|
419
|
-
|
420
|
-
if ((error = git_index_read_tree(i_index, i_tree)) < 0)
|
374
|
+
if ((error = git_index_read_tree(index, i_tree)) < 0)
|
421
375
|
goto cleanup;
|
422
376
|
|
423
|
-
if ((error = build_workdir_tree(&w_tree,
|
377
|
+
if ((error = build_workdir_tree(&w_tree, index, b_commit)) < 0)
|
424
378
|
goto cleanup;
|
425
379
|
|
426
380
|
error = git_commit_create(
|
427
381
|
w_commit_oid,
|
428
|
-
|
382
|
+
git_index_owner(index),
|
429
383
|
NULL,
|
430
384
|
stasher,
|
431
385
|
stasher,
|
@@ -438,7 +392,6 @@ static int commit_worktree(
|
|
438
392
|
cleanup:
|
439
393
|
git_tree_free(i_tree);
|
440
394
|
git_tree_free(w_tree);
|
441
|
-
git_index_free(i_index);
|
442
395
|
return error;
|
443
396
|
}
|
444
397
|
|
@@ -470,7 +423,7 @@ static int prepare_worktree_commit_message(
|
|
470
423
|
error = (git_buf_oom(msg) || git_buf_oom(&buf)) ? -1 : 0;
|
471
424
|
|
472
425
|
cleanup:
|
473
|
-
|
426
|
+
git_buf_free(&buf);
|
474
427
|
|
475
428
|
return error;
|
476
429
|
}
|
@@ -581,12 +534,12 @@ int git_stash_save(
|
|
581
534
|
goto cleanup;
|
582
535
|
|
583
536
|
if ((error = commit_index(
|
584
|
-
&i_commit,
|
537
|
+
&i_commit, index, stasher, git_buf_cstr(&msg), b_commit)) < 0)
|
585
538
|
goto cleanup;
|
586
539
|
|
587
540
|
if ((flags & (GIT_STASH_INCLUDE_UNTRACKED | GIT_STASH_INCLUDE_IGNORED)) &&
|
588
541
|
(error = commit_untracked(
|
589
|
-
&u_commit,
|
542
|
+
&u_commit, index, stasher, git_buf_cstr(&msg),
|
590
543
|
i_commit, flags)) < 0)
|
591
544
|
goto cleanup;
|
592
545
|
|
@@ -594,7 +547,7 @@ int git_stash_save(
|
|
594
547
|
goto cleanup;
|
595
548
|
|
596
549
|
if ((error = commit_worktree(
|
597
|
-
out,
|
550
|
+
out, index, stasher, git_buf_cstr(&msg),
|
598
551
|
i_commit, b_commit, u_commit)) < 0)
|
599
552
|
goto cleanup;
|
600
553
|
|
@@ -612,7 +565,7 @@ int git_stash_save(
|
|
612
565
|
|
613
566
|
cleanup:
|
614
567
|
|
615
|
-
|
568
|
+
git_buf_free(&msg);
|
616
569
|
git_commit_free(i_commit);
|
617
570
|
git_commit_free(b_commit);
|
618
571
|
git_commit_free(u_commit);
|
@@ -785,7 +738,8 @@ static void normalize_apply_options(
|
|
785
738
|
memcpy(opts, &default_apply_opts, sizeof(git_stash_apply_options));
|
786
739
|
}
|
787
740
|
|
788
|
-
opts->checkout_options.checkout_strategy
|
741
|
+
if ((opts->checkout_options.checkout_strategy & (GIT_CHECKOUT_SAFE | GIT_CHECKOUT_FORCE)) == 0)
|
742
|
+
opts->checkout_options.checkout_strategy = GIT_CHECKOUT_SAFE;
|
789
743
|
|
790
744
|
if (!opts->checkout_options.our_label)
|
791
745
|
opts->checkout_options.our_label = "Updated upstream";
|
data/vendor/libgit2/src/status.c
CHANGED
@@ -294,7 +294,7 @@ int git_status_list_new(
|
|
294
294
|
|
295
295
|
/* refresh index from disk unless prevented */
|
296
296
|
if ((flags & GIT_STATUS_OPT_NO_REFRESH) == 0 &&
|
297
|
-
|
297
|
+
git_index_read(index, false) < 0)
|
298
298
|
giterr_clear();
|
299
299
|
|
300
300
|
status = git_status_list_alloc(index);
|
@@ -330,7 +330,7 @@ int git_curl_stream_new(git_stream **out, const char *host, const char *port)
|
|
330
330
|
return -1;
|
331
331
|
}
|
332
332
|
|
333
|
-
if ((error =
|
333
|
+
if ((error = git__strntol32(&iport, port, strlen(port), NULL, 10)) < 0) {
|
334
334
|
git__free(st);
|
335
335
|
return error;
|
336
336
|
}
|
@@ -38,115 +38,8 @@ SSL_CTX *git__ssl_ctx;
|
|
38
38
|
|
39
39
|
#define GIT_SSL_DEFAULT_CIPHERS "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-DSS-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:DHE-DSS-AES128-SHA256:DHE-DSS-AES256-SHA256:DHE-DSS-AES128-SHA:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA"
|
40
40
|
|
41
|
-
#if
|
42
|
-
(defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L)
|
43
|
-
# define OPENSSL_LEGACY_API
|
44
|
-
#endif
|
45
|
-
|
46
|
-
/*
|
47
|
-
* OpenSSL 1.1 made BIO opaque so we have to use functions to interact with it
|
48
|
-
* which do not exist in previous versions. We define these inline functions so
|
49
|
-
* we can program against the interface instead of littering the implementation
|
50
|
-
* with ifdefs. We do the same for OPENSSL_init_ssl.
|
51
|
-
*/
|
52
|
-
#if defined(OPENSSL_LEGACY_API)
|
53
|
-
static int OPENSSL_init_ssl(int opts, void *settings)
|
54
|
-
{
|
55
|
-
GIT_UNUSED(opts);
|
56
|
-
GIT_UNUSED(settings);
|
57
|
-
SSL_load_error_strings();
|
58
|
-
OpenSSL_add_ssl_algorithms();
|
59
|
-
return 0;
|
60
|
-
}
|
61
|
-
|
62
|
-
static BIO_METHOD* BIO_meth_new(int type, const char *name)
|
63
|
-
{
|
64
|
-
BIO_METHOD *meth = git__calloc(1, sizeof(BIO_METHOD));
|
65
|
-
if (!meth) {
|
66
|
-
return NULL;
|
67
|
-
}
|
68
|
-
|
69
|
-
meth->type = type;
|
70
|
-
meth->name = name;
|
71
|
-
|
72
|
-
return meth;
|
73
|
-
}
|
74
|
-
|
75
|
-
static void BIO_meth_free(BIO_METHOD *biom)
|
76
|
-
{
|
77
|
-
git__free(biom);
|
78
|
-
}
|
79
|
-
|
80
|
-
static int BIO_meth_set_write(BIO_METHOD *biom, int (*write) (BIO *, const char *, int))
|
81
|
-
{
|
82
|
-
biom->bwrite = write;
|
83
|
-
return 1;
|
84
|
-
}
|
41
|
+
#if defined(GIT_THREADS) && OPENSSL_VERSION_NUMBER < 0x10100000L
|
85
42
|
|
86
|
-
static int BIO_meth_set_read(BIO_METHOD *biom, int (*read) (BIO *, char *, int))
|
87
|
-
{
|
88
|
-
biom->bread = read;
|
89
|
-
return 1;
|
90
|
-
}
|
91
|
-
|
92
|
-
static int BIO_meth_set_puts(BIO_METHOD *biom, int (*puts) (BIO *, const char *))
|
93
|
-
{
|
94
|
-
biom->bputs = puts;
|
95
|
-
return 1;
|
96
|
-
}
|
97
|
-
|
98
|
-
static int BIO_meth_set_gets(BIO_METHOD *biom, int (*gets) (BIO *, char *, int))
|
99
|
-
|
100
|
-
{
|
101
|
-
biom->bgets = gets;
|
102
|
-
return 1;
|
103
|
-
}
|
104
|
-
|
105
|
-
static int BIO_meth_set_ctrl(BIO_METHOD *biom, long (*ctrl) (BIO *, int, long, void *))
|
106
|
-
{
|
107
|
-
biom->ctrl = ctrl;
|
108
|
-
return 1;
|
109
|
-
}
|
110
|
-
|
111
|
-
static int BIO_meth_set_create(BIO_METHOD *biom, int (*create) (BIO *))
|
112
|
-
{
|
113
|
-
biom->create = create;
|
114
|
-
return 1;
|
115
|
-
}
|
116
|
-
|
117
|
-
static int BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy) (BIO *))
|
118
|
-
{
|
119
|
-
biom->destroy = destroy;
|
120
|
-
return 1;
|
121
|
-
}
|
122
|
-
|
123
|
-
static int BIO_get_new_index(void)
|
124
|
-
{
|
125
|
-
/* This exists as of 1.1 so before we'd just have 0 */
|
126
|
-
return 0;
|
127
|
-
}
|
128
|
-
|
129
|
-
static void BIO_set_init(BIO *b, int init)
|
130
|
-
{
|
131
|
-
b->init = init;
|
132
|
-
}
|
133
|
-
|
134
|
-
static void BIO_set_data(BIO *a, void *ptr)
|
135
|
-
{
|
136
|
-
a->ptr = ptr;
|
137
|
-
}
|
138
|
-
|
139
|
-
static void *BIO_get_data(BIO *a)
|
140
|
-
{
|
141
|
-
return a->ptr;
|
142
|
-
}
|
143
|
-
|
144
|
-
static const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x)
|
145
|
-
{
|
146
|
-
return ASN1_STRING_data((ASN1_STRING *)x);
|
147
|
-
}
|
148
|
-
|
149
|
-
# if defined(GIT_THREADS)
|
150
43
|
static git_mutex *openssl_locks;
|
151
44
|
|
152
45
|
static void openssl_locking_function(
|
@@ -177,8 +70,8 @@ static void shutdown_ssl_locking(void)
|
|
177
70
|
git_mutex_free(&openssl_locks[i]);
|
178
71
|
git__free(openssl_locks);
|
179
72
|
}
|
180
|
-
|
181
|
-
#endif /*
|
73
|
+
|
74
|
+
#endif /* GIT_THREADS && OPENSSL_VERSION_NUMBER < 0x10100000L */
|
182
75
|
|
183
76
|
static BIO_METHOD *git_stream_bio_method;
|
184
77
|
static int init_bio_method(void);
|
@@ -202,6 +95,7 @@ static void shutdown_ssl(void)
|
|
202
95
|
|
203
96
|
int git_openssl_stream_global_init(void)
|
204
97
|
{
|
98
|
+
#ifdef GIT_OPENSSL
|
205
99
|
long ssl_opts = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3;
|
206
100
|
const char *ciphers = git_libgit2__ssl_ciphers();
|
207
101
|
|
@@ -210,7 +104,13 @@ int git_openssl_stream_global_init(void)
|
|
210
104
|
ssl_opts |= SSL_OP_NO_COMPRESSION;
|
211
105
|
#endif
|
212
106
|
|
107
|
+
#if OPENSSL_VERSION_NUMBER < 0x10100000L || \
|
108
|
+
(defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L)
|
109
|
+
SSL_load_error_strings();
|
110
|
+
OpenSSL_add_ssl_algorithms();
|
111
|
+
#else
|
213
112
|
OPENSSL_init_ssl(0, NULL);
|
113
|
+
#endif
|
214
114
|
|
215
115
|
/*
|
216
116
|
* Load SSLv{2,3} and TLSv1 so that we can talk with servers
|
@@ -218,47 +118,49 @@ int git_openssl_stream_global_init(void)
|
|
218
118
|
* compatibility. We then disable SSL so we only allow OpenSSL
|
219
119
|
* to speak TLSv1 to perform the encryption itself.
|
220
120
|
*/
|
221
|
-
|
222
|
-
goto error;
|
223
|
-
|
121
|
+
git__ssl_ctx = SSL_CTX_new(SSLv23_method());
|
224
122
|
SSL_CTX_set_options(git__ssl_ctx, ssl_opts);
|
225
123
|
SSL_CTX_set_mode(git__ssl_ctx, SSL_MODE_AUTO_RETRY);
|
226
124
|
SSL_CTX_set_verify(git__ssl_ctx, SSL_VERIFY_NONE, NULL);
|
227
|
-
if (!SSL_CTX_set_default_verify_paths(git__ssl_ctx))
|
228
|
-
|
125
|
+
if (!SSL_CTX_set_default_verify_paths(git__ssl_ctx)) {
|
126
|
+
SSL_CTX_free(git__ssl_ctx);
|
127
|
+
git__ssl_ctx = NULL;
|
128
|
+
return -1;
|
129
|
+
}
|
229
130
|
|
230
|
-
if (!ciphers)
|
131
|
+
if (!ciphers) {
|
231
132
|
ciphers = GIT_SSL_DEFAULT_CIPHERS;
|
133
|
+
}
|
232
134
|
|
233
|
-
if(!SSL_CTX_set_cipher_list(git__ssl_ctx, ciphers))
|
234
|
-
|
135
|
+
if(!SSL_CTX_set_cipher_list(git__ssl_ctx, ciphers)) {
|
136
|
+
SSL_CTX_free(git__ssl_ctx);
|
137
|
+
git__ssl_ctx = NULL;
|
138
|
+
return -1;
|
139
|
+
}
|
140
|
+
|
141
|
+
if (init_bio_method() < 0) {
|
142
|
+
SSL_CTX_free(git__ssl_ctx);
|
143
|
+
git__ssl_ctx = NULL;
|
144
|
+
return -1;
|
145
|
+
}
|
235
146
|
|
236
|
-
|
237
|
-
goto error;
|
147
|
+
#endif
|
238
148
|
|
239
149
|
git__on_shutdown(shutdown_ssl);
|
240
150
|
|
241
151
|
return 0;
|
242
|
-
|
243
|
-
error:
|
244
|
-
giterr_set(GITERR_NET, "could not initialize openssl: %s",
|
245
|
-
ERR_error_string(ERR_get_error(), NULL));
|
246
|
-
SSL_CTX_free(git__ssl_ctx);
|
247
|
-
git__ssl_ctx = NULL;
|
248
|
-
return -1;
|
249
152
|
}
|
250
153
|
|
251
|
-
#if defined(GIT_THREADS)
|
154
|
+
#if defined(GIT_THREADS)
|
252
155
|
static void threadid_cb(CRYPTO_THREADID *threadid)
|
253
156
|
{
|
254
|
-
|
255
|
-
CRYPTO_THREADID_set_numeric(threadid, git_thread_currentid());
|
157
|
+
CRYPTO_THREADID_set_numeric(threadid, git_thread_currentid());
|
256
158
|
}
|
257
159
|
#endif
|
258
160
|
|
259
161
|
int git_openssl_set_locking(void)
|
260
162
|
{
|
261
|
-
#if defined(GIT_THREADS) &&
|
163
|
+
#if defined(GIT_THREADS) && OPENSSL_VERSION_NUMBER < 0x10100000L
|
262
164
|
int num_locks, i;
|
263
165
|
|
264
166
|
CRYPTO_THREADID_set_callback(threadid_cb);
|
@@ -277,7 +179,7 @@ int git_openssl_set_locking(void)
|
|
277
179
|
CRYPTO_set_locking_callback(openssl_locking_function);
|
278
180
|
git__on_shutdown(shutdown_ssl_locking);
|
279
181
|
return 0;
|
280
|
-
#elif
|
182
|
+
#elif OPENSSL_VERSION_NUMBER >= 0x10100000L
|
281
183
|
return 0;
|
282
184
|
#else
|
283
185
|
giterr_set(GITERR_THREAD, "libgit2 was not built with threads");
|