rugged 1.6.5 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rugged/rugged_allocator.c +0 -54
  3. data/lib/rugged/version.rb +1 -1
  4. data/vendor/libgit2/CMakeLists.txt +3 -8
  5. data/vendor/libgit2/cmake/CheckPrototypeDefinitionSafe.cmake +16 -0
  6. data/vendor/libgit2/cmake/SelectGSSAPI.cmake +3 -3
  7. data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +21 -2
  8. data/vendor/libgit2/cmake/SelectHashes.cmake +4 -0
  9. data/vendor/libgit2/cmake/SelectXdiff.cmake +9 -0
  10. data/vendor/libgit2/deps/pcre/LICENCE +5 -5
  11. data/vendor/libgit2/deps/pcre/pcre.h +2 -2
  12. data/vendor/libgit2/deps/pcre/pcre_compile.c +6 -3
  13. data/vendor/libgit2/deps/pcre/pcre_exec.c +2 -2
  14. data/vendor/libgit2/deps/xdiff/CMakeLists.txt +28 -0
  15. data/vendor/libgit2/{src/libgit2 → deps}/xdiff/git-xdiff.h +4 -1
  16. data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xdiffi.c +19 -18
  17. data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xdiffi.h +2 -4
  18. data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xemit.c +3 -3
  19. data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xhistogram.c +7 -18
  20. data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xmacros.h +18 -1
  21. data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xmerge.c +24 -22
  22. data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xpatience.c +21 -30
  23. data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xprepare.c +13 -30
  24. data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xutils.c +18 -1
  25. data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xutils.h +2 -1
  26. data/vendor/libgit2/include/git2/common.h +26 -1
  27. data/vendor/libgit2/include/git2/diff.h +41 -3
  28. data/vendor/libgit2/include/git2/errors.h +4 -2
  29. data/vendor/libgit2/include/git2/index.h +9 -0
  30. data/vendor/libgit2/include/git2/oid.h +1 -1
  31. data/vendor/libgit2/include/git2/remote.h +18 -0
  32. data/vendor/libgit2/include/git2/repository.h +12 -2
  33. data/vendor/libgit2/include/git2/sys/alloc.h +0 -34
  34. data/vendor/libgit2/include/git2/sys/commit_graph.h +12 -2
  35. data/vendor/libgit2/include/git2/sys/midx.h +5 -1
  36. data/vendor/libgit2/include/git2/sys/stream.h +16 -2
  37. data/vendor/libgit2/include/git2/sys/transport.h +20 -2
  38. data/vendor/libgit2/include/git2/version.h +4 -4
  39. data/vendor/libgit2/include/git2/worktree.h +3 -1
  40. data/vendor/libgit2/src/CMakeLists.txt +34 -11
  41. data/vendor/libgit2/src/cli/cmd_clone.c +22 -6
  42. data/vendor/libgit2/src/cli/progress.c +9 -8
  43. data/vendor/libgit2/src/cli/progress.h +4 -4
  44. data/vendor/libgit2/src/libgit2/CMakeLists.txt +1 -19
  45. data/vendor/libgit2/src/libgit2/annotated_commit.c +2 -2
  46. data/vendor/libgit2/src/libgit2/annotated_commit.h +1 -1
  47. data/vendor/libgit2/src/libgit2/apply.c +4 -3
  48. data/vendor/libgit2/src/libgit2/blame.c +23 -16
  49. data/vendor/libgit2/src/libgit2/blame_git.c +0 -1
  50. data/vendor/libgit2/src/libgit2/branch.c +2 -2
  51. data/vendor/libgit2/src/libgit2/cherrypick.c +3 -3
  52. data/vendor/libgit2/src/libgit2/clone.c +3 -1
  53. data/vendor/libgit2/src/libgit2/commit.c +31 -9
  54. data/vendor/libgit2/src/libgit2/commit_graph.c +110 -43
  55. data/vendor/libgit2/src/libgit2/commit_graph.h +20 -4
  56. data/vendor/libgit2/src/libgit2/commit_list.c +12 -5
  57. data/vendor/libgit2/src/libgit2/commit_list.h +1 -0
  58. data/vendor/libgit2/src/libgit2/config_file.c +14 -8
  59. data/vendor/libgit2/src/libgit2/describe.c +10 -7
  60. data/vendor/libgit2/src/libgit2/diff.c +16 -7
  61. data/vendor/libgit2/src/libgit2/diff.h +6 -6
  62. data/vendor/libgit2/src/libgit2/diff_file.c +7 -7
  63. data/vendor/libgit2/src/libgit2/diff_generate.c +36 -15
  64. data/vendor/libgit2/src/libgit2/diff_parse.c +20 -4
  65. data/vendor/libgit2/src/libgit2/diff_print.c +26 -7
  66. data/vendor/libgit2/src/libgit2/diff_tform.c +4 -4
  67. data/vendor/libgit2/src/libgit2/diff_xdiff.h +1 -1
  68. data/vendor/libgit2/src/libgit2/email.c +4 -3
  69. data/vendor/libgit2/src/libgit2/errors.c +73 -18
  70. data/vendor/libgit2/src/libgit2/fetch.c +37 -9
  71. data/vendor/libgit2/src/libgit2/fetch.h +0 -2
  72. data/vendor/libgit2/src/libgit2/fetchhead.c +11 -9
  73. data/vendor/libgit2/src/libgit2/grafts.c +272 -0
  74. data/vendor/libgit2/src/libgit2/grafts.h +36 -0
  75. data/vendor/libgit2/src/libgit2/ident.c +3 -3
  76. data/vendor/libgit2/src/libgit2/index.c +325 -125
  77. data/vendor/libgit2/src/libgit2/index.h +14 -1
  78. data/vendor/libgit2/src/libgit2/indexer.c +10 -3
  79. data/vendor/libgit2/src/libgit2/iterator.c +20 -5
  80. data/vendor/libgit2/src/libgit2/iterator.h +3 -0
  81. data/vendor/libgit2/src/libgit2/libgit2.c +39 -0
  82. data/vendor/libgit2/src/libgit2/merge.c +14 -9
  83. data/vendor/libgit2/src/libgit2/merge_file.c +0 -2
  84. data/vendor/libgit2/src/libgit2/midx.c +66 -37
  85. data/vendor/libgit2/src/libgit2/midx.h +13 -3
  86. data/vendor/libgit2/src/libgit2/notes.c +9 -8
  87. data/vendor/libgit2/src/libgit2/object.c +40 -15
  88. data/vendor/libgit2/src/libgit2/object.h +6 -0
  89. data/vendor/libgit2/src/libgit2/odb.c +11 -5
  90. data/vendor/libgit2/src/libgit2/odb_pack.c +16 -3
  91. data/vendor/libgit2/src/libgit2/oid.c +7 -1
  92. data/vendor/libgit2/src/libgit2/oidarray.c +49 -3
  93. data/vendor/libgit2/src/libgit2/oidarray.h +5 -1
  94. data/vendor/libgit2/src/libgit2/pack-objects.c +19 -12
  95. data/vendor/libgit2/src/libgit2/pack-objects.h +5 -2
  96. data/vendor/libgit2/src/libgit2/pack.c +3 -3
  97. data/vendor/libgit2/src/libgit2/parse.c +7 -4
  98. data/vendor/libgit2/src/libgit2/parse.h +1 -1
  99. data/vendor/libgit2/src/libgit2/patch.h +7 -1
  100. data/vendor/libgit2/src/libgit2/patch_generate.c +24 -5
  101. data/vendor/libgit2/src/libgit2/patch_parse.c +16 -8
  102. data/vendor/libgit2/src/libgit2/push.c +2 -2
  103. data/vendor/libgit2/src/libgit2/reader.c +1 -1
  104. data/vendor/libgit2/src/libgit2/rebase.c +72 -84
  105. data/vendor/libgit2/src/libgit2/refdb_fs.c +22 -13
  106. data/vendor/libgit2/src/libgit2/refs.c +8 -1
  107. data/vendor/libgit2/src/libgit2/remote.c +15 -6
  108. data/vendor/libgit2/src/libgit2/remote.h +1 -0
  109. data/vendor/libgit2/src/libgit2/repository.c +580 -301
  110. data/vendor/libgit2/src/libgit2/repository.h +17 -2
  111. data/vendor/libgit2/src/libgit2/reset.c +2 -2
  112. data/vendor/libgit2/src/libgit2/revert.c +8 -11
  113. data/vendor/libgit2/src/libgit2/revparse.c +1 -4
  114. data/vendor/libgit2/src/libgit2/revwalk.c +26 -4
  115. data/vendor/libgit2/src/libgit2/stash.c +9 -8
  116. data/vendor/libgit2/src/libgit2/streams/mbedtls.c +0 -1
  117. data/vendor/libgit2/src/libgit2/streams/openssl.c +8 -16
  118. data/vendor/libgit2/src/libgit2/streams/schannel.c +715 -0
  119. data/vendor/libgit2/src/libgit2/streams/schannel.h +28 -0
  120. data/vendor/libgit2/src/libgit2/streams/socket.c +237 -51
  121. data/vendor/libgit2/src/libgit2/streams/socket.h +3 -1
  122. data/vendor/libgit2/src/libgit2/streams/stransport.c +40 -12
  123. data/vendor/libgit2/src/libgit2/streams/tls.c +5 -0
  124. data/vendor/libgit2/src/libgit2/submodule.h +3 -3
  125. data/vendor/libgit2/src/libgit2/threadstate.c +15 -2
  126. data/vendor/libgit2/src/libgit2/threadstate.h +1 -3
  127. data/vendor/libgit2/src/libgit2/transports/auth.h +1 -2
  128. data/vendor/libgit2/src/libgit2/transports/{auth_negotiate.c → auth_gssapi.c} +32 -32
  129. data/vendor/libgit2/src/libgit2/transports/auth_negotiate.h +1 -1
  130. data/vendor/libgit2/src/libgit2/transports/auth_ntlm.h +1 -1
  131. data/vendor/libgit2/src/libgit2/transports/{auth_ntlm.c → auth_ntlmclient.c} +12 -12
  132. data/vendor/libgit2/src/libgit2/transports/auth_sspi.c +341 -0
  133. data/vendor/libgit2/src/libgit2/transports/git.c +7 -8
  134. data/vendor/libgit2/src/libgit2/transports/http.c +7 -2
  135. data/vendor/libgit2/src/libgit2/transports/httpclient.c +5 -0
  136. data/vendor/libgit2/src/libgit2/transports/local.c +13 -4
  137. data/vendor/libgit2/src/libgit2/transports/smart.c +33 -27
  138. data/vendor/libgit2/src/libgit2/transports/smart.h +23 -8
  139. data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +136 -17
  140. data/vendor/libgit2/src/libgit2/transports/smart_protocol.c +154 -47
  141. data/vendor/libgit2/src/libgit2/transports/ssh.c +3 -3
  142. data/vendor/libgit2/src/libgit2/transports/winhttp.c +14 -15
  143. data/vendor/libgit2/src/libgit2/tree-cache.c +26 -16
  144. data/vendor/libgit2/src/libgit2/tree-cache.h +5 -3
  145. data/vendor/libgit2/src/libgit2/tree.c +1 -1
  146. data/vendor/libgit2/src/libgit2/worktree.c +25 -10
  147. data/vendor/libgit2/src/util/alloc.c +65 -6
  148. data/vendor/libgit2/src/util/alloc.h +34 -9
  149. data/vendor/libgit2/src/util/allocators/failalloc.c +0 -60
  150. data/vendor/libgit2/src/util/allocators/failalloc.h +0 -6
  151. data/vendor/libgit2/src/util/allocators/stdalloc.c +2 -105
  152. data/vendor/libgit2/src/util/allocators/win32_leakcheck.c +0 -68
  153. data/vendor/libgit2/src/util/array.h +6 -1
  154. data/vendor/libgit2/src/util/cc-compat.h +2 -0
  155. data/vendor/libgit2/src/util/filebuf.c +6 -1
  156. data/vendor/libgit2/src/util/filebuf.h +19 -6
  157. data/vendor/libgit2/src/util/fs_path.c +1 -1
  158. data/vendor/libgit2/src/util/futils.c +8 -5
  159. data/vendor/libgit2/src/util/git2_features.h.in +9 -3
  160. data/vendor/libgit2/src/util/net.c +308 -157
  161. data/vendor/libgit2/src/util/net.h +25 -0
  162. data/vendor/libgit2/src/util/posix.c +54 -0
  163. data/vendor/libgit2/src/util/posix.h +22 -0
  164. data/vendor/libgit2/src/util/rand.c +6 -4
  165. data/vendor/libgit2/src/util/staticstr.h +66 -0
  166. data/vendor/libgit2/src/util/util.c +15 -10
  167. data/vendor/libgit2/src/util/util.h +24 -16
  168. data/vendor/libgit2/src/util/win32/error.c +1 -1
  169. data/vendor/libgit2/src/util/win32/path_w32.c +8 -8
  170. data/vendor/libgit2/src/util/win32/posix_w32.c +1 -1
  171. data/vendor/libgit2/src/util/win32/utf-conv.c +73 -75
  172. data/vendor/libgit2/src/util/win32/utf-conv.h +81 -14
  173. data/vendor/libgit2/src/util/win32/w32_util.c +1 -1
  174. metadata +29 -23
  175. data/vendor/libgit2/cmake/SelectWinHTTP.cmake +0 -17
  176. data/vendor/libgit2/src/libgit2/netops.c +0 -124
  177. data/vendor/libgit2/src/libgit2/netops.h +0 -68
  178. /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xdiff.h +0 -0
  179. /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xemit.h +0 -0
  180. /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xinclude.h +0 -0
  181. /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xprepare.h +0 -0
  182. /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xtypes.h +0 -0
