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
@@ -166,7 +166,7 @@ void git_repository_free(git_repository *repo)
166
166
  repo->diff_drivers = NULL;
167
167
 
168
168
  for (i = 0; i < repo->reserved_names.size; i++)
169
- git_buf_dispose(git_array_get(repo->reserved_names, i));
169
+ git_buf_free(git_array_get(repo->reserved_names, i));
170
170
  git_array_clear(repo->reserved_names);
171
171
 
172
172
  git__free(repo->gitlink);
@@ -203,7 +203,7 @@ static bool valid_repository_path(git_buf *repository_path, git_buf *common_path
203
203
  git_buf_swap(common_path, &common_link);
204
204
  }
205
205
 
206
- git_buf_dispose(&common_link);
206
+ git_buf_free(&common_link);
207
207
  }
208
208
  else {
209
209
  git_buf_set(common_path, repository_path->ptr, repository_path->size);
@@ -333,7 +333,7 @@ static int load_workdir(git_repository *repo, git_config *config, git_buf *paren
333
333
 
334
334
  GITERR_CHECK_ALLOC(repo->workdir);
335
335
  cleanup:
336
- git_buf_dispose(&path);
336
+ git_buf_free(&path);
337
337
  git_config_entry_free(ce);
338
338
  return error;
339
339
  }
@@ -425,7 +425,7 @@ static int read_gitfile(git_buf *path_out, const char *file_path)
425
425
  path_out, gitlink, git_buf_cstr(path_out));
426
426
  }
427
427
 
428
- git_buf_dispose(&file);
428
+ git_buf_free(&file);
429
429
  return error;
430
430
  }
431
431
 
@@ -556,9 +556,9 @@ static int find_repo(
556
556
  error = GIT_ENOTFOUND;
557
557
  }
558
558
 
559
- git_buf_dispose(&path);
560
- git_buf_dispose(&repo_link);
561
- git_buf_dispose(&common_link);
559
+ git_buf_free(&path);
560
+ git_buf_free(&repo_link);
561
+ git_buf_free(&common_link);
562
562
  return error;
563
563
  }
564
564
 
@@ -574,8 +574,8 @@ int git_repository_open_bare(
574
574
  return error;
575
575
 
576
576
  if (!valid_repository_path(&path, &common_path)) {
577
- git_buf_dispose(&path);
578
- git_buf_dispose(&common_path);
577
+ git_buf_free(&path);
578
+ git_buf_free(&common_path);
579
579
  giterr_set(GITERR_REPOSITORY, "path is not a repository: %s", bare_path);
580
580
  return GIT_ENOTFOUND;
581
581
  }
@@ -754,15 +754,15 @@ error:
754
754
  success:
755
755
  git_odb_free(odb);
756
756
  git_index_free(index);
757
- git_buf_dispose(&common_dir_buf);
758
- git_buf_dispose(&work_tree_buf);
759
- git_buf_dispose(&alts_buf);
760
- git_buf_dispose(&object_dir_buf);
761
- git_buf_dispose(&namespace_buf);
762
- git_buf_dispose(&index_file_buf);
763
- git_buf_dispose(&across_fs_buf);
764
- git_buf_dispose(&ceiling_dirs_buf);
765
- git_buf_dispose(&dir_buf);
757
+ git_buf_free(&common_dir_buf);
758
+ git_buf_free(&work_tree_buf);
759
+ git_buf_free(&alts_buf);
760
+ git_buf_free(&object_dir_buf);
761
+ git_buf_free(&namespace_buf);
762
+ git_buf_free(&index_file_buf);
763
+ git_buf_free(&across_fs_buf);
764
+ git_buf_free(&ceiling_dirs_buf);
765
+ git_buf_free(&dir_buf);
766
766
  return error;
767
767
  }
768
768
 
@@ -785,7 +785,7 @@ static int repo_is_worktree(unsigned *out, const git_repository *repo)
785
785
  * only used when the repository is a working tree. */
