rugged 0.27.5 → 0.27.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rugged/version.rb +1 -1
  3. data/vendor/libgit2/CMakeLists.txt +2 -2
  4. data/vendor/libgit2/cmake/Modules/FindmbedTLS.cmake +93 -0
  5. data/vendor/libgit2/deps/http-parser/CMakeLists.txt +2 -0
  6. data/vendor/libgit2/include/git2.h +1 -0
  7. data/vendor/libgit2/include/git2/attr.h +18 -7
  8. data/vendor/libgit2/include/git2/blame.h +39 -22
  9. data/vendor/libgit2/include/git2/blob.h +1 -1
  10. data/vendor/libgit2/include/git2/branch.h +1 -1
  11. data/vendor/libgit2/include/git2/buffer.h +14 -2
  12. data/vendor/libgit2/include/git2/checkout.h +13 -12
  13. data/vendor/libgit2/include/git2/cherrypick.h +6 -4
  14. data/vendor/libgit2/include/git2/clone.h +8 -6
  15. data/vendor/libgit2/include/git2/commit.h +28 -0
  16. data/vendor/libgit2/include/git2/common.h +27 -0
  17. data/vendor/libgit2/include/git2/config.h +1 -0
  18. data/vendor/libgit2/include/git2/describe.h +30 -7
  19. data/vendor/libgit2/include/git2/diff.h +32 -22
  20. data/vendor/libgit2/include/git2/errors.h +1 -0
  21. data/vendor/libgit2/include/git2/ignore.h +2 -2
  22. data/vendor/libgit2/include/git2/mailmap.h +115 -0
  23. data/vendor/libgit2/include/git2/merge.h +10 -8
  24. data/vendor/libgit2/include/git2/proxy.h +9 -5
  25. data/vendor/libgit2/include/git2/rebase.h +7 -4
  26. data/vendor/libgit2/include/git2/refspec.h +17 -0
  27. data/vendor/libgit2/include/git2/remote.h +12 -10
  28. data/vendor/libgit2/include/git2/repository.h +7 -5
  29. data/vendor/libgit2/include/git2/revert.h +5 -3
  30. data/vendor/libgit2/include/git2/stash.h +11 -8
  31. data/vendor/libgit2/include/git2/status.h +7 -3
  32. data/vendor/libgit2/include/git2/submodule.h +8 -7
  33. data/vendor/libgit2/include/git2/sys/alloc.h +101 -0
  34. data/vendor/libgit2/include/git2/sys/index.h +3 -0
  35. data/vendor/libgit2/include/git2/sys/mempack.h +35 -35
  36. data/vendor/libgit2/include/git2/sys/merge.h +6 -1
  37. data/vendor/libgit2/include/git2/sys/path.h +55 -0
  38. data/vendor/libgit2/include/git2/transaction.h +1 -0
  39. data/vendor/libgit2/include/git2/types.h +8 -5
  40. data/vendor/libgit2/include/git2/version.h +2 -2
  41. data/vendor/libgit2/include/git2/worktree.h +46 -11
  42. data/vendor/libgit2/src/CMakeLists.txt +87 -15
  43. data/vendor/libgit2/src/alloc.c +47 -0
  44. data/vendor/libgit2/src/alloc.h +40 -0
  45. data/vendor/libgit2/src/apply.c +4 -4
  46. data/vendor/libgit2/src/attr.c +4 -4
  47. data/vendor/libgit2/src/attr_file.c +8 -7
  48. data/vendor/libgit2/src/attrcache.c +2 -2
  49. data/vendor/libgit2/src/blame.c +11 -4
  50. data/vendor/libgit2/src/blame.h +1 -0
  51. data/vendor/libgit2/src/blame_git.c +8 -5
  52. data/vendor/libgit2/src/blob.c +5 -5
  53. data/vendor/libgit2/src/branch.c +20 -20
  54. data/vendor/libgit2/src/buffer.c +9 -4
  55. data/vendor/libgit2/src/buffer.h +1 -1
  56. data/vendor/libgit2/src/checkout.c +33 -24
  57. data/vendor/libgit2/src/cherrypick.c +3 -3
  58. data/vendor/libgit2/src/clone.c +13 -13
  59. data/vendor/libgit2/src/commit.c +16 -3
  60. data/vendor/libgit2/src/common.h +3 -1
  61. data/vendor/libgit2/src/config.c +3 -3
  62. data/vendor/libgit2/src/config_file.c +193 -241
  63. data/vendor/libgit2/src/config_parse.c +89 -66
  64. data/vendor/libgit2/src/config_parse.h +2 -2
  65. data/vendor/libgit2/src/crlf.c +9 -3
  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 +4 -3
  70. data/vendor/libgit2/src/diff_print.c +8 -8
  71. data/vendor/libgit2/src/diff_tform.c +1 -1
  72. data/vendor/libgit2/src/diff_xdiff.c +12 -0
  73. data/vendor/libgit2/src/features.h.in +2 -0
  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 +3 -3
  79. data/vendor/libgit2/src/global.c +17 -12
  80. data/vendor/libgit2/src/hash.h +2 -0
  81. data/vendor/libgit2/src/hash/hash_mbedtls.c +38 -0
  82. data/vendor/libgit2/src/hash/hash_mbedtls.h +20 -0
  83. data/vendor/libgit2/src/ignore.c +15 -20
  84. data/vendor/libgit2/src/index.c +77 -36
  85. data/vendor/libgit2/src/index.h +10 -0
  86. data/vendor/libgit2/src/indexer.c +9 -9
  87. data/vendor/libgit2/src/iterator.c +8 -8
  88. data/vendor/libgit2/src/khash.h +3 -1
  89. data/vendor/libgit2/src/mailmap.c +485 -0
  90. data/vendor/libgit2/src/mailmap.h +35 -0
  91. data/vendor/libgit2/src/merge.c +7 -7
  92. data/vendor/libgit2/src/netops.c +5 -5
  93. data/vendor/libgit2/src/notes.c +2 -2
  94. data/vendor/libgit2/src/odb.c +7 -7
  95. data/vendor/libgit2/src/odb_loose.c +13 -13
  96. data/vendor/libgit2/src/odb_pack.c +3 -3
  97. data/vendor/libgit2/src/pack-objects.c +2 -2
  98. data/vendor/libgit2/src/pack.c +5 -5
  99. data/vendor/libgit2/src/pack.h +1 -1
  100. data/vendor/libgit2/src/patch.c +1 -1
  101. data/vendor/libgit2/src/patch_generate.c +2 -2
  102. data/vendor/libgit2/src/patch_parse.c +11 -4
  103. data/vendor/libgit2/src/path.c +42 -66
  104. data/vendor/libgit2/src/path.h +2 -72
  105. data/vendor/libgit2/src/pathspec.c +1 -1
  106. data/vendor/libgit2/src/push.c +2 -2
  107. data/vendor/libgit2/src/rebase.c +19 -22
  108. data/vendor/libgit2/src/refdb_fs.c +65 -34
  109. data/vendor/libgit2/src/refs.c +6 -6
  110. data/vendor/libgit2/src/refspec.c +30 -5
  111. data/vendor/libgit2/src/refspec.h +1 -1
  112. data/vendor/libgit2/src/remote.c +40 -40
  113. data/vendor/libgit2/src/repository.c +63 -59
  114. data/vendor/libgit2/src/reset.c +1 -1
  115. data/vendor/libgit2/src/revert.c +3 -3
  116. data/vendor/libgit2/src/revparse.c +4 -4
  117. data/vendor/libgit2/src/revwalk.c +44 -10
  118. data/vendor/libgit2/src/revwalk.h +2 -1
  119. data/vendor/libgit2/src/settings.c +25 -1
  120. data/vendor/libgit2/src/signature.c +1 -1
  121. data/vendor/libgit2/src/stash.c +80 -34
  122. data/vendor/libgit2/src/status.c +1 -1
  123. data/vendor/libgit2/src/stdalloc.c +120 -0
  124. data/vendor/libgit2/src/stdalloc.h +17 -0
  125. data/vendor/libgit2/src/streams/mbedtls.c +463 -0
  126. data/vendor/libgit2/src/streams/mbedtls.h +20 -0
  127. data/vendor/libgit2/src/streams/openssl.c +132 -34
  128. data/vendor/libgit2/src/streams/openssl.h +0 -107
  129. data/vendor/libgit2/src/streams/tls.c +3 -0
  130. data/vendor/libgit2/src/submodule.c +117 -82
  131. data/vendor/libgit2/src/sysdir.c +4 -4
  132. data/vendor/libgit2/src/tag.c +7 -7
  133. data/vendor/libgit2/src/trace.h +1 -1
  134. data/vendor/libgit2/src/trailer.c +6 -6
  135. data/vendor/libgit2/src/transport.c +2 -2
  136. data/vendor/libgit2/src/transports/auth.c +1 -1
  137. data/vendor/libgit2/src/transports/auth_negotiate.c +2 -2
  138. data/vendor/libgit2/src/transports/git.c +1 -1
  139. data/vendor/libgit2/src/transports/http.c +12 -12
  140. data/vendor/libgit2/src/transports/local.c +7 -7
  141. data/vendor/libgit2/src/transports/smart.c +17 -8
  142. data/vendor/libgit2/src/transports/smart.h +5 -5
  143. data/vendor/libgit2/src/transports/smart_pkt.c +122 -130
  144. data/vendor/libgit2/src/transports/smart_protocol.c +48 -38
  145. data/vendor/libgit2/src/transports/ssh.c +1 -1
  146. data/vendor/libgit2/src/transports/winhttp.c +6 -6
  147. data/vendor/libgit2/src/tree.c +12 -53
  148. data/vendor/libgit2/src/tree.h +0 -12
  149. data/vendor/libgit2/src/util.c +16 -0
  150. data/vendor/libgit2/src/util.h +12 -135
  151. data/vendor/libgit2/src/win32/findfile.c +2 -2
  152. data/vendor/libgit2/src/win32/posix_w32.c +1 -1
  153. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +94 -0
  154. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +28 -75
  155. data/vendor/libgit2/src/worktree.c +64 -43
  156. data/vendor/libgit2/src/worktree.h +2 -0
  157. data/vendor/libgit2/src/xdiff/xdiffi.c +3 -1
  158. metadata +16 -2
