rugged 0.27.7 → 0.27.9
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/CMakeLists.txt +6 -2
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.c.in +29 -0
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.cmake +96 -0
- data/vendor/libgit2/cmake/Modules/FindIconv.cmake +11 -6
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +0 -2
- data/vendor/libgit2/include/git2.h +0 -1
- data/vendor/libgit2/include/git2/attr.h +7 -18
- data/vendor/libgit2/include/git2/blame.h +22 -39
- data/vendor/libgit2/include/git2/blob.h +1 -1
- data/vendor/libgit2/include/git2/branch.h +1 -1
- data/vendor/libgit2/include/git2/buffer.h +2 -14
- data/vendor/libgit2/include/git2/checkout.h +12 -13
- data/vendor/libgit2/include/git2/cherrypick.h +4 -6
- data/vendor/libgit2/include/git2/clone.h +6 -8
- data/vendor/libgit2/include/git2/commit.h +0 -28
- data/vendor/libgit2/include/git2/common.h +0 -27
- data/vendor/libgit2/include/git2/config.h +0 -1
- data/vendor/libgit2/include/git2/describe.h +7 -30
- data/vendor/libgit2/include/git2/diff.h +22 -32
- data/vendor/libgit2/include/git2/errors.h +0 -1
- data/vendor/libgit2/include/git2/ignore.h +2 -2
- data/vendor/libgit2/include/git2/merge.h +8 -10
- data/vendor/libgit2/include/git2/proxy.h +5 -9
- data/vendor/libgit2/include/git2/rebase.h +4 -7
- data/vendor/libgit2/include/git2/refs.h +1 -1
- data/vendor/libgit2/include/git2/refspec.h +0 -17
- data/vendor/libgit2/include/git2/remote.h +10 -12
- data/vendor/libgit2/include/git2/repository.h +5 -7
- data/vendor/libgit2/include/git2/revert.h +3 -5
- data/vendor/libgit2/include/git2/stash.h +8 -11
- data/vendor/libgit2/include/git2/status.h +3 -7
- data/vendor/libgit2/include/git2/submodule.h +7 -8
- data/vendor/libgit2/include/git2/sys/index.h +0 -3
- data/vendor/libgit2/include/git2/sys/mempack.h +35 -35
- data/vendor/libgit2/include/git2/sys/merge.h +1 -6
- data/vendor/libgit2/include/git2/transaction.h +0 -1
- data/vendor/libgit2/include/git2/types.h +5 -8
- data/vendor/libgit2/include/git2/version.h +2 -2
- data/vendor/libgit2/include/git2/worktree.h +11 -46
- data/vendor/libgit2/src/CMakeLists.txt +28 -91
- data/vendor/libgit2/src/annotated_commit.c +4 -4
- data/vendor/libgit2/src/apply.c +6 -5
- data/vendor/libgit2/src/attr.c +4 -4
- data/vendor/libgit2/src/attr_file.c +5 -5
- data/vendor/libgit2/src/attrcache.c +2 -2
- data/vendor/libgit2/src/blame.c +4 -11
- data/vendor/libgit2/src/blame.h +0 -1
- data/vendor/libgit2/src/blame_git.c +5 -8
- data/vendor/libgit2/src/blob.c +5 -5
- data/vendor/libgit2/src/branch.c +20 -20
- data/vendor/libgit2/src/buffer.c +4 -9
- data/vendor/libgit2/src/buffer.h +1 -1
- data/vendor/libgit2/src/checkout.c +24 -33
- data/vendor/libgit2/src/cherrypick.c +3 -3
- data/vendor/libgit2/src/clone.c +13 -13
- data/vendor/libgit2/src/commit.c +5 -18
- data/vendor/libgit2/src/commit_list.c +9 -3
- data/vendor/libgit2/src/common.h +1 -3
- data/vendor/libgit2/src/config.c +15 -6
- data/vendor/libgit2/src/config_file.c +249 -193
- data/vendor/libgit2/src/config_parse.c +66 -89
- data/vendor/libgit2/src/config_parse.h +2 -2
- data/vendor/libgit2/src/crlf.c +3 -9
- data/vendor/libgit2/src/diff.c +2 -2
- data/vendor/libgit2/src/diff_driver.c +3 -3
- data/vendor/libgit2/src/diff_file.c +3 -3
- data/vendor/libgit2/src/diff_generate.c +3 -4
- data/vendor/libgit2/src/diff_print.c +8 -8
- data/vendor/libgit2/src/diff_tform.c +4 -2
- data/vendor/libgit2/src/diff_xdiff.c +0 -12
- data/vendor/libgit2/src/features.h.in +0 -2
- data/vendor/libgit2/src/fetch.c +2 -2
- data/vendor/libgit2/src/fetchhead.c +5 -5
- data/vendor/libgit2/src/filebuf.c +4 -4
- data/vendor/libgit2/src/fileops.c +10 -10
- data/vendor/libgit2/src/filter.c +9 -3
- data/vendor/libgit2/src/global.c +12 -17
- data/vendor/libgit2/src/hash.h +0 -2
- data/vendor/libgit2/src/ignore.c +5 -5
- data/vendor/libgit2/src/index.c +40 -80
- data/vendor/libgit2/src/index.h +0 -10
- data/vendor/libgit2/src/indexer.c +9 -9
- data/vendor/libgit2/src/iterator.c +8 -8
- data/vendor/libgit2/src/khash.h +1 -3
- data/vendor/libgit2/src/merge.c +7 -7
- data/vendor/libgit2/src/netops.c +5 -5
- data/vendor/libgit2/src/notes.c +2 -2
- data/vendor/libgit2/src/odb.c +9 -9
- data/vendor/libgit2/src/odb_loose.c +22 -18
- data/vendor/libgit2/src/odb_pack.c +3 -3
- data/vendor/libgit2/src/pack-objects.c +3 -3
- data/vendor/libgit2/src/pack.c +5 -5
- data/vendor/libgit2/src/pack.h +1 -1
- data/vendor/libgit2/src/parse.c +7 -4
- data/vendor/libgit2/src/patch.c +1 -1
- data/vendor/libgit2/src/patch_generate.c +2 -2
- data/vendor/libgit2/src/patch_parse.c +4 -24
- data/vendor/libgit2/src/path.c +140 -39
- data/vendor/libgit2/src/path.h +84 -2
- data/vendor/libgit2/src/pathspec.c +1 -1
- data/vendor/libgit2/src/push.c +2 -2
- data/vendor/libgit2/src/rebase.c +23 -20
- data/vendor/libgit2/src/refdb_fs.c +34 -65
- data/vendor/libgit2/src/refs.c +16 -13
- data/vendor/libgit2/src/refspec.c +5 -30
- data/vendor/libgit2/src/refspec.h +1 -1
- data/vendor/libgit2/src/remote.c +43 -43
- data/vendor/libgit2/src/repository.c +56 -56
- data/vendor/libgit2/src/reset.c +1 -1
- data/vendor/libgit2/src/revert.c +3 -3
- data/vendor/libgit2/src/revparse.c +7 -6
- data/vendor/libgit2/src/revwalk.c +20 -48
- data/vendor/libgit2/src/revwalk.h +1 -2
- data/vendor/libgit2/src/settings.c +1 -25
- data/vendor/libgit2/src/signature.c +4 -2
- data/vendor/libgit2/src/stash.c +34 -80
- data/vendor/libgit2/src/status.c +1 -1
- data/vendor/libgit2/src/streams/curl.c +1 -1
- data/vendor/libgit2/src/streams/openssl.c +34 -132
- data/vendor/libgit2/src/streams/openssl.h +107 -0
- data/vendor/libgit2/src/streams/tls.c +0 -3
- data/vendor/libgit2/src/submodule.c +83 -118
- data/vendor/libgit2/src/sysdir.c +4 -4
- data/vendor/libgit2/src/tag.c +12 -12
- data/vendor/libgit2/src/trace.h +1 -1
- data/vendor/libgit2/src/trailer.c +6 -6
- data/vendor/libgit2/src/transport.c +2 -2
- data/vendor/libgit2/src/transports/auth.c +1 -1
- data/vendor/libgit2/src/transports/auth_negotiate.c +2 -2
- data/vendor/libgit2/src/transports/git.c +1 -1
- data/vendor/libgit2/src/transports/http.c +15 -12
- data/vendor/libgit2/src/transports/local.c +7 -7
- data/vendor/libgit2/src/transports/smart.c +15 -20
- data/vendor/libgit2/src/transports/smart.h +5 -5
- data/vendor/libgit2/src/transports/smart_pkt.c +131 -123
- data/vendor/libgit2/src/transports/smart_protocol.c +38 -48
- data/vendor/libgit2/src/transports/ssh.c +1 -1
- data/vendor/libgit2/src/transports/winhttp.c +26 -21
- data/vendor/libgit2/src/tree-cache.c +2 -2
- data/vendor/libgit2/src/tree.c +69 -23
- data/vendor/libgit2/src/tree.h +12 -0
- data/vendor/libgit2/src/util.c +99 -52
- data/vendor/libgit2/src/util.h +138 -14
- data/vendor/libgit2/src/vector.c +13 -8
- data/vendor/libgit2/src/win32/findfile.c +2 -2
- data/vendor/libgit2/src/win32/posix_w32.c +1 -1
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +0 -94
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +75 -28
- data/vendor/libgit2/src/worktree.c +44 -65
- data/vendor/libgit2/src/worktree.h +0 -2
- data/vendor/libgit2/src/xdiff/xdiffi.c +1 -3
- metadata +5 -17
- data/vendor/libgit2/cmake/Modules/FindmbedTLS.cmake +0 -93
- data/vendor/libgit2/include/git2/mailmap.h +0 -115
- data/vendor/libgit2/include/git2/sys/alloc.h +0 -101
- data/vendor/libgit2/include/git2/sys/path.h +0 -55
- data/vendor/libgit2/src/alloc.c +0 -47
- data/vendor/libgit2/src/alloc.h +0 -40
- data/vendor/libgit2/src/hash/hash_mbedtls.c +0 -38
- data/vendor/libgit2/src/hash/hash_mbedtls.h +0 -20
- data/vendor/libgit2/src/mailmap.c +0 -485
- data/vendor/libgit2/src/mailmap.h +0 -35
- data/vendor/libgit2/src/stdalloc.c +0 -120
- data/vendor/libgit2/src/stdalloc.h +0 -17
- data/vendor/libgit2/src/streams/mbedtls.c +0 -463
- data/vendor/libgit2/src/streams/mbedtls.h +0 -20
@@ -44,7 +44,7 @@ int git_smart__store_refs(transport_smart *t, int flushes)
|
|
44
44
|
|
45
45
|
do {
|
46
46
|
if (buf->offset > 0)
|
47
|
-
error = git_pkt_parse_line(&pkt, buf->data,
|
47
|
+
error = git_pkt_parse_line(&pkt, &line_end, buf->data, buf->offset);
|
48
48
|
else
|
49
49
|
error = GIT_EBUFS;
|
50
50
|
|
@@ -70,12 +70,6 @@ int git_smart__store_refs(transport_smart *t, int flushes)
|
|
70
70
|
return -1;
|
71
71
|
}
|
72
72
|
|
73
|
-
if (pkt->type == GIT_PKT_PACK) {
|
74
|
-
giterr_set(GITERR_NET, "unexpected packfile");
|
75
|
-
git__free(pkt);
|
76
|
-
return -1;
|
77
|
-
}
|
78
|
-
|
79
73
|
if (pkt->type != GIT_PKT_FLUSH && git_vector_insert(refs, pkt) < 0)
|
80
74
|
return -1;
|
81
75
|
|
@@ -112,7 +106,7 @@ static int append_symref(const char **out, git_vector *symrefs, const char *ptr)
|
|
112
106
|
GITERR_CHECK_ALLOC(mapping);
|
113
107
|
|
114
108
|
error = git_refspec__parse(mapping, git_buf_cstr(&buf), true);
|
115
|
-
|
109
|
+
git_buf_free(&buf);
|
116
110
|
|
117
111
|
/* if the error isn't OOM, then it's a parse error; let's use a nicer message */
|
118
112
|
if (error < 0) {
|
@@ -131,7 +125,7 @@ static int append_symref(const char **out, git_vector *symrefs, const char *ptr)
|
|
131
125
|
|
132
126
|
on_invalid:
|
133
127
|
giterr_set(GITERR_NET, "remote sent invalid symref");
|
134
|
-
|
128
|
+
git_refspec__free(mapping);
|
135
129
|
git__free(mapping);
|
136
130
|
return -1;
|
137
131
|
}
|
@@ -215,7 +209,7 @@ int git_smart__detect_caps(git_pkt_ref *pkt, transport_smart_caps *caps, git_vec
|
|
215
209
|
return 0;
|
216
210
|
}
|
217
211
|
|
218
|
-
static int recv_pkt(git_pkt **
|
212
|
+
static int recv_pkt(git_pkt **out, git_pkt_type *pkt_type, gitno_buffer *buf)
|
219
213
|
{
|
220
214
|
const char *ptr = buf->data, *line_end = ptr;
|
221
215
|
git_pkt *pkt = NULL;
|
@@ -223,7 +217,7 @@ static int recv_pkt(git_pkt **out_pkt, git_pkt_type *out_type, gitno_buffer *buf
|
|
223
217
|
|
224
218
|
do {
|
225
219
|
if (buf->offset > 0)
|
226
|
-
error = git_pkt_parse_line(&pkt,
|
220
|
+
error = git_pkt_parse_line(&pkt, &line_end, ptr, buf->offset);
|
227
221
|
else
|
228
222
|
error = GIT_EBUFS;
|
229
223
|
|
@@ -242,10 +236,10 @@ static int recv_pkt(git_pkt **out_pkt, git_pkt_type *out_type, gitno_buffer *buf
|
|
242
236
|
} while (error);
|
243
237
|
|
244
238
|
gitno_consume(buf, line_end);
|
245
|
-
if (
|
246
|
-
*
|
247
|
-
if (
|
248
|
-
*
|
239
|
+
if (pkt_type)
|
240
|
+
*pkt_type = pkt->type;
|
241
|
+
if (out != NULL)
|
242
|
+
*out = pkt;
|
249
243
|
else
|
250
244
|
git__free(pkt);
|
251
245
|
|
@@ -262,15 +256,14 @@ static int store_common(transport_smart *t)
|
|
262
256
|
if ((error = recv_pkt(&pkt, NULL, buf)) < 0)
|
263
257
|
return error;
|
264
258
|
|
265
|
-
if (pkt->type
|
259
|
+
if (pkt->type == GIT_PKT_ACK) {
|
260
|
+
if (git_vector_insert(&t->common, pkt) < 0)
|
261
|
+
return -1;
|
262
|
+
} else {
|
266
263
|
git__free(pkt);
|
267
264
|
return 0;
|
268
265
|
}
|
269
266
|
|
270
|
-
if (git_vector_insert(&t->common, pkt) < 0) {
|
271
|
-
git__free(pkt);
|
272
|
-
return -1;
|
273
|
-
}
|
274
267
|
} while (1);
|
275
268
|
|
276
269
|
return 0;
|
@@ -323,30 +316,27 @@ on_error:
|
|
323
316
|
static int wait_while_ack(gitno_buffer *buf)
|
324
317
|
{
|
325
318
|
int error;
|
326
|
-
|
327
|
-
git_pkt_ack *ack = NULL;
|
319
|
+
git_pkt_ack *pkt = NULL;
|
328
320
|
|
329
321
|
while (1) {
|
330
|
-
|
322
|
+
git__free(pkt);
|
331
323
|
|
332
|
-
if ((error = recv_pkt(&pkt, NULL, buf)) < 0)
|
324
|
+
if ((error = recv_pkt((git_pkt **)&pkt, NULL, buf)) < 0)
|
333
325
|
return error;
|
334
326
|
|
335
327
|
if (pkt->type == GIT_PKT_NAK)
|
336
328
|
break;
|
337
|
-
if (pkt->type != GIT_PKT_ACK)
|
338
|
-
continue;
|
339
|
-
|
340
|
-
ack = (git_pkt_ack*)pkt;
|
341
329
|
|
342
|
-
if (
|
343
|
-
|
344
|
-
|
345
|
-
|
330
|
+
if (pkt->type == GIT_PKT_ACK &&
|
331
|
+
(pkt->status != GIT_ACK_CONTINUE &&
|
332
|
+
pkt->status != GIT_ACK_COMMON &&
|
333
|
+
pkt->status != GIT_ACK_READY)) {
|
334
|
+
git__free(pkt);
|
335
|
+
return 0;
|
346
336
|
}
|
347
337
|
}
|
348
338
|
|
349
|
-
|
339
|
+
git__free(pkt);
|
350
340
|
return 0;
|
351
341
|
}
|
352
342
|
|
@@ -407,10 +397,10 @@ int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, c
|
|
407
397
|
if ((error = store_common(t)) < 0)
|
408
398
|
goto on_error;
|
409
399
|
} else {
|
410
|
-
|
400
|
+
error = recv_pkt(NULL, &pkt_type, buf);
|
401
|
+
if (error < 0) {
|
411
402
|
goto on_error;
|
412
|
-
|
413
|
-
if (pkt_type == GIT_PKT_ACK) {
|
403
|
+
} else if (pkt_type == GIT_PKT_ACK) {
|
414
404
|
break;
|
415
405
|
} else if (pkt_type == GIT_PKT_NAK) {
|
416
406
|
continue;
|
@@ -474,15 +464,16 @@ int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, c
|
|
474
464
|
if ((error = git_smart__negotiation_step(&t->parent, data.ptr, data.size)) < 0)
|
475
465
|
goto on_error;
|
476
466
|
|
477
|
-
|
467
|
+
git_buf_free(&data);
|
478
468
|
git_revwalk_free(walk);
|
479
469
|
|
480
470
|
/* Now let's eat up whatever the server gives us */
|
481
471
|
if (!t->caps.multi_ack && !t->caps.multi_ack_detailed) {
|
482
|
-
|
483
|
-
return error;
|
472
|
+
error = recv_pkt(NULL, &pkt_type, buf);
|
484
473
|
|
485
|
-
if (
|
474
|
+
if (error < 0) {
|
475
|
+
return error;
|
476
|
+
} else if (pkt_type != GIT_PKT_ACK && pkt_type != GIT_PKT_NAK) {
|
486
477
|
giterr_set(GITERR_NET, "Unexpected pkt type");
|
487
478
|
return -1;
|
488
479
|
}
|
@@ -494,7 +485,7 @@ int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, c
|
|
494
485
|
|
495
486
|
on_error:
|
496
487
|
git_revwalk_free(walk);
|
497
|
-
|
488
|
+
git_buf_free(&data);
|
498
489
|
return error;
|
499
490
|
}
|
500
491
|
|
@@ -624,8 +615,7 @@ int git_smart__download_pack(
|
|
624
615
|
}
|
625
616
|
}
|
626
617
|
|
627
|
-
|
628
|
-
|
618
|
+
git__free(pkt);
|
629
619
|
if (error < 0)
|
630
620
|
goto done;
|
631
621
|
|
@@ -761,7 +751,7 @@ static int add_push_report_sideband_pkt(git_push *push, git_pkt_data *data_pkt,
|
|
761
751
|
}
|
762
752
|
|
763
753
|
while (line_len > 0) {
|
764
|
-
error = git_pkt_parse_line(&pkt,
|
754
|
+
error = git_pkt_parse_line(&pkt, &line_end, line, line_len);
|
765
755
|
|
766
756
|
if (error == GIT_EBUFS) {
|
767
757
|
/* Buffer the data when the inner packet is split
|
@@ -804,8 +794,8 @@ static int parse_report(transport_smart *transport, git_push *push)
|
|
804
794
|
|
805
795
|
for (;;) {
|
806
796
|
if (buf->offset > 0)
|
807
|
-
error = git_pkt_parse_line(&pkt,
|
808
|
-
|
797
|
+
error = git_pkt_parse_line(&pkt, &line_end,
|
798
|
+
buf->data, buf->offset);
|
809
799
|
else
|
810
800
|
error = GIT_EBUFS;
|
811
801
|
|
@@ -872,7 +862,7 @@ static int parse_report(transport_smart *transport, git_push *push)
|
|
872
862
|
}
|
873
863
|
}
|
874
864
|
done:
|
875
|
-
|
865
|
+
git_buf_free(&data_pkt_buf);
|
876
866
|
return error;
|
877
867
|
}
|
878
868
|
|
@@ -1095,6 +1085,6 @@ int git_smart__push(git_transport *transport, git_push *push, const git_remote_c
|
|
1095
1085
|
}
|
1096
1086
|
|
1097
1087
|
done:
|
1098
|
-
|
1088
|
+
git_buf_free(&pktline);
|
1099
1089
|
return error;
|
1100
1090
|
}
|
@@ -455,7 +455,7 @@ static int winhttp_stream_connect(winhttp_stream *s)
|
|
455
455
|
|
456
456
|
/* Convert URL to wide characters */
|
457
457
|
error = git__utf8_to_16_alloc(&proxy_wide, processed_url.ptr);
|
458
|
-
|
458
|
+
git_buf_free(&processed_url);
|
459
459
|
if (error < 0)
|
460
460
|
goto on_error;
|
461
461
|
|
@@ -599,7 +599,7 @@ on_error:
|
|
599
599
|
winhttp_stream_close(s);
|
600
600
|
|
601
601
|
git__free(proxy_url);
|
602
|
-
|
602
|
+
git_buf_free(&buf);
|
603
603
|
return error;
|
604
604
|
}
|
605
605
|
|
@@ -659,12 +659,12 @@ static int write_chunk(HINTERNET request, const char *buffer, size_t len)
|
|
659
659
|
if (!WinHttpWriteData(request,
|
660
660
|
git_buf_cstr(&buf), (DWORD)git_buf_len(&buf),
|
661
661
|
&bytes_written)) {
|
662
|
-
|
662
|
+
git_buf_free(&buf);
|
663
663
|
giterr_set(GITERR_OS, "failed to write chunk header");
|
664
664
|
return -1;
|
665
665
|
}
|
666
666
|
|
667
|
-
|
667
|
+
git_buf_free(&buf);
|
668
668
|
|
669
669
|
/* Chunk body */
|
670
670
|
if (!WinHttpWriteData(request,
|
@@ -761,7 +761,8 @@ static int winhttp_connect(
|
|
761
761
|
t->connection = NULL;
|
762
762
|
|
763
763
|
/* Prepare port */
|
764
|
-
if (
|
764
|
+
if (git__strntol32(&port, t->connection_data.port,
|
765
|
+
strlen(t->connection_data.port), NULL, 10) < 0)
|
765
766
|
return -1;
|
766
767
|
|
767
768
|
/* Prepare host */
|
@@ -779,11 +780,11 @@ static int winhttp_connect(
|
|
779
780
|
if (git__utf8_to_16_alloc(&wide_ua, git_buf_cstr(&ua)) < 0) {
|
780
781
|
giterr_set(GITERR_OS, "unable to convert host to wide characters");
|
781
782
|
git__free(wide_host);
|
782
|
-
|
783
|
+
git_buf_free(&ua);
|
783
784
|
return -1;
|
784
785
|
}
|
785
786
|
|
786
|
-
|
787
|
+
git_buf_free(&ua);
|
787
788
|
|
788
789
|
/* Establish session */
|
789
790
|
t->session = WinHttpOpen(
|
@@ -845,23 +846,27 @@ on_error:
|
|
845
846
|
|
846
847
|
static int do_send_request(winhttp_stream *s, size_t len, int ignore_length)
|
847
848
|
{
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
849
|
+
int attempts;
|
850
|
+
bool success;
|
851
|
+
|
852
|
+
for (attempts = 0; attempts < 5; attempts++) {
|
853
|
+
if (ignore_length) {
|
854
|
+
success = WinHttpSendRequest(s->request,
|
855
|
+
WINHTTP_NO_ADDITIONAL_HEADERS, 0,
|
856
|
+
WINHTTP_NO_REQUEST_DATA, 0,
|
857
|
+
WINHTTP_IGNORE_REQUEST_TOTAL_LENGTH, 0);
|
858
|
+
} else {
|
859
|
+
success = WinHttpSendRequest(s->request,
|
860
|
+
WINHTTP_NO_ADDITIONAL_HEADERS, 0,
|
861
|
+
WINHTTP_NO_REQUEST_DATA, 0,
|
862
|
+
len, 0);
|
861
863
|
}
|
864
|
+
|
865
|
+
if (success || GetLastError() != SEC_E_BUFFER_TOO_SMALL)
|
866
|
+
break;
|
862
867
|
}
|
863
868
|
|
864
|
-
return 0;
|
869
|
+
return success ? 0 : -1;
|
865
870
|
}
|
866
871
|
|
867
872
|
static int send_request(winhttp_stream *s, size_t len, int ignore_length)
|
@@ -91,7 +91,7 @@ static int read_tree_internal(git_tree_cache **out,
|
|
91
91
|
return -1;
|
92
92
|
|
93
93
|
/* Blank-terminated ASCII decimal number of entries in this tree */
|
94
|
-
if (
|
94
|
+
if (git__strntol32(&count, buffer, buffer_end - buffer, &buffer, 10) < 0)
|
95
95
|
goto corrupted;
|
96
96
|
|
97
97
|
tree->entry_count = count;
|
@@ -100,7 +100,7 @@ static int read_tree_internal(git_tree_cache **out,
|
|
100
100
|
goto corrupted;
|
101
101
|
|
102
102
|
/* Number of children of the tree, newline-terminated */
|
103
|
-
if (
|
103
|
+
if (git__strntol32(&count, buffer, buffer_end - buffer, &buffer, 10) < 0 || count < 0)
|
104
104
|
goto corrupted;
|
105
105
|
|
106
106
|
tree->children_count = count;
|
data/vendor/libgit2/src/tree.c
CHANGED
@@ -74,6 +74,14 @@ int git_tree_entry_cmp(const git_tree_entry *e1, const git_tree_entry *e2)
|
|
74
74
|
return entry_sort_cmp(e1, e2);
|
75
75
|
}
|
76
76
|
|
77
|
+
int git_tree_entry_icmp(const git_tree_entry *e1, const git_tree_entry *e2)
|
78
|
+
{
|
79
|
+
return git_path_cmp(
|
80
|
+
e1->filename, e1->filename_len, git_tree_entry__is_tree(e1),
|
81
|
+
e2->filename, e2->filename_len, git_tree_entry__is_tree(e2),
|
82
|
+
git__strncasecmp);
|
83
|
+
}
|
84
|
+
|
77
85
|
/**
|
78
86
|
* Allocate a new self-contained entry, with enough space after it to
|
79
87
|
* store the filename and the id.
|
@@ -334,6 +342,41 @@ const git_tree_entry *git_tree_entry_byid(
|
|
334
342
|
return NULL;
|
335
343
|
}
|
336
344
|
|
345
|
+
int git_tree__prefix_position(const git_tree *tree, const char *path)
|
346
|
+
{
|
347
|
+
struct tree_key_search ksearch;
|
348
|
+
size_t at_pos, path_len;
|
349
|
+
|
350
|
+
if (!path)
|
351
|
+
return 0;
|
352
|
+
|
353
|
+
path_len = strlen(path);
|
354
|
+
TREE_ENTRY_CHECK_NAMELEN(path_len);
|
355
|
+
|
356
|
+
ksearch.filename = path;
|
357
|
+
ksearch.filename_len = (uint16_t)path_len;
|
358
|
+
|
359
|
+
/* Find tree entry with appropriate prefix */
|
360
|
+
git_array_search(
|
361
|
+
&at_pos, tree->entries, &homing_search_cmp, &ksearch);
|
362
|
+
|
363
|
+
for (; at_pos < tree->entries.size; ++at_pos) {
|
364
|
+
const git_tree_entry *entry = git_array_get(tree->entries, at_pos);
|
365
|
+
if (homing_search_cmp(&ksearch, entry) < 0)
|
366
|
+
break;
|
367
|
+
}
|
368
|
+
|
369
|
+
for (; at_pos > 0; --at_pos) {
|
370
|
+
const git_tree_entry *entry =
|
371
|
+
git_array_get(tree->entries, at_pos - 1);
|
372
|
+
|
373
|
+
if (homing_search_cmp(&ksearch, entry) > 0)
|
374
|
+
break;
|
375
|
+
}
|
376
|
+
|
377
|
+
return (int)at_pos;
|
378
|
+
}
|
379
|
+
|
337
380
|
size_t git_tree_entrycount(const git_tree *tree)
|
338
381
|
{
|
339
382
|
assert(tree);
|
@@ -356,21 +399,21 @@ static int tree_error(const char *str, const char *path)
|
|
356
399
|
return -1;
|
357
400
|
}
|
358
401
|
|
359
|
-
static int parse_mode(
|
402
|
+
static int parse_mode(uint16_t *mode_out, const char *buffer, size_t buffer_len, const char **buffer_out)
|
360
403
|
{
|
361
|
-
|
362
|
-
|
404
|
+
int32_t mode;
|
405
|
+
int error;
|
363
406
|
|
364
|
-
if (*buffer
|
407
|
+
if (!buffer_len || git__isspace(*buffer))
|
365
408
|
return -1;
|
366
409
|
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
*
|
410
|
+
if ((error = git__strntol32(&mode, buffer, buffer_len, buffer_out, 8)) < 0)
|
411
|
+
return error;
|
412
|
+
|
413
|
+
if (mode < 0 || mode > UINT16_MAX)
|
414
|
+
return -1;
|
415
|
+
|
416
|
+
*mode_out = mode;
|
374
417
|
|
375
418
|
return 0;
|
376
419
|
}
|
@@ -394,11 +437,14 @@ int git_tree__parse(void *_tree, git_odb_object *odb_obj)
|
|
394
437
|
git_tree_entry *entry;
|
395
438
|
size_t filename_len;
|
396
439
|
const char *nul;
|
397
|
-
|
440
|
+
uint16_t attr;
|
398
441
|
|
399
|
-
if (parse_mode(&attr, buffer, &buffer) < 0 || !buffer)
|
442
|
+
if (parse_mode(&attr, buffer, buffer_end - buffer, &buffer) < 0 || !buffer)
|
400
443
|
return tree_error("failed to parse tree: can't parse filemode", NULL);
|
401
444
|
|
445
|
+
if (buffer >= buffer_end || (*buffer++) != ' ')
|
446
|
+
return tree_error("failed to parse tree: missing space after filemode", NULL);
|
447
|
+
|
402
448
|
if ((nul = memchr(buffer, 0, buffer_end - buffer)) == NULL)
|
403
449
|
return tree_error("failed to parse tree: object is corrupted", NULL);
|
404
450
|
|
@@ -448,15 +494,15 @@ static int append_entry(
|
|
448
494
|
const char *filename,
|
449
495
|
const git_oid *id,
|
450
496
|
git_filemode_t filemode,
|
451
|
-
bool
|
497
|
+
bool validate)
|
452
498
|
{
|
453
499
|
git_tree_entry *entry;
|
454
500
|
int error = 0;
|
455
501
|
|
456
|
-
if (
|
502
|
+
if (validate && !valid_entry_name(bld->repo, filename))
|
457
503
|
return tree_error("failed to insert entry: invalid name for a tree entry", filename);
|
458
504
|
|
459
|
-
if (
|
505
|
+
if (validate && git_oid_iszero(id))
|
460
506
|
return tree_error("failed to insert entry: invalid null OID for a tree entry", filename);
|
461
507
|
|
462
508
|
entry = alloc_entry(filename, strlen(filename), id);
|
@@ -554,12 +600,12 @@ static int write_tree(
|
|
554
600
|
last_comp = subdir;
|
555
601
|
}
|
556
602
|
|
557
|
-
error = append_entry(bld, last_comp, &sub_oid, S_IFDIR,
|
603
|
+
error = append_entry(bld, last_comp, &sub_oid, S_IFDIR, true);
|
558
604
|
git__free(subdir);
|
559
605
|
if (error < 0)
|
560
606
|
goto on_error;
|
561
607
|
} else {
|
562
|
-
error = append_entry(bld, filename, &entry->id, entry->mode,
|
608
|
+
error = append_entry(bld, filename, &entry->id, entry->mode, true);
|
563
609
|
if (error < 0)
|
564
610
|
goto on_error;
|
565
611
|
}
|
@@ -608,7 +654,7 @@ int git_tree__write_index(
|
|
608
654
|
}
|
609
655
|
|
610
656
|
ret = write_tree(oid, repo, index, "", 0, &shared_buf);
|
611
|
-
|
657
|
+
git_buf_free(&shared_buf);
|
612
658
|
|
613
659
|
if (old_ignore_case)
|
614
660
|
git_index__set_ignore_case(index, true);
|
@@ -658,7 +704,7 @@ int git_treebuilder_new(
|
|
658
704
|
bld, entry_src->filename,
|
659
705
|
entry_src->oid,
|
660
706
|
entry_src->attr,
|
661
|
-
|
707
|
+
false) < 0)
|
662
708
|
goto on_error;
|
663
709
|
}
|
664
710
|
}
|
@@ -773,7 +819,7 @@ int git_treebuilder_write(git_oid *oid, git_treebuilder *bld)
|
|
773
819
|
|
774
820
|
error = git_treebuilder_write_with_buffer(oid, bld, &buffer);
|
775
821
|
|
776
|
-
|
822
|
+
git_buf_free(&buffer);
|
777
823
|
return error;
|
778
824
|
}
|
779
825
|
|
@@ -1014,7 +1060,7 @@ int git_tree_walk(
|
|
1014
1060
|
error = tree_walk(
|
1015
1061
|
tree, callback, &root_path, payload, (mode == GIT_TREEWALK_PRE));
|
1016
1062
|
|
1017
|
-
|
1063
|
+
git_buf_free(&root_path);
|
1018
1064
|
|
1019
1065
|
return error;
|
1020
1066
|
}
|
@@ -1279,7 +1325,7 @@ cleanup:
|
|
1279
1325
|
}
|
1280
1326
|
}
|
1281
1327
|
|
1282
|
-
|
1328
|
+
git_buf_free(&component);
|
1283
1329
|
git_array_clear(stack);
|
1284
1330
|
git_vector_free(&entries);
|
1285
1331
|
return error;
|