rugged 0.22.0b3 → 0.22.0b4
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/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/include/git2/errors.h +1 -0
- data/vendor/libgit2/include/git2/object.h +15 -8
- data/vendor/libgit2/src/attr_file.c +4 -4
- data/vendor/libgit2/src/buf_text.c +1 -0
- data/vendor/libgit2/src/buffer.c +7 -4
- data/vendor/libgit2/src/diff.c +1 -2
- data/vendor/libgit2/src/indexer.c +9 -8
- data/vendor/libgit2/src/iterator.c +1 -0
- data/vendor/libgit2/src/notes.c +1 -2
- data/vendor/libgit2/src/object.c +33 -6
- data/vendor/libgit2/src/pack.c +4 -1
- data/vendor/libgit2/src/remote.c +1 -0
- data/vendor/libgit2/src/revwalk.c +1 -1
- data/vendor/libgit2/src/transports/local.c +14 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c23a53921543d1466bbda19c3f6008f8977d0767
|
4
|
+
data.tar.gz: c955ad35377960f880ec4d23ea1a484705217fa0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33fbe1de4ca4dffebe7519d55b3214c604cf1c76537f5731d6c862cad864571f7620207eddb9b35e0a8e746254dadd389e1f0e586f1bd23b3314ed609700825f
|
7
|
+
data.tar.gz: d4097230c3f632ac55cdd8de180dd4f18cc96a5d0761f72cbc4a4d5868062adfe30c7eb5d9c2a81aecd9b240f113a6229f9f76f237cc29d0d1d6a9ed23e5d4ce
|
data/lib/rugged/version.rb
CHANGED
@@ -44,6 +44,7 @@ typedef enum {
|
|
44
44
|
GIT_EAUTH = -16, /**< Authentication error */
|
45
45
|
GIT_ECERTIFICATE = -17, /**< Server certificate is invalid */
|
46
46
|
GIT_EAPPLIED = -18, /**< Patch/merge has already been applied */
|
47
|
+
GIT_EPEEL = -19, /**< The requested peel operation is not possible */
|
47
48
|
|
48
49
|
GIT_PASSTHROUGH = -30, /**< Internal only */
|
49
50
|
GIT_ITEROVER = -31, /**< Signals end of iteration with iterator */
|
@@ -202,18 +202,25 @@ GIT_EXTERN(size_t) git_object__size(git_otype type);
|
|
202
202
|
/**
|
203
203
|
* Recursively peel an object until an object of the specified type is met.
|
204
204
|
*
|
205
|
-
*
|
206
|
-
*
|
205
|
+
* If the query cannot be satisfied due to the object model,
|
206
|
+
* GIT_EINVALIDSPEC will be returned (e.g. trying to peel a blob to a
|
207
|
+
* tree).
|
207
208
|
*
|
208
|
-
* If you pass `GIT_OBJ_ANY` as the target type, then the object will
|
209
|
-
* peeled until the type changes
|
210
|
-
* referenced object is no longer a tag
|
209
|
+
* If you pass `GIT_OBJ_ANY` as the target type, then the object will
|
210
|
+
* be peeled until the type changes. A tag will be peeled until the
|
211
|
+
* referenced object is no longer a tag, and a commit will be peeled
|
212
|
+
* to a tree. Any other object type will return GIT_EINVALIDSPEC.
|
213
|
+
*
|
214
|
+
* If peeling a tag we discover an object which cannot be peeled to
|
215
|
+
* the target type due to the object model, GIT_EPEEL will be
|
216
|
+
* returned.
|
217
|
+
*
|
218
|
+
* You must free the returned object.
|
211
219
|
*
|
212
220
|
* @param peeled Pointer to the peeled git_object
|
213
221
|
* @param object The object to be processed
|
214
|
-
* @param target_type The type of the requested object (
|
215
|
-
*
|
216
|
-
* @return 0 on success, GIT_EAMBIGUOUS, GIT_ENOTFOUND or an error code
|
222
|
+
* @param target_type The type of the requested object (a GIT_OBJ_ value)
|
223
|
+
* @return 0 on success, GIT_EINVALIDSPEC, GIT_EPEEL, or an error code
|
217
224
|
*/
|
218
225
|
GIT_EXTERN(int) git_object_peel(
|
219
226
|
git_object **peeled,
|
@@ -103,7 +103,6 @@ int git_attr_file__load(
|
|
103
103
|
int error = 0;
|
104
104
|
git_blob *blob = NULL;
|
105
105
|
git_buf content = GIT_BUF_INIT;
|
106
|
-
const char *data = NULL;
|
107
106
|
git_attr_file *file;
|
108
107
|
struct stat st;
|
109
108
|
|
@@ -120,7 +119,9 @@ int git_attr_file__load(
|
|
120
119
|
(error = git_blob_lookup(&blob, repo, &id)) < 0)
|
121
120
|
return error;
|
122
121
|
|
123
|
-
data
|
122
|
+
/* Do not assume that data straight from the ODB is NULL-terminated;
|
123
|
+
* copy the contents of a file to a buffer to work on */
|
124
|
+
git_buf_put(&content, git_blob_rawcontent(blob), git_blob_rawsize(blob));
|
124
125
|
break;
|
125
126
|
}
|
126
127
|
case GIT_ATTR_FILE__FROM_FILE: {
|
@@ -143,7 +144,6 @@ int git_attr_file__load(
|
|
143
144
|
if (error < 0)
|
144
145
|
return GIT_ENOTFOUND;
|
145
146
|
|
146
|
-
data = content.ptr;
|
147
147
|
break;
|
148
148
|
}
|
149
149
|
default:
|
@@ -154,7 +154,7 @@ int git_attr_file__load(
|
|
154
154
|
if ((error = git_attr_file__new(&file, entry, source)) < 0)
|
155
155
|
goto cleanup;
|
156
156
|
|
157
|
-
if (parser && (error = parser(repo, file,
|
157
|
+
if (parser && (error = parser(repo, file, git_buf_cstr(&content))) < 0) {
|
158
158
|
git_attr_file__free(file);
|
159
159
|
goto cleanup;
|
160
160
|
}
|
data/vendor/libgit2/src/buffer.c
CHANGED
@@ -176,10 +176,13 @@ int git_buf_putcn(git_buf *buf, char c, size_t len)
|
|
176
176
|
|
177
177
|
int git_buf_put(git_buf *buf, const char *data, size_t len)
|
178
178
|
{
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
179
|
+
if (len) {
|
180
|
+
assert(data);
|
181
|
+
ENSURE_SIZE(buf, buf->size + len + 1);
|
182
|
+
memmove(buf->ptr + buf->size, data, len);
|
183
|
+
buf->size += len;
|
184
|
+
buf->ptr[buf->size] = '\0';
|
185
|
+
}
|
183
186
|
return 0;
|
184
187
|
}
|
185
188
|
|
data/vendor/libgit2/src/diff.c
CHANGED
@@ -1234,7 +1234,7 @@ int git_diff_tree_to_workdir(
|
|
1234
1234
|
|
1235
1235
|
assert(diff && repo);
|
1236
1236
|
|
1237
|
-
if ((error =
|
1237
|
+
if ((error = git_repository_index__weakptr(&index, repo)))
|
1238
1238
|
return error;
|
1239
1239
|
|
1240
1240
|
DIFF_FROM_ITERATORS(
|
@@ -1243,7 +1243,6 @@ int git_diff_tree_to_workdir(
|
|
1243
1243
|
&b, repo, index, old_tree, GIT_ITERATOR_DONT_AUTOEXPAND, pfx, pfx)
|
1244
1244
|
);
|
1245
1245
|
|
1246
|
-
git_index_free(index);
|
1247
1246
|
return error;
|
1248
1247
|
}
|
1249
1248
|
|
@@ -120,6 +120,7 @@ int git_indexer_new(
|
|
120
120
|
idx->progress_cb = progress_cb;
|
121
121
|
idx->progress_payload = progress_payload;
|
122
122
|
idx->mode = mode ? mode : GIT_PACK_FILE_MODE;
|
123
|
+
git_hash_ctx_init(&idx->hash_ctx);
|
123
124
|
git_hash_ctx_init(&idx->trailer);
|
124
125
|
|
125
126
|
error = git_buf_joinpath(&path, prefix, suff);
|
@@ -265,7 +266,6 @@ static int store_object(git_indexer *idx)
|
|
265
266
|
struct entry *entry;
|
266
267
|
git_off_t entry_size;
|
267
268
|
struct git_pack_entry *pentry;
|
268
|
-
git_hash_ctx *ctx = &idx->hash_ctx;
|
269
269
|
git_off_t entry_start = idx->entry_start;
|
270
270
|
|
271
271
|
entry = git__calloc(1, sizeof(*entry));
|
@@ -274,7 +274,7 @@ static int store_object(git_indexer *idx)
|
|
274
274
|
pentry = git__calloc(1, sizeof(struct git_pack_entry));
|
275
275
|
GITERR_CHECK_ALLOC(pentry);
|
276
276
|
|
277
|
-
git_hash_final(&oid,
|
277
|
+
git_hash_final(&oid, &idx->hash_ctx);
|
278
278
|
entry_size = idx->off - entry_start;
|
279
279
|
if (entry_start > UINT31_MAX) {
|
280
280
|
entry->offset = UINT32_MAX;
|
@@ -557,7 +557,7 @@ int git_indexer_append(git_indexer *idx, const void *data, size_t size, git_tran
|
|
557
557
|
|
558
558
|
git_mwindow_close(&w);
|
559
559
|
idx->entry_start = entry_start;
|
560
|
-
|
560
|
+
git_hash_init(&idx->hash_ctx);
|
561
561
|
|
562
562
|
if (type == GIT_OBJ_REF_DELTA || type == GIT_OBJ_OFS_DELTA) {
|
563
563
|
error = advance_delta_offset(idx, type);
|
@@ -671,8 +671,10 @@ static int inject_object(git_indexer *idx, git_oid *id)
|
|
671
671
|
seek_back_trailer(idx);
|
672
672
|
entry_start = idx->pack->mwf.size;
|
673
673
|
|
674
|
-
if (git_odb_read(&obj, idx->odb, id) < 0)
|
674
|
+
if (git_odb_read(&obj, idx->odb, id) < 0) {
|
675
|
+
giterr_set(GITERR_INDEXER, "missing delta bases");
|
675
676
|
return -1;
|
677
|
+
}
|
676
678
|
|
677
679
|
data = git_odb_object_data(obj);
|
678
680
|
len = git_odb_object_size(obj);
|
@@ -827,7 +829,6 @@ static int resolve_deltas(git_indexer *idx, git_transfer_progress *stats)
|
|
827
829
|
break;
|
828
830
|
|
829
831
|
if (!progressed && (fix_thin_pack(idx, stats) < 0)) {
|
830
|
-
giterr_set(GITERR_INDEXER, "missing delta bases");
|
831
832
|
return -1;
|
832
833
|
}
|
833
834
|
}
|
@@ -843,12 +844,10 @@ static int update_header_and_rehash(git_indexer *idx, git_transfer_progress *sta
|
|
843
844
|
git_mwindow *w = NULL;
|
844
845
|
git_mwindow_file *mwf;
|
845
846
|
unsigned int left;
|
846
|
-
git_hash_ctx *ctx;
|
847
847
|
|
848
848
|
mwf = &idx->pack->mwf;
|
849
|
-
ctx = &idx->trailer;
|
850
849
|
|
851
|
-
|
850
|
+
git_hash_init(&idx->trailer);
|
852
851
|
|
853
852
|
|
854
853
|
/* Update the header to include the numer of local objects we injected */
|
@@ -1061,5 +1060,7 @@ void git_indexer_free(git_indexer *idx)
|
|
1061
1060
|
git_mutex_unlock(&git__mwindow_mutex);
|
1062
1061
|
}
|
1063
1062
|
|
1063
|
+
git_hash_ctx_cleanup(&idx->trailer);
|
1064
|
+
git_hash_ctx_cleanup(&idx->hash_ctx);
|
1064
1065
|
git__free(idx);
|
1065
1066
|
}
|
@@ -1418,6 +1418,7 @@ static void workdir_iterator__free(git_iterator *self)
|
|
1418
1418
|
workdir_iterator *wi = (workdir_iterator *)self;
|
1419
1419
|
if (wi->index)
|
1420
1420
|
git_index_snapshot_release(&wi->index_snapshot, wi->index);
|
1421
|
+
git_tree_free(wi->tree);
|
1421
1422
|
fs_iterator__free(self);
|
1422
1423
|
git_ignore__free(&wi->ignores);
|
1423
1424
|
}
|
data/vendor/libgit2/src/notes.c
CHANGED
@@ -323,11 +323,10 @@ static int note_new(
|
|
323
323
|
git_signature_dup(¬e->committer, git_commit_committer(commit)) < 0)
|
324
324
|
return -1;
|
325
325
|
|
326
|
-
note->message =
|
326
|
+
note->message = git__strndup(git_blob_rawcontent(blob), git_blob_rawsize(blob));
|
327
327
|
GITERR_CHECK_ALLOC(note->message);
|
328
328
|
|
329
329
|
*out = note;
|
330
|
-
|
331
330
|
return 0;
|
332
331
|
}
|
333
332
|
|
data/vendor/libgit2/src/object.c
CHANGED
@@ -277,10 +277,8 @@ static int dereference_object(git_object **dereferenced, git_object *obj)
|
|
277
277
|
return git_tag_target(dereferenced, (git_tag*)obj);
|
278
278
|
|
279
279
|
case GIT_OBJ_BLOB:
|
280
|
-
return GIT_ENOTFOUND;
|
281
|
-
|
282
280
|
case GIT_OBJ_TREE:
|
283
|
-
return
|
281
|
+
return GIT_EPEEL;
|
284
282
|
|
285
283
|
default:
|
286
284
|
return GIT_EINVALIDSPEC;
|
@@ -303,6 +301,32 @@ static int peel_error(int error, const git_oid *oid, git_otype type)
|
|
303
301
|
return error;
|
304
302
|
}
|
305
303
|
|
304
|
+
static int check_type_combination(git_otype type, git_otype target)
|
305
|
+
{
|
306
|
+
if (type == target)
|
307
|
+
return 0;
|
308
|
+
|
309
|
+
switch (type) {
|
310
|
+
case GIT_OBJ_BLOB:
|
311
|
+
case GIT_OBJ_TREE:
|
312
|
+
/* a blob or tree can never be peeled to anything but themselves */
|
313
|
+
return GIT_EINVALIDSPEC;
|
314
|
+
break;
|
315
|
+
case GIT_OBJ_COMMIT:
|
316
|
+
/* a commit can only be peeled to a tree */
|
317
|
+
if (target != GIT_OBJ_TREE && target != GIT_OBJ_ANY)
|
318
|
+
return GIT_EINVALIDSPEC;
|
319
|
+
break;
|
320
|
+
case GIT_OBJ_TAG:
|
321
|
+
/* a tag may point to anything, so we let anything through */
|
322
|
+
break;
|
323
|
+
default:
|
324
|
+
return GIT_EINVALIDSPEC;
|
325
|
+
}
|
326
|
+
|
327
|
+
return 0;
|
328
|
+
}
|
329
|
+
|
306
330
|
int git_object_peel(
|
307
331
|
git_object **peeled,
|
308
332
|
const git_object *object,
|
@@ -313,15 +337,18 @@ int git_object_peel(
|
|
313
337
|
|
314
338
|
assert(object && peeled);
|
315
339
|
|
316
|
-
if (git_object_type(object) == target_type)
|
317
|
-
return git_object_dup(peeled, (git_object *)object);
|
318
|
-
|
319
340
|
assert(target_type == GIT_OBJ_TAG ||
|
320
341
|
target_type == GIT_OBJ_COMMIT ||
|
321
342
|
target_type == GIT_OBJ_TREE ||
|
322
343
|
target_type == GIT_OBJ_BLOB ||
|
323
344
|
target_type == GIT_OBJ_ANY);
|
324
345
|
|
346
|
+
if ((error = check_type_combination(git_object_type(object), target_type)) < 0)
|
347
|
+
return peel_error(error, git_object_id(object), target_type);
|
348
|
+
|
349
|
+
if (git_object_type(object) == target_type)
|
350
|
+
return git_object_dup(peeled, (git_object *)object);
|
351
|
+
|
325
352
|
source = (git_object *)object;
|
326
353
|
|
327
354
|
while (!(error = dereference_object(&deref, source))) {
|
data/vendor/libgit2/src/pack.c
CHANGED
@@ -408,11 +408,14 @@ static int packfile_unpack_header1(
|
|
408
408
|
size = c & 15;
|
409
409
|
shift = 4;
|
410
410
|
while (c & 0x80) {
|
411
|
-
if (len <= used)
|
411
|
+
if (len <= used) {
|
412
|
+
giterr_set(GITERR_ODB, "buffer too small");
|
412
413
|
return GIT_EBUFS;
|
414
|
+
}
|
413
415
|
|
414
416
|
if (bitsizeof(long) <= shift) {
|
415
417
|
*usedp = 0;
|
418
|
+
giterr_set(GITERR_ODB, "packfile corrupted");
|
416
419
|
return -1;
|
417
420
|
}
|
418
421
|
|
data/vendor/libgit2/src/remote.c
CHANGED
@@ -995,6 +995,7 @@ static int remote_head_for_ref(git_remote_head **out, git_remote *remote, git_re
|
|
995
995
|
error = remote_head_for_fetchspec_src(out, update_heads, git_buf_cstr(&remote_name));
|
996
996
|
|
997
997
|
cleanup:
|
998
|
+
git_buf_free(&remote_name);
|
998
999
|
git_reference_free(resolved_ref);
|
999
1000
|
git_config_free(config);
|
1000
1001
|
return error;
|
@@ -124,7 +124,7 @@ static int push_commit(git_revwalk *walk, const git_oid *oid, int uninteresting,
|
|
124
124
|
error = git_object_peel(&obj, oobj, GIT_OBJ_COMMIT);
|
125
125
|
git_object_free(oobj);
|
126
126
|
|
127
|
-
if (error == GIT_ENOTFOUND) {
|
127
|
+
if (error == GIT_ENOTFOUND || error == GIT_EINVALIDSPEC || error == GIT_EPEEL) {
|
128
128
|
/* If this comes from e.g. push_glob("tags"), ignore this */
|
129
129
|
if (from_glob)
|
130
130
|
return 0;
|
@@ -47,6 +47,17 @@ static void free_head(git_remote_head *head)
|
|
47
47
|
git__free(head);
|
48
48
|
}
|
49
49
|
|
50
|
+
static void free_heads(git_vector *heads)
|
51
|
+
{
|
52
|
+
git_remote_head *head;
|
53
|
+
size_t i;
|
54
|
+
|
55
|
+
git_vector_foreach(heads, i, head)
|
56
|
+
free_head(head);
|
57
|
+
|
58
|
+
git_vector_free(heads);
|
59
|
+
}
|
60
|
+
|
50
61
|
static int add_ref(transport_local *t, const char *name)
|
51
62
|
{
|
52
63
|
const char peeled[] = "^{}";
|
@@ -198,6 +209,8 @@ static int local_connect(
|
|
198
209
|
if (t->connected)
|
199
210
|
return 0;
|
200
211
|
|
212
|
+
free_heads(&t->refs);
|
213
|
+
|
201
214
|
t->url = git__strdup(url);
|
202
215
|
GITERR_CHECK_ALLOC(t->url);
|
203
216
|
t->direction = direction;
|
@@ -624,13 +637,8 @@ static int local_close(git_transport *transport)
|
|
624
637
|
static void local_free(git_transport *transport)
|
625
638
|
{
|
626
639
|
transport_local *t = (transport_local *)transport;
|
627
|
-
size_t i;
|
628
|
-
git_remote_head *head;
|
629
640
|
|
630
|
-
|
631
|
-
free_head(head);
|
632
|
-
|
633
|
-
git_vector_free(&t->refs);
|
641
|
+
free_heads(&t->refs);
|
634
642
|
|
635
643
|
/* Close the transport, if it's still open. */
|
636
644
|
local_close(transport);
|