@@ -0,0 +1,35 @@
1
+ /*
2
+ * Copyright (C) the libgit2 contributors. All rights reserved.
3
+ *
4
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
5
+ * a Linking Exception. For full terms see the included COPYING file.
6
+ */
7
+ #ifndef INCLUDE_mailmap_h__
8
+ #define INCLUDE_mailmap_h__
9
+
10
+ #include "git2/mailmap.h"
11
+ #include "vector.h"
12
+
13
+ /*
14
+ * A mailmap is stored as a sorted vector of 'git_mailmap_entry's. These entries
15
+ * are sorted first by 'replace_email', and then by 'replace_name'. NULL
16
+ * replace_names are ordered first.
17
+ *
18
+ * Looking up a name and email in the mailmap is done with a binary search.
19
+ */
20
+ struct git_mailmap {
21
+ git_vector entries;
22
+ };
23
+
24
+ /* Single entry parsed from a mailmap */
25
+ typedef struct git_mailmap_entry {
26
+ char *real_name; /**< the real name (may be NULL) */
27
+ char *real_email; /**< the real email (may be NULL) */
28
+ char *replace_name; /**< the name to replace (may be NULL) */
29
+ char *replace_email; /**< the email to replace */
30
+ } git_mailmap_entry;
31
+
32
+ const git_mailmap_entry *git_mailmap_entry_lookup(
33
+ const git_mailmap *mm, const char *name, const char *email);
34
+
35
+ #endif
@@ -599,8 +599,8 @@ int git_repository_mergehead_foreach(
599
599
  }