786
786
  *out = !!git_path_exists(gitdir_link.ptr);
787
787
 
788
- git_buf_dispose(&gitdir_link);
788
+ git_buf_free(&gitdir_link);
789
789
  return error;
790
790
  }
791
791
 
@@ -856,8 +856,8 @@ int git_repository_open_ext(
856
856
  }
857
857
 
858
858
  cleanup:
859
- git_buf_dispose(&gitdir);
860
- git_buf_dispose(&workdir);
859
+ git_buf_free(&gitdir);
860
+ git_buf_free(&workdir);
861
861
  git_config_free(config);
862
862
 
863
863
  if (error < 0)
@@ -899,7 +899,7 @@ int git_repository_open_from_worktree(git_repository **repo_out, git_worktree *w
899
899
  *repo_out = repo;
900
900
 
901
901
  out:
902
- git_buf_dispose(&path);
902
+ git_buf_free(&path);
903
903
 
904
904
  return err;
905
905
  }
@@ -955,7 +955,7 @@ static int load_config(
955
955
  if (error && error != GIT_ENOTFOUND)
956
956
  goto on_error;
957
957
 
958
- git_buf_dispose(&config_path);
958
+ git_buf_free(&config_path);
959
959
 
960
960
  if (global_config_path != NULL &&
961
961
  (error = git_config_add_file_ondisk(
@@ -987,7 +987,7 @@ static int load_config(
987
987
  return 0;
988
988
 
989
989
  on_error:
990
- git_buf_dispose(&config_path);
990
+ git_buf_free(&config_path);
991
991
  git_config_free(cfg);
992
992
  *out = NULL;
993
993
  return error;
@@ -1034,10 +1034,10 @@ int git_repository_config__weakptr(git_config **out, git_repository *repo)
1034
1034
  }
1035
1035
  }
1036
1036
 
1037
- git_buf_dispose(&global_buf);
1038
- git_buf_dispose(&xdg_buf);
1039
- git_buf_dispose(&system_buf);
1040
- git_buf_dispose(&programdata_buf);
1037
+ git_buf_free(&global_buf);
1038
+ git_buf_free(&xdg_buf);
1039
+ git_buf_free(&system_buf);
1040
+ git_buf_free(&programdata_buf);
1041
1041
  }
1042
1042
 
1043
1043
  *out = repo->_config;
@@ -1099,7 +1099,7 @@ int git_repository_odb__weakptr(git_odb **out, git_repository *repo)
1099
1099
  git_odb_free(odb);
1100
1100
  }
1101
1101
 
1102
- git_buf_dispose(&odb_path);
1102
+ git_buf_free(&odb_path);
1103
1103
  }
1104
1104
 
1105
1105
  *out = repo->_odb;
@@ -1187,7 +1187,7 @@ int git_repository_index__weakptr(git_index **out, git_repository *repo)
1187
1187
  error = git_index_set_caps(repo->_index, GIT_INDEXCAP_FROM_OWNER);
1188
1188
  }
1189
1189
 
1190
- git_buf_dispose(&index_path);
1190
+ git_buf_free(&index_path);
1191
1191
  }
1192
1192
 
1193
1193
  *out = repo->_index;
@@ -1372,11 +1372,11 @@ int git_repository_create_head(const char *git_dir, const char *ref_name)
1372
1372
  git_filebuf_commit(&ref) < 0)
1373
1373
  goto fail;
1374
1374
 
1375
- git_buf_dispose(&ref_path);
1375
+ git_buf_free(&ref_path);
1376
1376
  return 0;
1377
1377
 
1378
1378
  fail:
1379
- git_buf_dispose(&ref_path);
1379
+ git_buf_free(&ref_path);
1380
1380
  git_filebuf_cleanup(&ref);
1381
1381
  return -1;
1382
1382
  }
@@ -1405,7 +1405,7 @@ static bool is_filesystem_case_insensitive(const char *gitdir_path)
1405
1405
  if (!git_buf_joinpath(&path, gitdir_path, "CoNfIg"))
