rugged 0.27.5 → 0.27.7
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 +2 -2
- data/vendor/libgit2/cmake/Modules/FindmbedTLS.cmake +93 -0
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +2 -0
- data/vendor/libgit2/include/git2.h +1 -0
- data/vendor/libgit2/include/git2/attr.h +18 -7
- data/vendor/libgit2/include/git2/blame.h +39 -22
- 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 +14 -2
- data/vendor/libgit2/include/git2/checkout.h +13 -12
- data/vendor/libgit2/include/git2/cherrypick.h +6 -4
- data/vendor/libgit2/include/git2/clone.h +8 -6
- data/vendor/libgit2/include/git2/commit.h +28 -0
- data/vendor/libgit2/include/git2/common.h +27 -0
- data/vendor/libgit2/include/git2/config.h +1 -0
- data/vendor/libgit2/include/git2/describe.h +30 -7
- data/vendor/libgit2/include/git2/diff.h +32 -22
- data/vendor/libgit2/include/git2/errors.h +1 -0
- data/vendor/libgit2/include/git2/ignore.h +2 -2
- data/vendor/libgit2/include/git2/mailmap.h +115 -0
- data/vendor/libgit2/include/git2/merge.h +10 -8
- data/vendor/libgit2/include/git2/proxy.h +9 -5
- data/vendor/libgit2/include/git2/rebase.h +7 -4
- data/vendor/libgit2/include/git2/refspec.h +17 -0
- data/vendor/libgit2/include/git2/remote.h +12 -10
- data/vendor/libgit2/include/git2/repository.h +7 -5
- data/vendor/libgit2/include/git2/revert.h +5 -3
- data/vendor/libgit2/include/git2/stash.h +11 -8
- data/vendor/libgit2/include/git2/status.h +7 -3
- data/vendor/libgit2/include/git2/submodule.h +8 -7
- data/vendor/libgit2/include/git2/sys/alloc.h +101 -0
- data/vendor/libgit2/include/git2/sys/index.h +3 -0
- data/vendor/libgit2/include/git2/sys/mempack.h +35 -35
- data/vendor/libgit2/include/git2/sys/merge.h +6 -1
- data/vendor/libgit2/include/git2/sys/path.h +55 -0
- data/vendor/libgit2/include/git2/transaction.h +1 -0
- data/vendor/libgit2/include/git2/types.h +8 -5
- data/vendor/libgit2/include/git2/version.h +2 -2
- data/vendor/libgit2/include/git2/worktree.h +46 -11
- data/vendor/libgit2/src/CMakeLists.txt +87 -15
- data/vendor/libgit2/src/alloc.c +47 -0
- data/vendor/libgit2/src/alloc.h +40 -0
- data/vendor/libgit2/src/apply.c +4 -4
- data/vendor/libgit2/src/attr.c +4 -4
- data/vendor/libgit2/src/attr_file.c +8 -7
- data/vendor/libgit2/src/attrcache.c +2 -2
- data/vendor/libgit2/src/blame.c +11 -4
- data/vendor/libgit2/src/blame.h +1 -0
- data/vendor/libgit2/src/blame_git.c +8 -5
- data/vendor/libgit2/src/blob.c +5 -5
- data/vendor/libgit2/src/branch.c +20 -20
- data/vendor/libgit2/src/buffer.c +9 -4
- data/vendor/libgit2/src/buffer.h +1 -1
- data/vendor/libgit2/src/checkout.c +33 -24
- data/vendor/libgit2/src/cherrypick.c +3 -3
- data/vendor/libgit2/src/clone.c +13 -13
- data/vendor/libgit2/src/commit.c +16 -3
- data/vendor/libgit2/src/common.h +3 -1
- data/vendor/libgit2/src/config.c +3 -3
- data/vendor/libgit2/src/config_file.c +193 -241
- data/vendor/libgit2/src/config_parse.c +89 -66
- data/vendor/libgit2/src/config_parse.h +2 -2
- data/vendor/libgit2/src/crlf.c +9 -3
- 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 +4 -3
- data/vendor/libgit2/src/diff_print.c +8 -8
- data/vendor/libgit2/src/diff_tform.c +1 -1
- data/vendor/libgit2/src/diff_xdiff.c +12 -0
- data/vendor/libgit2/src/features.h.in +2 -0
- 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 +3 -3
- data/vendor/libgit2/src/global.c +17 -12
- data/vendor/libgit2/src/hash.h +2 -0
- data/vendor/libgit2/src/hash/hash_mbedtls.c +38 -0
- data/vendor/libgit2/src/hash/hash_mbedtls.h +20 -0
- data/vendor/libgit2/src/ignore.c +15 -20
- data/vendor/libgit2/src/index.c +77 -36
- data/vendor/libgit2/src/index.h +10 -0
- data/vendor/libgit2/src/indexer.c +9 -9
- data/vendor/libgit2/src/iterator.c +8 -8
- data/vendor/libgit2/src/khash.h +3 -1
- data/vendor/libgit2/src/mailmap.c +485 -0
- data/vendor/libgit2/src/mailmap.h +35 -0
- 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 +7 -7
- data/vendor/libgit2/src/odb_loose.c +13 -13
- data/vendor/libgit2/src/odb_pack.c +3 -3
- data/vendor/libgit2/src/pack-objects.c +2 -2
- data/vendor/libgit2/src/pack.c +5 -5
- data/vendor/libgit2/src/pack.h +1 -1
- data/vendor/libgit2/src/patch.c +1 -1
- data/vendor/libgit2/src/patch_generate.c +2 -2
- data/vendor/libgit2/src/patch_parse.c +11 -4
- data/vendor/libgit2/src/path.c +42 -66
- data/vendor/libgit2/src/path.h +2 -72
- data/vendor/libgit2/src/pathspec.c +1 -1
- data/vendor/libgit2/src/push.c +2 -2
- data/vendor/libgit2/src/rebase.c +19 -22
- data/vendor/libgit2/src/refdb_fs.c +65 -34
- data/vendor/libgit2/src/refs.c +6 -6
- data/vendor/libgit2/src/refspec.c +30 -5
- data/vendor/libgit2/src/refspec.h +1 -1
- data/vendor/libgit2/src/remote.c +40 -40
- data/vendor/libgit2/src/repository.c +63 -59
- data/vendor/libgit2/src/reset.c +1 -1
- data/vendor/libgit2/src/revert.c +3 -3
- data/vendor/libgit2/src/revparse.c +4 -4
- data/vendor/libgit2/src/revwalk.c +44 -10
- data/vendor/libgit2/src/revwalk.h +2 -1
- data/vendor/libgit2/src/settings.c +25 -1
- data/vendor/libgit2/src/signature.c +1 -1
- data/vendor/libgit2/src/stash.c +80 -34
- data/vendor/libgit2/src/status.c +1 -1
- data/vendor/libgit2/src/stdalloc.c +120 -0
- data/vendor/libgit2/src/stdalloc.h +17 -0
- data/vendor/libgit2/src/streams/mbedtls.c +463 -0
- data/vendor/libgit2/src/streams/mbedtls.h +20 -0
- data/vendor/libgit2/src/streams/openssl.c +132 -34
- data/vendor/libgit2/src/streams/openssl.h +0 -107
- data/vendor/libgit2/src/streams/tls.c +3 -0
- data/vendor/libgit2/src/submodule.c +117 -82
- data/vendor/libgit2/src/sysdir.c +4 -4
- data/vendor/libgit2/src/tag.c +7 -7
- 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 +12 -12
- data/vendor/libgit2/src/transports/local.c +7 -7
- data/vendor/libgit2/src/transports/smart.c +17 -8
- data/vendor/libgit2/src/transports/smart.h +5 -5
- data/vendor/libgit2/src/transports/smart_pkt.c +122 -130
- data/vendor/libgit2/src/transports/smart_protocol.c +48 -38
- data/vendor/libgit2/src/transports/ssh.c +1 -1
- data/vendor/libgit2/src/transports/winhttp.c +6 -6
- data/vendor/libgit2/src/tree.c +12 -53
- data/vendor/libgit2/src/tree.h +0 -12
- data/vendor/libgit2/src/util.c +16 -0
- data/vendor/libgit2/src/util.h +12 -135
- 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 +94 -0
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +28 -75
- data/vendor/libgit2/src/worktree.c +64 -43
- data/vendor/libgit2/src/worktree.h +2 -0
- data/vendor/libgit2/src/xdiff/xdiffi.c +3 -1
- metadata +16 -2
data/vendor/libgit2/src/sysdir.c
CHANGED
@@ -136,7 +136,7 @@ static int git_sysdir_guess_xdg_dirs(git_buf *out)
|
|
136
136
|
error = 0;
|
137
137
|
}
|
138
138
|
|
139
|
-
|
139
|
+
git_buf_dispose(&env);
|
140
140
|
return error;
|
141
141
|
#endif
|
142
142
|
}
|
@@ -168,7 +168,7 @@ static void git_sysdir_global_shutdown(void)
|
|
168
168
|
size_t i;
|
169
169
|
|
170
170
|
for (i = 0; i < ARRAY_SIZE(git_sysdir__dirs); ++i)
|
171
|
-
|
171
|
+
git_buf_dispose(&git_sysdir__dirs[i].buf);
|
172
172
|
}
|
173
173
|
|
174
174
|
int git_sysdir_global_init(void)
|
@@ -262,7 +262,7 @@ int git_sysdir_set(git_sysdir_t which, const char *search_path)
|
|
262
262
|
git_buf_join(&merge, GIT_PATH_LIST_SEPARATOR, merge.ptr, expand_path);
|
263
263
|
|
264
264
|
git_buf_swap(&git_sysdir__dirs[which].buf, &merge);
|
265
|
-
|
265
|
+
git_buf_dispose(&merge);
|
266
266
|
|
267
267
|
done:
|
268
268
|
if (git_buf_oom(&git_sysdir__dirs[which].buf))
|
@@ -307,7 +307,7 @@ static int git_sysdir_find_in_dirlist(
|
|
307
307
|
}
|
308
308
|
|
309
309
|
done:
|
310
|
-
|
310
|
+
git_buf_dispose(path);
|
311
311
|
giterr_set(GITERR_OS, "the %s file '%s' doesn't exist", label, name);
|
312
312
|
return GIT_ENOTFOUND;
|
313
313
|
}
|
data/vendor/libgit2/src/tag.c
CHANGED
@@ -229,11 +229,11 @@ static int write_tag_annotation(
|
|
229
229
|
if (git_odb_write(oid, odb, tag.ptr, tag.size, GIT_OBJ_TAG) < 0)
|
230
230
|
goto on_error;
|
231
231
|
|
232
|
-
|
232
|
+
git_buf_dispose(&tag);
|
233
233
|
return 0;
|
234
234
|
|
235
235
|
on_error:
|
236
|
-
|
236
|
+
git_buf_dispose(&tag);
|
237
237
|
giterr_set(GITERR_OBJECT, "failed to create tag annotation");
|
238
238
|
return -1;
|
239
239
|
}
|
@@ -268,7 +268,7 @@ static int git_tag_create__internal(
|
|
268
268
|
/** Ensure the tag name doesn't conflict with an already existing
|
269
269
|
* reference unless overwriting has explicitly been requested **/
|
270
270
|
if (error == 0 && !allow_ref_overwrite) {
|
271
|
-
|
271
|
+
git_buf_dispose(&ref_name);
|
272
272
|
giterr_set(GITERR_TAG, "tag already exists");
|
273
273
|
return GIT_EEXISTS;
|
274
274
|
}
|
@@ -283,7 +283,7 @@ static int git_tag_create__internal(
|
|
283
283
|
|
284
284
|
cleanup:
|
285
285
|
git_reference_free(new_ref);
|
286
|
-
|
286
|
+
git_buf_dispose(&ref_name);
|
287
287
|
return error;
|
288
288
|
}
|
289
289
|
|
@@ -381,7 +381,7 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu
|
|
381
381
|
git_odb_stream_free(stream);
|
382
382
|
|
383
383
|
if (error < 0) {
|
384
|
-
|
384
|
+
git_buf_dispose(&ref_name);
|
385
385
|
return error;
|
386
386
|
}
|
387
387
|
|
@@ -389,7 +389,7 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu
|
|
389
389
|
&new_ref, repo, ref_name.ptr, oid, allow_ref_overwrite, NULL);
|
390
390
|
|
391
391
|
git_reference_free(new_ref);
|
392
|
-
|
392
|
+
git_buf_dispose(&ref_name);
|
393
393
|
|
394
394
|
return error;
|
395
395
|
|
@@ -409,7 +409,7 @@ int git_tag_delete(git_repository *repo, const char *tag_name)
|
|
409
409
|
|
410
410
|
error = retrieve_tag_reference(&tag_ref, &ref_name, repo, tag_name);
|
411
411
|
|
412
|
-
|
412
|
+
git_buf_dispose(&ref_name);
|
413
413
|
|
414
414
|
if (error < 0)
|
415
415
|
return error;
|
data/vendor/libgit2/src/trace.h
CHANGED
@@ -36,7 +36,7 @@ static const char *next_line(const char *str)
|
|
36
36
|
if (nl) {
|
37
37
|
return nl + 1;
|
38
38
|
} else {
|
39
|
-
|
39
|
+
/* return pointer to the NUL terminator: */
|
40
40
|
return str + strlen(str);
|
41
41
|
}
|
42
42
|
}
|
@@ -310,12 +310,12 @@ int git_message_trailers(git_message_trailer_array *trailer_arr, const char *mes
|
|
310
310
|
}
|
311
311
|
|
312
312
|
if (isalnum(*ptr) || *ptr == '-') {
|
313
|
-
|
313
|
+
/* legal key character */
|
314
314
|
NEXT(S_KEY);
|
315
315
|
}
|
316
316
|
|
317
317
|
if (*ptr == ' ' || *ptr == '\t') {
|
318
|
-
|
318
|
+
/* optional whitespace before separator */
|
319
319
|
*ptr = 0;
|
320
320
|
NEXT(S_KEY_WS);
|
321
321
|
}
|
@@ -325,7 +325,7 @@ int git_message_trailers(git_message_trailer_array *trailer_arr, const char *mes
|
|
325
325
|
NEXT(S_SEP_WS);
|
326
326
|
}
|
327
327
|
|
328
|
-
|
328
|
+
/* illegal character */
|
329
329
|
GOTO(S_IGNORE);
|
330
330
|
}
|
331
331
|
case S_KEY_WS: {
|
@@ -341,7 +341,7 @@ int git_message_trailers(git_message_trailer_array *trailer_arr, const char *mes
|
|
341
341
|
NEXT(S_SEP_WS);
|
342
342
|
}
|
343
343
|
|
344
|
-
|
344
|
+
/* illegal character */
|
345
345
|
GOTO(S_IGNORE);
|
346
346
|
}
|
347
347
|
case S_SEP_WS: {
|
@@ -369,7 +369,7 @@ int git_message_trailers(git_message_trailer_array *trailer_arr, const char *mes
|
|
369
369
|
}
|
370
370
|
case S_VALUE_NL: {
|
371
371
|
if (*ptr == ' ') {
|
372
|
-
|
372
|
+
/* continuation; */
|
373
373
|
NEXT(S_VALUE);
|
374
374
|
}
|
375
375
|
|
@@ -174,7 +174,7 @@ int git_transport_register(
|
|
174
174
|
return 0;
|
175
175
|
|
176
176
|
on_error:
|
177
|
-
|
177
|
+
git_buf_dispose(&prefix);
|
178
178
|
git__free(definition);
|
179
179
|
return error;
|
180
180
|
}
|
@@ -210,7 +210,7 @@ int git_transport_unregister(const char *scheme)
|
|
210
210
|
error = GIT_ENOTFOUND;
|
211
211
|
|
212
212
|
done:
|
213
|
-
|
213
|
+
git_buf_dispose(&prefix);
|
214
214
|
return error;
|
215
215
|
}
|
216
216
|
|
@@ -165,7 +165,7 @@ static int negotiate_next_token(
|
|
165
165
|
done:
|
166
166
|
gss_release_name(&status_minor, &server);
|
167
167
|
gss_release_buffer(&status_minor, (gss_buffer_t) &output_token);
|
168
|
-
|
168
|
+
git_buf_dispose(&input_buf);
|
169
169
|
return error;
|
170
170
|
}
|
171
171
|
|
@@ -180,7 +180,7 @@ static void negotiate_context_free(git_http_auth_context *c)
|
|
180
180
|
ctx->gss_context = GSS_C_NO_CONTEXT;
|
181
181
|
}
|
182
182
|
|
183
|
-
|
183
|
+
git_buf_dispose(&ctx->target);
|
184
184
|
|
185
185
|
git__free(ctx->challenge);
|
186
186
|
|
@@ -449,14 +449,14 @@ static int on_headers_complete(http_parser *parser)
|
|
449
449
|
return t->parse_error = PARSE_ERROR_GENERIC;
|
450
450
|
|
451
451
|
if (strcmp(t->content_type, git_buf_cstr(&buf))) {
|
452
|
-
|
452
|
+
git_buf_dispose(&buf);
|
453
453
|
giterr_set(GITERR_NET,
|
454
454
|
"invalid Content-Type: %s",
|
455
455
|
t->content_type);
|
456
456
|
return t->parse_error = PARSE_ERROR_GENERIC;
|
457
457
|
}
|
458
458
|
|
459
|
-
|
459
|
+
git_buf_dispose(&buf);
|
460
460
|
|
461
461
|
return 0;
|
462
462
|
}
|
@@ -508,10 +508,10 @@ static void clear_parser_state(http_subtransport *t)
|
|
508
508
|
t->parse_error = 0;
|
509
509
|
t->parse_finished = 0;
|
510
510
|
|
511
|
-
|
511
|
+
git_buf_dispose(&t->parse_header_name);
|
512
512
|
git_buf_init(&t->parse_header_name, 0);
|
513
513
|
|
514
|
-
|
514
|
+
git_buf_dispose(&t->parse_header_value);
|
515
515
|
git_buf_init(&t->parse_header_value, 0);
|
516
516
|
|
517
517
|
git__free(t->content_type);
|
@@ -534,11 +534,11 @@ static int write_chunk(git_stream *io, const char *buffer, size_t len)
|
|
534
534
|
return -1;
|
535
535
|
|
536
536
|
if (git_stream_write(io, buf.ptr, buf.size, 0) < 0) {
|
537
|
-
|
537
|
+
git_buf_dispose(&buf);
|
538
538
|
return -1;
|
539
539
|
}
|
540
540
|
|
541
|
-
|
541
|
+
git_buf_dispose(&buf);
|
542
542
|
|
543
543
|
/* Chunk body */
|
544
544
|
if (len > 0 && git_stream_write(io, buffer, len, 0) < 0)
|
@@ -671,11 +671,11 @@ replay:
|
|
671
671
|
return -1;
|
672
672
|
|
673
673
|
if (git_stream_write(t->io, request.ptr, request.size, 0) < 0) {
|
674
|
-
|
674
|
+
git_buf_dispose(&request);
|
675
675
|
return -1;
|
676
676
|
}
|
677
677
|
|
678
|
-
|
678
|
+
git_buf_dispose(&request);
|
679
679
|
|
680
680
|
s->sent_request = 1;
|
681
681
|
}
|
@@ -792,11 +792,11 @@ static int http_stream_write_chunked(
|
|
792
792
|
return -1;
|
793
793
|
|
794
794
|
if (git_stream_write(t->io, request.ptr, request.size, 0) < 0) {
|
795
|
-
|
795
|
+
git_buf_dispose(&request);
|
796
796
|
return -1;
|
797
797
|
}
|
798
798
|
|
799
|
-
|
799
|
+
git_buf_dispose(&request);
|
800
800
|
|
801
801
|
s->sent_request = 1;
|
802
802
|
}
|
@@ -870,13 +870,13 @@ static int http_stream_write_single(
|
|
870
870
|
if (len && git_stream_write(t->io, buffer, len, 0) < 0)
|
871
871
|
goto on_error;
|
872
872
|
|
873
|
-
|
873
|
+
git_buf_dispose(&request);
|
874
874
|
s->sent_request = 1;
|
875
875
|
|
876
876
|
return 0;
|
877
877
|
|
878
878
|
on_error:
|
879
|
-
|
879
|
+
git_buf_dispose(&request);
|
880
880
|
return -1;
|
881
881
|
}
|
882
882
|
|
@@ -228,14 +228,14 @@ static int local_connect(
|
|
228
228
|
|
229
229
|
/* 'url' may be a url or path; convert to a path */
|
230
230
|
if ((error = git_path_from_url_or_path(&buf, url)) < 0) {
|
231
|
-
|
231
|
+
git_buf_dispose(&buf);
|
232
232
|
return error;
|
233
233
|
}
|
234
234
|
path = git_buf_cstr(&buf);
|
235
235
|
|
236
236
|
error = git_repository_open(&repo, path);
|
237
237
|
|
238
|
-
|
238
|
+
git_buf_dispose(&buf);
|
239
239
|
|
240
240
|
if (error < 0)
|
241
241
|
return -1;
|
@@ -354,14 +354,14 @@ static int local_push(
|
|
354
354
|
|
355
355
|
/* 'push->remote->url' may be a url or path; convert to a path */
|
356
356
|
if ((error = git_path_from_url_or_path(&buf, push->remote->url)) < 0) {
|
357
|
-
|
357
|
+
git_buf_dispose(&buf);
|
358
358
|
return error;
|
359
359
|
}
|
360
360
|
path = git_buf_cstr(&buf);
|
361
361
|
|
362
362
|
error = git_repository_open(&remote_repo, path);
|
363
363
|
|
364
|
-
|
364
|
+
git_buf_dispose(&buf);
|
365
365
|
|
366
366
|
if (error < 0)
|
367
367
|
return error;
|
@@ -383,7 +383,7 @@ static int local_push(
|
|
383
383
|
goto on_error;
|
384
384
|
|
385
385
|
error = git_packbuilder_write(push->pb, odb_path.ptr, 0, transfer_to_push_transfer, (void *) cbs);
|
386
|
-
|
386
|
+
git_buf_dispose(&odb_path);
|
387
387
|
|
388
388
|
if (error < 0)
|
389
389
|
goto on_error;
|
@@ -502,7 +502,7 @@ static int local_counting(int stage, unsigned int current, unsigned int total, v
|
|
502
502
|
return -1;
|
503
503
|
|
504
504
|
error = t->progress_cb(git_buf_cstr(&progress_info), git_buf_len(&progress_info), t->message_cb_payload);
|
505
|
-
|
505
|
+
git_buf_dispose(&progress_info);
|
506
506
|
|
507
507
|
return error;
|
508
508
|
}
|
@@ -627,7 +627,7 @@ static int local_download_pack(
|
|
627
627
|
|
628
628
|
cleanup:
|
629
629
|
if (writepack) writepack->free(writepack);
|
630
|
-
|
630
|
+
git_buf_dispose(&progress_info);
|
631
631
|
git_packbuilder_free(pack);
|
632
632
|
git_revwalk_free(walk);
|
633
633
|
return error;
|
@@ -82,7 +82,7 @@ static bool is_malformed_http_header(const char *http_header)
|
|
82
82
|
const char *c;
|
83
83
|
int name_len;
|
84
84
|
|
85
|
-
|
85
|
+
/* Disallow \r and \n */
|
86
86
|
c = strchr(http_header, '\r');
|
87
87
|
if (c)
|
88
88
|
return true;
|
@@ -90,7 +90,7 @@ static bool is_malformed_http_header(const char *http_header)
|
|
90
90
|
if (c)
|
91
91
|
return true;
|
92
92
|
|
93
|
-
|
93
|
+
/* Require a header name followed by : */
|
94
94
|
name_len = http_header_name_length(http_header);
|
95
95
|
if (name_len < 1)
|
96
96
|
return true;
|
@@ -112,7 +112,7 @@ static bool is_forbidden_custom_header(const char *custom_header)
|
|
112
112
|
unsigned long i;
|
113
113
|
int name_len = http_header_name_length(custom_header);
|
114
114
|
|
115
|
-
|
115
|
+
/* Disallow headers that we set */
|
116
116
|
for (i = 0; i < ARRAY_SIZE(forbidden_custom_headers); i++)
|
117
117
|
if (strncmp(forbidden_custom_headers[i], custom_header, name_len) == 0)
|
118
118
|
return true;
|
@@ -167,11 +167,13 @@ int git_smart__update_heads(transport_smart *t, git_vector *symrefs)
|
|
167
167
|
git_vector_foreach(symrefs, j, spec) {
|
168
168
|
git_buf_clear(&buf);
|
169
169
|
if (git_refspec_src_matches(spec, ref->head.name) &&
|
170
|
-
!(error = git_refspec_transform(&buf, spec, ref->head.name)))
|
170
|
+
!(error = git_refspec_transform(&buf, spec, ref->head.name))) {
|
171
|
+
git__free(ref->head.symref_target);
|
171
172
|
ref->head.symref_target = git_buf_detach(&buf);
|
173
|
+
}
|
172
174
|
}
|
173
175
|
|
174
|
-
|
176
|
+
git_buf_dispose(&buf);
|
175
177
|
|
176
178
|
if (error < 0)
|
177
179
|
return error;
|
@@ -190,7 +192,7 @@ static void free_symrefs(git_vector *symrefs)
|
|
190
192
|
size_t i;
|
191
193
|
|
192
194
|
git_vector_foreach(symrefs, i, spec) {
|
193
|
-
|
195
|
+
git_refspec__dispose(spec);
|
194
196
|
git__free(spec);
|
195
197
|
}
|
196
198
|
|
@@ -266,14 +268,21 @@ static int git_smart__connect(
|
|
266
268
|
/* We now have loaded the refs. */
|
267
269
|
t->have_refs = 1;
|
268
270
|
|
269
|
-
|
271
|
+
pkt = (git_pkt *)git_vector_get(&t->refs, 0);
|
272
|
+
if (pkt && GIT_PKT_REF != pkt->type) {
|
273
|
+
giterr_set(GITERR_NET, "invalid response");
|
274
|
+
return -1;
|
275
|
+
}
|
276
|
+
first = (git_pkt_ref *)pkt;
|
270
277
|
|
271
278
|
if ((error = git_vector_init(&symrefs, 1, NULL)) < 0)
|
272
279
|
return error;
|
273
280
|
|
274
281
|
/* Detect capabilities */
|
275
|
-
if (git_smart__detect_caps(first, &t->caps, &symrefs) < 0)
|
282
|
+
if (git_smart__detect_caps(first, &t->caps, &symrefs) < 0) {
|
283
|
+
free_symrefs(&symrefs);
|
276
284
|
return -1;
|
285
|
+
}
|
277
286
|
|
278
287
|
/* If the only ref in the list is capabilities^{} with OID_ZERO, remove it */
|
279
288
|
if (1 == t->refs.length && !strcmp(first->head.name, "capabilities^{}") &&
|
@@ -40,7 +40,7 @@ typedef enum {
|
|
40
40
|
GIT_PKT_HAVE,
|
41
41
|
GIT_PKT_ACK,
|
42
42
|
GIT_PKT_NAK,
|
43
|
-
|
43
|
+
GIT_PKT_PACK,
|
44
44
|
GIT_PKT_COMMENT,
|
45
45
|
GIT_PKT_ERR,
|
46
46
|
GIT_PKT_DATA,
|
@@ -50,7 +50,7 @@ typedef enum {
|
|
50
50
|
GIT_PKT_UNPACK,
|
51
51
|
} git_pkt_type;
|
52
52
|
|
53
|
-
/* Used for multi_ack and
|
53
|
+
/* Used for multi_ack and multi_ack_detailed */
|
54
54
|
enum git_ack_status {
|
55
55
|
GIT_ACK_NONE,
|
56
56
|
GIT_ACK_CONTINUE,
|
@@ -91,7 +91,7 @@ typedef struct {
|
|
91
91
|
|
92
92
|
typedef struct {
|
93
93
|
git_pkt_type type;
|
94
|
-
|
94
|
+
int len;
|
95
95
|
char data[GIT_FLEX_ARRAY];
|
96
96
|
} git_pkt_data;
|
97
97
|
|
@@ -99,7 +99,7 @@ typedef git_pkt_data git_pkt_progress;
|
|
99
99
|
|
100
100
|
typedef struct {
|
101
101
|
git_pkt_type type;
|
102
|
-
|
102
|
+
int len;
|
103
103
|
char error[GIT_FLEX_ARRAY];
|
104
104
|
} git_pkt_err;
|
105
105
|
|
@@ -189,7 +189,7 @@ int git_smart__get_push_stream(transport_smart *t, git_smart_subtransport_stream
|
|
189
189
|
int git_smart__update_heads(transport_smart *t, git_vector *symrefs);
|
190
190
|
|
191
191
|
/* smart_pkt.c */
|
192
|
-
int git_pkt_parse_line(git_pkt **head, const char
|
192
|
+
int git_pkt_parse_line(git_pkt **head, const char *line, const char **out, size_t len);
|
193
193
|
int git_pkt_buffer_flush(git_buf *buf);
|
194
194
|
int git_pkt_send_flush(GIT_SOCKET s);
|
195
195
|
int git_pkt_buffer_done(git_buf *buf);
|