600
600
 
601
601
  cleanup:
602
- git_buf_free(&merge_head_path);
603
- git_buf_free(&merge_head_file);
602
+ git_buf_dispose(&merge_head_path);
603
+ git_buf_dispose(&merge_head_file);
604
604
 
605
605
  return error;
606
606
  }
@@ -875,7 +875,7 @@ static int merge_conflict_invoke_driver(
875
875
  *out = result;
876
876
 
877
877
  done:
878
- git_buf_free(&buf);
878
+ git_buf_dispose(&buf);
879
879
  git_odb_free(odb);
880
880
 
881
881
  return error;
@@ -2444,7 +2444,7 @@ cleanup:
2444
2444
  if (error < 0)
2445
2445
  git_filebuf_cleanup(&file);
2446
2446
 
2447
- git_buf_free(&file_path);
2447
+ git_buf_dispose(&file_path);
2448
2448
 
2449
2449
  return error;
2450
2450
  }
@@ -2470,7 +2470,7 @@ cleanup:
2470
2470
  if (error < 0)
2471
2471
  git_filebuf_cleanup(&file);
2472
2472
 
2473
- git_buf_free(&file_path);
2473
+ git_buf_dispose(&file_path);
2474
2474
 
2475
2475
  return error;
2476
2476
  }