@@ -24,6 +24,7 @@
24
24
  #include "attrcache.h"
25
25
  #include "submodule.h"
26
26
  #include "diff_driver.h"
27
+ #include "grafts.h"
27
28
 
28
29
  #define DOT_GIT ".git"
29
30
  #define GIT_DIR DOT_GIT "/"
@@ -151,12 +152,16 @@ struct git_repository {
151
152
 
152
153
  git_array_t(git_str) reserved_names;
153
154
 
154
- unsigned is_bare:1;
155
- unsigned is_worktree:1;
155
+ unsigned use_env:1,
156
+ is_bare:1,
157
+ is_worktree:1;
156
158
  git_oid_t oid_type;
157
159
 
158
160
  unsigned int lru_counter;
159
161
 
162
+ git_grafts *grafts;
163
+ git_grafts *shallow_grafts;
164
+
160
165
  git_atomic32 attr_session_key;
161
166
 
162
167
  intptr_t configmap_cache[GIT_CONFIGMAP_CACHE_MAX];
@@ -188,6 +193,13 @@ int git_repository_config__weakptr(git_config **out, git_repository *repo);
188
193
  int git_repository_odb__weakptr(git_odb **out, git_repository *repo);
189
194
  int git_repository_refdb__weakptr(git_refdb **out, git_repository *repo);
190
195
  int git_repository_index__weakptr(git_index **out, git_repository *repo);
196
+ int git_repository_grafts__weakptr(git_grafts **out, git_repository *repo);
197
+ int git_repository_shallow_grafts__weakptr(git_grafts **out, git_repository *repo);
198
+
199
+ int git_repository__wrap_odb(
200
+ git_repository **out,
201
+ git_odb *odb,
202
+ git_oid_t oid_type);
191
203
 
192
204
  /*
193
205
  * Configuration map cache
@@ -239,6 +251,9 @@ extern size_t git_repository__reserved_names_posix_len;
239
251
  bool git_repository__reserved_names(
240
252
  git_str **out, size_t *outlen, git_repository *repo, bool include_ntfs);
241
253
 
254
+ int git_repository__shallow_roots(git_oid **out, size_t *out_len, git_repository *repo);
255
+ int git_repository__shallow_roots_write(git_repository *repo, git_oidarray *roots);
256
+
242
257
  /*
243
258
  * The default branch for the repository; the `init.defaultBranch`
244
259
  * configuration option, if set, or `master` if it is not.
@@ -188,9 +188,9 @@ int git_reset(
188
188
  git_reset_t reset_type,
189
189
  const git_checkout_options *checkout_opts)
190
190
  {
191
- char to[GIT_OID_SHA1_HEXSIZE + 1];
191
+ char to[GIT_OID_MAX_HEXSIZE + 1];
192
192
 
193
- git_oid_tostr(to, GIT_OID_SHA1_HEXSIZE + 1, git_object_id(target));
193
+ git_oid_tostr(to, GIT_OID_MAX_HEXSIZE + 1, git_object_id(target));
194
194
  return reset(repo, target, to, reset_type, checkout_opts);
195
195
  }
196
196
 
@@ -107,12 +107,10 @@ static int revert_state_cleanup(git_repository *repo)
107
107
 
108
108
  static int revert_seterr(git_commit *commit, const char *fmt)
109
109
  {
110
- char commit_oidstr[GIT_OID_SHA1_HEXSIZE + 1];
110
+ char commit_id[GIT_OID_MAX_HEXSIZE + 1];
111
111
 
112
- git_oid_fmt(commit_oidstr, git_commit_id(commit));
113
- commit_oidstr[GIT_OID_SHA1_HEXSIZE] = '\0';
114
-
115
- git_error_set(GIT_ERROR_REVERT, fmt, commit_oidstr);
112
+ git_oid_tostr(commit_id, GIT_OID_MAX_HEXSIZE + 1, git_commit_id(commit));
113
+ git_error_set(GIT_ERROR_REVERT, fmt, commit_id);
116
114
 
117
115
  return -1;
118
116
  }
@@ -176,7 +174,7 @@ int git_revert(
176
174
  git_revert_options opts;
177
175
  git_reference *our_ref = NULL;
178
176
  git_commit *our_commit = NULL;
179
- char commit_oidstr[GIT_OID_SHA1_HEXSIZE + 1];
177
+ char commit_id[GIT_OID_MAX_HEXSIZE + 1];
180
178
  const char *commit_msg;
181
179
  git_str their_label = GIT_STR_INIT;
182
180
  git_index *index = NULL;
@@ -191,19 +189,18 @@ int git_revert(
191
189
  if ((error = git_repository__ensure_not_bare(repo, "revert")) < 0)
192
190
  return error;
193
191
 
194
- git_oid_fmt(commit_oidstr, git_commit_id(commit));
195
- commit_oidstr[GIT_OID_SHA1_HEXSIZE] = '\0';
192
+ git_oid_tostr(commit_id, GIT_OID_MAX_HEXSIZE + 1, git_commit_id(commit));
196
193
 
197
194
  if ((commit_msg = git_commit_summary(commit)) == NULL) {
198
195
  error = -1;
199
196
  goto on_error;
200
197
  }
201
198
 
202
- if ((error = git_str_printf(&their_label, "parent of %.7s... %s", commit_oidstr, commit_msg)) < 0 ||
199
+ if ((error = git_str_printf(&their_label, "parent of %.7s... %s", commit_id, commit_msg)) < 0 ||
203
200
  (error = revert_normalize_opts(repo, &opts, given_opts, git_str_cstr(&their_label))) < 0 ||
204
201
  (error = git_indexwriter_init_for_operation(&indexwriter, repo, &opts.checkout_opts.checkout_strategy)) < 0 ||
205
- (error = write_revert_head(repo, commit_oidstr)) < 0 ||
206
- (error = write_merge_msg(repo, commit_oidstr, commit_msg)) < 0 ||
202
+ (error = write_revert_head(repo, commit_id)) < 0 ||
203
+ (error = write_merge_msg(repo, commit_id, commit_msg)) < 0 ||
207
204
  (error = git_repository_head(&our_ref, repo)) < 0 ||
208
205
  (error = git_reference_peel((git_object **)&our_commit, our_ref, GIT_OBJECT_COMMIT)) < 0 ||
209
206
  (error = git_revert_commit(&index, repo, commit, our_commit, opts.mainline, &opts.merge_opts)) < 0 ||
@@ -701,7 +701,6 @@ static int revparse(
701
701
  git_object *base_rev = NULL;
702
702
 
703
703
  bool should_return_reference = true;
704
- bool parsed = false;
705
704
 
706
705
  GIT_ASSERT_ARG(object_out);
707
706
  GIT_ASSERT_ARG(reference_out);
@@ -711,7 +710,7 @@ static int revparse(
711
710
  *object_out = NULL;
712
711
  *reference_out = NULL;
713
712
 
714
- while (!parsed && spec[pos]) {
713
+ while (spec[pos]) {
715
714
  switch (spec[pos]) {
716
715
  case '^':
717
716
  should_return_reference = false;
@@ -818,8 +817,6 @@ static int revparse(
818
817
  break;
819
818
  } else if (spec[pos+1] == '\0') {
820
819
  spec = "HEAD";
821
- identifier_len = 4;
822
- parsed = true;
823
820
  break;
824
821
  }
825
822
  /* fall through */
@@ -83,8 +83,13 @@ int git_revwalk__push_commit(git_revwalk *walk, const git_oid *oid, const git_re
83
83
 
84
84
  commit->uninteresting = opts->uninteresting;
85
85
  list = walk->user_input;
86
- if ((opts->insert_by_date &&
87
- git_commit_list_insert_by_date(commit, &list) == NULL) ||
86
+
87
+ /* To insert by date, we need to parse so we know the date. */
88
+ if (opts->insert_by_date && ((error = git_commit_list_parse(walk, commit)) < 0))
89
+ return error;
90
+
91
+ if ((opts->insert_by_date == 0 ||
92
+ git_commit_list_insert_by_date(commit, &list) == NULL) &&
88
93
  git_commit_list_insert(commit, &list) == NULL) {
89
94
  git_error_set_oom();
90
95
  return -1;
@@ -609,7 +614,7 @@ cleanup:
609
614
  static int prepare_walk(git_revwalk *walk)
610
615
  {
611
616
  int error = 0;
612
- git_commit_list *list, *commits = NULL;
617
+ git_commit_list *list, *commits = NULL, *commits_last = NULL;
613
618
  git_commit_list_node *next;
614
619
 
615
620
  /* If there were no pushes, we know that the walk is already over */
@@ -618,6 +623,12 @@ static int prepare_walk(git_revwalk *walk)
618
623
  return GIT_ITEROVER;
619
624
  }
620
625
 
626
+ /*
627
+ * This is a bit convoluted, but necessary to maintain the order of
628
+ * the commits. This is especially important in situations where
629
+ * git_revwalk__push_glob is called with a git_revwalk__push_options
630
+ * setting insert_by_date = 1, which is critical for fetch negotiation.
631
+ */
621
632
  for (list = walk->user_input; list; list = list->next) {
622
633
  git_commit_list_node *commit = list->item;
623
634
  if ((error = git_commit_list_parse(walk, commit)) < 0)
@@ -627,8 +638,19 @@ static int prepare_walk(git_revwalk *walk)
627
638
  mark_parents_uninteresting(commit);
628
639
 
629
640
  if (!commit->seen) {
641
+ git_commit_list *new_list = NULL;
642
+ if ((new_list = git_commit_list_create(commit, NULL)) == NULL) {
643
+ git_error_set_oom();
644
+ return -1;
645
+ }
646
+
630
647
  commit->seen = 1;
631
- git_commit_list_insert(commit, &commits);
648
+ if (commits_last == NULL)
649
+ commits = new_list;
650
+ else
651
+ commits_last->next = new_list;
652
+
653
+ commits_last = new_list;
632
654
  }
633
655
  }
634
656
 
@@ -284,7 +284,7 @@ static int build_untracked_tree(
284
284
  struct stash_update_rules data = {0};
285
285
  int error;
286
286
 
287
- if ((error = git_index_new(&i_index)) < 0)
287
+ if ((error = git_index__new(&i_index, repo->oid_type)) < 0)
288
288
  goto cleanup;
289
289
 
290
290
  if (flags & GIT_STASH_INCLUDE_UNTRACKED) {
@@ -487,7 +487,7 @@ static int commit_worktree(
487
487
  int error = 0, ignorecase;
488
488
 
489
489
  if ((error = git_repository_index(&r_index, repo) < 0) ||
490
- (error = git_index_new(&i_index)) < 0 ||
490
+ (error = git_index__new(&i_index, repo->oid_type)) < 0 ||
491
491
  (error = git_index__fill(i_index, &r_index->entries) < 0) ||
492
492
  (error = git_repository__configmap_lookup(&ignorecase, repo, GIT_CONFIGMAP_IGNORECASE)) < 0)
493
493
  goto cleanup;
@@ -732,7 +732,7 @@ int git_stash_save_with_opts(
732
732
  i_commit, b_commit, u_commit)) < 0)
733
733
  goto cleanup;
734
734
  } else {
735
- if ((error = git_index_new(&paths_index)) < 0 ||
735
+ if ((error = git_index__new(&paths_index, repo->oid_type)) < 0 ||
736
736
  (error = retrieve_head(&head, repo)) < 0 ||
737
737
  (error = git_reference_peel((git_object**)&tree, head, GIT_OBJECT_TREE)) < 0 ||
738
738
  (error = git_index_read_tree(paths_index, tree)) < 0 ||
@@ -1003,6 +1003,7 @@ static int stage_new_file(const git_index_entry **entries, void *data)
1003
1003
 
1004
1004
  static int stage_new_files(
1005
1005
  git_index **out,
1006
+ git_repository *repo,
1006
1007
  git_tree *parent_tree,
1007
1008
  git_tree *tree)
1008
1009
  {
@@ -1011,7 +1012,7 @@ static int stage_new_files(
1011
1012
  git_index *index = NULL;
1012
1013
  int error;
1013
1014
 
1014
- if ((error = git_index_new(&index)) < 0 ||
1015
+ if ((error = git_index__new(&index, repo->oid_type)) < 0 ||
1015
1016
  (error = git_iterator_for_tree(
1016
1017
  &iterators[0], parent_tree, &iterator_options)) < 0 ||
1017
1018
  (error = git_iterator_for_tree(
@@ -1095,10 +1096,10 @@ int git_stash_apply(
1095
1096
  * previously unstaged contents are staged, not the previously staged.)
1096
1097
  */
1097
1098
  } else if ((opts.flags & GIT_STASH_APPLY_REINSTATE_INDEX) == 0) {
1098
- if ((error = stage_new_files(
1099
- &stash_adds, stash_parent_tree, stash_tree)) < 0 ||
1100
- (error = merge_indexes(
1101
- &unstashed_index, repo, stash_parent_tree, repo_index, stash_adds)) < 0)
1099
+ if ((error = stage_new_files(&stash_adds, repo,
1100
+ stash_parent_tree, stash_tree)) < 0 ||
1101
+ (error = merge_indexes(&unstashed_index, repo,
1102
+ stash_parent_tree, repo_index, stash_adds)) < 0)
1102
1103
  goto cleanup;
1103
1104
  }
1104
1105
 
@@ -14,7 +14,6 @@
14
14
  #include "runtime.h"
15
15
  #include "stream.h"
16
16
  #include "streams/socket.h"
17
- #include "netops.h"
18
17
  #include "git2/transport.h"
19
18
  #include "util.h"
20
19
 
@@ -18,8 +18,8 @@
18
18
  #include "settings.h"
19
19
  #include "posix.h"
20
20
  #include "stream.h"
21
+ #include "net.h"
21
22
  #include "streams/socket.h"
22
- #include "netops.h"
23
23
  #include "git2/transport.h"
24
24
  #include "git2/sys/openssl.h"
25
25
 
@@ -70,14 +70,14 @@ static void *git_openssl_malloc(size_t bytes, const char *file, int line)
70
70
  GIT_UNUSED(line);
71
71
  return git__calloc(1, bytes);
72
72
  }
73
-
73
+
74
74
  static void *git_openssl_realloc(void *mem, size_t size, const char *file, int line)
75
75
  {
76
76
  GIT_UNUSED(file);
77
77
  GIT_UNUSED(line);
78
78
  return git__realloc(mem, size);
79
79
  }
80
-
80
+
81
81
  static void git_openssl_free(void *mem, const char *file, int line)
82
82
  {
83
83
  GIT_UNUSED(file);
@@ -357,15 +357,10 @@ static int ssl_teardown(SSL *ssl)
357
357
  return ret;
358
358
  }
359
359
 
360
- static int check_host_name(const char *name, const char *host)
360
+ static bool check_host_name(const char *host, const char *name)
361
361
  {
362
- if (!strcasecmp(name, host))
363
- return 0;
364
-
365
- if (gitno__match_host(name, host) < 0)
366
- return -1;
367
-
368
- return 0;
362
+ return !strcasecmp(host, name) ||
363
+ git_net_hostname_matches_cert(host, name);
369
364
  }
370
365
 
371
366
  static int verify_server_cert(SSL *ssl, const char *host)
@@ -425,10 +420,7 @@ static int verify_server_cert(SSL *ssl, const char *host)
425
420
  if (memchr(name, '\0', namelen))
426
421
  continue;
427
422
 
428
- if (check_host_name(name, host) < 0)
429
- matched = 0;
430
- else
431
- matched = 1;
423
+ matched = !!check_host_name(host, name);
432
424
  } else if (type == GEN_IPADD) {
433
425
  /* Here name isn't so much a name but a binary representation of the IP */
434
426
  matched = addr && !!memcmp(name, addr, namelen);
@@ -481,7 +473,7 @@ static int verify_server_cert(SSL *ssl, const char *host)
481
473
  goto cert_fail_name;
482
474
  }
483
475
 
484
- if (check_host_name((char *)peer_cn, host) < 0)
476
+ if (!check_host_name(host, (char *)peer_cn))
485
477
  goto cert_fail_name;
486
478
 
487
479
  goto cleanup;