rugged 0.27.7 → 0.27.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rugged/version.rb +1 -1
  3. data/vendor/libgit2/CMakeLists.txt +6 -2
  4. data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.c.in +29 -0
  5. data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.cmake +96 -0
  6. data/vendor/libgit2/cmake/Modules/FindIconv.cmake +11 -6
  7. data/vendor/libgit2/deps/http-parser/CMakeLists.txt +0 -2
  8. data/vendor/libgit2/include/git2.h +0 -1
  9. data/vendor/libgit2/include/git2/attr.h +7 -18
  10. data/vendor/libgit2/include/git2/blame.h +22 -39
  11. data/vendor/libgit2/include/git2/blob.h +1 -1
  12. data/vendor/libgit2/include/git2/branch.h +1 -1
  13. data/vendor/libgit2/include/git2/buffer.h +2 -14
  14. data/vendor/libgit2/include/git2/checkout.h +12 -13
  15. data/vendor/libgit2/include/git2/cherrypick.h +4 -6
  16. data/vendor/libgit2/include/git2/clone.h +6 -8
  17. data/vendor/libgit2/include/git2/commit.h +0 -28
  18. data/vendor/libgit2/include/git2/common.h +0 -27
  19. data/vendor/libgit2/include/git2/config.h +0 -1
  20. data/vendor/libgit2/include/git2/describe.h +7 -30
  21. data/vendor/libgit2/include/git2/diff.h +22 -32
  22. data/vendor/libgit2/include/git2/errors.h +0 -1
  23. data/vendor/libgit2/include/git2/ignore.h +2 -2
  24. data/vendor/libgit2/include/git2/merge.h +8 -10
  25. data/vendor/libgit2/include/git2/proxy.h +5 -9
  26. data/vendor/libgit2/include/git2/rebase.h +4 -7
  27. data/vendor/libgit2/include/git2/refs.h +1 -1
  28. data/vendor/libgit2/include/git2/refspec.h +0 -17
  29. data/vendor/libgit2/include/git2/remote.h +10 -12
  30. data/vendor/libgit2/include/git2/repository.h +5 -7
  31. data/vendor/libgit2/include/git2/revert.h +3 -5
  32. data/vendor/libgit2/include/git2/stash.h +8 -11
  33. data/vendor/libgit2/include/git2/status.h +3 -7
  34. data/vendor/libgit2/include/git2/submodule.h +7 -8
  35. data/vendor/libgit2/include/git2/sys/index.h +0 -3
  36. data/vendor/libgit2/include/git2/sys/mempack.h +35 -35
  37. data/vendor/libgit2/include/git2/sys/merge.h +1 -6
  38. data/vendor/libgit2/include/git2/transaction.h +0 -1
  39. data/vendor/libgit2/include/git2/types.h +5 -8
  40. data/vendor/libgit2/include/git2/version.h +2 -2
  41. data/vendor/libgit2/include/git2/worktree.h +11 -46
  42. data/vendor/libgit2/src/CMakeLists.txt +28 -91
  43. data/vendor/libgit2/src/annotated_commit.c +4 -4
  44. data/vendor/libgit2/src/apply.c +6 -5
  45. data/vendor/libgit2/src/attr.c +4 -4
  46. data/vendor/libgit2/src/attr_file.c +5 -5
  47. data/vendor/libgit2/src/attrcache.c +2 -2
  48. data/vendor/libgit2/src/blame.c +4 -11
  49. data/vendor/libgit2/src/blame.h +0 -1
  50. data/vendor/libgit2/src/blame_git.c +5 -8
  51. data/vendor/libgit2/src/blob.c +5 -5
  52. data/vendor/libgit2/src/branch.c +20 -20
  53. data/vendor/libgit2/src/buffer.c +4 -9
  54. data/vendor/libgit2/src/buffer.h +1 -1
  55. data/vendor/libgit2/src/checkout.c +24 -33
  56. data/vendor/libgit2/src/cherrypick.c +3 -3
  57. data/vendor/libgit2/src/clone.c +13 -13
  58. data/vendor/libgit2/src/commit.c +5 -18
  59. data/vendor/libgit2/src/commit_list.c +9 -3
  60. data/vendor/libgit2/src/common.h +1 -3
  61. data/vendor/libgit2/src/config.c +15 -6
  62. data/vendor/libgit2/src/config_file.c +249 -193
  63. data/vendor/libgit2/src/config_parse.c +66 -89
  64. data/vendor/libgit2/src/config_parse.h +2 -2
  65. data/vendor/libgit2/src/crlf.c +3 -9
  66. data/vendor/libgit2/src/diff.c +2 -2
  67. data/vendor/libgit2/src/diff_driver.c +3 -3
  68. data/vendor/libgit2/src/diff_file.c +3 -3
  69. data/vendor/libgit2/src/diff_generate.c +3 -4
  70. data/vendor/libgit2/src/diff_print.c +8 -8
  71. data/vendor/libgit2/src/diff_tform.c +4 -2
  72. data/vendor/libgit2/src/diff_xdiff.c +0 -12
  73. data/vendor/libgit2/src/features.h.in +0 -2
  74. data/vendor/libgit2/src/fetch.c +2 -2
  75. data/vendor/libgit2/src/fetchhead.c +5 -5
  76. data/vendor/libgit2/src/filebuf.c +4 -4
  77. data/vendor/libgit2/src/fileops.c +10 -10
  78. data/vendor/libgit2/src/filter.c +9 -3
  79. data/vendor/libgit2/src/global.c +12 -17
  80. data/vendor/libgit2/src/hash.h +0 -2
  81. data/vendor/libgit2/src/ignore.c +5 -5
  82. data/vendor/libgit2/src/index.c +40 -80
  83. data/vendor/libgit2/src/index.h +0 -10
  84. data/vendor/libgit2/src/indexer.c +9 -9
  85. data/vendor/libgit2/src/iterator.c +8 -8
  86. data/vendor/libgit2/src/khash.h +1 -3
  87. data/vendor/libgit2/src/merge.c +7 -7
  88. data/vendor/libgit2/src/netops.c +5 -5
  89. data/vendor/libgit2/src/notes.c +2 -2
  90. data/vendor/libgit2/src/odb.c +9 -9
  91. data/vendor/libgit2/src/odb_loose.c +22 -18
  92. data/vendor/libgit2/src/odb_pack.c +3 -3
  93. data/vendor/libgit2/src/pack-objects.c +3 -3
  94. data/vendor/libgit2/src/pack.c +5 -5
  95. data/vendor/libgit2/src/pack.h +1 -1
  96. data/vendor/libgit2/src/parse.c +7 -4
  97. data/vendor/libgit2/src/patch.c +1 -1
  98. data/vendor/libgit2/src/patch_generate.c +2 -2
  99. data/vendor/libgit2/src/patch_parse.c +4 -24
  100. data/vendor/libgit2/src/path.c +140 -39
  101. data/vendor/libgit2/src/path.h +84 -2
  102. data/vendor/libgit2/src/pathspec.c +1 -1
  103. data/vendor/libgit2/src/push.c +2 -2
  104. data/vendor/libgit2/src/rebase.c +23 -20
  105. data/vendor/libgit2/src/refdb_fs.c +34 -65
  106. data/vendor/libgit2/src/refs.c +16 -13
  107. data/vendor/libgit2/src/refspec.c +5 -30
  108. data/vendor/libgit2/src/refspec.h +1 -1
  109. data/vendor/libgit2/src/remote.c +43 -43
  110. data/vendor/libgit2/src/repository.c +56 -56
  111. data/vendor/libgit2/src/reset.c +1 -1
  112. data/vendor/libgit2/src/revert.c +3 -3
  113. data/vendor/libgit2/src/revparse.c +7 -6
  114. data/vendor/libgit2/src/revwalk.c +20 -48
  115. data/vendor/libgit2/src/revwalk.h +1 -2
  116. data/vendor/libgit2/src/settings.c +1 -25
  117. data/vendor/libgit2/src/signature.c +4 -2
  118. data/vendor/libgit2/src/stash.c +34 -80
  119. data/vendor/libgit2/src/status.c +1 -1
  120. data/vendor/libgit2/src/streams/curl.c +1 -1
  121. data/vendor/libgit2/src/streams/openssl.c +34 -132
  122. data/vendor/libgit2/src/streams/openssl.h +107 -0
  123. data/vendor/libgit2/src/streams/tls.c +0 -3
  124. data/vendor/libgit2/src/submodule.c +83 -118
  125. data/vendor/libgit2/src/sysdir.c +4 -4
  126. data/vendor/libgit2/src/tag.c +12 -12
  127. data/vendor/libgit2/src/trace.h +1 -1
  128. data/vendor/libgit2/src/trailer.c +6 -6
  129. data/vendor/libgit2/src/transport.c +2 -2
  130. data/vendor/libgit2/src/transports/auth.c +1 -1
  131. data/vendor/libgit2/src/transports/auth_negotiate.c +2 -2
  132. data/vendor/libgit2/src/transports/git.c +1 -1
  133. data/vendor/libgit2/src/transports/http.c +15 -12
  134. data/vendor/libgit2/src/transports/local.c +7 -7
  135. data/vendor/libgit2/src/transports/smart.c +15 -20
  136. data/vendor/libgit2/src/transports/smart.h +5 -5
  137. data/vendor/libgit2/src/transports/smart_pkt.c +131 -123
  138. data/vendor/libgit2/src/transports/smart_protocol.c +38 -48
  139. data/vendor/libgit2/src/transports/ssh.c +1 -1
  140. data/vendor/libgit2/src/transports/winhttp.c +26 -21
  141. data/vendor/libgit2/src/tree-cache.c +2 -2
  142. data/vendor/libgit2/src/tree.c +69 -23
  143. data/vendor/libgit2/src/tree.h +12 -0
  144. data/vendor/libgit2/src/util.c +99 -52
  145. data/vendor/libgit2/src/util.h +138 -14
  146. data/vendor/libgit2/src/vector.c +13 -8
  147. data/vendor/libgit2/src/win32/findfile.c +2 -2
  148. data/vendor/libgit2/src/win32/posix_w32.c +1 -1
  149. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +0 -94
  150. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +75 -28
  151. data/vendor/libgit2/src/worktree.c +44 -65
  152. data/vendor/libgit2/src/worktree.h +0 -2
  153. data/vendor/libgit2/src/xdiff/xdiffi.c +1 -3
  154. metadata +5 -17
  155. data/vendor/libgit2/cmake/Modules/FindmbedTLS.cmake +0 -93
  156. data/vendor/libgit2/include/git2/mailmap.h +0 -115
  157. data/vendor/libgit2/include/git2/sys/alloc.h +0 -101
  158. data/vendor/libgit2/include/git2/sys/path.h +0 -55
  159. data/vendor/libgit2/src/alloc.c +0 -47
  160. data/vendor/libgit2/src/alloc.h +0 -40
  161. data/vendor/libgit2/src/hash/hash_mbedtls.c +0 -38
  162. data/vendor/libgit2/src/hash/hash_mbedtls.h +0 -20
  163. data/vendor/libgit2/src/mailmap.c +0 -485
  164. data/vendor/libgit2/src/mailmap.h +0 -35
  165. data/vendor/libgit2/src/stdalloc.c +0 -120
  166. data/vendor/libgit2/src/stdalloc.h +0 -17
  167. data/vendor/libgit2/src/streams/mbedtls.c +0 -463
  168. data/vendor/libgit2/src/streams/mbedtls.h +0 -20