@@ -2770,7 +2770,7 @@ cleanup:
2770
2770
  if (error < 0)
2771
2771
  git_filebuf_cleanup(&file);
2772
2772
 
2773
- git_buf_free(&file_path);
2773
+ git_buf_dispose(&file_path);
2774
2774
 
2775
2775
  git_vector_free(&matching);
2776
2776
  git__free(entries);
@@ -3090,7 +3090,7 @@ cleanup:
3090
3090
  if (error < 0)
3091
3091
  git_filebuf_cleanup(&file);
3092
3092
 
3093
- git_buf_free(&file_path);
3093
+ git_buf_dispose(&file_path);
3094
3094
 
3095
3095
  return error;
3096
3096
  }
@@ -292,10 +292,10 @@ int gitno_extract_url_parts(
292
292
  *password_out = git_buf_detach(&password);
293
293
 
294
294
  done:
295
- git_buf_free(&host);
296
- git_buf_free(&port);
297
- git_buf_free(&path);
298
- git_buf_free(&username);
299
- git_buf_free(&password);
295
+ git_buf_dispose(&host);
296
+ git_buf_dispose(&port);
297
+ git_buf_dispose(&path);
298
+ git_buf_dispose(&username);
299
+ git_buf_dispose(&password);
300
300
  return error;
301
301
  }
@@ -285,7 +285,7 @@ static int note_write(
285
285
  git_oid oid;
286
286
  git_tree *tree = NULL;
287
287
 
288
- // TODO: should we apply filters?
288
+ /* TODO: should we apply filters? */
289
289
  /* create note object */
290
290
  if ((error = git_blob_create_frombuffer(&oid, repo, note, strlen(note))) < 0)
291
291
  goto cleanup;
@@ -710,7 +710,7 @@ static int process_entry_path(
710
710
  error = git_oid_fromstr(annotated_object_id, buf.ptr);
711
711
 
712
712
  cleanup:
713
- git_buf_free(&buf);
713
+ git_buf_dispose(&buf);
714
714
  return error;
715
715
  }
716
716
 
@@ -260,12 +260,12 @@ int git_odb__hashfd_filtered(
260
260
 
261
261
  error = git_filter_list_apply_to_data(&post, fl, &raw);
262
262
 
263
- git_buf_free(&raw);
263
+ git_buf_dispose(&raw);
264
264
 
265
265
  if (!error)
266
266
  error = git_odb_hash(out, post.ptr, post.size, type);
267
267
 
268
- git_buf_free(&post);
268
+ git_buf_dispose(&post);
269
269
  }
270
270
 
271
271
  return error;
@@ -588,12 +588,12 @@ static int load_alternates(git_odb *odb, const char *objects_dir, int alternate_
588
588
  return -1;
589
589
 
590
590
  if (git_path_exists(alternates_path.ptr) == false) {
591
- git_buf_free(&alternates_path);
591
+ git_buf_dispose(&alternates_path);
592
592
  return 0;
593
593
  }
594
594
 
595
595
  if (git_futils_readbuffer(&alternates_buf, alternates_path.ptr) < 0) {
596
- git_buf_free(&alternates_path);
596
+ git_buf_dispose(&alternates_path);
597
597
  return -1;
598
598
  }
599
599
 
@@ -619,8 +619,8 @@ static int load_alternates(git_odb *odb, const char *objects_dir, int alternate_
619
619
  break;
620
620
  }
621
621
 
622
- git_buf_free(&alternates_path);
623
- git_buf_free(&alternates_buf);
622
+ git_buf_dispose(&alternates_path);
623
+ git_buf_dispose(&alternates_buf);
624
624
 
625
625
  return result;
626
626
  }
@@ -1181,7 +1181,7 @@ static int read_prefix_1(git_odb_object **out, git_odb *db,
1181
1181
  git_oid_tostr_s(&found_full_oid));
1182
1182
 
1183
1183
  error = git_odb__error_ambiguous(buf.ptr);
1184
- git_buf_free(&buf);
1184
+ git_buf_dispose(&buf);
1185
1185
  goto out;
1186
1186
  }