1406
1406
  is_insensitive = git_path_exists(git_buf_cstr(&path));
1407
1407
 
1408
- git_buf_dispose(&path);
1408
+ git_buf_free(&path);
1409
1409
  return is_insensitive;
1410
1410
  }
1411
1411
 
@@ -1426,7 +1426,7 @@ static bool are_symlinks_supported(const char *wd_path)
1426
1426
  symlinks_supported = (S_ISLNK(st.st_mode) != 0);
1427
1427
 
1428
1428
  (void)p_unlink(path.ptr);
1429
- git_buf_dispose(&path);
1429
+ git_buf_free(&path);
1430
1430
 
1431
1431
  return symlinks_supported;
1432
1432
  }
@@ -1586,8 +1586,8 @@ static int repo_init_config(
1586
1586
  }
1587
1587
 
1588
1588
  cleanup:
1589
- git_buf_dispose(&cfg_path);
1590
- git_buf_dispose(&worktree_path);
1589
+ git_buf_free(&cfg_path);
1590
+ git_buf_free(&worktree_path);
1591
1591
  git_config_free(config);
1592
1592
 
1593
1593
  return error;
@@ -1618,7 +1618,7 @@ int git_repository_reinit_filesystem(git_repository *repo, int recurse)
1618
1618
  config, path.ptr, repo_dir, git_repository_workdir(repo), true);
1619
1619
 
1620
1620
  git_config_free(config);
1621
- git_buf_dispose(&path);
1621
+ git_buf_free(&path);
1622
1622
 
1623
1623
  git_repository__cvar_cache_clear(repo);
1624
1624
 
@@ -1666,7 +1666,7 @@ static int repo_write_template(
1666
1666
  GIT_UNUSED(hidden);
1667
1667
  #endif
1668
1668
 
1669
- git_buf_dispose(&path);
1669
+ git_buf_free(&path);
1670
1670
 
1671
1671
  if (error)
1672
1672
  giterr_set(GITERR_OS,
@@ -1720,8 +1720,8 @@ static int repo_write_gitlink(
1720
1720
  error = repo_write_template(in_dir, true, DOT_GIT, 0666, true, buf.ptr);
1721
1721
 
1722
1722
  cleanup:
1723
- git_buf_dispose(&buf);
1724
- git_buf_dispose(&path_to_repo);
1723
+ git_buf_free(&buf);
1724
+ git_buf_free(&path_to_repo);
1725
1725
  return error;
1726
1726
  }
1727
1727
 
@@ -1805,7 +1805,7 @@ static int repo_init_structure(
1805
1805
  error = git_futils_cp_r(tdir, repo_dir, cpflags, dmode);
1806
1806
  }
1807
1807
 
1808
- git_buf_dispose(&template_buf);
1808
+ git_buf_free(&template_buf);
1809
1809
  git_config_free(cfg);
1810
1810
 
1811
1811
  if (error < 0) {
@@ -2065,9 +2065,9 @@ int git_repository_init_ext(
2065
2065
  error = repo_init_create_origin(*out, opts->origin_url);
2066
2066
 
2067
2067
  cleanup:
2068
- git_buf_dispose(&common_path);
2069
- git_buf_dispose(&repo_path);
2070
- git_buf_dispose(&wd_path);
2068
+ git_buf_free(&common_path);
2069
+ git_buf_free(&repo_path);
2070
+ git_buf_free(&wd_path);
2071
2071
 
2072
2072
  return error;
2073
2073
  }
@@ -2165,7 +2165,7 @@ out:
2165
2165
  if (error)
2166
2166
  git_reference_free(head);
2167
2167
 
2168
- git_buf_dispose(&path);
2168
+ git_buf_free(&path);
2169
2169
 
2170
2170
  return error;
2171
2171
  }
@@ -2197,7 +2197,7 @@ int git_repository_foreach_head(git_repository *repo, git_repository_foreach_hea
2197
2197
  }
2198
2198
 
2199
2199
  out:
2200
- git_buf_dispose(&path);
2200
+ git_buf_free(&path);
2201
2201
  git_strarray_free(&worktrees);
2202
2202
  return error;
2203
2203
  }
@@ -2440,7 +2440,7 @@ int git_repository__set_orig_head(git_repository *repo, const git_oid *orig_head
2440
2440
  if (error < 0)
2441
2441
  git_filebuf_cleanup(&file);
2442
2442
 
2443
- git_buf_dispose(&file_path);
2443
+ git_buf_free(&file_path);
2444
2444
 
2445
2445
  return error;
2446
2446
  }
@@ -2464,7 +2464,7 @@ int git_repository_message(git_buf *out, git_repository *repo)
2464
2464
  error = git_futils_readbuffer(out, git_buf_cstr(&path));
2465
2465
  }
