rugged 1.5.1 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/rugged/extconf.rb +2 -2
- data/ext/rugged/rugged_blame.c +2 -0
- data/ext/rugged/rugged_blob.c +3 -0
- data/ext/rugged/rugged_commit.c +1 -0
- data/ext/rugged/rugged_config.c +2 -0
- data/ext/rugged/rugged_diff.c +1 -0
- data/ext/rugged/rugged_index.c +2 -0
- data/ext/rugged/rugged_patch.c +1 -0
- data/ext/rugged/rugged_rebase.c +1 -0
- data/ext/rugged/rugged_reference.c +1 -0
- data/ext/rugged/rugged_remote.c +1 -0
- data/ext/rugged/rugged_repo.c +5 -2
- data/ext/rugged/rugged_revwalk.c +5 -1
- data/ext/rugged/rugged_submodule.c +1 -0
- data/ext/rugged/rugged_tag.c +1 -0
- data/ext/rugged/rugged_tree.c +4 -0
- data/lib/rugged/index.rb +1 -1
- data/lib/rugged/tree.rb +1 -1
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +5 -1
- data/vendor/libgit2/COPYING +30 -0
- data/vendor/libgit2/cmake/ExperimentalFeatures.cmake +23 -0
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +2 -0
- data/vendor/libgit2/include/git2/common.h +13 -6
- data/vendor/libgit2/include/git2/deprecated.h +6 -0
- data/vendor/libgit2/include/git2/diff.h +1 -1
- data/vendor/libgit2/include/git2/experimental.h +20 -0
- data/vendor/libgit2/include/git2/indexer.h +29 -0
- data/vendor/libgit2/include/git2/object.h +28 -2
- data/vendor/libgit2/include/git2/odb.h +58 -7
- data/vendor/libgit2/include/git2/odb_backend.h +106 -18
- data/vendor/libgit2/include/git2/oid.h +115 -15
- data/vendor/libgit2/include/git2/repository.h +20 -1
- data/vendor/libgit2/include/git2/stash.h +60 -6
- data/vendor/libgit2/include/git2/strarray.h +0 -13
- data/vendor/libgit2/include/git2/sys/odb_backend.h +1 -1
- data/vendor/libgit2/include/git2/sys/transport.h +12 -0
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2.h +1 -0
- data/vendor/libgit2/src/CMakeLists.txt +0 -6
- data/vendor/libgit2/src/cli/CMakeLists.txt +6 -2
- data/vendor/libgit2/src/cli/cmd_hash_object.c +27 -8
- data/vendor/libgit2/src/cli/opt.c +1 -1
- data/vendor/libgit2/src/libgit2/CMakeLists.txt +25 -15
- data/vendor/libgit2/src/libgit2/annotated_commit.c +1 -1
- data/vendor/libgit2/src/libgit2/annotated_commit.h +1 -1
- data/vendor/libgit2/src/libgit2/attr_file.c +1 -1
- data/vendor/libgit2/src/libgit2/attrcache.c +1 -1
- data/vendor/libgit2/src/libgit2/blame.c +2 -0
- data/vendor/libgit2/src/libgit2/blob.c +4 -2
- data/vendor/libgit2/src/libgit2/blob.h +2 -2
- data/vendor/libgit2/src/libgit2/branch.c +2 -2
- data/vendor/libgit2/src/libgit2/cherrypick.c +3 -3
- data/vendor/libgit2/src/libgit2/clone.c +31 -2
- data/vendor/libgit2/src/libgit2/commit.c +52 -17
- data/vendor/libgit2/src/libgit2/commit.h +25 -7
- data/vendor/libgit2/src/libgit2/commit_graph.c +47 -32
- data/vendor/libgit2/src/libgit2/commit_graph.h +3 -0
- data/vendor/libgit2/src/libgit2/commit_list.c +6 -2
- data/vendor/libgit2/src/libgit2/config.c +1 -1
- data/vendor/libgit2/src/libgit2/config_file.c +2 -2
- data/vendor/libgit2/src/libgit2/describe.c +8 -8
- data/vendor/libgit2/src/libgit2/diff.c +5 -1
- data/vendor/libgit2/src/libgit2/diff_file.c +15 -6
- data/vendor/libgit2/src/libgit2/diff_generate.c +17 -12
- data/vendor/libgit2/src/libgit2/diff_print.c +5 -5
- data/vendor/libgit2/src/libgit2/diff_tform.c +4 -0
- data/vendor/libgit2/src/libgit2/email.c +2 -2
- data/vendor/libgit2/src/libgit2/experimental.h.in +13 -0
- data/vendor/libgit2/src/libgit2/fetch.c +3 -6
- data/vendor/libgit2/src/libgit2/fetchhead.c +4 -4
- data/vendor/libgit2/src/libgit2/ident.c +3 -3
- data/vendor/libgit2/src/libgit2/index.c +11 -9
- data/vendor/libgit2/src/libgit2/indexer.c +107 -44
- data/vendor/libgit2/src/libgit2/iterator.c +4 -2
- data/vendor/libgit2/src/libgit2/libgit2.c +19 -0
- data/vendor/libgit2/src/libgit2/merge.c +3 -3
- data/vendor/libgit2/src/libgit2/midx.c +16 -15
- data/vendor/libgit2/src/libgit2/mwindow.c +5 -2
- data/vendor/libgit2/src/libgit2/mwindow.h +4 -1
- data/vendor/libgit2/src/libgit2/notes.c +5 -5
- data/vendor/libgit2/src/libgit2/object.c +89 -25
- data/vendor/libgit2/src/libgit2/object.h +12 -3
- data/vendor/libgit2/src/libgit2/odb.c +194 -50
- data/vendor/libgit2/src/libgit2/odb.h +43 -4
- data/vendor/libgit2/src/libgit2/odb_loose.c +128 -70
- data/vendor/libgit2/src/libgit2/odb_pack.c +96 -44
- data/vendor/libgit2/src/libgit2/oid.c +134 -76
- data/vendor/libgit2/src/libgit2/oid.h +183 -9
- data/vendor/libgit2/src/libgit2/pack-objects.c +15 -4
- data/vendor/libgit2/src/libgit2/pack.c +90 -66
- data/vendor/libgit2/src/libgit2/pack.h +29 -15
- data/vendor/libgit2/src/libgit2/parse.c +4 -3
- data/vendor/libgit2/src/libgit2/patch_parse.c +5 -5
- data/vendor/libgit2/src/libgit2/push.c +13 -3
- data/vendor/libgit2/src/libgit2/reader.c +1 -1
- data/vendor/libgit2/src/libgit2/rebase.c +19 -18
- data/vendor/libgit2/src/libgit2/refdb_fs.c +70 -39
- data/vendor/libgit2/src/libgit2/reflog.c +7 -5
- data/vendor/libgit2/src/libgit2/reflog.h +1 -2
- data/vendor/libgit2/src/libgit2/refs.c +2 -0
- data/vendor/libgit2/src/libgit2/remote.c +38 -37
- data/vendor/libgit2/src/libgit2/remote.h +40 -0
- data/vendor/libgit2/src/libgit2/repository.c +212 -36
- data/vendor/libgit2/src/libgit2/repository.h +9 -0
- data/vendor/libgit2/src/libgit2/reset.c +2 -2
- data/vendor/libgit2/src/libgit2/revert.c +4 -4
- data/vendor/libgit2/src/libgit2/revparse.c +23 -7
- data/vendor/libgit2/src/libgit2/revwalk.c +5 -1
- data/vendor/libgit2/src/libgit2/stash.c +201 -26
- data/vendor/libgit2/src/libgit2/strarray.c +1 -0
- data/vendor/libgit2/src/libgit2/strarray.h +25 -0
- data/vendor/libgit2/src/libgit2/streams/openssl.c +1 -1
- data/vendor/libgit2/src/libgit2/streams/openssl_dynamic.c +7 -3
- data/vendor/libgit2/src/libgit2/streams/socket.c +4 -1
- data/vendor/libgit2/src/libgit2/submodule.c +6 -2
- data/vendor/libgit2/src/libgit2/sysdir.c +294 -7
- data/vendor/libgit2/src/libgit2/sysdir.h +39 -9
- data/vendor/libgit2/src/libgit2/tag.c +29 -10
- data/vendor/libgit2/src/libgit2/tag.h +2 -2
- data/vendor/libgit2/src/libgit2/threadstate.h +1 -1
- data/vendor/libgit2/src/libgit2/transports/http.c +8 -7
- data/vendor/libgit2/src/libgit2/transports/httpclient.c +9 -0
- data/vendor/libgit2/src/libgit2/transports/httpclient.h +10 -0
- data/vendor/libgit2/src/libgit2/transports/local.c +14 -0
- data/vendor/libgit2/src/libgit2/transports/smart.c +35 -0
- data/vendor/libgit2/src/libgit2/transports/smart.h +10 -1
- data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +153 -41
- data/vendor/libgit2/src/libgit2/transports/smart_protocol.c +42 -12
- data/vendor/libgit2/src/libgit2/transports/ssh.c +62 -65
- data/vendor/libgit2/src/libgit2/transports/winhttp.c +9 -4
- data/vendor/libgit2/src/libgit2/tree-cache.c +4 -4
- data/vendor/libgit2/src/libgit2/tree.c +22 -16
- data/vendor/libgit2/src/libgit2/tree.h +2 -2
- data/vendor/libgit2/src/libgit2/worktree.c +5 -0
- data/vendor/libgit2/src/util/CMakeLists.txt +7 -1
- data/vendor/libgit2/src/util/fs_path.c +1 -1
- data/vendor/libgit2/src/util/futils.c +0 -3
- data/vendor/libgit2/src/util/git2_util.h +2 -2
- data/vendor/libgit2/src/util/hash/openssl.c +4 -3
- data/vendor/libgit2/src/util/hash/rfc6234/sha.h +0 -112
- data/vendor/libgit2/src/util/hash.h +13 -0
- data/vendor/libgit2/src/util/net.c +338 -84
- data/vendor/libgit2/src/util/net.h +7 -0
- data/vendor/libgit2/src/util/posix.h +2 -0
- data/vendor/libgit2/src/util/rand.c +4 -0
- data/vendor/libgit2/src/util/regexp.c +3 -3
- data/vendor/libgit2/src/util/thread.h +20 -19
- data/vendor/libgit2/src/util/util.h +1 -0
- metadata +7 -5
- data/vendor/libgit2/src/util/win32/findfile.c +0 -286
- data/vendor/libgit2/src/util/win32/findfile.h +0 -22
- /data/vendor/libgit2/src/{features.h.in → util/git2_features.h.in} +0 -0
@@ -25,6 +25,7 @@
|
|
25
25
|
#include "merge.h"
|
26
26
|
#include "diff.h"
|
27
27
|
#include "diff_generate.h"
|
28
|
+
#include "strarray.h"
|
28
29
|
|
29
30
|
static int create_error(int error, const char *msg)
|
30
31
|
{
|
@@ -193,6 +194,30 @@ static int stash_to_index(
|
|
193
194
|
return git_index_add(index, &entry);
|
194
195
|
}
|
195
196
|
|
197
|
+
static int stash_update_index_from_paths(
|
198
|
+
git_repository *repo,
|
199
|
+
git_index *index,
|
200
|
+
const git_strarray *paths)
|
201
|
+
{
|
202
|
+
unsigned int status_flags;
|
203
|
+
size_t i;
|
204
|
+
int error = 0;
|
205
|
+
|
206
|
+
for (i = 0; i < paths->count; i++) {
|
207
|
+
git_status_file(&status_flags, repo, paths->strings[i]);
|
208
|
+
|
209
|
+
if (status_flags & (GIT_STATUS_WT_DELETED | GIT_STATUS_INDEX_DELETED)) {
|
210
|
+
if ((error = git_index_remove(index, paths->strings[i], 0)) < 0)
|
211
|
+
return error;
|
212
|
+
} else {
|
213
|
+
if ((error = stash_to_index(repo, index, paths->strings[i])) < 0)
|
214
|
+
return error;
|
215
|
+
}
|
216
|
+
}
|
217
|
+
|
218
|
+
return error;
|
219
|
+
}
|
220
|
+
|
196
221
|
static int stash_update_index_from_diff(
|
197
222
|
git_repository *repo,
|
198
223
|
git_index *index,
|
@@ -388,24 +413,79 @@ cleanup:
|
|
388
413
|
return error;
|
389
414
|
}
|
390
415
|
|
391
|
-
static int
|
416
|
+
static int build_stash_commit_from_tree(
|
392
417
|
git_oid *w_commit_oid,
|
393
418
|
git_repository *repo,
|
394
419
|
const git_signature *stasher,
|
395
420
|
const char *message,
|
396
421
|
git_commit *i_commit,
|
397
422
|
git_commit *b_commit,
|
398
|
-
git_commit *u_commit
|
423
|
+
git_commit *u_commit,
|
424
|
+
const git_tree *tree)
|
399
425
|
{
|
400
426
|
const git_commit *parents[] = { NULL, NULL, NULL };
|
401
|
-
git_index *i_index = NULL, *r_index = NULL;
|
402
|
-
git_tree *w_tree = NULL;
|
403
|
-
int error = 0, ignorecase;
|
404
427
|
|
405
428
|
parents[0] = b_commit;
|
406
429
|
parents[1] = i_commit;
|
407
430
|
parents[2] = u_commit;
|
408
431
|
|
432
|
+
return git_commit_create(
|
433
|
+
w_commit_oid,
|
434
|
+
repo,
|
435
|
+
NULL,
|
436
|
+
stasher,
|
437
|
+
stasher,
|
438
|
+
NULL,
|
439
|
+
message,
|
440
|
+
tree,
|
441
|
+
u_commit ? 3 : 2,
|
442
|
+
parents);
|
443
|
+
}
|
444
|
+
|
445
|
+
static int build_stash_commit_from_index(
|
446
|
+
git_oid *w_commit_oid,
|
447
|
+
git_repository *repo,
|
448
|
+
const git_signature *stasher,
|
449
|
+
const char *message,
|
450
|
+
git_commit *i_commit,
|
451
|
+
git_commit *b_commit,
|
452
|
+
git_commit *u_commit,
|
453
|
+
git_index *index)
|
454
|
+
{
|
455
|
+
git_tree *tree;
|
456
|
+
int error;
|
457
|
+
|
458
|
+
if ((error = build_tree_from_index(&tree, repo, index)) < 0)
|
459
|
+
goto cleanup;
|
460
|
+
|
461
|
+
error = build_stash_commit_from_tree(
|
462
|
+
w_commit_oid,
|
463
|
+
repo,
|
464
|
+
stasher,
|
465
|
+
message,
|
466
|
+
i_commit,
|
467
|
+
b_commit,
|
468
|
+
u_commit,
|
469
|
+
tree);
|
470
|
+
|
471
|
+
cleanup:
|
472
|
+
git_tree_free(tree);
|
473
|
+
return error;
|
474
|
+
}
|
475
|
+
|
476
|
+
static int commit_worktree(
|
477
|
+
git_oid *w_commit_oid,
|
478
|
+
git_repository *repo,
|
479
|
+
const git_signature *stasher,
|
480
|
+
const char *message,
|
481
|
+
git_commit *i_commit,
|
482
|
+
git_commit *b_commit,
|
483
|
+
git_commit *u_commit)
|
484
|
+
{
|
485
|
+
git_index *i_index = NULL, *r_index = NULL;
|
486
|
+
git_tree *w_tree = NULL;
|
487
|
+
int error = 0, ignorecase;
|
488
|
+
|
409
489
|
if ((error = git_repository_index(&r_index, repo) < 0) ||
|
410
490
|
(error = git_index_new(&i_index)) < 0 ||
|
411
491
|
(error = git_index__fill(i_index, &r_index->entries) < 0) ||
|
@@ -417,17 +497,16 @@ static int commit_worktree(
|
|
417
497
|
if ((error = build_workdir_tree(&w_tree, repo, i_index, b_commit)) < 0)
|
418
498
|
goto cleanup;
|
419
499
|
|
420
|
-
error =
|
500
|
+
error = build_stash_commit_from_tree(
|
421
501
|
w_commit_oid,
|
422
502
|
repo,
|
423
|
-
NULL,
|
424
503
|
stasher,
|
425
|
-
stasher,
|
426
|
-
NULL,
|
427
504
|
message,
|
428
|
-
|
429
|
-
|
430
|
-
|
505
|
+
i_commit,
|
506
|
+
b_commit,
|
507
|
+
u_commit,
|
508
|
+
w_tree
|
509
|
+
);
|
431
510
|
|
432
511
|
cleanup:
|
433
512
|
git_tree_free(w_tree);
|
@@ -520,6 +599,54 @@ static int ensure_there_are_changes_to_stash(git_repository *repo, uint32_t flag
|
|
520
599
|
return error;
|
521
600
|
}
|
522
601
|
|
602
|
+
static int has_changes_cb(
|
603
|
+
const char *path,
|
604
|
+
unsigned int status,
|
605
|
+
void *payload)
|
606
|
+
{
|
607
|
+
GIT_UNUSED(path);
|
608
|
+
GIT_UNUSED(status);
|
609
|
+
GIT_UNUSED(payload);
|
610
|
+
|
611
|
+
if (status == GIT_STATUS_CURRENT)
|
612
|
+
return GIT_ENOTFOUND;
|
613
|
+
|
614
|
+
return 0;
|
615
|
+
}
|
616
|
+
|
617
|
+
static int ensure_there_are_changes_to_stash_paths(
|
618
|
+
git_repository *repo,
|
619
|
+
uint32_t flags,
|
620
|
+
const git_strarray *paths)
|
621
|
+
{
|
622
|
+
int error;
|
623
|
+
git_status_options opts = GIT_STATUS_OPTIONS_INIT;
|
624
|
+
|
625
|
+
opts.show = GIT_STATUS_SHOW_INDEX_AND_WORKDIR;
|
626
|
+
opts.flags = GIT_STATUS_OPT_EXCLUDE_SUBMODULES |
|
627
|
+
GIT_STATUS_OPT_INCLUDE_UNMODIFIED |
|
628
|
+
GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH;
|
629
|
+
|
630
|
+
if (flags & GIT_STASH_INCLUDE_UNTRACKED)
|
631
|
+
opts.flags |= GIT_STATUS_OPT_INCLUDE_UNTRACKED |
|
632
|
+
GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS;
|
633
|
+
|
634
|
+
if (flags & GIT_STASH_INCLUDE_IGNORED)
|
635
|
+
opts.flags |= GIT_STATUS_OPT_INCLUDE_IGNORED |
|
636
|
+
GIT_STATUS_OPT_RECURSE_IGNORED_DIRS;
|
637
|
+
|
638
|
+
git_strarray_copy(&opts.pathspec, paths);
|
639
|
+
|
640
|
+
error = git_status_foreach_ext(repo, &opts, has_changes_cb, NULL);
|
641
|
+
|
642
|
+
git_strarray_dispose(&opts.pathspec);
|
643
|
+
|
644
|
+
if (error == GIT_ENOTFOUND)
|
645
|
+
return create_error(GIT_ENOTFOUND, "one of the files does not have any changes to stash.");
|
646
|
+
|
647
|
+
return error;
|
648
|
+
}
|
649
|
+
|
523
650
|
static int reset_index_and_workdir(git_repository *repo, git_commit *commit, uint32_t flags)
|
524
651
|
{
|
525
652
|
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
@@ -540,14 +667,36 @@ int git_stash_save(
|
|
540
667
|
const char *message,
|
541
668
|
uint32_t flags)
|
542
669
|
{
|
543
|
-
|
670
|
+
git_stash_save_options opts = GIT_STASH_SAVE_OPTIONS_INIT;
|
671
|
+
|
672
|
+
GIT_ASSERT_ARG(stasher);
|
673
|
+
|
674
|
+
opts.stasher = stasher;
|
675
|
+
opts.message = message;
|
676
|
+
opts.flags = flags;
|
677
|
+
|
678
|
+
return git_stash_save_with_opts(out, repo, &opts);
|
679
|
+
}
|
680
|
+
|
681
|
+
int git_stash_save_with_opts(
|
682
|
+
git_oid *out,
|
683
|
+
git_repository *repo,
|
684
|
+
const git_stash_save_options *opts)
|
685
|
+
{
|
686
|
+
git_index *index = NULL, *paths_index = NULL;
|
544
687
|
git_commit *b_commit = NULL, *i_commit = NULL, *u_commit = NULL;
|
545
688
|
git_str msg = GIT_STR_INIT;
|
689
|
+
git_tree *tree = NULL;
|
690
|
+
git_reference *head = NULL;
|
691
|
+
bool has_paths = false;
|
692
|
+
|
546
693
|
int error;
|
547
694
|
|
548
695
|
GIT_ASSERT_ARG(out);
|
549
696
|
GIT_ASSERT_ARG(repo);
|
550
|
-
GIT_ASSERT_ARG(stasher);
|
697
|
+
GIT_ASSERT_ARG(opts && opts->stasher);
|
698
|
+
|
699
|
+
has_paths = opts->paths.count > 0;
|
551
700
|
|
552
701
|
if ((error = git_repository__ensure_not_bare(repo, "stash save")) < 0)
|
553
702
|
return error;
|
@@ -555,44 +704,63 @@ int git_stash_save(
|
|
555
704
|
if ((error = retrieve_base_commit_and_message(&b_commit, &msg, repo)) < 0)
|
556
705
|
goto cleanup;
|
557
706
|
|
558
|
-
if (
|
707
|
+
if (!has_paths &&
|
708
|
+
(error = ensure_there_are_changes_to_stash(repo, opts->flags)) < 0)
|
709
|
+
goto cleanup;
|
710
|
+
else if (has_paths &&
|
711
|
+
(error = ensure_there_are_changes_to_stash_paths(
|
712
|
+
repo, opts->flags, &opts->paths)) < 0)
|
559
713
|
goto cleanup;
|
560
714
|
|
561
715
|
if ((error = git_repository_index(&index, repo)) < 0)
|
562
716
|
goto cleanup;
|
563
717
|
|
564
|
-
if ((error = commit_index(&i_commit, repo, index, stasher,
|
718
|
+
if ((error = commit_index(&i_commit, repo, index, opts->stasher,
|
565
719
|
git_str_cstr(&msg), b_commit)) < 0)
|
566
720
|
goto cleanup;
|
567
721
|
|
568
|
-
if ((flags & (GIT_STASH_INCLUDE_UNTRACKED | GIT_STASH_INCLUDE_IGNORED)) &&
|
569
|
-
(error = commit_untracked(&u_commit, repo, stasher,
|
570
|
-
|
722
|
+
if ((opts->flags & (GIT_STASH_INCLUDE_UNTRACKED | GIT_STASH_INCLUDE_IGNORED)) &&
|
723
|
+
(error = commit_untracked(&u_commit, repo, opts->stasher,
|
724
|
+
git_str_cstr(&msg), i_commit, opts->flags)) < 0)
|
571
725
|
goto cleanup;
|
572
726
|
|
573
|
-
if ((error = prepare_worktree_commit_message(&msg, message)) < 0)
|
727
|
+
if ((error = prepare_worktree_commit_message(&msg, opts->message)) < 0)
|
574
728
|
goto cleanup;
|
575
729
|
|
576
|
-
if (
|
577
|
-
|
578
|
-
|
730
|
+
if (!has_paths) {
|
731
|
+
if ((error = commit_worktree(out, repo, opts->stasher, git_str_cstr(&msg),
|
732
|
+
i_commit, b_commit, u_commit)) < 0)
|
733
|
+
goto cleanup;
|
734
|
+
} else {
|
735
|
+
if ((error = git_index_new(&paths_index)) < 0 ||
|
736
|
+
(error = retrieve_head(&head, repo)) < 0 ||
|
737
|
+
(error = git_reference_peel((git_object**)&tree, head, GIT_OBJECT_TREE)) < 0 ||
|
738
|
+
(error = git_index_read_tree(paths_index, tree)) < 0 ||
|
739
|
+
(error = stash_update_index_from_paths(repo, paths_index, &opts->paths)) < 0 ||
|
740
|
+
(error = build_stash_commit_from_index(out, repo, opts->stasher, git_str_cstr(&msg),
|
741
|
+
i_commit, b_commit, u_commit, paths_index)) < 0)
|
742
|
+
goto cleanup;
|
743
|
+
}
|
579
744
|
|
580
745
|
git_str_rtrim(&msg);
|
581
746
|
|
582
747
|
if ((error = update_reflog(out, repo, git_str_cstr(&msg))) < 0)
|
583
748
|
goto cleanup;
|
584
749
|
|
585
|
-
if ((
|
586
|
-
|
750
|
+
if (!(opts->flags & GIT_STASH_KEEP_ALL) &&
|
751
|
+
(error = reset_index_and_workdir(repo,
|
752
|
+
(opts->flags & GIT_STASH_KEEP_INDEX) ? i_commit : b_commit,opts->flags)) < 0)
|
587
753
|
goto cleanup;
|
588
754
|
|
589
755
|
cleanup:
|
590
|
-
|
591
756
|
git_str_dispose(&msg);
|
592
757
|
git_commit_free(i_commit);
|
593
758
|
git_commit_free(b_commit);
|
594
759
|
git_commit_free(u_commit);
|
760
|
+
git_tree_free(tree);
|
761
|
+
git_reference_free(head);
|
595
762
|
git_index_free(index);
|
763
|
+
git_index_free(paths_index);
|
596
764
|
|
597
765
|
return error;
|
598
766
|
}
|
@@ -777,6 +945,13 @@ int git_stash_apply_options_init(git_stash_apply_options *opts, unsigned int ver
|
|
777
945
|
return 0;
|
778
946
|
}
|
779
947
|
|
948
|
+
int git_stash_save_options_init(git_stash_save_options *opts, unsigned int version)
|
949
|
+
{
|
950
|
+
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
|
951
|
+
opts, version, git_stash_save_options, GIT_STASH_SAVE_OPTIONS_INIT);
|
952
|
+
return 0;
|
953
|
+
}
|
954
|
+
|
780
955
|
#ifndef GIT_DEPRECATE_HARD
|
781
956
|
int git_stash_apply_init_options(git_stash_apply_options *opts, unsigned int version)
|
782
957
|
{
|
@@ -0,0 +1,25 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
|
+
*
|
4
|
+
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
|
+
* a Linking Exception. For full terms see the included COPYING file.
|
6
|
+
*/
|
7
|
+
#ifndef INCLUDE_strarray_h__
|
8
|
+
#define INCLUDE_strarray_h__
|
9
|
+
|
10
|
+
#include "common.h"
|
11
|
+
#include "git2/strarray.h"
|
12
|
+
|
13
|
+
/**
|
14
|
+
* Copy a string array object from source to target.
|
15
|
+
*
|
16
|
+
* Note: target is overwritten and hence should be empty, otherwise its
|
17
|
+
* contents are leaked. Call git_strarray_free() if necessary.
|
18
|
+
*
|
19
|
+
* @param tgt target
|
20
|
+
* @param src source
|
21
|
+
* @return 0 on success, < 0 on allocation failure
|
22
|
+
*/
|
23
|
+
extern int git_strarray_copy(git_strarray *tgt, const git_strarray *src);
|
24
|
+
|
25
|
+
#endif
|
@@ -198,7 +198,7 @@ static int openssl_ensure_initialized(void)
|
|
198
198
|
if ((error = git_openssl_stream_dynamic_init()) == 0)
|
199
199
|
error = openssl_init();
|
200
200
|
|
201
|
-
openssl_initialized =
|
201
|
+
openssl_initialized = !error;
|
202
202
|
}
|
203
203
|
|
204
204
|
error |= git_mutex_unlock(&openssl_mutex);
|
@@ -91,7 +91,7 @@ int (*sk_num)(const void *sk);
|
|
91
91
|
void *(*sk_value)(const void *sk, int i);
|
92
92
|
void (*sk_free)(void *sk);
|
93
93
|
|
94
|
-
void *openssl_handle;
|
94
|
+
static void *openssl_handle;
|
95
95
|
|
96
96
|
GIT_INLINE(void *) openssl_sym(int *err, const char *name, bool required)
|
97
97
|
{
|
@@ -125,7 +125,8 @@ int git_openssl_stream_dynamic_init(void)
|
|
125
125
|
(openssl_handle = dlopen("libssl.1.1.dylib", RTLD_NOW)) == NULL &&
|
126
126
|
(openssl_handle = dlopen("libssl.so.1.0.0", RTLD_NOW)) == NULL &&
|
127
127
|
(openssl_handle = dlopen("libssl.1.0.0.dylib", RTLD_NOW)) == NULL &&
|
128
|
-
(openssl_handle = dlopen("libssl.so.10", RTLD_NOW)) == NULL
|
128
|
+
(openssl_handle = dlopen("libssl.so.10", RTLD_NOW)) == NULL &&
|
129
|
+
(openssl_handle = dlopen("libssl.so.3", RTLD_NOW)) == NULL) {
|
129
130
|
git_error_set(GIT_ERROR_SSL, "could not load ssl libraries");
|
130
131
|
return -1;
|
131
132
|
}
|
@@ -175,7 +176,6 @@ int git_openssl_stream_dynamic_init(void)
|
|
175
176
|
|
176
177
|
SSL_connect = (int (*)(SSL *))openssl_sym(&err, "SSL_connect", true);
|
177
178
|
SSL_ctrl = (long (*)(SSL *, int, long, void *))openssl_sym(&err, "SSL_ctrl", true);
|
178
|
-
SSL_get_peer_certificate = (X509 *(*)(const SSL *))openssl_sym(&err, "SSL_get_peer_certificate", true);
|
179
179
|
SSL_library_init = (int (*)(void))openssl_sym(&err, "SSL_library_init", false);
|
180
180
|
SSL_free = (void (*)(SSL *))openssl_sym(&err, "SSL_free", true);
|
181
181
|
SSL_get_error = (int (*)(SSL *, int))openssl_sym(&err, "SSL_get_error", true);
|
@@ -187,6 +187,10 @@ int git_openssl_stream_dynamic_init(void)
|
|
187
187
|
SSL_shutdown = (int (*)(SSL *ssl))openssl_sym(&err, "SSL_shutdown", true);
|
188
188
|
SSL_write = (int (*)(SSL *, const void *, int))openssl_sym(&err, "SSL_write", true);
|
189
189
|
|
190
|
+
if (!(SSL_get_peer_certificate = (X509 *(*)(const SSL *))openssl_sym(&err, "SSL_get_peer_certificate", false))) {
|
191
|
+
SSL_get_peer_certificate = (X509 *(*)(const SSL *))openssl_sym(&err, "SSL_get1_peer_certificate", true);
|
192
|
+
}
|
193
|
+
|
190
194
|
SSL_CTX_ctrl = (long (*)(SSL_CTX *, int, long, void *))openssl_sym(&err, "SSL_CTX_ctrl", true);
|
191
195
|
SSL_CTX_free = (void (*)(SSL_CTX *))openssl_sym(&err, "SSL_CTX_free", true);
|
192
196
|
SSL_CTX_new = (SSL_CTX *(*)(const SSL_METHOD *))openssl_sym(&err, "SSL_CTX_new", true);
|
@@ -135,9 +135,12 @@ static ssize_t socket_write(git_stream *stream, const char *data, size_t len, in
|
|
135
135
|
git_socket_stream *st = (git_socket_stream *) stream;
|
136
136
|
ssize_t written;
|
137
137
|
|
138
|
+
GIT_ASSERT(flags == 0);
|
139
|
+
GIT_UNUSED(flags);
|
140
|
+
|
138
141
|
errno = 0;
|
139
142
|
|
140
|
-
if ((written = p_send(st->s, data, len,
|
143
|
+
if ((written = p_send(st->s, data, len, 0)) < 0) {
|
141
144
|
net_set_error("error sending data");
|
142
145
|
return -1;
|
143
146
|
}
|
@@ -1338,7 +1338,11 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
|
|
1338
1338
|
/* Get the status of the submodule to determine if it is already initialized */
|
1339
1339
|
if ((error = git_submodule_status(&submodule_status, sm->repo, sm->name, GIT_SUBMODULE_IGNORE_UNSPECIFIED)) < 0)
|
1340
1340
|
goto done;
|
1341
|
-
|
1341
|
+
|
1342
|
+
/* If the submodule is configured but hasn't been added, skip it */
|
1343
|
+
if (submodule_status == GIT_SUBMODULE_STATUS_IN_CONFIG)
|
1344
|
+
goto done;
|
1345
|
+
|
1342
1346
|
/*
|
1343
1347
|
* If submodule work dir is not already initialized, check to see
|
1344
1348
|
* what we need to do (initialize, clone, return error...)
|
@@ -1389,7 +1393,7 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
|
|
1389
1393
|
*/
|
1390
1394
|
clone_options.checkout_opts.checkout_strategy = GIT_CHECKOUT_NONE;
|
1391
1395
|
|
1392
|
-
if ((error =
|
1396
|
+
if ((error = git_clone__submodule(&sub_repo, submodule_url, sm->path, &clone_options)) < 0 ||
|
1393
1397
|
(error = git_repository_set_head_detached(sub_repo, git_submodule_index_id(sm))) < 0 ||
|
1394
1398
|
(error = git_checkout_head(sub_repo, &update_options.checkout_opts)) != 0)
|
1395
1399
|
goto done;
|