1187
1187
 
@@ -266,7 +266,7 @@ static int read_loose_packlike(git_rawobj *out, git_buf *obj)
266
266
  out->data = git_buf_detach(&body);
267
267
 
268
268
  done:
269
- git_buf_free(&body);
269
+ git_buf_dispose(&body);
270
270
  return error;
271
271
  }
272
272
 
@@ -362,7 +362,7 @@ static int read_loose(git_rawobj *out, git_buf *loc)
362
362
  error = read_loose_standard(out, &obj);
363
363
 
364
364
  done:
365
- git_buf_free(&obj);
365
+ git_buf_dispose(&obj);
366
366
  return error;
367
367
  }
368
368
 
@@ -593,7 +593,7 @@ static int loose_backend__read_header(size_t *len_p, git_otype *type_p, git_odb_
593
593
  *type_p = raw.type;
594
594
  }
595
595
 
596
- git_buf_free(&object_path);
596
+ git_buf_dispose(&object_path);
597
597
 
598
598
  return error;
599
599
  }
@@ -615,7 +615,7 @@ static int loose_backend__read(void **buffer_p, size_t *len_p, git_otype *type_p
615
615
  *type_p = raw.type;
616
616
  }
617
617
 
618
- git_buf_free(&object_path);
618
+ git_buf_dispose(&object_path);
619
619
 
620
620
  return error;
621
621
  }
@@ -653,7 +653,7 @@ static int loose_backend__read_prefix(
653
653
  *type_p = raw.type;
654
654
  }
655
655
 
656
- git_buf_free(&object_path);
656
+ git_buf_dispose(&object_path);
657
657
  }
658
658
 
659
659
  return error;
@@ -668,7 +668,7 @@ static int loose_backend__exists(git_odb_backend *backend, const git_oid *oid)
668
668
 
669
669
  error = locate_object(&object_path, (loose_backend *)backend, oid);
670
670
 
671
- git_buf_free(&object_path);
671
+ git_buf_dispose(&object_path);
672
672
 
673
673
  return !error;
674
674
  }
@@ -684,7 +684,7 @@ static int loose_backend__exists_prefix(
684
684
  error = locate_object_short_oid(
685
685
  &object_path, out, (loose_backend *)backend, short_id, len);
686
686
 
687
- git_buf_free(&object_path);
687
+ git_buf_dispose(&object_path);
688
688
 
689
689
  return error;
690
690
  }
@@ -770,7 +770,7 @@ static int loose_backend__foreach(git_odb_backend *_backend, git_odb_foreach_cb
770
770
 
771
771
  error = git_path_direach(&buf, 0, foreach_cb, &state);
772
772
 
773
- git_buf_free(&buf);
773
+ git_buf_dispose(&buf);
774
774
 
775
775
  return error;
776
776
  }
@@ -789,7 +789,7 @@ static int loose_backend__writestream_finalize(git_odb_stream *_stream, const gi
789
789
  error = git_filebuf_commit_at(
790
790
  &stream->fbuf, final_path.ptr);
791
791
 
792
- git_buf_free(&final_path);
792
+ git_buf_dispose(&final_path);
793
793
 
794
794
  return error;
795
795
  }
@@ -856,7 +856,7 @@ static int loose_backend__writestream(git_odb_stream **stream_out, git_odb_backe
856
856
  git__free(stream);
857
857
  stream = NULL;
858
858
  }
859
- git_buf_free(&tmp_path);
859
+ git_buf_dispose(&tmp_path);
860
860
  *stream_out = (git_odb_stream *)stream;
861
861
 
862
862
  return !stream ? -1 : 0;
@@ -1035,7 +1035,7 @@ done:
1035
1035
  git__free(stream);
1036
1036
  }
1037
1037
 
1038
- git_buf_free(&object_path);
1038
+ git_buf_dispose(&object_path);
1039
1039
  return error;
1040
1040
  }
1041
1041
 
