rugged 1.0.1 → 1.1.0
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/rugged_commit.c +1 -1
- data/lib/rugged/commit.rb +16 -2
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +31 -69
- data/vendor/libgit2/cmake/{Modules/AddCFlagIfSupported.cmake → AddCFlagIfSupported.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/EnableWarnings.cmake → EnableWarnings.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindCoreFoundation.cmake → FindCoreFoundation.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindGSSAPI.cmake → FindGSSAPI.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindGSSFramework.cmake → FindGSSFramework.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindHTTP_Parser.cmake → FindHTTP_Parser.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindIconv.cmake → FindIconv.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindPCRE.cmake → FindPCRE.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindPCRE2.cmake → FindPCRE2.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindPkgLibraries.cmake → FindPkgLibraries.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindSecurity.cmake → FindSecurity.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindStatNsec.cmake → FindStatNsec.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindmbedTLS.cmake → FindmbedTLS.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/IdeSplitSources.cmake → IdeSplitSources.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/PkgBuildConfig.cmake → PkgBuildConfig.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/SanitizeBool.cmake → SanitizeBool.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/SelectGSSAPI.cmake → SelectGSSAPI.cmake} +18 -26
- data/vendor/libgit2/cmake/{Modules/SelectHTTPSBackend.cmake → SelectHTTPSBackend.cmake} +25 -32
- data/vendor/libgit2/cmake/{Modules/SelectHashes.cmake → SelectHashes.cmake} +20 -28
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +4 -3
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +6 -5
- data/vendor/libgit2/deps/ntlmclient/compat.h +8 -1
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +8 -11
- data/vendor/libgit2/deps/pcre/LICENCE +93 -0
- data/vendor/libgit2/deps/pcre/pcre.h +2 -2
- data/vendor/libgit2/deps/pcre/pcre_compile.c +29 -17
- data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +4 -4
- data/vendor/libgit2/deps/pcre/pcreposix.c +2 -3
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +6 -5
- data/vendor/libgit2/deps/zlib/deflate.c +1 -0
- data/vendor/libgit2/include/git2/annotated_commit.h +1 -1
- data/vendor/libgit2/include/git2/blame.h +2 -0
- data/vendor/libgit2/include/git2/common.h +15 -3
- data/vendor/libgit2/include/git2/deprecated.h +42 -2
- data/vendor/libgit2/include/git2/errors.h +2 -1
- data/vendor/libgit2/include/git2/index.h +1 -2
- data/vendor/libgit2/include/git2/pack.h +1 -1
- data/vendor/libgit2/include/git2/strarray.h +6 -10
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/src/CMakeLists.txt +53 -41
- data/vendor/libgit2/src/apply.c +5 -1
- data/vendor/libgit2/src/assert_safe.h +58 -0
- data/vendor/libgit2/src/attr_file.c +8 -3
- data/vendor/libgit2/src/attrcache.c +2 -3
- data/vendor/libgit2/src/blame.c +2 -0
- data/vendor/libgit2/src/blame_git.c +6 -3
- data/vendor/libgit2/src/blob.c +2 -0
- data/vendor/libgit2/src/branch.c +19 -21
- data/vendor/libgit2/src/buffer.c +6 -3
- data/vendor/libgit2/src/cache.c +1 -22
- data/vendor/libgit2/src/checkout.c +49 -72
- data/vendor/libgit2/src/cherrypick.c +2 -0
- data/vendor/libgit2/src/clone.c +78 -18
- data/vendor/libgit2/src/common.h +1 -0
- data/vendor/libgit2/src/config.c +3 -7
- data/vendor/libgit2/src/config_entries.c +35 -27
- data/vendor/libgit2/src/config_parse.c +1 -1
- data/vendor/libgit2/src/config_snapshot.c +2 -1
- data/vendor/libgit2/src/describe.c +5 -1
- data/vendor/libgit2/src/diff.c +12 -11
- data/vendor/libgit2/src/diff_file.c +3 -1
- data/vendor/libgit2/src/diff_generate.c +10 -11
- data/vendor/libgit2/src/diff_parse.c +2 -3
- data/vendor/libgit2/src/diff_print.c +63 -60
- data/vendor/libgit2/src/diff_stats.c +12 -11
- data/vendor/libgit2/src/diff_tform.c +2 -3
- data/vendor/libgit2/src/errors.c +2 -0
- data/vendor/libgit2/src/fetch.c +2 -0
- data/vendor/libgit2/src/filter.c +3 -3
- data/vendor/libgit2/src/futils.c +3 -3
- data/vendor/libgit2/src/futils.h +3 -3
- data/vendor/libgit2/src/global.c +3 -1
- data/vendor/libgit2/src/idxmap.c +0 -22
- data/vendor/libgit2/src/index.c +12 -7
- data/vendor/libgit2/src/indexer.c +10 -4
- data/vendor/libgit2/src/iterator.c +4 -4
- data/vendor/libgit2/src/merge.c +13 -7
- data/vendor/libgit2/src/merge_file.c +4 -6
- data/vendor/libgit2/src/midx.c +418 -0
- data/vendor/libgit2/src/midx.h +83 -0
- data/vendor/libgit2/src/mwindow.c +124 -51
- data/vendor/libgit2/src/net.c +6 -1
- data/vendor/libgit2/src/object.c +2 -1
- data/vendor/libgit2/src/odb.c +9 -6
- data/vendor/libgit2/src/odb_loose.c +3 -3
- data/vendor/libgit2/src/odb_mempack.c +2 -0
- data/vendor/libgit2/src/oid.c +2 -0
- data/vendor/libgit2/src/pack-objects.c +29 -21
- data/vendor/libgit2/src/pack.c +47 -28
- data/vendor/libgit2/src/pack.h +19 -2
- data/vendor/libgit2/src/patch_generate.c +1 -3
- data/vendor/libgit2/src/patch_parse.c +4 -2
- data/vendor/libgit2/src/path.c +4 -4
- data/vendor/libgit2/src/pathspec.c +4 -3
- data/vendor/libgit2/src/pool.c +21 -15
- data/vendor/libgit2/src/pool.h +9 -1
- data/vendor/libgit2/src/proxy.c +2 -0
- data/vendor/libgit2/src/push.c +2 -0
- data/vendor/libgit2/src/rebase.c +2 -0
- data/vendor/libgit2/src/refdb.c +135 -0
- data/vendor/libgit2/src/refdb.h +69 -0
- data/vendor/libgit2/src/refdb_fs.c +19 -81
- data/vendor/libgit2/src/reflog.c +2 -6
- data/vendor/libgit2/src/refs.c +60 -188
- data/vendor/libgit2/src/refs.h +1 -19
- data/vendor/libgit2/src/regexp.c +2 -2
- data/vendor/libgit2/src/remote.c +32 -17
- data/vendor/libgit2/src/repository.c +168 -79
- data/vendor/libgit2/src/repository.h +10 -27
- data/vendor/libgit2/src/revert.c +2 -0
- data/vendor/libgit2/src/revparse.c +5 -4
- data/vendor/libgit2/src/revwalk.c +3 -5
- data/vendor/libgit2/src/settings.c +9 -0
- data/vendor/libgit2/src/sortedcache.c +2 -3
- data/vendor/libgit2/src/stash.c +2 -0
- data/vendor/libgit2/src/status.c +2 -0
- data/vendor/libgit2/src/strarray.c +63 -0
- data/vendor/libgit2/src/streams/openssl.c +12 -6
- data/vendor/libgit2/src/streams/registry.c +5 -3
- data/vendor/libgit2/src/submodule.c +6 -4
- data/vendor/libgit2/src/sysdir.c +4 -20
- data/vendor/libgit2/src/sysdir.h +0 -11
- data/vendor/libgit2/src/tag.c +2 -0
- data/vendor/libgit2/src/thread-utils.h +139 -21
- data/vendor/libgit2/src/transaction.c +2 -1
- data/vendor/libgit2/src/transports/credential.c +2 -0
- data/vendor/libgit2/src/transports/credential_helpers.c +2 -0
- data/vendor/libgit2/src/transports/httpclient.c +6 -8
- data/vendor/libgit2/src/transports/local.c +2 -2
- data/vendor/libgit2/src/transports/smart.c +2 -2
- data/vendor/libgit2/src/transports/winhttp.c +18 -7
- data/vendor/libgit2/src/unix/posix.h +13 -1
- data/vendor/libgit2/src/util.c +25 -58
- data/vendor/libgit2/src/util.h +2 -2
- data/vendor/libgit2/src/win32/git2.rc +18 -3
- data/vendor/libgit2/src/win32/path_w32.c +2 -2
- data/vendor/libgit2/src/worktree.c +4 -0
- metadata +27 -25
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.c.in +0 -29
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.cmake +0 -96
- data/vendor/libgit2/src/refdb_fs.h +0 -19
data/vendor/libgit2/src/refs.c
CHANGED
@@ -27,9 +27,6 @@
|
|
27
27
|
|
28
28
|
bool git_reference__enable_symbolic_ref_target_validation = true;
|
29
29
|
|
30
|
-
#define DEFAULT_NESTING_LEVEL 5
|
31
|
-
#define MAX_NESTING_LEVEL 10
|
32
|
-
|
33
30
|
enum {
|
34
31
|
GIT_PACKREF_HAS_PEEL = 1,
|
35
32
|
GIT_PACKREF_WAS_LOOSE = 2
|
@@ -214,89 +211,32 @@ int git_reference_lookup_resolved(
|
|
214
211
|
const char *name,
|
215
212
|
int max_nesting)
|
216
213
|
{
|
217
|
-
git_refname_t
|
218
|
-
git_reference_t scan_type;
|
219
|
-
int error = 0, nesting;
|
220
|
-
git_reference *ref = NULL;
|
214
|
+
git_refname_t normalized;
|
221
215
|
git_refdb *refdb;
|
216
|
+
int error = 0;
|
222
217
|
|
223
218
|
assert(ref_out && repo && name);
|
224
219
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
max_nesting = MAX_NESTING_LEVEL;
|
229
|
-
else if (max_nesting < 0)
|
230
|
-
max_nesting = DEFAULT_NESTING_LEVEL;
|
231
|
-
|
232
|
-
scan_type = GIT_REFERENCE_SYMBOLIC;
|
233
|
-
|
234
|
-
if ((error = reference_normalize_for_repo(scan_name, repo, name, true)) < 0)
|
220
|
+
if ((error = reference_normalize_for_repo(normalized, repo, name, true)) < 0 ||
|
221
|
+
(error = git_repository_refdb__weakptr(&refdb, repo)) < 0 ||
|
222
|
+
(error = git_refdb_resolve(ref_out, refdb, normalized, max_nesting)) < 0)
|
235
223
|
return error;
|
236
224
|
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
{
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
}
|
248
|
-
|
249
|
-
if ((error = git_refdb_lookup(&ref, refdb, scan_name)) < 0)
|
250
|
-
return error;
|
251
|
-
|
252
|
-
scan_type = ref->type;
|
253
|
-
}
|
254
|
-
|
255
|
-
if (scan_type != GIT_REFERENCE_DIRECT && max_nesting != 0) {
|
256
|
-
git_error_set(GIT_ERROR_REFERENCE,
|
257
|
-
"cannot resolve reference (>%u levels deep)", max_nesting);
|
258
|
-
git_reference_free(ref);
|
259
|
-
return -1;
|
225
|
+
/*
|
226
|
+
* The resolved reference may be a symbolic reference in case its
|
227
|
+
* target doesn't exist. If the user asked us to resolve (e.g.
|
228
|
+
* `max_nesting != 0`), then we need to return an error in case we got
|
229
|
+
* a symbolic reference back.
|
230
|
+
*/
|
231
|
+
if (max_nesting && git_reference_type(*ref_out) == GIT_REFERENCE_SYMBOLIC) {
|
232
|
+
git_reference_free(*ref_out);
|
233
|
+
*ref_out = NULL;
|
234
|
+
return GIT_ENOTFOUND;
|
260
235
|
}
|
261
236
|
|
262
|
-
*ref_out = ref;
|
263
237
|
return 0;
|
264
238
|
}
|
265
239
|
|
266
|
-
int git_reference__read_head(
|
267
|
-
git_reference **out,
|
268
|
-
git_repository *repo,
|
269
|
-
const char *path)
|
270
|
-
{
|
271
|
-
git_buf reference = GIT_BUF_INIT;
|
272
|
-
char *name = NULL;
|
273
|
-
int error;
|
274
|
-
|
275
|
-
if ((error = git_futils_readbuffer(&reference, path)) < 0)
|
276
|
-
goto out;
|
277
|
-
git_buf_rtrim(&reference);
|
278
|
-
|
279
|
-
if (git__strncmp(reference.ptr, GIT_SYMREF, strlen(GIT_SYMREF)) == 0) {
|
280
|
-
git_buf_consume(&reference, reference.ptr + strlen(GIT_SYMREF));
|
281
|
-
|
282
|
-
name = git_path_basename(path);
|
283
|
-
|
284
|
-
if ((*out = git_reference__alloc_symbolic(name, reference.ptr)) == NULL) {
|
285
|
-
error = -1;
|
286
|
-
goto out;
|
287
|
-
}
|
288
|
-
} else {
|
289
|
-
if ((error = git_reference_lookup(out, repo, reference.ptr)) < 0)
|
290
|
-
goto out;
|
291
|
-
}
|
292
|
-
|
293
|
-
out:
|
294
|
-
git__free(name);
|
295
|
-
git_buf_dispose(&reference);
|
296
|
-
|
297
|
-
return error;
|
298
|
-
}
|
299
|
-
|
300
240
|
int git_reference_dwim(git_reference **out, git_repository *repo, const char *refname)
|
301
241
|
{
|
302
242
|
int error = 0, i;
|
@@ -480,7 +420,7 @@ static int reference__create(
|
|
480
420
|
return 0;
|
481
421
|
}
|
482
422
|
|
483
|
-
int
|
423
|
+
static int refs_configured_ident(git_signature **out, const git_repository *repo)
|
484
424
|
{
|
485
425
|
if (repo->ident_name && repo->ident_email)
|
486
426
|
return git_signature_now(out, repo->ident_name, repo->ident_email);
|
@@ -494,7 +434,7 @@ int git_reference__log_signature(git_signature **out, git_repository *repo)
|
|
494
434
|
int error;
|
495
435
|
git_signature *who;
|
496
436
|
|
497
|
-
if(((error =
|
437
|
+
if(((error = refs_configured_ident(&who, repo)) < 0) &&
|
498
438
|
((error = git_signature_default(&who, repo)) < 0) &&
|
499
439
|
((error = git_signature_now(&who, "unknown", "unknown")) < 0))
|
500
440
|
return error;
|
@@ -631,84 +571,33 @@ int git_reference_symbolic_set_target(
|
|
631
571
|
typedef struct {
|
632
572
|
const char *old_name;
|
633
573
|
git_refname_t new_name;
|
634
|
-
}
|
574
|
+
} refs_update_head_payload;
|
635
575
|
|
636
|
-
static int
|
576
|
+
static int refs_update_head(git_repository *worktree, void *_payload)
|
637
577
|
{
|
638
|
-
|
639
|
-
git_reference *head = NULL;
|
640
|
-
char *gitdir = NULL;
|
578
|
+
refs_update_head_payload *payload = (refs_update_head_payload *)_payload;
|
579
|
+
git_reference *head = NULL, *updated = NULL;
|
641
580
|
int error;
|
642
581
|
|
643
|
-
if ((error =
|
644
|
-
git_error_set(GIT_ERROR_REFERENCE, "could not read HEAD when renaming references");
|
582
|
+
if ((error = git_reference_lookup(&head, worktree, GIT_HEAD_FILE)) < 0)
|
645
583
|
goto out;
|
646
|
-
}
|
647
|
-
|
648
|
-
if ((gitdir = git_path_dirname(path)) == NULL) {
|
649
|
-
error = -1;
|
650
|
-
goto out;
|
651
|
-
}
|
652
584
|
|
653
585
|
if (git_reference_type(head) != GIT_REFERENCE_SYMBOLIC ||
|
654
|
-
git__strcmp(head
|
655
|
-
error = 0;
|
586
|
+
git__strcmp(git_reference_symbolic_target(head), payload->old_name) != 0)
|
656
587
|
goto out;
|
657
|
-
}
|
658
588
|
|
659
|
-
/* Update HEAD it was pointing to the reference being renamed */
|
660
|
-
if ((error =
|
589
|
+
/* Update HEAD if it was pointing to the reference being renamed */
|
590
|
+
if ((error = git_reference_symbolic_set_target(&updated, head, payload->new_name, NULL)) < 0) {
|
661
591
|
git_error_set(GIT_ERROR_REFERENCE, "failed to update HEAD after renaming reference");
|
662
592
|
goto out;
|
663
593
|
}
|
664
594
|
|
665
595
|
out:
|
596
|
+
git_reference_free(updated);
|
666
597
|
git_reference_free(head);
|
667
|
-
git__free(gitdir);
|
668
|
-
|
669
|
-
return error;
|
670
|
-
}
|
671
|
-
|
672
|
-
static int reference__rename(git_reference **out, git_reference *ref, const char *new_name, int force,
|
673
|
-
const git_signature *signature, const char *message)
|
674
|
-
{
|
675
|
-
git_repository *repo;
|
676
|
-
git_refname_t normalized;
|
677
|
-
bool should_head_be_updated = false;
|
678
|
-
int error = 0;
|
679
|
-
|
680
|
-
assert(ref && new_name && signature);
|
681
|
-
|
682
|
-
repo = git_reference_owner(ref);
|
683
|
-
|
684
|
-
if ((error = reference_normalize_for_repo(
|
685
|
-
normalized, repo, new_name, true)) < 0)
|
686
|
-
return error;
|
687
|
-
|
688
|
-
/* Check if we have to update HEAD. */
|
689
|
-
if ((error = git_branch_is_head(ref)) < 0)
|
690
|
-
return error;
|
691
|
-
|
692
|
-
should_head_be_updated = (error > 0);
|
693
|
-
|
694
|
-
if ((error = git_refdb_rename(out, ref->db, ref->name, normalized, force, signature, message)) < 0)
|
695
|
-
return error;
|
696
|
-
|
697
|
-
/* Update HEAD if it was pointing to the reference being renamed */
|
698
|
-
if (should_head_be_updated) {
|
699
|
-
error = git_repository_set_head(ref->db->repo, normalized);
|
700
|
-
} else {
|
701
|
-
rename_cb_data payload;
|
702
|
-
payload.old_name = ref->name;
|
703
|
-
memcpy(&payload.new_name, &normalized, sizeof(normalized));
|
704
|
-
|
705
|
-
error = git_repository_foreach_head(repo, update_wt_heads, 0, &payload);
|
706
|
-
}
|
707
|
-
|
708
598
|
return error;
|
709
599
|
}
|
710
600
|
|
711
|
-
|
712
601
|
int git_reference_rename(
|
713
602
|
git_reference **out,
|
714
603
|
git_reference *ref,
|
@@ -716,17 +605,28 @@ int git_reference_rename(
|
|
716
605
|
int force,
|
717
606
|
const char *log_message)
|
718
607
|
{
|
719
|
-
|
608
|
+
refs_update_head_payload payload;
|
609
|
+
git_signature *signature = NULL;
|
610
|
+
git_repository *repo;
|
720
611
|
int error;
|
721
612
|
|
722
613
|
assert(out && ref);
|
723
614
|
|
724
|
-
|
725
|
-
return error;
|
615
|
+
repo = git_reference_owner(ref);
|
726
616
|
|
727
|
-
error =
|
728
|
-
|
617
|
+
if ((error = git_reference__log_signature(&signature, repo)) < 0 ||
|
618
|
+
(error = reference_normalize_for_repo(payload.new_name, repo, new_name, true)) < 0 ||
|
619
|
+
(error = git_refdb_rename(out, ref->db, ref->name, payload.new_name, force, signature, log_message)) < 0)
|
620
|
+
goto out;
|
729
621
|
|
622
|
+
payload.old_name = ref->name;
|
623
|
+
|
624
|
+
/* We may have to update any HEAD that was pointing to the renamed reference. */
|
625
|
+
if ((error = git_repository_foreach_worktree(repo, refs_update_head, &payload)) < 0)
|
626
|
+
goto out;
|
627
|
+
|
628
|
+
out:
|
629
|
+
git_signature_free(signature);
|
730
630
|
return error;
|
731
631
|
}
|
732
632
|
|
@@ -1154,40 +1054,6 @@ int git_reference_cmp(
|
|
1154
1054
|
return git_oid__cmp(&ref1->target.oid, &ref2->target.oid);
|
1155
1055
|
}
|
1156
1056
|
|
1157
|
-
/**
|
1158
|
-
* Get the end of a chain of references. If the final one is not
|
1159
|
-
* found, we return the reference just before that.
|
1160
|
-
*/
|
1161
|
-
static int get_terminal(git_reference **out, git_repository *repo, const char *ref_name, int nesting)
|
1162
|
-
{
|
1163
|
-
git_reference *ref;
|
1164
|
-
int error = 0;
|
1165
|
-
|
1166
|
-
if (nesting > MAX_NESTING_LEVEL) {
|
1167
|
-
git_error_set(GIT_ERROR_REFERENCE, "reference chain too deep (%d)", nesting);
|
1168
|
-
return GIT_ENOTFOUND;
|
1169
|
-
}
|
1170
|
-
|
1171
|
-
/* set to NULL to let the caller know that they're at the end of the chain */
|
1172
|
-
if ((error = git_reference_lookup(&ref, repo, ref_name)) < 0) {
|
1173
|
-
*out = NULL;
|
1174
|
-
return error;
|
1175
|
-
}
|
1176
|
-
|
1177
|
-
if (git_reference_type(ref) == GIT_REFERENCE_DIRECT) {
|
1178
|
-
*out = ref;
|
1179
|
-
error = 0;
|
1180
|
-
} else {
|
1181
|
-
error = get_terminal(out, repo, git_reference_symbolic_target(ref), nesting + 1);
|
1182
|
-
if (error == GIT_ENOTFOUND && !*out)
|
1183
|
-
*out = ref;
|
1184
|
-
else
|
1185
|
-
git_reference_free(ref);
|
1186
|
-
}
|
1187
|
-
|
1188
|
-
return error;
|
1189
|
-
}
|
1190
|
-
|
1191
1057
|
/*
|
1192
1058
|
* Starting with the reference given by `ref_name`, follows symbolic
|
1193
1059
|
* references until a direct reference is found and updated the OID
|
@@ -1202,31 +1068,37 @@ int git_reference__update_terminal(
|
|
1202
1068
|
{
|
1203
1069
|
git_reference *ref = NULL, *ref2 = NULL;
|
1204
1070
|
git_signature *who = NULL;
|
1071
|
+
git_refdb *refdb = NULL;
|
1205
1072
|
const git_signature *to_use;
|
1206
1073
|
int error = 0;
|
1207
1074
|
|
1208
1075
|
if (!sig && (error = git_reference__log_signature(&who, repo)) < 0)
|
1209
|
-
|
1076
|
+
goto out;
|
1210
1077
|
|
1211
1078
|
to_use = sig ? sig : who;
|
1212
|
-
error = get_terminal(&ref, repo, ref_name, 0);
|
1213
1079
|
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1080
|
+
if ((error = git_repository_refdb__weakptr(&refdb, repo)) < 0)
|
1081
|
+
goto out;
|
1082
|
+
|
1083
|
+
if ((error = git_refdb_resolve(&ref, refdb, ref_name, -1)) < 0) {
|
1084
|
+
if (error == GIT_ENOTFOUND) {
|
1085
|
+
git_error_clear();
|
1086
|
+
error = reference__create(&ref2, repo, ref_name, oid, NULL, 0, to_use,
|
1087
|
+
log_message, NULL, NULL);
|
1088
|
+
}
|
1089
|
+
goto out;
|
1090
|
+
}
|
1091
|
+
|
1092
|
+
/* In case the resolved reference is symbolic, then it's a dangling symref. */
|
1093
|
+
if (git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC) {
|
1218
1094
|
error = reference__create(&ref2, repo, ref->target.symbolic, oid, NULL, 0, to_use,
|
1219
1095
|
log_message, NULL, NULL);
|
1220
|
-
} else
|
1221
|
-
git_error_clear();
|
1222
|
-
error = reference__create(&ref2, repo, ref_name, oid, NULL, 0, to_use,
|
1223
|
-
log_message, NULL, NULL);
|
1224
|
-
} else if (error == 0) {
|
1225
|
-
assert(git_reference_type(ref) == GIT_REFERENCE_DIRECT);
|
1096
|
+
} else {
|
1226
1097
|
error = reference__create(&ref2, repo, ref->name, oid, NULL, 1, to_use,
|
1227
1098
|
log_message, &ref->target.oid, NULL);
|
1228
1099
|
}
|
1229
1100
|
|
1101
|
+
out:
|
1230
1102
|
git_reference_free(ref2);
|
1231
1103
|
git_reference_free(ref);
|
1232
1104
|
git_signature_free(who);
|
data/vendor/libgit2/src/refs.h
CHANGED
@@ -45,7 +45,6 @@ extern bool git_reference__enable_symbolic_ref_target_validation;
|
|
45
45
|
#define GIT_REBASE_APPLY_DIR "rebase-apply/"
|
46
46
|
#define GIT_REBASE_APPLY_REBASING_FILE GIT_REBASE_APPLY_DIR "rebasing"
|
47
47
|
#define GIT_REBASE_APPLY_APPLYING_FILE GIT_REBASE_APPLY_DIR "applying"
|
48
|
-
#define GIT_REFS_HEADS_MASTER_FILE GIT_REFS_HEADS_DIR "master"
|
49
48
|
|
50
49
|
#define GIT_SEQUENCER_DIR "sequencer/"
|
51
50
|
#define GIT_SEQUENCER_HEAD_FILE GIT_SEQUENCER_DIR "head"
|
@@ -90,6 +89,7 @@ int git_reference__is_valid_name(const char *refname, unsigned int flags);
|
|
90
89
|
int git_reference__is_branch(const char *ref_name);
|
91
90
|
int git_reference__is_remote(const char *ref_name);
|
92
91
|
int git_reference__is_tag(const char *ref_name);
|
92
|
+
int git_reference__is_note(const char *ref_name);
|
93
93
|
const char *git_reference__shorthand(const char *name);
|
94
94
|
|
95
95
|
/**
|
@@ -115,24 +115,6 @@ int git_reference_lookup_resolved(
|
|
115
115
|
const char *name,
|
116
116
|
int max_deref);
|
117
117
|
|
118
|
-
/**
|
119
|
-
* Read reference from a file.
|
120
|
-
*
|
121
|
-
* This function will read in the file at `path`. If it is a
|
122
|
-
* symref, it will return a new unresolved symbolic reference
|
123
|
-
* with the given name pointing to the reference pointed to by
|
124
|
-
* the file. If it is not a symbolic reference, it will return
|
125
|
-
* the resolved reference.
|
126
|
-
*
|
127
|
-
* Note that because the refdb is not involved for symbolic references, they
|
128
|
-
* won't be owned, hence you should either not make the returned reference
|
129
|
-
* 'externally visible', or perform the lookup before returning it to the user.
|
130
|
-
*/
|
131
|
-
int git_reference__read_head(
|
132
|
-
git_reference **out,
|
133
|
-
git_repository *repo,
|
134
|
-
const char *path);
|
135
|
-
|
136
118
|
int git_reference__log_signature(git_signature **out, git_repository *repo);
|
137
119
|
|
138
120
|
/** Update a reference after a commit. */
|
data/vendor/libgit2/src/regexp.c
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
int git_regexp_compile(git_regexp *r, const char *pattern, int flags)
|
13
13
|
{
|
14
14
|
int erroffset, cflags = 0;
|
15
|
-
const char *error;
|
15
|
+
const char *error = NULL;
|
16
16
|
|
17
17
|
if (flags & GIT_REGEXP_ICASE)
|
18
18
|
cflags |= PCRE_CASELESS;
|
@@ -41,7 +41,7 @@ int git_regexp_match(const git_regexp *r, const char *string)
|
|
41
41
|
|
42
42
|
int git_regexp_search(const git_regexp *r, const char *string, size_t nmatches, git_regmatch *matches)
|
43
43
|
{
|
44
|
-
int static_ovec[9], *ovec;
|
44
|
+
int static_ovec[9] = {0}, *ovec;
|
45
45
|
int error;
|
46
46
|
size_t i;
|
47
47
|
|
data/vendor/libgit2/src/remote.c
CHANGED
@@ -195,10 +195,12 @@ int git_remote_create_options_init(git_remote_create_options *opts, unsigned int
|
|
195
195
|
return 0;
|
196
196
|
}
|
197
197
|
|
198
|
+
#ifndef GIT_DEPRECATE_HARD
|
198
199
|
int git_remote_create_init_options(git_remote_create_options *opts, unsigned int version)
|
199
200
|
{
|
200
201
|
return git_remote_create_options_init(opts, version);
|
201
202
|
}
|
203
|
+
#endif
|
202
204
|
|
203
205
|
int git_remote_create_with_opts(git_remote **out, const char *url, const git_remote_create_options *opts)
|
204
206
|
{
|
@@ -686,7 +688,7 @@ int git_remote__urlfordirection(git_buf *url_out, struct git_remote *remote, int
|
|
686
688
|
return resolve_url(url_out, url, direction, callbacks);
|
687
689
|
}
|
688
690
|
|
689
|
-
int
|
691
|
+
static int remote_transport_set_callbacks(git_transport *t, const git_remote_callbacks *cbs)
|
690
692
|
{
|
691
693
|
if (!t->set_callbacks || !cbs)
|
692
694
|
return 0;
|
@@ -744,7 +746,7 @@ int git_remote__connect(git_remote *remote, git_direction direction, const git_r
|
|
744
746
|
if ((error = set_transport_custom_headers(t, conn->custom_headers)) != 0)
|
745
747
|
goto on_error;
|
746
748
|
|
747
|
-
if ((error =
|
749
|
+
if ((error = remote_transport_set_callbacks(t, callbacks)) < 0 ||
|
748
750
|
(error = t->connect(t, url.ptr, credentials, payload, conn->proxy, direction, flags)) != 0)
|
749
751
|
goto on_error;
|
750
752
|
|
@@ -1237,7 +1239,7 @@ static int prune_candidates(git_vector *candidates, git_remote *remote)
|
|
1237
1239
|
}
|
1238
1240
|
|
1239
1241
|
out:
|
1240
|
-
|
1242
|
+
git_strarray_dispose(&arr);
|
1241
1243
|
return error;
|
1242
1244
|
}
|
1243
1245
|
|
@@ -2373,29 +2375,36 @@ int git_remote_default_branch(git_buf *out, git_remote *remote)
|
|
2373
2375
|
const git_remote_head *guess = NULL;
|
2374
2376
|
const git_oid *head_id;
|
2375
2377
|
size_t heads_len, i;
|
2378
|
+
git_buf local_default = GIT_BUF_INIT;
|
2376
2379
|
int error;
|
2377
2380
|
|
2378
2381
|
assert(out);
|
2379
2382
|
|
2380
2383
|
if ((error = git_remote_ls(&heads, &heads_len, remote)) < 0)
|
2381
|
-
|
2384
|
+
goto done;
|
2382
2385
|
|
2383
|
-
if (heads_len == 0)
|
2384
|
-
|
2385
|
-
|
2386
|
-
|
2387
|
-
return GIT_ENOTFOUND;
|
2386
|
+
if (heads_len == 0 || strcmp(heads[0]->name, GIT_HEAD_FILE)) {
|
2387
|
+
error = GIT_ENOTFOUND;
|
2388
|
+
goto done;
|
2389
|
+
}
|
2388
2390
|
|
2389
2391
|
git_buf_sanitize(out);
|
2392
|
+
|
2390
2393
|
/* the first one must be HEAD so if that has the symref info, we're done */
|
2391
|
-
if (heads[0]->symref_target)
|
2392
|
-
|
2394
|
+
if (heads[0]->symref_target) {
|
2395
|
+
error = git_buf_puts(out, heads[0]->symref_target);
|
2396
|
+
goto done;
|
2397
|
+
}
|
2393
2398
|
|
2394
2399
|
/*
|
2395
2400
|
* If there's no symref information, we have to look over them
|
2396
|
-
* and guess. We return the first match unless the
|
2397
|
-
* branch is a candidate. Then we return the
|
2401
|
+
* and guess. We return the first match unless the default
|
2402
|
+
* branch is a candidate. Then we return the default branch.
|
2398
2403
|
*/
|
2404
|
+
|
2405
|
+
if ((error = git_repository_initialbranch(&local_default, remote->repo)) < 0)
|
2406
|
+
goto done;
|
2407
|
+
|
2399
2408
|
head_id = &heads[0]->oid;
|
2400
2409
|
|
2401
2410
|
for (i = 1; i < heads_len; i++) {
|
@@ -2410,16 +2419,22 @@ int git_remote_default_branch(git_buf *out, git_remote *remote)
|
|
2410
2419
|
continue;
|
2411
2420
|
}
|
2412
2421
|
|
2413
|
-
if (!git__strcmp(
|
2422
|
+
if (!git__strcmp(local_default.ptr, heads[i]->name)) {
|
2414
2423
|
guess = heads[i];
|
2415
2424
|
break;
|
2416
2425
|
}
|
2417
2426
|
}
|
2418
2427
|
|
2419
|
-
if (!guess)
|
2420
|
-
|
2428
|
+
if (!guess) {
|
2429
|
+
error = GIT_ENOTFOUND;
|
2430
|
+
goto done;
|
2431
|
+
}
|
2432
|
+
|
2433
|
+
error = git_buf_puts(out, guess->name);
|
2421
2434
|
|
2422
|
-
|
2435
|
+
done:
|
2436
|
+
git_buf_dispose(&local_default);
|
2437
|
+
return error;
|
2423
2438
|
}
|
2424
2439
|
|
2425
2440
|
int git_remote_upload(git_remote *remote, const git_strarray *refspecs, const git_push_options *opts)
|