@@ -136,7 +136,7 @@ static int git_sysdir_guess_xdg_dirs(git_buf *out)
136
136
  error = 0;
137
137
  }
138
138
 
139
- git_buf_dispose(&env);
139
+ git_buf_free(&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
- git_buf_dispose(&git_sysdir__dirs[i].buf);
171
+ git_buf_free(&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
- git_buf_dispose(&merge);
265
+ git_buf_free(&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
- git_buf_dispose(path);
310
+ git_buf_free(path);
311
311
  giterr_set(GITERR_OS, "the %s file '%s' doesn't exist", label, name);
312
312
  return GIT_ENOTFOUND;
313
313
  }
@@ -70,10 +70,9 @@ static int tag_parse(git_tag *tag, const char *buffer, const char *buffer_end)
70
70
  static const char *tag_types[] = {
71
71
  NULL, "commit\n", "tree\n", "blob\n", "tag\n"
72
72
  };
73
-
74
- unsigned int i;
75
73
  size_t text_len, alloc_len;
76
- char *search;
74
+ const char *search;
75
+ unsigned int i;
77
76
 
78
77
  if (git_oid__parse(&tag->target, &buffer, buffer_end, "object ") < 0)
79
78
  return tag_error("object field invalid");
@@ -138,8 +137,9 @@ static int tag_parse(git_tag *tag, const char *buffer, const char *buffer_end)
138
137
  tag->message = NULL;
139
138
  if (buffer < buffer_end) {
140
139
  /* If we're not at the end of the header, search for it */
141
- if( *buffer != '\n' ) {
142
- search = strstr(buffer, "\n\n");
140
+ if(*buffer != '\n') {
141
+ search = git__memmem(buffer, buffer_end - buffer,
142
+ "\n\n", 2);
143
143
  if (search)
144
144
  buffer = search + 1;
145
145
  else
@@ -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
- git_buf_dispose(&tag);
232
+ git_buf_free(&tag);
233
233
  return 0;
234
234
 
235
235
  on_error:
236
- git_buf_dispose(&tag);
236
+ git_buf_free(&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
- git_buf_dispose(&ref_name);
271
+ git_buf_free(&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
- git_buf_dispose(&ref_name);
286
+ git_buf_free(&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
- git_buf_dispose(&ref_name);
384
+ git_buf_free(&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
- git_buf_dispose(&ref_name);
392
+ git_buf_free(&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
- git_buf_dispose(&ref_name);
412
+ git_buf_free(&ref_name);
413
413
 
414
414
  if (error < 0)
415
415
  return error;
@@ -35,7 +35,7 @@ GIT_INLINE(void) git_trace__write_fmt(
35
35
 
36
36
  callback(level, git_buf_cstr(&message));
37
37
 
38
- git_buf_dispose(&message);
38
+ git_buf_free(&message);
39
39
  }
40
40
 
41
41
  #define git_trace_level() (git_trace__data.level)
@@ -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
- /* return pointer to the NUL terminator: */
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
- /* legal key character */
313
+ // legal key character
314
314
  NEXT(S_KEY);
315
315
  }
316
316
 
317
317
  if (*ptr == ' ' || *ptr == '\t') {
318
- /* optional whitespace before separator */
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
- /* illegal character */
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
- /* illegal character */
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
- /* continuation; */
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
- git_buf_dispose(&prefix);
177
+ git_buf_free(&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
- git_buf_dispose(&prefix);
213
+ git_buf_free(&prefix);
214
214
  return error;
215
215
  }
216
216
 
@@ -40,7 +40,7 @@ on_error:
40
40
  if (raw.size)
41
41
  git__memzero(raw.ptr, raw.size);
42
42
 
43
- git_buf_dispose(&raw);
43
+ git_buf_free(&raw);
44
44
  return error;
45
45
  }
46
46
 
@@ -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
- git_buf_dispose(&input_buf);
168
+ git_buf_free(&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
- git_buf_dispose(&ctx->target);
183
+ git_buf_free(&ctx->target);
184
184
 
185
185
  git__free(ctx->challenge);
186
186
 
@@ -87,7 +87,7 @@ static int send_command(git_proto_stream *s)
87
87
  s->sent_command = 1;
88
88
 
89
89
  cleanup:
90
- git_buf_dispose(&request);
90
+ git_buf_free(&request);
91
91
  return error;
92
92
  }
93
93
 
@@ -188,6 +188,9 @@ static int apply_credentials(git_buf *buf, http_subtransport *t)
188
188
  if (auth_context_match(&context, t, credtype_match, &cred->credtype) < 0)
189
189
  return -1;
190
190
 
191
+ if (!context)
192
+ return 0;
193
+
191
194
  return context->next_token(buf, context, cred);
192
195
  }
193
196
 
@@ -449,14 +452,14 @@ static int on_headers_complete(http_parser *parser)
449
452
  return t->parse_error = PARSE_ERROR_GENERIC;
450
453
 
451
454
  if (strcmp(t->content_type, git_buf_cstr(&buf))) {
452
- git_buf_dispose(&buf);
455
+ git_buf_free(&buf);
453
456
  giterr_set(GITERR_NET,
454
457
  "invalid Content-Type: %s",
455
458
  t->content_type);
456
459
  return t->parse_error = PARSE_ERROR_GENERIC;
457
460
  }
458
461
 
459
- git_buf_dispose(&buf);
462
+ git_buf_free(&buf);
460
463
 
461
464
  return 0;
462
465
  }
@@ -508,10 +511,10 @@ static void clear_parser_state(http_subtransport *t)
508
511
  t->parse_error = 0;
509
512
  t->parse_finished = 0;
510
513
 
511
- git_buf_dispose(&t->parse_header_name);
514
+ git_buf_free(&t->parse_header_name);
512
515
  git_buf_init(&t->parse_header_name, 0);
513
516
 
514
- git_buf_dispose(&t->parse_header_value);
517
+ git_buf_free(&t->parse_header_value);
515
518
  git_buf_init(&t->parse_header_value, 0);
516
519
 
517
520
  git__free(t->content_type);
@@ -534,11 +537,11 @@ static int write_chunk(git_stream *io, const char *buffer, size_t len)
534
537
  return -1;
535
538
 
536
539
  if (git_stream_write(io, buf.ptr, buf.size, 0) < 0) {
537
- git_buf_dispose(&buf);
540
+ git_buf_free(&buf);
538
541
  return -1;
539
542
  }
540
543
 
541
- git_buf_dispose(&buf);
544
+ git_buf_free(&buf);
542
545
 
543
546
  /* Chunk body */
544
547
  if (len > 0 && git_stream_write(io, buffer, len, 0) < 0)
@@ -671,11 +674,11 @@ replay:
671
674
  return -1;
672
675
 
673
676
  if (git_stream_write(t->io, request.ptr, request.size, 0) < 0) {
674
- git_buf_dispose(&request);
677
+ git_buf_free(&request);
675
678
  return -1;
676
679
  }
677
680
 
678
- git_buf_dispose(&request);
681
+ git_buf_free(&request);
679
682
 
680
683
  s->sent_request = 1;
681
684
  }
@@ -792,11 +795,11 @@ static int http_stream_write_chunked(
792
795
  return -1;
793
796
 
794
797
  if (git_stream_write(t->io, request.ptr, request.size, 0) < 0) {
795
- git_buf_dispose(&request);
798
+ git_buf_free(&request);
796
799
  return -1;
797
800
  }
798
801
 
799
- git_buf_dispose(&request);
802
+ git_buf_free(&request);
800
803
 
801
804
  s->sent_request = 1;
802
805
  }
@@ -870,13 +873,13 @@ static int http_stream_write_single(
870
873
  if (len && git_stream_write(t->io, buffer, len, 0) < 0)
871
874
  goto on_error;
872
875
 
873
- git_buf_dispose(&request);
876
+ git_buf_free(&request);
874
877
  s->sent_request = 1;
875
878
 
876
879
  return 0;
877
880
 
878
881
  on_error:
879
- git_buf_dispose(&request);
882
+ git_buf_free(&request);
880
883
  return -1;
881
884
  }
882
885
 
@@ -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
- git_buf_dispose(&buf);
231
+ git_buf_free(&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
- git_buf_dispose(&buf);
238
+ git_buf_free(&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
- git_buf_dispose(&buf);
357
+ git_buf_free(&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
- git_buf_dispose(&buf);
364
+ git_buf_free(&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
- git_buf_dispose(&odb_path);
386
+ git_buf_free(&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
- git_buf_dispose(&progress_info);
505
+ git_buf_free(&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
- git_buf_dispose(&progress_info);
630
+ git_buf_free(&progress_info);
631
631
  git_packbuilder_free(pack);
632
632
  git_revwalk_free(walk);
633
633
  return error;
@@ -45,9 +45,13 @@ GIT_INLINE(int) git_smart__reset_stream(transport_smart *t, bool close_subtransp
45
45
  t->current_stream = NULL;
46
46
  }
47
47
 
48
- if (close_subtransport &&
49
- t->wrapped->close(t->wrapped) < 0)
50
- return -1;
48
+ if (close_subtransport) {
49
+ git__free(t->url);
50
+ t->url = NULL;
51
+
52
+ if (t->wrapped->close(t->wrapped) < 0)
53
+ return -1;
54
+ }
51
55
 
52
56
  return 0;
53
57
  }
@@ -82,7 +86,7 @@ static bool is_malformed_http_header(const char *http_header)
82
86
  const char *c;
83
87
  int name_len;
84
88
 
85
- /* Disallow \r and \n */
89
+ // Disallow \r and \n
86
90
  c = strchr(http_header, '\r');
87
91
  if (c)
88
92
  return true;
@@ -90,7 +94,7 @@ static bool is_malformed_http_header(const char *http_header)
90
94
  if (c)
91
95
  return true;
92
96
 
93
- /* Require a header name followed by : */
97
+ // Require a header name followed by :
94
98
  name_len = http_header_name_length(http_header);
95
99
  if (name_len < 1)
96
100
  return true;
@@ -112,7 +116,7 @@ static bool is_forbidden_custom_header(const char *custom_header)
112
116
  unsigned long i;
113
117
  int name_len = http_header_name_length(custom_header);
114
118
 
115
- /* Disallow headers that we set */
119
+ // Disallow headers that we set
116
120
  for (i = 0; i < ARRAY_SIZE(forbidden_custom_headers); i++)
117
121
  if (strncmp(forbidden_custom_headers[i], custom_header, name_len) == 0)
118
122
  return true;
@@ -167,13 +171,11 @@ int git_smart__update_heads(transport_smart *t, git_vector *symrefs)
167
171
  git_vector_foreach(symrefs, j, spec) {
168
172
  git_buf_clear(&buf);
169
173
  if (git_refspec_src_matches(spec, ref->head.name) &&
170
- !(error = git_refspec_transform(&buf, spec, ref->head.name))) {
171
- git__free(ref->head.symref_target);
174
+ !(error = git_refspec_transform(&buf, spec, ref->head.name)))
172
175
  ref->head.symref_target = git_buf_detach(&buf);
173
- }
174
176
  }
175
177
 
176
- git_buf_dispose(&buf);
178
+ git_buf_free(&buf);
177
179
 
178
180
  if (error < 0)
179
181
  return error;
@@ -192,7 +194,7 @@ static void free_symrefs(git_vector *symrefs)
192
194
  size_t i;
193
195
 
194
196
  git_vector_foreach(symrefs, i, spec) {
195
- git_refspec__dispose(spec);
197
+ git_refspec__free(spec);
196
198
  git__free(spec);
197
199
  }
198
200
 
@@ -268,21 +270,14 @@ static int git_smart__connect(
268
270
  /* We now have loaded the refs. */
269
271
  t->have_refs = 1;
270
272
 
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;
273
+ first = (git_pkt_ref *)git_vector_get(&t->refs, 0);
277
274
 
278
275
  if ((error = git_vector_init(&symrefs, 1, NULL)) < 0)
279
276
  return error;
280
277
 
281
278
  /* Detect capabilities */
282
- if (git_smart__detect_caps(first, &t->caps, &symrefs) < 0) {
283
- free_symrefs(&symrefs);
279
+ if (git_smart__detect_caps(first, &t->caps, &symrefs) < 0)
284
280
  return -1;
285
- }
286
281
 
287
282
  /* If the only ref in the list is capabilities^{} with OID_ZERO, remove it */
288
283
  if (1 == t->refs.length && !strcmp(first->head.name, "capabilities^{}") &&