2466
2466
 
2467
- git_buf_dispose(&path);
2467
+ git_buf_free(&path);
2468
2468
 
2469
2469
  return error;
2470
2470
  }
@@ -2478,7 +2478,7 @@ int git_repository_message_remove(git_repository *repo)
2478
2478
  return -1;
2479
2479
 
2480
2480
  error = p_unlink(git_buf_cstr(&path));
2481
- git_buf_dispose(&path);
2481
+ git_buf_free(&path);
2482
2482
 
2483
2483
  return error;
2484
2484
  }
@@ -2548,7 +2548,7 @@ cleanup:
2548
2548
  if (fd >= 0)
2549
2549
  p_close(fd);
2550
2550
  git_filter_list_free(fl);
2551
- git_buf_dispose(&full_path);
2551
+ git_buf_free(&full_path);
2552
2552
 
2553
2553
  return error;
2554
2554
  }
@@ -2604,7 +2604,7 @@ static int detach(git_repository *repo, const git_oid *id, const char *new)
2604
2604
  error = git_reference_create(&new_head, repo, GIT_HEAD_FILE, git_object_id(peeled), true, git_buf_cstr(&log_message));
2605
2605
 
2606
2606
  cleanup:
2607
- git_buf_dispose(&log_message);
2607
+ git_buf_free(&log_message);
2608
2608
  git_object_free(object);
2609
2609
  git_object_free(peeled);
2610
2610
  git_reference_free(current);
@@ -2654,7 +2654,7 @@ int git_repository_set_head(
2654
2654
  }
2655
2655
 
2656
2656
  cleanup:
2657
- git_buf_dispose(&log_message);
2657
+ git_buf_free(&log_message);
2658
2658
  git_reference_free(current);
2659
2659
  git_reference_free(ref);
2660
2660
  git_reference_free(new_head);
@@ -2702,7 +2702,7 @@ int git_repository_detach_head(git_repository* repo)
2702
2702
  1, git_buf_cstr(&log_message));
2703
2703
 
2704
2704
  cleanup:
2705
- git_buf_dispose(&log_message);
2705
+ git_buf_free(&log_message);
2706
2706
  git_object_free(object);
2707
2707
  git_reference_free(old_head);
2708
2708
  git_reference_free(new_head);
@@ -2749,7 +2749,7 @@ int git_repository_state(git_repository *repo)
2749
2749
  } else if (git_path_contains_file(&repo_path, GIT_BISECT_LOG_FILE))
2750
2750
  state = GIT_REPOSITORY_STATE_BISECT;
2751
2751
 
2752
- git_buf_dispose(&repo_path);
2752
+ git_buf_free(&repo_path);
2753
2753
  return state;
2754
2754
  }
2755
2755
 
@@ -2778,7 +2778,7 @@ int git_repository__cleanup_files(
2778
2778
  git_buf_clear(&buf);
2779
2779
  }
2780
2780
 
2781
- git_buf_dispose(&buf);
2781
+ git_buf_free(&buf);
2782
2782
  return error;
