rugged 0.21.1b2 → 0.21.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -12
- data/ext/rugged/extconf.rb +8 -8
- data/ext/rugged/rugged.h +1 -1
- data/ext/rugged/rugged_blob.c +0 -57
- data/ext/rugged/rugged_cred.c +0 -23
- data/ext/rugged/rugged_index.c +2 -6
- data/ext/rugged/rugged_remote.c +1 -69
- data/ext/rugged/rugged_repo.c +5 -287
- data/ext/rugged/rugged_tag_collection.c +2 -70
- data/ext/rugged/rugged_tree.c +10 -29
- data/lib/rugged.rb +0 -2
- data/lib/rugged/diff.rb +1 -0
- data/lib/rugged/diff/line.rb +3 -1
- data/lib/rugged/patch.rb +2 -12
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +0 -11
- data/vendor/libgit2/deps/http-parser/http_parser.h +0 -2
- data/vendor/libgit2/deps/zlib/adler32.c +29 -39
- data/vendor/libgit2/deps/zlib/crc32.c +50 -33
- data/vendor/libgit2/deps/zlib/crc32.h +1 -1
- data/vendor/libgit2/deps/zlib/deflate.c +65 -198
- data/vendor/libgit2/deps/zlib/deflate.h +4 -8
- 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 +52 -84
- data/vendor/libgit2/deps/zlib/inftrees.c +39 -15
- data/vendor/libgit2/deps/zlib/trees.c +36 -18
- data/vendor/libgit2/deps/zlib/zconf.h +0 -4
- data/vendor/libgit2/deps/zlib/zlib.h +95 -250
- data/vendor/libgit2/deps/zlib/zutil.c +10 -13
- data/vendor/libgit2/deps/zlib/zutil.h +62 -41
- data/vendor/libgit2/include/git2/attr.h +13 -16
- data/vendor/libgit2/include/git2/buffer.h +0 -16
- 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 +69 -77
- data/vendor/libgit2/include/git2/diff.h +0 -7
- data/vendor/libgit2/include/git2/errors.h +0 -2
- data/vendor/libgit2/include/git2/merge.h +0 -16
- data/vendor/libgit2/include/git2/oid.h +4 -8
- data/vendor/libgit2/include/git2/remote.h +32 -13
- data/vendor/libgit2/include/git2/repository.h +1 -4
- data/vendor/libgit2/include/git2/reset.h +0 -4
- data/vendor/libgit2/include/git2/revert.h +1 -1
- data/vendor/libgit2/include/git2/status.h +14 -17
- data/vendor/libgit2/include/git2/submodule.h +0 -18
- data/vendor/libgit2/include/git2/sys/repository.h +0 -13
- data/vendor/libgit2/include/git2/transport.h +313 -79
- data/vendor/libgit2/include/git2/tree.h +2 -4
- data/vendor/libgit2/include/git2/types.h +6 -54
- data/vendor/libgit2/include/git2/version.h +2 -2
- data/vendor/libgit2/src/attr.c +4 -8
- data/vendor/libgit2/src/attr_file.c +1 -14
- data/vendor/libgit2/src/blame.c +1 -0
- data/vendor/libgit2/src/buf_text.c +5 -9
- data/vendor/libgit2/src/buf_text.h +2 -3
- data/vendor/libgit2/src/buffer.c +10 -67
- data/vendor/libgit2/src/buffer.h +2 -4
- data/vendor/libgit2/src/cache.c +9 -9
- data/vendor/libgit2/src/cache.h +1 -1
- data/vendor/libgit2/src/checkout.c +44 -121
- data/vendor/libgit2/src/cherrypick.c +44 -41
- data/vendor/libgit2/src/clone.c +56 -94
- data/vendor/libgit2/src/config_file.c +7 -2
- data/vendor/libgit2/src/crlf.c +1 -2
- data/vendor/libgit2/src/diff.c +0 -21
- data/vendor/libgit2/src/diff_file.c +0 -1
- data/vendor/libgit2/src/diff_print.c +9 -11
- data/vendor/libgit2/src/diff_tform.c +2 -4
- data/vendor/libgit2/src/errors.c +7 -9
- data/vendor/libgit2/src/filebuf.c +2 -0
- data/vendor/libgit2/src/fileops.c +7 -9
- data/vendor/libgit2/src/filter.c +11 -2
- data/vendor/libgit2/src/global.c +20 -3
- data/vendor/libgit2/src/global.h +0 -2
- data/vendor/libgit2/src/graph.c +2 -2
- data/vendor/libgit2/src/hashsig.c +1 -1
- data/vendor/libgit2/{include/git2/sys → src}/hashsig.h +7 -11
- data/vendor/libgit2/src/ignore.c +2 -2
- data/vendor/libgit2/src/indexer.c +1 -13
- data/vendor/libgit2/src/merge.c +145 -99
- data/vendor/libgit2/src/merge.h +1 -1
- data/vendor/libgit2/src/mwindow.c +8 -117
- data/vendor/libgit2/src/mwindow.h +1 -9
- data/vendor/libgit2/src/netops.c +7 -6
- data/vendor/libgit2/src/netops.h +4 -0
- data/vendor/libgit2/src/odb_loose.c +1 -1
- data/vendor/libgit2/src/odb_pack.c +3 -6
- data/vendor/libgit2/src/oid.c +0 -8
- data/vendor/libgit2/src/oid.h +0 -11
- data/vendor/libgit2/src/pack.c +6 -20
- data/vendor/libgit2/src/pack.h +0 -3
- data/vendor/libgit2/src/path.c +64 -134
- data/vendor/libgit2/src/path.h +1 -22
- data/vendor/libgit2/src/posix.h +28 -46
- data/vendor/libgit2/src/refs.h +2 -2
- data/vendor/libgit2/src/refspec.c +2 -14
- data/vendor/libgit2/src/remote.c +26 -29
- data/vendor/libgit2/src/remote.h +1 -3
- data/vendor/libgit2/src/repository.c +14 -54
- data/vendor/libgit2/src/revert.c +6 -4
- data/vendor/libgit2/src/revparse.c +18 -15
- data/vendor/libgit2/src/signature.c +2 -2
- data/vendor/libgit2/src/stash.c +1 -2
- data/vendor/libgit2/src/status.c +2 -11
- data/vendor/libgit2/src/strnlen.h +1 -2
- data/vendor/libgit2/src/submodule.c +33 -73
- data/vendor/libgit2/src/tag.c +3 -2
- data/vendor/libgit2/src/thread-utils.h +7 -0
- data/vendor/libgit2/src/trace.h +1 -9
- data/vendor/libgit2/src/transport.c +90 -93
- data/vendor/libgit2/src/transports/cred.c +0 -58
- data/vendor/libgit2/src/transports/cred_helpers.c +0 -3
- data/vendor/libgit2/src/transports/git.c +0 -1
- data/vendor/libgit2/src/transports/http.c +82 -205
- data/vendor/libgit2/src/transports/smart.c +0 -2
- data/vendor/libgit2/src/transports/smart.h +0 -2
- data/vendor/libgit2/src/transports/smart_protocol.c +5 -7
- data/vendor/libgit2/src/transports/ssh.c +35 -224
- data/vendor/libgit2/src/transports/winhttp.c +34 -140
- data/vendor/libgit2/src/tree.c +60 -64
- data/vendor/libgit2/src/tree.h +3 -2
- data/vendor/libgit2/src/unix/posix.h +9 -23
- data/vendor/libgit2/src/unix/realpath.c +7 -8
- data/vendor/libgit2/src/util.c +1 -2
- data/vendor/libgit2/src/util.h +3 -3
- data/vendor/libgit2/src/win32/mingw-compat.h +12 -5
- data/vendor/libgit2/src/win32/msvc-compat.h +32 -3
- data/vendor/libgit2/src/win32/posix.h +31 -20
- data/vendor/libgit2/src/win32/posix_w32.c +18 -62
- metadata +5 -18
- data/lib/rugged/attributes.rb +0 -41
- data/lib/rugged/blob.rb +0 -28
- data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +0 -324
- data/vendor/libgit2/deps/zlib/infback.c +0 -640
- data/vendor/libgit2/include/git2/oidarray.h +0 -40
- data/vendor/libgit2/include/git2/sys/transport.h +0 -352
- data/vendor/libgit2/src/oidarray.c +0 -21
- data/vendor/libgit2/src/oidarray.h +0 -18
- data/vendor/libgit2/src/transports/auth.c +0 -71
- data/vendor/libgit2/src/transports/auth.h +0 -63
- data/vendor/libgit2/src/transports/auth_negotiate.c +0 -275
- data/vendor/libgit2/src/transports/auth_negotiate.h +0 -27
- data/vendor/libgit2/src/transports/cred.h +0 -14
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, *index_repo = NULL;
|
178
178
|
int error;
|
179
179
|
|
180
180
|
assert(repo && commit);
|
@@ -199,9 +199,10 @@ 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 =
|
202
|
+
(error = git_merge__indexes(repo, index_new)) < 0 ||
|
203
|
+
(error = git_repository_index(&index_repo, repo)) < 0 ||
|
204
|
+
(error = git_merge__append_conflicts_to_merge_msg(repo, index_repo)) < 0 ||
|
205
|
+
(error = git_checkout_index(repo, index_repo, &opts.checkout_opts)) < 0)
|
205
206
|
goto on_error;
|
206
207
|
|
207
208
|
goto done;
|
@@ -211,6 +212,7 @@ on_error:
|
|
211
212
|
|
212
213
|
done:
|
213
214
|
git_index_free(index_new);
|
215
|
+
git_index_free(index_repo);
|
214
216
|
git_commit_free(our_commit);
|
215
217
|
git_reference_free(our_ref);
|
216
218
|
git_buf_free(&their_label);
|
@@ -205,6 +205,7 @@ 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;
|
208
209
|
size_t numentries;
|
209
210
|
const git_reflog_entry *entry;
|
210
211
|
bool search_by_pos = (identifier <= 100000000);
|
@@ -215,11 +216,21 @@ static int retrieve_oid_from_reflog(git_oid *oid, git_reference *ref, size_t ide
|
|
215
216
|
numentries = git_reflog_entrycount(reflog);
|
216
217
|
|
217
218
|
if (search_by_pos) {
|
218
|
-
if (numentries < identifier + 1)
|
219
|
-
|
219
|
+
if (numentries < identifier + 1) {
|
220
|
+
giterr_set(
|
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
|
+
}
|
220
228
|
|
221
229
|
entry = git_reflog_entry_byindex(reflog, identifier);
|
222
230
|
git_oid_cpy(oid, git_reflog_entry_id_new(entry));
|
231
|
+
error = 0;
|
232
|
+
goto cleanup;
|
233
|
+
|
223
234
|
} else {
|
224
235
|
size_t i;
|
225
236
|
git_time commit_time;
|
@@ -232,24 +243,16 @@ static int retrieve_oid_from_reflog(git_oid *oid, git_reference *ref, size_t ide
|
|
232
243
|
continue;
|
233
244
|
|
234
245
|
git_oid_cpy(oid, git_reflog_entry_id_new(entry));
|
235
|
-
|
246
|
+
error = 0;
|
247
|
+
goto cleanup;
|
236
248
|
}
|
237
249
|
|
238
|
-
|
239
|
-
goto notfound;
|
250
|
+
error = GIT_ENOTFOUND;
|
240
251
|
}
|
241
252
|
|
253
|
+
cleanup:
|
242
254
|
git_reflog_free(reflog);
|
243
|
-
return
|
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;
|
255
|
+
return error;
|
253
256
|
}
|
254
257
|
|
255
258
|
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') {
|
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");
|
76
76
|
}
|
77
77
|
|
78
78
|
p->when.time = time;
|
data/vendor/libgit2/src/stash.c
CHANGED
@@ -636,8 +636,7 @@ int git_stash_drop(
|
|
636
636
|
entry = git_reflog_entry_byindex(reflog, 0);
|
637
637
|
|
638
638
|
git_reference_free(stash);
|
639
|
-
error = git_reference_create(&stash, repo, GIT_REFS_STASH_FILE, &entry->oid_cur, 1, NULL, NULL)
|
640
|
-
if (error < 0)
|
639
|
+
if ((error = git_reference_create(&stash, repo, GIT_REFS_STASH_FILE, &entry->oid_cur, 1, NULL, NULL) < 0))
|
641
640
|
goto cleanup;
|
642
641
|
|
643
642
|
/* We need to undo the writing that we just did */
|
data/vendor/libgit2/src/status.c
CHANGED
@@ -62,9 +62,6 @@ static unsigned int workdir_delta2status(
|
|
62
62
|
case GIT_DELTA_UNTRACKED:
|
63
63
|
st = GIT_STATUS_WT_NEW;
|
64
64
|
break;
|
65
|
-
case GIT_DELTA_UNREADABLE:
|
66
|
-
st = GIT_STATUS_WT_UNREADABLE;
|
67
|
-
break;
|
68
65
|
case GIT_DELTA_DELETED:
|
69
66
|
st = GIT_STATUS_WT_DELETED;
|
70
67
|
break;
|
@@ -313,10 +310,6 @@ int git_status_list_new(
|
|
313
310
|
diffopt.flags = diffopt.flags | GIT_DIFF_IGNORE_SUBMODULES;
|
314
311
|
if ((flags & GIT_STATUS_OPT_UPDATE_INDEX) != 0)
|
315
312
|
diffopt.flags = diffopt.flags | GIT_DIFF_UPDATE_INDEX;
|
316
|
-
if ((flags & GIT_STATUS_OPT_INCLUDE_UNREADABLE) != 0)
|
317
|
-
diffopt.flags = diffopt.flags | GIT_DIFF_INCLUDE_UNREADABLE;
|
318
|
-
if ((flags & GIT_STATUS_OPT_INCLUDE_UNREADABLE_AS_UNTRACKED) != 0)
|
319
|
-
diffopt.flags = diffopt.flags | GIT_DIFF_INCLUDE_UNREADABLE_AS_UNTRACKED;
|
320
313
|
|
321
314
|
if ((flags & GIT_STATUS_OPT_RENAMES_FROM_REWRITES) != 0)
|
322
315
|
findopt.flags = findopt.flags |
|
@@ -336,9 +329,8 @@ int git_status_list_new(
|
|
336
329
|
|
337
330
|
if (show != GIT_STATUS_SHOW_INDEX_ONLY) {
|
338
331
|
if ((error = git_diff_index_to_workdir(
|
339
|
-
&status->idx2wd, repo, index, &diffopt)) < 0)
|
332
|
+
&status->idx2wd, repo, index, &diffopt)) < 0)
|
340
333
|
goto done;
|
341
|
-
}
|
342
334
|
|
343
335
|
if ((flags & GIT_STATUS_OPT_RENAMES_INDEX_TO_WORKDIR) != 0 &&
|
344
336
|
(error = git_diff_find_similar(status->idx2wd, &findopt)) < 0)
|
@@ -415,9 +407,8 @@ int git_status_foreach_ext(
|
|
415
407
|
size_t i;
|
416
408
|
int error = 0;
|
417
409
|
|
418
|
-
if ((error = git_status_list_new(&status, repo, opts)) < 0)
|
410
|
+
if ((error = git_status_list_new(&status, repo, opts)) < 0)
|
419
411
|
return error;
|
420
|
-
}
|
421
412
|
|
422
413
|
git_vector_foreach(&status->paired, i, status_entry) {
|
423
414
|
const char *path = status_entry->head_to_index ?
|
@@ -7,8 +7,7 @@
|
|
7
7
|
#ifndef INCLUDE_strlen_h__
|
8
8
|
#define INCLUDE_strlen_h__
|
9
9
|
|
10
|
-
#if defined(__MINGW32__) || defined(__sun) || defined(__APPLE__) || defined(__MidnightBSD__)
|
11
|
-
(defined(_MSC_VER) && _MSC_VER < 1500)
|
10
|
+
#if defined(__MINGW32__) || defined(__sun) || defined(__APPLE__) || defined(__MidnightBSD__)
|
12
11
|
# define NO_STRNLEN
|
13
12
|
#endif
|
14
13
|
|
@@ -306,56 +306,6 @@ void git_submodule_cache_free(git_repository *repo)
|
|
306
306
|
submodule_cache_free(cache);
|
307
307
|
}
|
308
308
|
|
309
|
-
static int submodule_repo_init(
|
310
|
-
git_repository **out,
|
311
|
-
git_repository *parent_repo,
|
312
|
-
const char *path,
|
313
|
-
const char *url,
|
314
|
-
bool use_gitlink)
|
315
|
-
{
|
316
|
-
int error = 0;
|
317
|
-
git_buf workdir = GIT_BUF_INIT, repodir = GIT_BUF_INIT;
|
318
|
-
git_repository_init_options initopt = GIT_REPOSITORY_INIT_OPTIONS_INIT;
|
319
|
-
git_repository *subrepo = NULL;
|
320
|
-
|
321
|
-
error = git_buf_joinpath(&workdir, git_repository_workdir(parent_repo), path);
|
322
|
-
if (error < 0)
|
323
|
-
goto cleanup;
|
324
|
-
|
325
|
-
initopt.flags = GIT_REPOSITORY_INIT_MKPATH | GIT_REPOSITORY_INIT_NO_REINIT;
|
326
|
-
initopt.origin_url = url;
|
327
|
-
|
328
|
-
/* init submodule repository and add origin remote as needed */
|
329
|
-
|
330
|
-
/* New style: sub-repo goes in <repo-dir>/modules/<name>/ with a
|
331
|
-
* gitlink in the sub-repo workdir directory to that repository
|
332
|
-
*
|
333
|
-
* Old style: sub-repo goes directly into repo/<name>/.git/
|
334
|
-
*/
|
335
|
-
if (use_gitlink) {
|
336
|
-
error = git_buf_join3(
|
337
|
-
&repodir, '/', git_repository_path(parent_repo), "modules", path);
|
338
|
-
if (error < 0)
|
339
|
-
goto cleanup;
|
340
|
-
|
341
|
-
initopt.workdir_path = workdir.ptr;
|
342
|
-
initopt.flags |=
|
343
|
-
GIT_REPOSITORY_INIT_NO_DOTGIT_DIR |
|
344
|
-
GIT_REPOSITORY_INIT_RELATIVE_GITLINK;
|
345
|
-
|
346
|
-
error = git_repository_init_ext(&subrepo, repodir.ptr, &initopt);
|
347
|
-
} else
|
348
|
-
error = git_repository_init_ext(&subrepo, workdir.ptr, &initopt);
|
349
|
-
|
350
|
-
cleanup:
|
351
|
-
git_buf_free(&workdir);
|
352
|
-
git_buf_free(&repodir);
|
353
|
-
|
354
|
-
*out = subrepo;
|
355
|
-
|
356
|
-
return error;
|
357
|
-
}
|
358
|
-
|
359
309
|
int git_submodule_add_setup(
|
360
310
|
git_submodule **out,
|
361
311
|
git_repository *repo,
|
@@ -367,6 +317,7 @@ int git_submodule_add_setup(
|
|
367
317
|
git_config_backend *mods = NULL;
|
368
318
|
git_submodule *sm = NULL;
|
369
319
|
git_buf name = GIT_BUF_INIT, real_url = GIT_BUF_INIT;
|
320
|
+
git_repository_init_options initopt = GIT_REPOSITORY_INIT_OPTIONS_INIT;
|
370
321
|
git_repository *subrepo = NULL;
|
371
322
|
|
372
323
|
assert(repo && url && path);
|
@@ -420,14 +371,41 @@ int git_submodule_add_setup(
|
|
420
371
|
if (error < 0)
|
421
372
|
goto cleanup;
|
422
373
|
|
423
|
-
/*
|
424
|
-
*
|
374
|
+
/* New style: sub-repo goes in <repo-dir>/modules/<name>/ with a
|
375
|
+
* gitlink in the sub-repo workdir directory to that repository
|
376
|
+
*
|
377
|
+
* Old style: sub-repo goes directly into repo/<name>/.git/
|
425
378
|
*/
|
426
|
-
|
427
|
-
|
428
|
-
|
379
|
+
|
380
|
+
initopt.flags = GIT_REPOSITORY_INIT_MKPATH |
|
381
|
+
GIT_REPOSITORY_INIT_NO_REINIT;
|
382
|
+
initopt.origin_url = real_url.ptr;
|
383
|
+
|
384
|
+
if (git_path_exists(name.ptr) &&
|
385
|
+
git_path_contains(&name, DOT_GIT))
|
386
|
+
{
|
387
|
+
/* repo appears to already exist - reinit? */
|
388
|
+
}
|
389
|
+
else if (use_gitlink) {
|
390
|
+
git_buf repodir = GIT_BUF_INIT;
|
391
|
+
|
392
|
+
error = git_buf_join3(
|
393
|
+
&repodir, '/', git_repository_path(repo), "modules", path);
|
394
|
+
if (error < 0)
|
429
395
|
goto cleanup;
|
396
|
+
|
397
|
+
initopt.workdir_path = name.ptr;
|
398
|
+
initopt.flags |= GIT_REPOSITORY_INIT_NO_DOTGIT_DIR;
|
399
|
+
|
400
|
+
error = git_repository_init_ext(&subrepo, repodir.ptr, &initopt);
|
401
|
+
|
402
|
+
git_buf_free(&repodir);
|
430
403
|
}
|
404
|
+
else {
|
405
|
+
error = git_repository_init_ext(&subrepo, name.ptr, &initopt);
|
406
|
+
}
|
407
|
+
if (error < 0)
|
408
|
+
goto cleanup;
|
431
409
|
|
432
410
|
/* add submodule to hash and "reload" it */
|
433
411
|
|
@@ -459,23 +437,6 @@ cleanup:
|
|
459
437
|
return error;
|
460
438
|
}
|
461
439
|
|
462
|
-
int git_submodule_repo_init(
|
463
|
-
git_repository **out,
|
464
|
-
const git_submodule *sm,
|
465
|
-
int use_gitlink)
|
466
|
-
{
|
467
|
-
int error;
|
468
|
-
git_repository *sub_repo = NULL;
|
469
|
-
|
470
|
-
assert(out && sm);
|
471
|
-
|
472
|
-
error = submodule_repo_init(&sub_repo, sm->repo, sm->path, sm->url, use_gitlink);
|
473
|
-
|
474
|
-
*out = sub_repo;
|
475
|
-
|
476
|
-
return error;
|
477
|
-
}
|
478
|
-
|
479
440
|
int git_submodule_add_finalize(git_submodule *sm)
|
480
441
|
{
|
481
442
|
int error;
|
@@ -1936,7 +1897,6 @@ static void submodule_get_index_status(unsigned int *status, git_submodule *sm)
|
|
1936
1897
|
*status |= GIT_SUBMODULE_STATUS_INDEX_MODIFIED;
|
1937
1898
|
}
|
1938
1899
|
|
1939
|
-
|
1940
1900
|
static void submodule_get_wd_status(
|
1941
1901
|
unsigned int *status,
|
1942
1902
|
git_submodule *sm,
|
data/vendor/libgit2/src/tag.c
CHANGED
@@ -406,8 +406,9 @@ int git_tag_delete(git_repository *repo, const char *tag_name)
|
|
406
406
|
if (error < 0)
|
407
407
|
return error;
|
408
408
|
|
409
|
-
|
410
|
-
|
409
|
+
error = git_reference_delete(tag_ref);
|
410
|
+
|
411
|
+
git_reference_free(tag_ref);
|
411
412
|
|
412
413
|
return error;
|
413
414
|
}
|
@@ -53,6 +53,12 @@ typedef struct {
|
|
53
53
|
|
54
54
|
#endif
|
55
55
|
|
56
|
+
#if defined(GIT_WIN32)
|
57
|
+
#define git_thread_yield() Sleep(0)
|
58
|
+
#else
|
59
|
+
#define git_thread_yield() sched_yield()
|
60
|
+
#endif
|
61
|
+
|
56
62
|
/* Pthreads Mutex */
|
57
63
|
#define git_mutex pthread_mutex_t
|
58
64
|
#define git_mutex_init(a) pthread_mutex_init(a, NULL)
|
@@ -180,6 +186,7 @@ GIT_INLINE(int64_t) git_atomic64_add(git_atomic64 *a, int64_t addend)
|
|
180
186
|
#define git_thread unsigned int
|
181
187
|
#define git_thread_create(thread, attr, start_routine, arg) 0
|
182
188
|
#define git_thread_join(id, status) (void)0
|
189
|
+
#define git_thread_yield() (void)0
|
183
190
|
|
184
191
|
/* Pthreads Mutex */
|
185
192
|
#define git_mutex unsigned int
|
data/vendor/libgit2/src/trace.h
CHANGED
@@ -46,16 +46,8 @@ GIT_INLINE(void) git_trace__write_fmt(
|
|
46
46
|
|
47
47
|
#else
|
48
48
|
|
49
|
-
GIT_INLINE(void) git_trace__null(
|
50
|
-
git_trace_level_t level,
|
51
|
-
const char *fmt, ...)
|
52
|
-
{
|
53
|
-
GIT_UNUSED(level);
|
54
|
-
GIT_UNUSED(fmt);
|
55
|
-
}
|
56
|
-
|
57
49
|
#define git_trace_level() ((void)0)
|
58
|
-
#define git_trace
|
50
|
+
#define git_trace(lvl, ...) ((void)0)
|
59
51
|
|
60
52
|
#endif
|
61
53
|
|
@@ -9,11 +9,11 @@
|
|
9
9
|
#include "git2/remote.h"
|
10
10
|
#include "git2/net.h"
|
11
11
|
#include "git2/transport.h"
|
12
|
-
#include "git2/sys/transport.h"
|
13
12
|
#include "path.h"
|
14
13
|
|
15
14
|
typedef struct transport_definition {
|
16
15
|
char *prefix;
|
16
|
+
unsigned priority;
|
17
17
|
git_transport_cb fn;
|
18
18
|
void *param;
|
19
19
|
} transport_definition;
|
@@ -24,55 +24,52 @@ static git_smart_subtransport_definition git_subtransport_definition = { git_sma
|
|
24
24
|
static git_smart_subtransport_definition ssh_subtransport_definition = { git_smart_subtransport_ssh, 0 };
|
25
25
|
#endif
|
26
26
|
|
27
|
-
static transport_definition local_transport_definition = { "file://", git_transport_local, NULL };
|
27
|
+
static transport_definition local_transport_definition = { "file://", 1, git_transport_local, NULL };
|
28
|
+
#ifdef GIT_SSH
|
29
|
+
static transport_definition ssh_transport_definition = { "ssh://", 1, git_transport_smart, &ssh_subtransport_definition };
|
30
|
+
#else
|
31
|
+
static transport_definition dummy_transport_definition = { NULL, 1, git_transport_dummy, NULL };
|
32
|
+
#endif
|
28
33
|
|
29
34
|
static transport_definition transports[] = {
|
30
|
-
{
|
31
|
-
{
|
32
|
-
|
33
|
-
{
|
34
|
-
#endif
|
35
|
-
{ "file://", git_transport_local, NULL },
|
35
|
+
{"git://", 1, git_transport_smart, &git_subtransport_definition},
|
36
|
+
{"http://", 1, git_transport_smart, &http_subtransport_definition},
|
37
|
+
{"https://", 1, git_transport_smart, &http_subtransport_definition},
|
38
|
+
{"file://", 1, git_transport_local, NULL},
|
36
39
|
#ifdef GIT_SSH
|
37
|
-
{
|
40
|
+
{"ssh://", 1, git_transport_smart, &ssh_subtransport_definition},
|
38
41
|
#endif
|
39
|
-
{
|
42
|
+
{NULL, 0, 0}
|
40
43
|
};
|
41
44
|
|
42
|
-
static git_vector
|
45
|
+
static git_vector additional_transports = GIT_VECTOR_INIT;
|
43
46
|
|
44
47
|
#define GIT_TRANSPORT_COUNT (sizeof(transports)/sizeof(transports[0])) - 1
|
45
48
|
|
46
|
-
static
|
49
|
+
static int transport_find_fn(const char *url, git_transport_cb *callback, void **param)
|
47
50
|
{
|
48
51
|
size_t i = 0;
|
49
|
-
|
52
|
+
unsigned priority = 0;
|
53
|
+
transport_definition *definition = NULL, *definition_iter;
|
50
54
|
|
51
|
-
|
52
|
-
git_vector_foreach(&custom_transports, i, d) {
|
53
|
-
if (strncasecmp(url, d->prefix, strlen(d->prefix)) == 0) {
|
54
|
-
return d;
|
55
|
-
}
|
56
|
-
}
|
57
|
-
|
58
|
-
/* Find a system transport for this URI */
|
55
|
+
// First, check to see if it's an obvious URL, which a URL scheme
|
59
56
|
for (i = 0; i < GIT_TRANSPORT_COUNT; ++i) {
|
60
|
-
|
57
|
+
definition_iter = &transports[i];
|
61
58
|
|
62
|
-
if (strncasecmp(url,
|
63
|
-
|
64
|
-
|
59
|
+
if (strncasecmp(url, definition_iter->prefix, strlen(definition_iter->prefix)))
|
60
|
+
continue;
|
61
|
+
|
62
|
+
if (definition_iter->priority > priority)
|
63
|
+
definition = definition_iter;
|
65
64
|
}
|
66
65
|
|
67
|
-
|
68
|
-
|
66
|
+
git_vector_foreach(&additional_transports, i, definition_iter) {
|
67
|
+
if (strncasecmp(url, definition_iter->prefix, strlen(definition_iter->prefix)))
|
68
|
+
continue;
|
69
69
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
void **param)
|
74
|
-
{
|
75
|
-
transport_definition *definition = transport_find_by_url(url);
|
70
|
+
if (definition_iter->priority > priority)
|
71
|
+
definition = definition_iter;
|
72
|
+
}
|
76
73
|
|
77
74
|
#ifdef GIT_WIN32
|
78
75
|
/* On Windows, it might not be possible to discern between absolute local
|
@@ -89,10 +86,12 @@ static int transport_find_fn(
|
|
89
86
|
|
90
87
|
/* It could be a SSH remote path. Check to see if there's a :
|
91
88
|
* SSH is an unsupported transport mechanism in this version of libgit2 */
|
92
|
-
if (!definition && strrchr(url, ':'))
|
93
|
-
|
94
|
-
definition =
|
95
|
-
|
89
|
+
if (!definition && strrchr(url, ':'))
|
90
|
+
#ifdef GIT_SSH
|
91
|
+
definition = &ssh_transport_definition;
|
92
|
+
#else
|
93
|
+
definition = &dummy_transport_definition;
|
94
|
+
#endif
|
96
95
|
|
97
96
|
#ifndef GIT_WIN32
|
98
97
|
/* Check to see if the path points to a file on the local file system */
|
@@ -101,9 +100,9 @@ static int transport_find_fn(
|
|
101
100
|
#endif
|
102
101
|
|
103
102
|
if (!definition)
|
104
|
-
return
|
103
|
+
return -1;
|
105
104
|
|
106
|
-
*
|
105
|
+
*callback = definition->fn;
|
107
106
|
*param = definition->param;
|
108
107
|
|
109
108
|
return 0;
|
@@ -113,6 +112,15 @@ static int transport_find_fn(
|
|
113
112
|
* Public API *
|
114
113
|
**************/
|
115
114
|
|
115
|
+
int git_transport_dummy(git_transport **transport, git_remote *owner, void *param)
|
116
|
+
{
|
117
|
+
GIT_UNUSED(transport);
|
118
|
+
GIT_UNUSED(owner);
|
119
|
+
GIT_UNUSED(param);
|
120
|
+
giterr_set(GITERR_NET, "This transport isn't implemented. Sorry");
|
121
|
+
return -1;
|
122
|
+
}
|
123
|
+
|
116
124
|
int git_transport_new(git_transport **out, git_remote *owner, const char *url)
|
117
125
|
{
|
118
126
|
git_transport_cb fn;
|
@@ -120,96 +128,83 @@ int git_transport_new(git_transport **out, git_remote *owner, const char *url)
|
|
120
128
|
void *param;
|
121
129
|
int error;
|
122
130
|
|
123
|
-
if ((
|
131
|
+
if (transport_find_fn(url, &fn, ¶m) < 0) {
|
124
132
|
giterr_set(GITERR_NET, "Unsupported URL protocol");
|
125
133
|
return -1;
|
126
|
-
}
|
127
|
-
return error;
|
134
|
+
}
|
128
135
|
|
129
|
-
|
136
|
+
error = fn(&transport, owner, param);
|
137
|
+
if (error < 0)
|
130
138
|
return error;
|
131
139
|
|
132
|
-
GITERR_CHECK_VERSION(transport, GIT_TRANSPORT_VERSION, "git_transport");
|
133
|
-
|
134
140
|
*out = transport;
|
135
141
|
|
136
142
|
return 0;
|
137
143
|
}
|
138
144
|
|
139
145
|
int git_transport_register(
|
140
|
-
const char *
|
146
|
+
const char *prefix,
|
147
|
+
unsigned priority,
|
141
148
|
git_transport_cb cb,
|
142
149
|
void *param)
|
143
150
|
{
|
144
|
-
|
145
|
-
transport_definition *d, *definition = NULL;
|
146
|
-
size_t i;
|
147
|
-
int error = 0;
|
148
|
-
|
149
|
-
assert(scheme);
|
150
|
-
assert(cb);
|
151
|
+
transport_definition *d;
|
151
152
|
|
152
|
-
|
153
|
-
|
153
|
+
d = git__calloc(sizeof(transport_definition), 1);
|
154
|
+
GITERR_CHECK_ALLOC(d);
|
154
155
|
|
155
|
-
|
156
|
-
if (strcasecmp(d->prefix, prefix.ptr) == 0) {
|
157
|
-
error = GIT_EEXISTS;
|
158
|
-
goto on_error;
|
159
|
-
}
|
160
|
-
}
|
156
|
+
d->prefix = git__strdup(prefix);
|
161
157
|
|
162
|
-
|
163
|
-
|
158
|
+
if (!d->prefix)
|
159
|
+
goto on_error;
|
164
160
|
|
165
|
-
|
166
|
-
|
167
|
-
|
161
|
+
d->priority = priority;
|
162
|
+
d->fn = cb;
|
163
|
+
d->param = param;
|
168
164
|
|
169
|
-
if (git_vector_insert(&
|
165
|
+
if (git_vector_insert(&additional_transports, d) < 0)
|
170
166
|
goto on_error;
|
171
167
|
|
172
168
|
return 0;
|
173
169
|
|
174
170
|
on_error:
|
175
|
-
|
176
|
-
git__free(
|
177
|
-
return
|
171
|
+
git__free(d->prefix);
|
172
|
+
git__free(d);
|
173
|
+
return -1;
|
178
174
|
}
|
179
175
|
|
180
|
-
int git_transport_unregister(
|
176
|
+
int git_transport_unregister(
|
177
|
+
const char *prefix,
|
178
|
+
unsigned priority)
|
181
179
|
{
|
182
|
-
git_buf prefix = GIT_BUF_INIT;
|
183
180
|
transport_definition *d;
|
184
|
-
|
185
|
-
int error = 0;
|
186
|
-
|
187
|
-
assert(scheme);
|
188
|
-
|
189
|
-
if ((error = git_buf_printf(&prefix, "%s://", scheme)) < 0)
|
190
|
-
goto done;
|
181
|
+
unsigned i;
|
191
182
|
|
192
|
-
git_vector_foreach(&
|
193
|
-
if (strcasecmp(d->prefix, prefix
|
194
|
-
if (
|
195
|
-
|
183
|
+
git_vector_foreach(&additional_transports, i, d) {
|
184
|
+
if (d->priority == priority && !strcasecmp(d->prefix, prefix)) {
|
185
|
+
if (git_vector_remove(&additional_transports, i) < 0)
|
186
|
+
return -1;
|
196
187
|
|
197
188
|
git__free(d->prefix);
|
198
189
|
git__free(d);
|
199
190
|
|
200
|
-
if (!
|
201
|
-
git_vector_free(&
|
191
|
+
if (!additional_transports.length)
|
192
|
+
git_vector_free(&additional_transports);
|
202
193
|
|
203
|
-
|
204
|
-
goto done;
|
194
|
+
return 0;
|
205
195
|
}
|
206
196
|
}
|
207
197
|
|
208
|
-
|
198
|
+
return GIT_ENOTFOUND;
|
199
|
+
}
|
209
200
|
|
210
|
-
|
211
|
-
|
212
|
-
|
201
|
+
/* from remote.h */
|
202
|
+
int git_remote_valid_url(const char *url)
|
203
|
+
{
|
204
|
+
git_transport_cb fn;
|
205
|
+
void *param;
|
206
|
+
|
207
|
+
return !transport_find_fn(url, &fn, ¶m);
|
213
208
|
}
|
214
209
|
|
215
210
|
int git_remote_supported_url(const char* url)
|
@@ -217,8 +212,10 @@ int git_remote_supported_url(const char* url)
|
|
217
212
|
git_transport_cb fn;
|
218
213
|
void *param;
|
219
214
|
|
220
|
-
|
221
|
-
|
215
|
+
if (transport_find_fn(url, &fn, ¶m) < 0)
|
216
|
+
return 0;
|
217
|
+
|
218
|
+
return fn != &git_transport_dummy;
|
222
219
|
}
|
223
220
|
|
224
221
|
int git_transport_init(git_transport *opts, unsigned int version)
|