rugged 0.25.1.1 → 0.26.0b1
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/include/git2/common.h +10 -0
- data/vendor/libgit2/include/git2/merge.h +2 -1
- data/vendor/libgit2/include/git2/oid.h +4 -5
- data/vendor/libgit2/include/git2/submodule.h +2 -11
- data/vendor/libgit2/include/git2/sys/repository.h +29 -0
- data/vendor/libgit2/include/git2/tree.h +13 -0
- data/vendor/libgit2/src/apply.c +2 -2
- data/vendor/libgit2/src/attr_file.c +5 -5
- data/vendor/libgit2/src/attrcache.c +9 -7
- data/vendor/libgit2/src/blob.c +3 -3
- data/vendor/libgit2/src/branch.c +10 -10
- data/vendor/libgit2/src/buffer.c +4 -4
- data/vendor/libgit2/src/cache.c +1 -1
- data/vendor/libgit2/src/checkout.c +29 -25
- data/vendor/libgit2/src/cherrypick.c +2 -2
- data/vendor/libgit2/src/commit.c +2 -2
- data/vendor/libgit2/src/commit_list.c +2 -2
- data/vendor/libgit2/src/common.h +1 -1
- data/vendor/libgit2/src/config.c +12 -12
- data/vendor/libgit2/src/config_file.c +9 -9
- data/vendor/libgit2/src/crlf.c +1 -1
- data/vendor/libgit2/src/delta.c +4 -4
- data/vendor/libgit2/src/describe.c +11 -11
- data/vendor/libgit2/src/diff_driver.c +1 -1
- data/vendor/libgit2/src/diff_file.c +1 -1
- data/vendor/libgit2/src/diff_generate.c +2 -2
- data/vendor/libgit2/src/diff_print.c +5 -5
- data/vendor/libgit2/src/diff_tform.c +1 -1
- data/vendor/libgit2/src/diff_xdiff.c +2 -2
- data/vendor/libgit2/src/fetch.c +1 -1
- data/vendor/libgit2/src/fetchhead.c +8 -8
- data/vendor/libgit2/src/filebuf.c +9 -9
- data/vendor/libgit2/src/fileops.c +27 -27
- data/vendor/libgit2/src/filter.c +4 -4
- data/vendor/libgit2/src/hashsig.c +2 -2
- data/vendor/libgit2/src/ignore.c +4 -4
- data/vendor/libgit2/src/index.c +15 -15
- data/vendor/libgit2/src/indexer.c +39 -6
- data/vendor/libgit2/src/integer.h +6 -6
- data/vendor/libgit2/src/merge.c +12 -12
- data/vendor/libgit2/src/merge_file.c +1 -1
- data/vendor/libgit2/src/mwindow.c +1 -1
- data/vendor/libgit2/src/netops.c +4 -4
- data/vendor/libgit2/src/notes.c +3 -3
- data/vendor/libgit2/src/object.c +5 -5
- data/vendor/libgit2/src/odb.c +12 -12
- data/vendor/libgit2/src/odb_loose.c +6 -6
- data/vendor/libgit2/src/oid.c +5 -5
- data/vendor/libgit2/src/openssl_stream.c +3 -3
- data/vendor/libgit2/src/pack-objects.c +6 -6
- data/vendor/libgit2/src/pack.c +19 -10
- data/vendor/libgit2/src/pack.h +1 -0
- data/vendor/libgit2/src/patch_generate.c +5 -3
- data/vendor/libgit2/src/path.c +15 -15
- data/vendor/libgit2/src/pathspec.c +2 -2
- data/vendor/libgit2/src/posix.c +1 -1
- data/vendor/libgit2/src/push.c +6 -6
- data/vendor/libgit2/src/rebase.c +12 -12
- data/vendor/libgit2/src/refdb.c +1 -1
- data/vendor/libgit2/src/refdb_fs.c +12 -12
- data/vendor/libgit2/src/reflog.c +2 -2
- data/vendor/libgit2/src/refs.c +34 -17
- data/vendor/libgit2/src/refs.h +3 -0
- data/vendor/libgit2/src/remote.c +3 -3
- data/vendor/libgit2/src/repository.c +46 -13
- data/vendor/libgit2/src/repository.h +2 -1
- data/vendor/libgit2/src/reset.c +1 -1
- data/vendor/libgit2/src/revert.c +2 -2
- data/vendor/libgit2/src/revparse.c +5 -5
- data/vendor/libgit2/src/revwalk.c +3 -3
- data/vendor/libgit2/src/settings.c +6 -1
- data/vendor/libgit2/src/sha1_lookup.c +1 -1
- data/vendor/libgit2/src/signature.c +1 -1
- data/vendor/libgit2/src/socket_stream.c +5 -5
- data/vendor/libgit2/src/sortedcache.c +5 -5
- data/vendor/libgit2/src/stash.c +6 -6
- data/vendor/libgit2/src/status.c +4 -4
- data/vendor/libgit2/src/submodule.c +159 -110
- data/vendor/libgit2/src/submodule.h +3 -0
- data/vendor/libgit2/src/sysdir.c +2 -2
- data/vendor/libgit2/src/tag.c +14 -14
- data/vendor/libgit2/src/trace.c +1 -1
- data/vendor/libgit2/src/transport.c +1 -1
- data/vendor/libgit2/src/transports/auth_negotiate.c +4 -4
- data/vendor/libgit2/src/transports/cred.c +1 -1
- data/vendor/libgit2/src/transports/git.c +3 -3
- data/vendor/libgit2/src/transports/http.c +6 -6
- data/vendor/libgit2/src/transports/local.c +2 -2
- data/vendor/libgit2/src/transports/smart.c +5 -5
- data/vendor/libgit2/src/transports/smart_pkt.c +4 -4
- data/vendor/libgit2/src/transports/smart_protocol.c +1 -1
- data/vendor/libgit2/src/transports/ssh.c +9 -9
- data/vendor/libgit2/src/transports/winhttp.c +155 -118
- data/vendor/libgit2/src/tree-cache.c +2 -2
- data/vendor/libgit2/src/tree.c +35 -20
- data/vendor/libgit2/src/unix/map.c +1 -1
- data/vendor/libgit2/src/util.c +3 -3
- data/vendor/libgit2/src/vector.c +3 -0
- data/vendor/libgit2/src/win32/dir.c +3 -3
- data/vendor/libgit2/src/win32/findfile.c +1 -1
- data/vendor/libgit2/src/win32/map.c +6 -6
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +2 -2
- data/vendor/libgit2/src/win32/w32_util.c +1 -1
- data/vendor/libgit2/src/win32/w32_util.h +1 -1
- data/vendor/libgit2/src/zstream.c +1 -1
- metadata +4 -4
@@ -487,7 +487,7 @@ static int pathspec_match_from_iterator(
|
|
487
487
|
|
488
488
|
/* if every pattern failed to match, then we have failed */
|
489
489
|
if ((flags & GIT_PATHSPEC_NO_MATCH_ERROR) != 0 && !found_files) {
|
490
|
-
giterr_set(GITERR_INVALID, "
|
490
|
+
giterr_set(GITERR_INVALID, "no matching files were found");
|
491
491
|
error = GIT_ENOTFOUND;
|
492
492
|
}
|
493
493
|
|
@@ -658,7 +658,7 @@ int git_pathspec_match_diff(
|
|
658
658
|
|
659
659
|
/* if every pattern failed to match, then we have failed */
|
660
660
|
if ((flags & GIT_PATHSPEC_NO_MATCH_ERROR) != 0 && !found_deltas) {
|
661
|
-
giterr_set(GITERR_INVALID, "
|
661
|
+
giterr_set(GITERR_INVALID, "no matching deltas were found");
|
662
662
|
error = GIT_ENOTFOUND;
|
663
663
|
}
|
664
664
|
|
data/vendor/libgit2/src/posix.c
CHANGED
@@ -240,7 +240,7 @@ int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offs
|
|
240
240
|
out->len = 0;
|
241
241
|
|
242
242
|
if ((prot & GIT_PROT_WRITE) && ((flags & GIT_MAP_TYPE) == GIT_MAP_SHARED)) {
|
243
|
-
giterr_set(GITERR_OS, "
|
243
|
+
giterr_set(GITERR_OS, "trying to map shared-writeable");
|
244
244
|
return -1;
|
245
245
|
}
|
246
246
|
|
data/vendor/libgit2/src/push.c
CHANGED
@@ -90,7 +90,7 @@ static void free_refspec(push_spec *spec)
|
|
90
90
|
static int check_rref(char *ref)
|
91
91
|
{
|
92
92
|
if (git__prefixcmp(ref, "refs/")) {
|
93
|
-
giterr_set(GITERR_INVALID, "
|
93
|
+
giterr_set(GITERR_INVALID, "not a valid reference '%s'", ref);
|
94
94
|
return -1;
|
95
95
|
}
|
96
96
|
|
@@ -111,7 +111,7 @@ static int check_lref(git_push *push, char *ref)
|
|
111
111
|
giterr_set(GITERR_REFERENCE,
|
112
112
|
"src refspec '%s' does not match any existing object", ref);
|
113
113
|
else
|
114
|
-
giterr_set(GITERR_INVALID, "
|
114
|
+
giterr_set(GITERR_INVALID, "not a valid reference '%s'", ref);
|
115
115
|
return -1;
|
116
116
|
}
|
117
117
|
|
@@ -321,7 +321,7 @@ static int revwalk(git_vector *commits, git_push *push)
|
|
321
321
|
|
322
322
|
if (!git_odb_exists(push->repo->_odb, &spec->roid)) {
|
323
323
|
giterr_set(GITERR_REFERENCE,
|
324
|
-
"
|
324
|
+
"cannot push because a reference that you are trying to update on the remote contains commits that are not present locally.");
|
325
325
|
error = GIT_ENONFASTFORWARD;
|
326
326
|
goto on_error;
|
327
327
|
}
|
@@ -332,7 +332,7 @@ static int revwalk(git_vector *commits, git_push *push)
|
|
332
332
|
if (error == GIT_ENOTFOUND ||
|
333
333
|
(!error && !git_oid_equal(&base, &spec->roid))) {
|
334
334
|
giterr_set(GITERR_REFERENCE,
|
335
|
-
"
|
335
|
+
"cannot push non-fastforwardable reference");
|
336
336
|
error = GIT_ENONFASTFORWARD;
|
337
337
|
goto on_error;
|
338
338
|
}
|
@@ -553,7 +553,7 @@ static int calculate_work(git_push *push)
|
|
553
553
|
/* This is a create or update. Local ref must exist. */
|
554
554
|
if (git_reference_name_to_id(
|
555
555
|
&spec->loid, push->repo, spec->refspec.src) < 0) {
|
556
|
-
giterr_set(GITERR_REFERENCE, "
|
556
|
+
giterr_set(GITERR_REFERENCE, "no such reference '%s'", spec->refspec.src);
|
557
557
|
return -1;
|
558
558
|
}
|
559
559
|
}
|
@@ -579,7 +579,7 @@ static int do_push(git_push *push, const git_remote_callbacks *callbacks)
|
|
579
579
|
git_transport *transport = push->remote->transport;
|
580
580
|
|
581
581
|
if (!transport->push) {
|
582
|
-
giterr_set(GITERR_NET, "
|
582
|
+
giterr_set(GITERR_NET, "remote transport doesn't support push");
|
583
583
|
error = -1;
|
584
584
|
goto on_error;
|
585
585
|
}
|
data/vendor/libgit2/src/rebase.c
CHANGED
@@ -152,7 +152,7 @@ GIT_INLINE(int) rebase_readint(
|
|
152
152
|
return error;
|
153
153
|
|
154
154
|
if (git__strtol32(&num, asc_out->ptr, &eol, 10) < 0 || num < 0 || *eol) {
|
155
|
-
giterr_set(GITERR_REBASE, "
|
155
|
+
giterr_set(GITERR_REBASE, "the file '%s' contains an invalid numeric value", filename);
|
156
156
|
return -1;
|
157
157
|
}
|
158
158
|
|
@@ -170,7 +170,7 @@ GIT_INLINE(int) rebase_readoid(
|
|
170
170
|
return error;
|
171
171
|
|
172
172
|
if (str_out->size != GIT_OID_HEXSZ || git_oid_fromstr(out, str_out->ptr) < 0) {
|
173
|
-
giterr_set(GITERR_REBASE, "
|
173
|
+
giterr_set(GITERR_REBASE, "the file '%s' contains an invalid object ID", filename);
|
174
174
|
return -1;
|
175
175
|
}
|
176
176
|
|
@@ -316,7 +316,7 @@ int git_rebase_open(
|
|
316
316
|
goto done;
|
317
317
|
|
318
318
|
if (rebase->type == GIT_REBASE_TYPE_NONE) {
|
319
|
-
giterr_set(GITERR_REBASE, "
|
319
|
+
giterr_set(GITERR_REBASE, "there is no rebase in progress");
|
320
320
|
error = GIT_ENOTFOUND;
|
321
321
|
goto done;
|
322
322
|
}
|
@@ -372,14 +372,14 @@ int git_rebase_open(
|
|
372
372
|
|
373
373
|
switch (rebase->type) {
|
374
374
|
case GIT_REBASE_TYPE_INTERACTIVE:
|
375
|
-
giterr_set(GITERR_REBASE, "
|
375
|
+
giterr_set(GITERR_REBASE, "interactive rebase is not supported");
|
376
376
|
error = -1;
|
377
377
|
break;
|
378
378
|
case GIT_REBASE_TYPE_MERGE:
|
379
379
|
error = rebase_open_merge(rebase);
|
380
380
|
break;
|
381
381
|
case GIT_REBASE_TYPE_APPLY:
|
382
|
-
giterr_set(GITERR_REBASE, "
|
382
|
+
giterr_set(GITERR_REBASE, "patch application rebase is not supported");
|
383
383
|
error = -1;
|
384
384
|
break;
|
385
385
|
default:
|
@@ -478,7 +478,7 @@ static int rebase_setupfiles(git_rebase *rebase)
|
|
478
478
|
git_oid_fmt(orig_head, &rebase->orig_head_id);
|
479
479
|
|
480
480
|
if (p_mkdir(rebase->state_path, REBASE_DIR_MODE) < 0) {
|
481
|
-
giterr_set(GITERR_OS, "
|
481
|
+
giterr_set(GITERR_OS, "failed to create rebase directory '%s'", rebase->state_path);
|
482
482
|
return -1;
|
483
483
|
}
|
484
484
|
|
@@ -511,7 +511,7 @@ static int rebase_ensure_not_in_progress(git_repository *repo)
|
|
511
511
|
return error;
|
512
512
|
|
513
513
|
if (type != GIT_REBASE_TYPE_NONE) {
|
514
|
-
giterr_set(GITERR_REBASE, "
|
514
|
+
giterr_set(GITERR_REBASE, "there is an existing rebase in progress");
|
515
515
|
return -1;
|
516
516
|
}
|
517
517
|
|
@@ -536,7 +536,7 @@ static int rebase_ensure_not_dirty(
|
|
536
536
|
goto done;
|
537
537
|
|
538
538
|
if (git_diff_num_deltas(diff) > 0) {
|
539
|
-
giterr_set(GITERR_REBASE, "
|
539
|
+
giterr_set(GITERR_REBASE, "uncommitted changes exist in index");
|
540
540
|
error = fail_with;
|
541
541
|
goto done;
|
542
542
|
}
|
@@ -550,7 +550,7 @@ static int rebase_ensure_not_dirty(
|
|
550
550
|
goto done;
|
551
551
|
|
552
552
|
if (git_diff_num_deltas(diff) > 0) {
|
553
|
-
giterr_set(GITERR_REBASE, "
|
553
|
+
giterr_set(GITERR_REBASE, "unstaged changes exist in workdir");
|
554
554
|
error = fail_with;
|
555
555
|
goto done;
|
556
556
|
}
|
@@ -807,7 +807,7 @@ static int rebase_next_merge(
|
|
807
807
|
goto done;
|
808
808
|
|
809
809
|
if ((parent_count = git_commit_parentcount(current_commit)) > 1) {
|
810
|
-
giterr_set(GITERR_REBASE, "
|
810
|
+
giterr_set(GITERR_REBASE, "cannot rebase a merge commit");
|
811
811
|
error = -1;
|
812
812
|
goto done;
|
813
813
|
} else if (parent_count) {
|
@@ -864,7 +864,7 @@ static int rebase_next_inmemory(
|
|
864
864
|
goto done;
|
865
865
|
|
866
866
|
if ((parent_count = git_commit_parentcount(current_commit)) > 1) {
|
867
|
-
giterr_set(GITERR_REBASE, "
|
867
|
+
giterr_set(GITERR_REBASE, "cannot rebase a merge commit");
|
868
868
|
error = -1;
|
869
869
|
goto done;
|
870
870
|
} else if (parent_count) {
|
@@ -1259,7 +1259,7 @@ static int rebase_copy_notes(
|
|
1259
1259
|
goto done;
|
1260
1260
|
|
1261
1261
|
on_error:
|
1262
|
-
giterr_set(GITERR_REBASE, "
|
1262
|
+
giterr_set(GITERR_REBASE, "invalid rewritten file at line %d", linenum);
|
1263
1263
|
error = -1;
|
1264
1264
|
|
1265
1265
|
done:
|
data/vendor/libgit2/src/refdb.c
CHANGED
@@ -128,7 +128,7 @@ int git_refdb_iterator(git_reference_iterator **out, git_refdb *db, const char *
|
|
128
128
|
int error;
|
129
129
|
|
130
130
|
if (!db->backend || !db->backend->iterator) {
|
131
|
-
giterr_set(GITERR_REFERENCE, "
|
131
|
+
giterr_set(GITERR_REFERENCE, "this backend doesn't support iterators");
|
132
132
|
return -1;
|
133
133
|
}
|
134
134
|
|
@@ -185,7 +185,7 @@ static int packed_reload(refdb_fs_backend *backend)
|
|
185
185
|
return 0;
|
186
186
|
|
187
187
|
parse_failed:
|
188
|
-
giterr_set(GITERR_REFERENCE, "
|
188
|
+
giterr_set(GITERR_REFERENCE, "corrupted packed references file");
|
189
189
|
|
190
190
|
git_sortedcache_clear(backend->refcache, false);
|
191
191
|
git_sortedcache_wunlock(backend->refcache);
|
@@ -212,7 +212,7 @@ static int loose_parse_oid(
|
|
212
212
|
return 0;
|
213
213
|
|
214
214
|
corrupted:
|
215
|
-
giterr_set(GITERR_REFERENCE, "
|
215
|
+
giterr_set(GITERR_REFERENCE, "corrupted loose reference file: %s", filename);
|
216
216
|
return -1;
|
217
217
|
}
|
218
218
|
|
@@ -349,7 +349,7 @@ static const char *loose_parse_symbolic(git_buf *file_content)
|
|
349
349
|
refname_start = (const char *)file_content->ptr;
|
350
350
|
|
351
351
|
if (git_buf_len(file_content) < header_len + 1) {
|
352
|
-
giterr_set(GITERR_REFERENCE, "
|
352
|
+
giterr_set(GITERR_REFERENCE, "corrupted loose reference file");
|
353
353
|
return NULL;
|
354
354
|
}
|
355
355
|
|
@@ -398,7 +398,7 @@ static int loose_lookup(
|
|
398
398
|
|
399
399
|
static int ref_error_notfound(const char *name)
|
400
400
|
{
|
401
|
-
giterr_set(GITERR_REFERENCE, "
|
401
|
+
giterr_set(GITERR_REFERENCE, "reference '%s' not found", name);
|
402
402
|
return GIT_ENOTFOUND;
|
403
403
|
}
|
404
404
|
|
@@ -691,7 +691,7 @@ static int reference_path_available(
|
|
691
691
|
|
692
692
|
if (exists) {
|
693
693
|
giterr_set(GITERR_REFERENCE,
|
694
|
-
"
|
694
|
+
"failed to write reference '%s': a reference with "
|
695
695
|
"that name already exists.", new_ref);
|
696
696
|
return GIT_EEXISTS;
|
697
697
|
}
|
@@ -705,7 +705,7 @@ static int reference_path_available(
|
|
705
705
|
if (ref && !ref_is_available(old_ref, new_ref, ref->name)) {
|
706
706
|
git_sortedcache_runlock(backend->refcache);
|
707
707
|
giterr_set(GITERR_REFERENCE,
|
708
|
-
"
|
708
|
+
"path to reference '%s' collides with existing one", new_ref);
|
709
709
|
return -1;
|
710
710
|
}
|
711
711
|
}
|
@@ -722,7 +722,7 @@ static int loose_lock(git_filebuf *file, refdb_fs_backend *backend, const char *
|
|
722
722
|
assert(file && backend && name);
|
723
723
|
|
724
724
|
if (!git_path_isvalid(backend->repo, name, GIT_PATH_REJECT_FILESYSTEM_DEFAULTS)) {
|
725
|
-
giterr_set(GITERR_INVALID, "
|
725
|
+
giterr_set(GITERR_INVALID, "invalid reference name '%s'", name);
|
726
726
|
return GIT_EINVALIDSPEC;
|
727
727
|
}
|
728
728
|
|
@@ -1484,7 +1484,7 @@ static int reflog_parse(git_reflog *log, const char *buf, size_t buf_size)
|
|
1484
1484
|
|
1485
1485
|
#define seek_forward(_increase) do { \
|
1486
1486
|
if (_increase >= buf_size) { \
|
1487
|
-
giterr_set(GITERR_INVALID, "
|
1487
|
+
giterr_set(GITERR_INVALID, "ran out of data while parsing reflog"); \
|
1488
1488
|
goto fail; \
|
1489
1489
|
} \
|
1490
1490
|
buf += _increase; \
|
@@ -1700,7 +1700,7 @@ static int lock_reflog(git_filebuf *file, refdb_fs_backend *backend, const char
|
|
1700
1700
|
repo = backend->repo;
|
1701
1701
|
|
1702
1702
|
if (!git_path_isvalid(backend->repo, refname, GIT_PATH_REJECT_FILESYSTEM_DEFAULTS)) {
|
1703
|
-
giterr_set(GITERR_INVALID, "
|
1703
|
+
giterr_set(GITERR_INVALID, "invalid reference name '%s'", refname);
|
1704
1704
|
return GIT_EINVALIDSPEC;
|
1705
1705
|
}
|
1706
1706
|
|
@@ -1709,7 +1709,7 @@ static int lock_reflog(git_filebuf *file, refdb_fs_backend *backend, const char
|
|
1709
1709
|
|
1710
1710
|
if (!git_path_isfile(git_buf_cstr(&log_path))) {
|
1711
1711
|
giterr_set(GITERR_INVALID,
|
1712
|
-
"
|
1712
|
+
"log file for reference '%s' doesn't exist", refname);
|
1713
1713
|
error = -1;
|
1714
1714
|
goto cleanup;
|
1715
1715
|
}
|
@@ -1889,7 +1889,7 @@ static int refdb_reflog_fs__rename(git_refdb_backend *_backend, const char *old_
|
|
1889
1889
|
p_close(fd);
|
1890
1890
|
|
1891
1891
|
if (p_rename(git_buf_cstr(&old_path), git_buf_cstr(&temp_path)) < 0) {
|
1892
|
-
giterr_set(GITERR_OS, "
|
1892
|
+
giterr_set(GITERR_OS, "failed to rename reflog for %s", new_name);
|
1893
1893
|
error = -1;
|
1894
1894
|
goto cleanup;
|
1895
1895
|
}
|
@@ -1906,7 +1906,7 @@ static int refdb_reflog_fs__rename(git_refdb_backend *_backend, const char *old_
|
|
1906
1906
|
}
|
1907
1907
|
|
1908
1908
|
if (p_rename(git_buf_cstr(&temp_path), git_buf_cstr(&new_path)) < 0) {
|
1909
|
-
giterr_set(GITERR_OS, "
|
1909
|
+
giterr_set(GITERR_OS, "failed to rename reflog for %s", new_name);
|
1910
1910
|
error = -1;
|
1911
1911
|
}
|
1912
1912
|
|
data/vendor/libgit2/src/reflog.c
CHANGED
@@ -93,7 +93,7 @@ int git_reflog_append(git_reflog *reflog, const git_oid *new_oid, const git_sign
|
|
93
93
|
|
94
94
|
if (newline) {
|
95
95
|
if (newline[1] != '\0') {
|
96
|
-
giterr_set(GITERR_INVALID, "
|
96
|
+
giterr_set(GITERR_INVALID, "reflog message cannot contain newline");
|
97
97
|
goto cleanup;
|
98
98
|
}
|
99
99
|
|
@@ -193,7 +193,7 @@ int git_reflog_drop(git_reflog *reflog, size_t idx, int rewrite_previous_entry)
|
|
193
193
|
entry = (git_reflog_entry *)git_reflog_entry_byindex(reflog, idx);
|
194
194
|
|
195
195
|
if (entry == NULL) {
|
196
|
-
giterr_set(GITERR_REFERENCE, "
|
196
|
+
giterr_set(GITERR_REFERENCE, "no reflog entry at index %"PRIuZ, idx);
|
197
197
|
return GIT_ENOTFOUND;
|
198
198
|
}
|
199
199
|
|
data/vendor/libgit2/src/refs.c
CHANGED
@@ -24,6 +24,8 @@
|
|
24
24
|
#include <git2/signature.h>
|
25
25
|
#include <git2/commit.h>
|
26
26
|
|
27
|
+
bool git_reference__enable_symbolic_ref_target_validation = true;
|
28
|
+
|
27
29
|
GIT__USE_STRMAP
|
28
30
|
|
29
31
|
#define DEFAULT_NESTING_LEVEL 5
|
@@ -178,7 +180,8 @@ int git_reference_name_to_id(
|
|
178
180
|
static int reference_normalize_for_repo(
|
179
181
|
git_refname_t out,
|
180
182
|
git_repository *repo,
|
181
|
-
const char *name
|
183
|
+
const char *name,
|
184
|
+
bool validate)
|
182
185
|
{
|
183
186
|
int precompose;
|
184
187
|
unsigned int flags = GIT_REF_FORMAT_ALLOW_ONELEVEL;
|
@@ -187,6 +190,9 @@ static int reference_normalize_for_repo(
|
|
187
190
|
precompose)
|
188
191
|
flags |= GIT_REF_FORMAT__PRECOMPOSE_UNICODE;
|
189
192
|
|
193
|
+
if (!validate)
|
194
|
+
flags |= GIT_REF_FORMAT__VALIDATION_DISABLE;
|
195
|
+
|
190
196
|
return git_reference_normalize_name(out, GIT_REFNAME_MAX, name, flags);
|
191
197
|
}
|
192
198
|
|
@@ -213,7 +219,7 @@ int git_reference_lookup_resolved(
|
|
213
219
|
|
214
220
|
scan_type = GIT_REF_SYMBOLIC;
|
215
221
|
|
216
|
-
if ((error = reference_normalize_for_repo(scan_name, repo, name)) < 0)
|
222
|
+
if ((error = reference_normalize_for_repo(scan_name, repo, name, true)) < 0)
|
217
223
|
return error;
|
218
224
|
|
219
225
|
if ((error = git_repository_refdb__weakptr(&refdb, repo)) < 0)
|
@@ -236,7 +242,7 @@ int git_reference_lookup_resolved(
|
|
236
242
|
|
237
243
|
if (scan_type != GIT_REF_OID && max_nesting != 0) {
|
238
244
|
giterr_set(GITERR_REFERENCE,
|
239
|
-
"
|
245
|
+
"cannot resolve reference (>%u levels deep)", max_nesting);
|
240
246
|
git_reference_free(ref);
|
241
247
|
return -1;
|
242
248
|
}
|
@@ -298,7 +304,7 @@ cleanup:
|
|
298
304
|
if (error && !foundvalid) {
|
299
305
|
/* never found a valid reference name */
|
300
306
|
giterr_set(GITERR_REFERENCE,
|
301
|
-
"
|
307
|
+
"could not use '%s' as valid reference name", git_buf_cstr(&name));
|
302
308
|
}
|
303
309
|
|
304
310
|
if (error == GIT_ENOTFOUND)
|
@@ -383,7 +389,7 @@ static int reference__create(
|
|
383
389
|
if (ref_out)
|
384
390
|
*ref_out = NULL;
|
385
391
|
|
386
|
-
error = reference_normalize_for_repo(normalized, repo, name);
|
392
|
+
error = reference_normalize_for_repo(normalized, repo, name, true);
|
387
393
|
if (error < 0)
|
388
394
|
return error;
|
389
395
|
|
@@ -396,7 +402,7 @@ static int reference__create(
|
|
396
402
|
|
397
403
|
if (!git_object__is_valid(repo, oid, GIT_OBJ_ANY)) {
|
398
404
|
giterr_set(GITERR_REFERENCE,
|
399
|
-
"
|
405
|
+
"target OID for the reference doesn't exist on the repository");
|
400
406
|
return -1;
|
401
407
|
}
|
402
408
|
|
@@ -404,7 +410,10 @@ static int reference__create(
|
|
404
410
|
} else {
|
405
411
|
git_refname_t normalized_target;
|
406
412
|
|
407
|
-
|
413
|
+
error = reference_normalize_for_repo(normalized_target, repo,
|
414
|
+
symbolic, git_reference__enable_symbolic_ref_target_validation);
|
415
|
+
|
416
|
+
if (error < 0)
|
408
417
|
return error;
|
409
418
|
|
410
419
|
ref = git_reference__alloc_symbolic(normalized, normalized_target);
|
@@ -524,7 +533,7 @@ static int ensure_is_an_updatable_direct_reference(git_reference *ref)
|
|
524
533
|
if (ref->type == GIT_REF_OID)
|
525
534
|
return 0;
|
526
535
|
|
527
|
-
giterr_set(GITERR_REFERENCE, "
|
536
|
+
giterr_set(GITERR_REFERENCE, "cannot set OID on symbolic reference");
|
528
537
|
return -1;
|
529
538
|
}
|
530
539
|
|
@@ -552,7 +561,7 @@ static int ensure_is_an_updatable_symbolic_reference(git_reference *ref)
|
|
552
561
|
if (ref->type == GIT_REF_SYMBOLIC)
|
553
562
|
return 0;
|
554
563
|
|
555
|
-
giterr_set(GITERR_REFERENCE, "
|
564
|
+
giterr_set(GITERR_REFERENCE, "cannot set symbolic target on a direct reference");
|
556
565
|
return -1;
|
557
566
|
}
|
558
567
|
|
@@ -583,7 +592,7 @@ static int reference__rename(git_reference **out, git_reference *ref, const char
|
|
583
592
|
assert(ref && new_name && signature);
|
584
593
|
|
585
594
|
if ((error = reference_normalize_for_repo(
|
586
|
-
|
595
|
+
normalized, git_reference_owner(ref), new_name, true)) < 0)
|
587
596
|
return error;
|
588
597
|
|
589
598
|
|
@@ -599,7 +608,7 @@ static int reference__rename(git_reference **out, git_reference *ref, const char
|
|
599
608
|
/* Update HEAD it was pointing to the reference being renamed */
|
600
609
|
if (should_head_be_updated &&
|
601
610
|
(error = git_repository_set_head(ref->db->repo, normalized)) < 0) {
|
602
|
-
giterr_set(GITERR_REFERENCE, "
|
611
|
+
giterr_set(GITERR_REFERENCE, "failed to update HEAD after renaming reference");
|
603
612
|
return error;
|
604
613
|
}
|
605
614
|
|
@@ -636,7 +645,7 @@ int git_reference_resolve(git_reference **ref_out, const git_reference *ref)
|
|
636
645
|
return git_reference_lookup_resolved(ref_out, ref->db->repo, ref->target.symbolic, -1);
|
637
646
|
|
638
647
|
default:
|
639
|
-
giterr_set(GITERR_REFERENCE, "
|
648
|
+
giterr_set(GITERR_REFERENCE, "invalid reference");
|
640
649
|
return -1;
|
641
650
|
}
|
642
651
|
}
|
@@ -876,6 +885,7 @@ int git_reference__normalize_name(
|
|
876
885
|
int segment_len, segments_count = 0, error = GIT_EINVALIDSPEC;
|
877
886
|
unsigned int process_flags;
|
878
887
|
bool normalize = (buf != NULL);
|
888
|
+
bool validate = (flags & GIT_REF_FORMAT__VALIDATION_DISABLE) == 0;
|
879
889
|
|
880
890
|
#ifdef GIT_USE_ICONV
|
881
891
|
git_path_iconv_t ic = GIT_PATH_ICONV_INIT;
|
@@ -886,7 +896,7 @@ int git_reference__normalize_name(
|
|
886
896
|
process_flags = flags;
|
887
897
|
current = (char *)name;
|
888
898
|
|
889
|
-
if (*current == '/')
|
899
|
+
if (validate && *current == '/')
|
890
900
|
goto cleanup;
|
891
901
|
|
892
902
|
if (normalize)
|
@@ -902,6 +912,13 @@ int git_reference__normalize_name(
|
|
902
912
|
}
|
903
913
|
#endif
|
904
914
|
|
915
|
+
if (!validate) {
|
916
|
+
git_buf_sets(buf, current);
|
917
|
+
|
918
|
+
error = git_buf_oom(buf) ? -1 : 0;
|
919
|
+
goto cleanup;
|
920
|
+
}
|
921
|
+
|
905
922
|
while (true) {
|
906
923
|
segment_len = ensure_segment_validity(current);
|
907
924
|
if (segment_len < 0) {
|
@@ -973,7 +990,7 @@ cleanup:
|
|
973
990
|
if (error == GIT_EINVALIDSPEC)
|
974
991
|
giterr_set(
|
975
992
|
GITERR_REFERENCE,
|
976
|
-
"
|
993
|
+
"the given reference name '%s' is not valid", name);
|
977
994
|
|
978
995
|
if (error && normalize)
|
979
996
|
git_buf_free(buf);
|
@@ -1000,7 +1017,7 @@ int git_reference_normalize_name(
|
|
1000
1017
|
if (git_buf_len(&buf) > buffer_size - 1) {
|
1001
1018
|
giterr_set(
|
1002
1019
|
GITERR_REFERENCE,
|
1003
|
-
"
|
1020
|
+
"the provided buffer is too short to hold the normalization of '%s'", name);
|
1004
1021
|
error = GIT_EBUFS;
|
1005
1022
|
goto cleanup;
|
1006
1023
|
}
|
@@ -1046,7 +1063,7 @@ static int get_terminal(git_reference **out, git_repository *repo, const char *r
|
|
1046
1063
|
int error = 0;
|
1047
1064
|
|
1048
1065
|
if (nesting > MAX_NESTING_LEVEL) {
|
1049
|
-
giterr_set(GITERR_REFERENCE, "
|
1066
|
+
giterr_set(GITERR_REFERENCE, "reference chain too deep (%d)", nesting);
|
1050
1067
|
return GIT_ENOTFOUND;
|
1051
1068
|
}
|
1052
1069
|
|
@@ -1229,7 +1246,7 @@ static int peel_error(int error, git_reference *ref, const char* msg)
|
|
1229
1246
|
{
|
1230
1247
|
giterr_set(
|
1231
1248
|
GITERR_INVALID,
|
1232
|
-
"
|
1249
|
+
"the reference '%s' cannot be peeled - %s", git_reference_name(ref), msg);
|
1233
1250
|
return error;
|
1234
1251
|
}
|
1235
1252
|
|