2783
2783
  }
2784
2784
 
@@ -2811,7 +2811,7 @@ int git_repository_is_shallow(git_repository *repo)
2811
2811
  return error;
2812
2812
 
2813
2813
  error = git_path_lstat(path.ptr, &st);
2814
- git_buf_dispose(&path);
2814
+ git_buf_free(&path);
2815
2815
 
2816
2816
  if (error == GIT_ENOTFOUND) {
2817
2817
  giterr_clear();
@@ -176,7 +176,7 @@ cleanup:
176
176
  git_object_free(commit);
177
177
  git_index_free(index);
178
178
  git_tree_free(tree);
179
- git_buf_dispose(&log_message);
179
+ git_buf_free(&log_message);
180
180
 
181
181
  return error;
182
182
  }
@@ -36,7 +36,7 @@ static int write_revert_head(
36
36
  if (error < 0)
37
37
  git_filebuf_cleanup(&file);
38
38
 
39
- git_buf_dispose(&file_path);
39
+ git_buf_free(&file_path);
40
40
 
41
41
  return error;
42
42
  }
@@ -62,7 +62,7 @@ cleanup:
62
62
  if (error < 0)
63
63
  git_filebuf_cleanup(&file);
64
64
 
65
- git_buf_dispose(&file_path);
65
+ git_buf_free(&file_path);
66
66
 
67
67
  return error;
68
68
  }
@@ -219,7 +219,7 @@ done:
219
219
  git_index_free(index);
220
220
  git_commit_free(our_commit);
221
221
  git_reference_free(our_ref);
222
- git_buf_dispose(&their_label);
222
+ git_buf_free(&their_label);
223
223
 
224
224
  return error;
225
225
  }
@@ -128,7 +128,8 @@ static int try_parse_numeric(int *n, const char *curly_braces_content)
128
128
  int32_t content;
129
129
  const char *end_ptr;
130
130
 
131
- if (git__strtol32(&content, curly_braces_content, &end_ptr, 10) < 0)
131
+ if (git__strntol32(&content, curly_braces_content, strlen(curly_braces_content),
132
+ &end_ptr, 10) < 0)
132
133
  return -1;
133
134
 
134
135
  if (*end_ptr != '\0')
@@ -197,7 +198,7 @@ static int retrieve_previously_checked_out_branch_or_revision(git_object **out,
197
198
 
198
199
  cleanup:
199
200
  git_reference_free(ref);
200
- git_buf_dispose(&buf);
201
+ git_buf_free(&buf);
201
202
  regfree(&preg);
202
203
  git_reflog_free(reflog);
203
204
  return error;
@@ -350,7 +351,7 @@ static int handle_at_syntax(git_object **out, git_reference **ref, const char *s
350
351
  error = retrieve_revobject_from_reflog(out, ref, repo, git_buf_cstr(&identifier), (size_t)timestamp);
351
352
 
352
353
  cleanup:
353
- git_buf_dispose(&identifier);
354
+ git_buf_free(&identifier);
354
355
  return error;
355
356
  }
356
357
 
@@ -578,7 +579,7 @@ static int extract_how_many(int *n, const char *spec, size_t *pos)
578
579
  } while (spec[(*pos)] == kind && kind == '~');
579
580
 
580
581
  if (git__isdigit(spec[*pos])) {
581
- if (git__strtol32(&parsed, spec + *pos, &end_ptr, 10) < 0)
582
+ if (git__strntol32(&parsed, spec + *pos, strlen(spec + *pos), &end_ptr, 10) < 0)
582
583
  return GIT_EINVALIDSPEC;
583
584
 
584
585
  accumulated += (parsed - 1);
@@ -624,7 +625,7 @@ static int ensure_base_rev_loaded(git_object **object, git_reference **reference
624
625
  return -1;
625
626
 
626
627
  error = revparse_lookup_object(object, reference, repo, git_buf_cstr(&identifier));
627
- git_buf_dispose(&identifier);
628
+ git_buf_free(&identifier);
628
629
 
629
630
  return error;
630
631
  }
@@ -820,7 +821,7 @@ cleanup:
820
821
  git_reference_free(reference);
821
822
  }