@@ -1074,7 +1074,7 @@ static int loose_backend__write(git_odb_backend *_backend, const git_oid *oid, c
1074
1074
  cleanup:
1075
1075
  if (error < 0)
1076
1076
  git_filebuf_cleanup(&fbuf);
1077
- git_buf_free(&final_path);
1077
+ git_buf_dispose(&final_path);
1078
1078
  return error;
1079
1079
  }
1080
1080
 
@@ -1090,7 +1090,7 @@ static int loose_backend__freshen(
1090
1090
  return -1;
1091
1091
 
1092
1092
  error = git_futils_touch(path.ptr, NULL);
1093
- git_buf_free(&path);
1093
+ git_buf_dispose(&path);
1094
1094
 
1095
1095
  return error;
1096
1096
  }
@@ -210,7 +210,7 @@ static int packfile_load__cb(void *data, git_buf *path)
210
210
  for (i = 0; i < backend->packs.length; ++i) {
211
211
  struct git_pack_file *p = git_vector_get(&backend->packs, i);
212
212
 
213
- if (strncmp(p->pack_name, path_str, cmp_len) == 0)
213
+ if (memcmp(p->pack_name, path_str, cmp_len) == 0)
214
214
  return 0;
215
215
  }
216
216
 
@@ -346,7 +346,7 @@ static int pack_backend__refresh(git_odb_backend *backend_)
346
346
  /* reload all packs */
347
347
  error = git_path_direach(&path, 0, packfile_load__cb, backend);
348
348
 
349
- git_buf_free(&path);
349
+ git_buf_dispose(&path);
350
350
  git_vector_sort(&backend->packs);
351
351
 
352
352
  return error;
@@ -635,7 +635,7 @@ int git_odb_backend_pack(git_odb_backend **backend_out, const char *objects_dir)
635
635
 
636
636
  *backend_out = (git_odb_backend *)backend;
637
637
 
638
- git_buf_free(&path);
638
+ git_buf_dispose(&path);
639
639
 
640
640
  return error;
641
641
  }
@@ -1095,7 +1095,7 @@ on_error:
1095
1095
  git__free(array[i].data);
1096
1096
  }
1097
1097
  git__free(array);
1098
- git_buf_free(&zbuf);
1098
+ git_buf_dispose(&zbuf);
1099
1099
 
1100
1100
  return error;
1101
1101
  }
@@ -1463,7 +1463,7 @@ int git_packbuilder_insert_tree(git_packbuilder *pb, const git_oid *oid)
1463
1463
  error = git_tree_walk(tree, GIT_TREEWALK_PRE, cb_tree_walk, &context);
1464
1464
 
1465
1465
  git_tree_free(tree);
1466
- git_buf_free(&context.buf);
1466
+ git_buf_dispose(&context.buf);
1467
1467
  return error;
1468
1468
  }
1469
1469
 
@@ -326,19 +326,19 @@ static int pack_index_open(struct git_pack_file *p)
326
326
  git_buf_put(&idx_name, p->pack_name, name_len - strlen(".pack"));
327
327
  git_buf_puts(&idx_name, ".idx");
328
328
  if (git_buf_oom(&idx_name)) {
329
- git_buf_free(&idx_name);
329
+ git_buf_dispose(&idx_name);
330
330
  return -1;
331
331
  }
332
332
 
333
333
  if ((error = git_mutex_lock(&p->lock)) < 0) {
334
- git_buf_free(&idx_name);
334
+ git_buf_dispose(&idx_name);
335
335
  return error;
336
336
  }
337
337
 
338
338
  if (p->index_version == -1)
339
339
  error = pack_index_check(idx_name.ptr, p);
340
340
 
341
- git_buf_free(&idx_name);
341
+ git_buf_dispose(&idx_name);
342
342
 
343
343
  git_mutex_unlock(&p->lock);
344
344
 