822
823
 
823
- git_buf_dispose(&buf);
824
+ git_buf_free(&buf);
824
825
  return error;
825
826
  }
826
827
 
@@ -15,8 +15,6 @@
15
15
  #include "merge.h"
16
16
  #include "vector.h"
17
17
 
18
- static int get_revision(git_commit_list_node **out, git_revwalk *walk, git_commit_list **list);
19
-
20
18
  git_commit_list_node *git_revwalk__commit_lookup(
21
19
  git_revwalk *walk, const git_oid *oid)
22
20
  {
@@ -78,12 +76,10 @@ static int push_commit(git_revwalk *walk, const git_oid *oid, int uninteresting,
78
76
  if (commit->uninteresting)
79
77
  return 0;
80
78
 
81
- if (uninteresting) {
82
- walk->limited = 1;
79
+ if (uninteresting)
83
80
  walk->did_hide = 1;
84
- } else {
81
+ else
85
82
  walk->did_push = 1;
86
- }
87
83
 
88
84
  commit->uninteresting = uninteresting;
89
85
  list = walk->user_input;
@@ -156,7 +152,7 @@ static int push_glob(git_revwalk *walk, const char *glob, int hide)
156
152
  if (error == GIT_ITEROVER)
157
153
  error = 0;
158
154
  out:
159
- git_buf_dispose(&buf);
155
+ git_buf_free(&buf);
160
156
  return error;
161
157
  }
162
158
 
@@ -249,10 +245,9 @@ static int revwalk_next_timesort(git_commit_list_node **object_out, git_revwalk
249
245
 
250
246
  static int revwalk_next_unsorted(git_commit_list_node **object_out, git_revwalk *walk)
251
247
  {
252
- int error;
253
248
  git_commit_list_node *next;
254
249
 
255
- while (!(error = get_revision(&next, walk, &walk->iterator_rand))) {
250
+ while ((next = git_commit_list_pop(&walk->iterator_rand)) != NULL) {
256
251
  /* Some commits might become uninteresting after being added to the list */
257
252
  if (!next->uninteresting) {
258
253
  *object_out = next;
@@ -260,15 +255,15 @@ static int revwalk_next_unsorted(git_commit_list_node **object_out, git_revwalk
260
255
  }
261
256
  }
262
257
 
263
- return error;
258
+ giterr_clear();
259
+ return GIT_ITEROVER;
264
260
  }
265
261
 
266
262
  static int revwalk_next_toposort(git_commit_list_node **object_out, git_revwalk *walk)
267
263
  {
268
- int error;
269
264
  git_commit_list_node *next;
270
265
 
271
- while (!(error = get_revision(&next, walk, &walk->iterator_topo))) {
266
+ while ((next = git_commit_list_pop(&walk->iterator_topo)) != NULL) {
272
267
  /* Some commits might become uninteresting after being added to the list */
273
268
  if (!next->uninteresting) {
274
269
  *object_out = next;
@@ -276,7 +271,8 @@ static int revwalk_next_toposort(git_commit_list_node **object_out, git_revwalk
276
271
  }
277
272
  }
278
273
 
279
- return error;
274
+ giterr_clear();
275
+ return GIT_ITEROVER;
280
276
  }
281
277
 
282
278
  static int revwalk_next_reverse(git_commit_list_node **object_out, git_revwalk *walk)
@@ -388,10 +384,16 @@ static int still_interesting(git_commit_list *list, int64_t time, int slop)
388
384
  if (!list)
389
385
  return 0;
390
386
 
387
+ /*
388
+ * If the destination list has commits with an earlier date than our
389
+ * source, we want to reset the slop counter as we're not done.
390
+ */
391
+ if (time <= list->item->time)
392
+ return SLOP;
393
+
391
394
  for (; list; list = list->next) {
392
395
  /*
393
- * If the destination list has commits with an earlier date than
394
- * our source or if it still contains interesting commits we
396
+ * If the destination list still contains interesting commits we
395
397
  * want to continue looking.
396
398
  */
397
399
  if (!list->item->uninteresting || list->item->time > time)
@@ -405,7 +407,7 @@ static int still_interesting(git_commit_list *list, int64_t time, int slop)
405
407
  static int limit_list(git_commit_list **out, git_revwalk *walk, git_commit_list *commits)
406
408
  {
407
409
  int error, slop = SLOP;
408
- int64_t time = ~0ll;
410
+ int64_t time = INT64_MAX;
409
411
  git_commit_list *list = commits;
410
412
  git_commit_list *newlist = NULL;
411
413
  git_commit_list **p = &newlist;
@@ -438,30 +440,6 @@ static int limit_list(git_commit_list **out, git_revwalk *walk, git_commit_list
438
440
  return 0;
439
441
  }
440
442
 
441
- static int get_revision(git_commit_list_node **out, git_revwalk *walk, git_commit_list **list)
442
- {
443
- int error;
444
- git_commit_list_node *commit;
445
-
446
- commit = git_commit_list_pop(list);
447
- if (!commit) {
448
- giterr_clear();
449
- return GIT_ITEROVER;
450
- }
451
-
452
- /*
453
- * If we did not run limit_list and we must add parents to the
454
- * list ourselves.
455
- */
456
- if (!walk->limited) {
457
- if ((error = add_parents_to_list(walk, commit, list)) < 0)
458
- return error;
459
- }
460
-
461
- *out = commit;
462
- return 0;
463
- }
464
-
465
443
  static int sort_in_topological_order(git_commit_list **out, git_revwalk *walk, git_commit_list *list)
466
444
  {
467
445
  git_commit_list *ll = NULL, *newlist, **pptr;
@@ -550,7 +528,7 @@ cleanup:
550
528
 
551
529
  static int prepare_walk(git_revwalk *walk)
552
530
  {
553
- int error;
531
+ int error = 0;
554
532
  git_commit_list *list, *commits = NULL;
555
533
  git_commit_list_node *next;
556
534
 
@@ -574,7 +552,7 @@ static int prepare_walk(git_revwalk *walk)
574
552
  }
575
553
  }
576
554
 
577
- if (walk->limited && (error = limit_list(&commits, walk, commits)) < 0)
555
+ if ((error = limit_list(&commits, walk, commits)) < 0)
578
556
  return error;
579
557
 
580
558
  if (walk->sorting & GIT_SORT_TOPOLOGICAL) {
@@ -677,9 +655,6 @@ void git_revwalk_sorting(git_revwalk *walk, unsigned int sort_mode)
677
655
  walk->get_next = &revwalk_next_unsorted;
678
656
  walk->enqueue = &revwalk_enqueue_unsorted;
679
657
  }
680
-
681
- if (walk->sorting != GIT_SORT_NONE)
682
- walk->limited = 1;
683
658
  }
684
659
 
685
660
  void git_revwalk_simplify_first_parent(git_revwalk *walk)
@@ -735,9 +710,7 @@ void git_revwalk_reset(git_revwalk *walk)
735
710
  git_commit_list_free(&walk->user_input);
736
711
  walk->first_parent = 0;
737
712
  walk->walking = 0;
738
- walk->limited = 0;
739
713
  walk->did_push = walk->did_hide = 0;
740
- walk->sorting = GIT_SORT_NONE;
741
714
  }
742
715
 
743
716
  int git_revwalk_add_hide_cb(
@@ -758,7 +731,6 @@ int git_revwalk_add_hide_cb(
758
731
 
759
732
  walk->hide_cb = hide_cb;
760
733
  walk->hide_cb_payload = payload;
761
- walk->limited = 1;
762
734
 
763
735
  return 0;
764
736
  }