@@ -499,7 +499,7 @@ int git_packfile_resolve_header(
499
499
  if ((error = git_packfile_stream_open(&stream, p, curpos)) < 0)
500
500
  return error;
501
501
  error = git_delta_read_header_fromstream(&base_size, size_p, &stream);
502
- git_packfile_stream_free(&stream);
502
+ git_packfile_stream_dispose(&stream);
503
503
  if (error < 0)
504
504
  return error;
505
505
  } else {
@@ -840,7 +840,7 @@ ssize_t git_packfile_stream_read(git_packfile_stream *obj, void *buffer, size_t
840
840
 
841
841
  }
842
842
 
843
- void git_packfile_stream_free(git_packfile_stream *obj)
843
+ void git_packfile_stream_dispose(git_packfile_stream *obj)
844
844
  {
845
845
  inflateEnd(&obj->zstream);
846
846
  }
@@ -144,7 +144,7 @@ int git_packfile_unpack(git_rawobj *obj, struct git_pack_file *p, git_off_t *obj
144
144
 
145
145
  int git_packfile_stream_open(git_packfile_stream *obj, struct git_pack_file *p, git_off_t curpos);
146
146
  ssize_t git_packfile_stream_read(git_packfile_stream *obj, void *buffer, size_t len);
147
- void git_packfile_stream_free(git_packfile_stream *obj);
147
+ void git_packfile_stream_dispose(git_packfile_stream *obj);
148
148
 
149
149
  git_off_t get_delta_base(struct git_pack_file *p, git_mwindow **w_curs,
150
150
  git_off_t *curpos, git_otype type,
@@ -84,7 +84,7 @@ size_t git_patch_size(
84
84
  else
85
85
  out += git_buf_len(&file_header);
86
86
 
87
- git_buf_free(&file_header);
87
+ git_buf_dispose(&file_header);
88
88
  }
89
89
 
90
90
  return out;
@@ -314,8 +314,8 @@ static int create_binary(
314
314
  }
315
315
 
316
316
  done:
317
- git_buf_free(&deflate);
318
- git_buf_free(&delta);
317
+ git_buf_dispose(&deflate);
318
+ git_buf_dispose(&delta);
319
319
 
320
320
  return error;
321
321
  }
@@ -98,7 +98,7 @@ static int parse_header_git_oldpath(
98
98
  patch->old_path = git_buf_detach(&old_path);
99
99
 
100
100
  out:
101
- git_buf_free(&old_path);
101
+ git_buf_dispose(&old_path);
102
102
  return error;
103
103
  }
104
104
 
@@ -114,7 +114,7 @@ static int parse_header_git_newpath(
114
114
  patch->new_path = git_buf_detach(&new_path);
115
115
 
116
116
  out:
117
- git_buf_free(&new_path);
117
+ git_buf_dispose(&new_path);
118
118
  return error;
119
119
  }
120
120
 
@@ -563,6 +563,8 @@ static int parse_hunk_body(
563
563
  char c;
564
564
  int origin;
565
565
  int prefix = 1;
566
+ int old_lineno = hunk->hunk.old_start + (hunk->hunk.old_lines - oldlines);
567
+ int new_lineno = hunk->hunk.new_start + (hunk->hunk.new_lines - newlines);
566
568
 
567
569
  if (ctx->parse_ctx.line_len == 0 || ctx->parse_ctx.line[ctx->parse_ctx.line_len - 1] != '\n') {
568
570
  error = git_parse_err("invalid patch instruction at line %"PRIuZ,
@@ -586,11 +588,13 @@ static int parse_hunk_body(
586
588
  case '-':
587
589
  origin = GIT_DIFF_LINE_DELETION;
588
590
  oldlines--;
591
+ new_lineno = -1;
589
592
  break;
590
593
 
591
594
  case '+':
592
595
  origin = GIT_DIFF_LINE_ADDITION;
593
596
  newlines--;
597
+ old_lineno = -1;
594
598
  break;
595
599
 
596
600
  default:
@@ -607,6 +611,9 @@ static int parse_hunk_body(
607
611
  line->content_len = ctx->parse_ctx.line_len - prefix;
608
612
  line->content_offset = ctx->parse_ctx.content_len - ctx->parse_ctx.remain_len;
609
613
  line->origin = origin;
614
+ line->num_lines = 1;
615
+ line->old_lineno = old_lineno;
616
+ line->new_lineno = new_lineno;
610
617
 
611
618
  hunk->line_count++;
612
619
  }
@@ -770,8 +777,8 @@ static int parse_patch_binary_side(
770
777
  binary->data = git_buf_detach(&decoded);
771
778
 
772
779
  done:
773
- git_buf_free(&base85);
774
- git_buf_free(&decoded);
780
+ git_buf_dispose(&base85);
781
+ git_buf_dispose(&decoded);
775
782
  return error;
776
783
  }
777
784