rugged 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (277) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -0
  3. data/README.md +1 -1
  4. data/ext/rugged/rugged.c +7 -4
  5. data/ext/rugged/rugged_object.c +1 -1
  6. data/ext/rugged/rugged_repo.c +3 -3
  7. data/lib/rugged/repository.rb +2 -2
  8. data/lib/rugged/version.rb +1 -1
  9. data/vendor/libgit2/CMakeLists.txt +11 -6
  10. data/vendor/libgit2/COPYING +109 -1
  11. data/vendor/libgit2/cmake/Findfutimens.cmake +14 -0
  12. data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +4 -0
  13. data/vendor/libgit2/cmake/SelectHashes.cmake +1 -0
  14. data/vendor/libgit2/deps/chromium-zlib/CMakeLists.txt +101 -0
  15. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +17 -5
  16. data/vendor/libgit2/deps/ntlmclient/crypt.h +14 -9
  17. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +20 -20
  18. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +3 -3
  19. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +37 -36
  20. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +4 -3
  21. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +178 -51
  22. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +74 -5
  23. data/vendor/libgit2/deps/ntlmclient/ntlm.c +150 -118
  24. data/vendor/libgit2/deps/ntlmclient/ntlm.h +13 -9
  25. data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +16 -3
  26. data/vendor/libgit2/deps/ntlmclient/unicode.h +10 -4
  27. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +16 -27
  28. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.h +20 -0
  29. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +28 -52
  30. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.h +22 -0
  31. data/vendor/libgit2/include/git2/attr.h +89 -0
  32. data/vendor/libgit2/include/git2/blame.h +93 -42
  33. data/vendor/libgit2/include/git2/blob.h +14 -2
  34. data/vendor/libgit2/include/git2/branch.h +25 -0
  35. data/vendor/libgit2/include/git2/cert.h +42 -5
  36. data/vendor/libgit2/include/git2/checkout.h +28 -12
  37. data/vendor/libgit2/include/git2/commit.h +35 -19
  38. data/vendor/libgit2/include/git2/common.h +14 -4
  39. data/vendor/libgit2/include/git2/deprecated.h +206 -6
  40. data/vendor/libgit2/include/git2/diff.h +34 -19
  41. data/vendor/libgit2/include/git2/errors.h +6 -6
  42. data/vendor/libgit2/include/git2/filter.h +57 -17
  43. data/vendor/libgit2/include/git2/graph.h +20 -2
  44. data/vendor/libgit2/include/git2/index.h +2 -2
  45. data/vendor/libgit2/include/git2/odb.h +29 -0
  46. data/vendor/libgit2/include/git2/patch.h +8 -0
  47. data/vendor/libgit2/include/git2/rebase.h +25 -1
  48. data/vendor/libgit2/include/git2/refs.h +6 -2
  49. data/vendor/libgit2/include/git2/remote.h +59 -6
  50. data/vendor/libgit2/include/git2/revparse.h +5 -5
  51. data/vendor/libgit2/include/git2/status.h +115 -59
  52. data/vendor/libgit2/include/git2/submodule.h +9 -0
  53. data/vendor/libgit2/include/git2/sys/commit_graph.h +174 -0
  54. data/vendor/libgit2/include/git2/sys/filter.h +49 -28
  55. data/vendor/libgit2/include/git2/sys/midx.h +74 -0
  56. data/vendor/libgit2/include/git2/sys/odb_backend.h +7 -0
  57. data/vendor/libgit2/include/git2/sys/transport.h +1 -0
  58. data/vendor/libgit2/include/git2/tag.h +12 -0
  59. data/vendor/libgit2/include/git2/tree.h +0 -14
  60. data/vendor/libgit2/include/git2/types.h +9 -0
  61. data/vendor/libgit2/include/git2/version.h +4 -4
  62. data/vendor/libgit2/include/git2/worktree.h +1 -0
  63. data/vendor/libgit2/src/CMakeLists.txt +25 -4
  64. data/vendor/libgit2/src/alloc.c +21 -8
  65. data/vendor/libgit2/src/allocators/failalloc.c +92 -0
  66. data/vendor/libgit2/src/allocators/failalloc.h +23 -0
  67. data/vendor/libgit2/src/allocators/stdalloc.c +41 -10
  68. data/vendor/libgit2/src/allocators/win32_leakcheck.c +118 -0
  69. data/vendor/libgit2/src/allocators/{win32_crtdbg.h → win32_leakcheck.h} +3 -3
  70. data/vendor/libgit2/src/annotated_commit.c +21 -9
  71. data/vendor/libgit2/src/apply.c +16 -7
  72. data/vendor/libgit2/src/array.h +11 -11
  73. data/vendor/libgit2/src/attr.c +181 -74
  74. data/vendor/libgit2/src/attr_file.c +84 -39
  75. data/vendor/libgit2/src/attr_file.h +32 -11
  76. data/vendor/libgit2/src/attrcache.c +42 -37
  77. data/vendor/libgit2/src/attrcache.h +4 -5
  78. data/vendor/libgit2/src/blame.c +11 -5
  79. data/vendor/libgit2/src/blob.c +35 -24
  80. data/vendor/libgit2/src/branch.c +69 -17
  81. data/vendor/libgit2/src/buffer.c +334 -25
  82. data/vendor/libgit2/src/buffer.h +153 -2
  83. data/vendor/libgit2/src/cache.c +2 -2
  84. data/vendor/libgit2/src/cache.h +7 -7
  85. data/vendor/libgit2/src/cc-compat.h +10 -2
  86. data/vendor/libgit2/src/checkout.c +48 -26
  87. data/vendor/libgit2/src/cherrypick.c +6 -2
  88. data/vendor/libgit2/src/clone.c +41 -47
  89. data/vendor/libgit2/src/commit.c +41 -28
  90. data/vendor/libgit2/src/commit_graph.c +1209 -0
  91. data/vendor/libgit2/src/commit_graph.h +162 -0
  92. data/vendor/libgit2/src/commit_list.c +46 -0
  93. data/vendor/libgit2/src/commit_list.h +2 -0
  94. data/vendor/libgit2/src/common.h +25 -2
  95. data/vendor/libgit2/src/config.c +37 -15
  96. data/vendor/libgit2/src/config_cache.c +5 -3
  97. data/vendor/libgit2/src/config_file.c +16 -8
  98. data/vendor/libgit2/src/config_parse.c +4 -6
  99. data/vendor/libgit2/src/crlf.c +16 -6
  100. data/vendor/libgit2/src/date.c +4 -3
  101. data/vendor/libgit2/src/delta.c +1 -1
  102. data/vendor/libgit2/src/describe.c +6 -3
  103. data/vendor/libgit2/src/diff.c +11 -8
  104. data/vendor/libgit2/src/diff_driver.c +21 -17
  105. data/vendor/libgit2/src/diff_file.c +2 -6
  106. data/vendor/libgit2/src/diff_generate.c +46 -17
  107. data/vendor/libgit2/src/diff_print.c +19 -6
  108. data/vendor/libgit2/src/diff_stats.c +7 -5
  109. data/vendor/libgit2/src/diff_tform.c +9 -8
  110. data/vendor/libgit2/src/diff_xdiff.c +4 -2
  111. data/vendor/libgit2/src/diff_xdiff.h +1 -1
  112. data/vendor/libgit2/src/errors.c +24 -19
  113. data/vendor/libgit2/src/features.h.in +5 -1
  114. data/vendor/libgit2/src/fetch.c +5 -2
  115. data/vendor/libgit2/src/fetchhead.c +8 -4
  116. data/vendor/libgit2/src/filebuf.c +9 -7
  117. data/vendor/libgit2/src/filter.c +206 -110
  118. data/vendor/libgit2/src/filter.h +24 -5
  119. data/vendor/libgit2/src/futils.c +5 -5
  120. data/vendor/libgit2/src/futils.h +1 -1
  121. data/vendor/libgit2/src/graph.c +64 -9
  122. data/vendor/libgit2/src/hash/sha1/collisiondetect.c +3 -3
  123. data/vendor/libgit2/src/hash/sha1/common_crypto.c +3 -3
  124. data/vendor/libgit2/src/hash/sha1/generic.h +1 -1
  125. data/vendor/libgit2/src/hash/sha1/mbedtls.c +12 -12
  126. data/vendor/libgit2/src/hash/sha1/openssl.c +3 -3
  127. data/vendor/libgit2/src/hash/sha1/sha1dc/sha1.c +0 -2
  128. data/vendor/libgit2/src/hash/sha1/win32.c +15 -11
  129. data/vendor/libgit2/src/hash.c +16 -13
  130. data/vendor/libgit2/src/hash.h +1 -1
  131. data/vendor/libgit2/src/hashsig.c +23 -10
  132. data/vendor/libgit2/src/ident.c +13 -3
  133. data/vendor/libgit2/src/ignore.c +35 -19
  134. data/vendor/libgit2/src/index.c +106 -70
  135. data/vendor/libgit2/src/index.h +1 -1
  136. data/vendor/libgit2/src/indexer.c +31 -29
  137. data/vendor/libgit2/src/integer.h +64 -2
  138. data/vendor/libgit2/src/iterator.c +36 -24
  139. data/vendor/libgit2/src/iterator.h +1 -1
  140. data/vendor/libgit2/src/khash.h +2 -11
  141. data/vendor/libgit2/src/{settings.c → libgit2.c} +117 -50
  142. data/vendor/libgit2/src/libgit2.h +15 -0
  143. data/vendor/libgit2/src/mailmap.c +23 -10
  144. data/vendor/libgit2/src/map.h +3 -3
  145. data/vendor/libgit2/src/merge.c +70 -30
  146. data/vendor/libgit2/src/merge.h +2 -1
  147. data/vendor/libgit2/src/merge_driver.c +19 -13
  148. data/vendor/libgit2/src/merge_file.c +11 -3
  149. data/vendor/libgit2/src/message.c +3 -1
  150. data/vendor/libgit2/src/midx.c +471 -10
  151. data/vendor/libgit2/src/midx.h +28 -1
  152. data/vendor/libgit2/src/mwindow.c +103 -59
  153. data/vendor/libgit2/src/mwindow.h +3 -3
  154. data/vendor/libgit2/src/net.c +127 -3
  155. data/vendor/libgit2/src/net.h +16 -2
  156. data/vendor/libgit2/src/netops.c +6 -4
  157. data/vendor/libgit2/src/netops.h +2 -2
  158. data/vendor/libgit2/src/notes.c +10 -10
  159. data/vendor/libgit2/src/object.c +22 -14
  160. data/vendor/libgit2/src/odb.c +285 -48
  161. data/vendor/libgit2/src/odb.h +16 -2
  162. data/vendor/libgit2/src/odb_loose.c +28 -18
  163. data/vendor/libgit2/src/odb_mempack.c +1 -1
  164. data/vendor/libgit2/src/odb_pack.c +391 -114
  165. data/vendor/libgit2/src/oid.c +5 -4
  166. data/vendor/libgit2/src/pack-objects.c +54 -48
  167. data/vendor/libgit2/src/pack.c +329 -119
  168. data/vendor/libgit2/src/pack.h +25 -7
  169. data/vendor/libgit2/src/patch.c +14 -7
  170. data/vendor/libgit2/src/patch_generate.c +2 -2
  171. data/vendor/libgit2/src/patch_parse.c +2 -1
  172. data/vendor/libgit2/src/path.c +98 -53
  173. data/vendor/libgit2/src/path.h +79 -6
  174. data/vendor/libgit2/src/pathspec.c +8 -8
  175. data/vendor/libgit2/src/pool.c +13 -7
  176. data/vendor/libgit2/src/posix.c +11 -3
  177. data/vendor/libgit2/src/reader.c +10 -6
  178. data/vendor/libgit2/src/rebase.c +93 -49
  179. data/vendor/libgit2/src/refdb.c +30 -13
  180. data/vendor/libgit2/src/refdb_fs.c +121 -69
  181. data/vendor/libgit2/src/reflog.c +19 -14
  182. data/vendor/libgit2/src/refs.c +76 -41
  183. data/vendor/libgit2/src/refspec.c +32 -12
  184. data/vendor/libgit2/src/remote.c +272 -102
  185. data/vendor/libgit2/src/remote.h +2 -1
  186. data/vendor/libgit2/src/repository.c +176 -103
  187. data/vendor/libgit2/src/repository.h +12 -1
  188. data/vendor/libgit2/src/reset.c +7 -6
  189. data/vendor/libgit2/src/revert.c +6 -2
  190. data/vendor/libgit2/src/revparse.c +14 -9
  191. data/vendor/libgit2/src/revwalk.c +32 -15
  192. data/vendor/libgit2/src/runtime.c +162 -0
  193. data/vendor/libgit2/src/runtime.h +62 -0
  194. data/vendor/libgit2/src/settings.h +11 -0
  195. data/vendor/libgit2/src/signature.c +6 -5
  196. data/vendor/libgit2/src/sortedcache.h +10 -8
  197. data/vendor/libgit2/src/stash.c +3 -1
  198. data/vendor/libgit2/src/status.c +7 -4
  199. data/vendor/libgit2/src/strarray.c +2 -1
  200. data/vendor/libgit2/src/streams/mbedtls.c +14 -17
  201. data/vendor/libgit2/src/streams/mbedtls.h +1 -1
  202. data/vendor/libgit2/src/streams/openssl.c +101 -201
  203. data/vendor/libgit2/src/streams/openssl.h +9 -1
  204. data/vendor/libgit2/src/streams/openssl_dynamic.c +309 -0
  205. data/vendor/libgit2/src/streams/openssl_dynamic.h +348 -0
  206. data/vendor/libgit2/src/streams/openssl_legacy.c +203 -0
  207. data/vendor/libgit2/src/streams/openssl_legacy.h +63 -0
  208. data/vendor/libgit2/src/streams/registry.c +5 -6
  209. data/vendor/libgit2/src/streams/socket.c +6 -2
  210. data/vendor/libgit2/src/streams/stransport.c +6 -3
  211. data/vendor/libgit2/src/streams/tls.c +5 -3
  212. data/vendor/libgit2/src/submodule.c +128 -62
  213. data/vendor/libgit2/src/submodule.h +9 -9
  214. data/vendor/libgit2/src/sysdir.c +4 -6
  215. data/vendor/libgit2/src/tag.c +47 -11
  216. data/vendor/libgit2/src/thread.c +140 -0
  217. data/vendor/libgit2/src/thread.h +479 -0
  218. data/vendor/libgit2/src/threadstate.c +83 -0
  219. data/vendor/libgit2/src/threadstate.h +24 -0
  220. data/vendor/libgit2/src/trace.c +2 -2
  221. data/vendor/libgit2/src/trace.h +17 -13
  222. data/vendor/libgit2/src/transaction.c +19 -8
  223. data/vendor/libgit2/src/transport.c +3 -3
  224. data/vendor/libgit2/src/transports/auth.c +1 -1
  225. data/vendor/libgit2/src/transports/auth_negotiate.c +11 -4
  226. data/vendor/libgit2/src/transports/auth_ntlm.c +10 -6
  227. data/vendor/libgit2/src/transports/credential.c +15 -7
  228. data/vendor/libgit2/src/transports/git.c +1 -3
  229. data/vendor/libgit2/src/transports/http.c +19 -17
  230. data/vendor/libgit2/src/transports/http.h +1 -0
  231. data/vendor/libgit2/src/transports/httpclient.c +53 -26
  232. data/vendor/libgit2/src/transports/httpclient.h +1 -1
  233. data/vendor/libgit2/src/transports/local.c +3 -3
  234. data/vendor/libgit2/src/transports/smart.c +12 -7
  235. data/vendor/libgit2/src/transports/smart.h +1 -1
  236. data/vendor/libgit2/src/transports/smart_protocol.c +11 -5
  237. data/vendor/libgit2/src/transports/ssh.c +51 -17
  238. data/vendor/libgit2/src/transports/winhttp.c +41 -31
  239. data/vendor/libgit2/src/tree.c +100 -77
  240. data/vendor/libgit2/src/tree.h +1 -0
  241. data/vendor/libgit2/src/tsort.c +0 -2
  242. data/vendor/libgit2/src/unix/map.c +3 -1
  243. data/vendor/libgit2/src/unix/pthread.h +2 -1
  244. data/vendor/libgit2/src/utf8.c +150 -0
  245. data/vendor/libgit2/src/utf8.h +52 -0
  246. data/vendor/libgit2/src/util.c +53 -129
  247. data/vendor/libgit2/src/util.h +33 -39
  248. data/vendor/libgit2/src/vector.c +23 -19
  249. data/vendor/libgit2/src/vector.h +4 -2
  250. data/vendor/libgit2/src/win32/findfile.c +4 -2
  251. data/vendor/libgit2/src/win32/map.c +1 -1
  252. data/vendor/libgit2/src/win32/msvc-compat.h +9 -1
  253. data/vendor/libgit2/src/win32/path_w32.c +22 -24
  254. data/vendor/libgit2/src/win32/path_w32.h +0 -1
  255. data/vendor/libgit2/src/win32/posix_w32.c +7 -1
  256. data/vendor/libgit2/src/win32/precompiled.h +0 -1
  257. data/vendor/libgit2/src/win32/reparse.h +4 -4
  258. data/vendor/libgit2/src/win32/thread.c +24 -15
  259. data/vendor/libgit2/src/win32/thread.h +1 -1
  260. data/vendor/libgit2/src/win32/w32_buffer.c +3 -3
  261. data/vendor/libgit2/src/win32/w32_common.h +18 -9
  262. data/vendor/libgit2/src/win32/{w32_crtdbg_stacktrace.c → w32_leakcheck.c} +269 -33
  263. data/vendor/libgit2/src/win32/w32_leakcheck.h +222 -0
  264. data/vendor/libgit2/src/win32/w32_util.h +6 -6
  265. data/vendor/libgit2/src/worktree.c +27 -16
  266. data/vendor/libgit2/src/zstream.c +1 -1
  267. metadata +32 -16
  268. data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
  269. data/vendor/libgit2/src/buf_text.c +0 -316
  270. data/vendor/libgit2/src/buf_text.h +0 -122
  271. data/vendor/libgit2/src/global.c +0 -363
  272. data/vendor/libgit2/src/global.h +0 -41
  273. data/vendor/libgit2/src/thread-utils.c +0 -58
  274. data/vendor/libgit2/src/thread-utils.h +0 -369
  275. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +0 -127
  276. data/vendor/libgit2/src/win32/w32_stack.c +0 -188
  277. data/vendor/libgit2/src/win32/w32_stack.h +0 -140
@@ -263,7 +263,7 @@ GIT_INLINE(bool) git_iterator_ignore_case(git_iterator *iter)
263
263
  return ((iter->flags & GIT_ITERATOR_IGNORE_CASE) != 0);
264
264
  }
265
265
 
266
- extern void git_iterator_set_ignore_case(
266
+ extern int git_iterator_set_ignore_case(
267
267
  git_iterator *iter, bool ignore_case);
268
268
 
269
269
  extern int git_iterator_current_tree_entry(
@@ -131,17 +131,8 @@ int main() {
131
131
 
132
132
  /* compiler specific configuration */
133
133
 
134
- #if UINT_MAX == 0xffffffffu
135
- typedef unsigned int khint32_t;
136
- #elif ULONG_MAX == 0xffffffffu
137
- typedef unsigned long khint32_t;
138
- #endif
139
-
140
- #if ULONG_MAX == ULLONG_MAX
141
- typedef unsigned long khint64_t;
142
- #else
143
- typedef unsigned long long khint64_t;
144
- #endif
134
+ typedef uint32_t khint32_t;
135
+ typedef uint64_t khint64_t;
145
136
 
146
137
  #ifndef kh_inline
147
138
  #ifdef _MSC_VER
@@ -5,29 +5,94 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
- #include "common.h"
9
-
10
- #ifdef GIT_OPENSSL
11
- # include <openssl/err.h>
12
- #endif
13
-
14
- #ifdef GIT_MBEDTLS
15
- # include <mbedtls/error.h>
16
- #endif
8
+ #include "libgit2.h"
17
9
 
18
10
  #include <git2.h>
19
11
  #include "alloc.h"
20
- #include "sysdir.h"
21
12
  #include "cache.h"
22
- #include "global.h"
13
+ #include "common.h"
14
+ #include "filter.h"
15
+ #include "hash.h"
16
+ #include "index.h"
17
+ #include "merge_driver.h"
18
+ #include "pool.h"
19
+ #include "mwindow.h"
23
20
  #include "object.h"
24
21
  #include "odb.h"
25
22
  #include "refs.h"
26
- #include "index.h"
23
+ #include "runtime.h"
24
+ #include "sysdir.h"
25
+ #include "thread.h"
26
+ #include "threadstate.h"
27
+ #include "git2/global.h"
28
+ #include "streams/registry.h"
29
+ #include "streams/mbedtls.h"
30
+ #include "streams/openssl.h"
27
31
  #include "transports/smart.h"
28
32
  #include "transports/http.h"
29
- #include "streams/openssl.h"
30
- #include "streams/mbedtls.h"
33
+ #include "transports/ssh.h"
34
+
35
+ #ifdef GIT_WIN32
36
+ # include "win32/w32_leakcheck.h"
37
+ #endif
38
+
39
+ /* Declarations for tuneable settings */
40
+ extern size_t git_mwindow__window_size;
41
+ extern size_t git_mwindow__mapped_limit;
42
+ extern size_t git_mwindow__file_limit;
43
+ extern size_t git_indexer__max_objects;
44
+ extern bool git_disable_pack_keep_file_checks;
45
+ extern int git_odb__packed_priority;
46
+ extern int git_odb__loose_priority;
47
+
48
+ char *git__user_agent;
49
+ char *git__ssl_ciphers;
50
+
51
+ static void libgit2_settings_global_shutdown(void)
52
+ {
53
+ git__free(git__user_agent);
54
+ git__free(git__ssl_ciphers);
55
+ }
56
+
57
+ static int git_libgit2_settings_global_init(void)
58
+ {
59
+ return git_runtime_shutdown_register(libgit2_settings_global_shutdown);
60
+ }
61
+
62
+ int git_libgit2_init(void)
63
+ {
64
+ static git_runtime_init_fn init_fns[] = {
65
+ #ifdef GIT_WIN32
66
+ git_win32_leakcheck_global_init,
67
+ #endif
68
+ git_allocator_global_init,
69
+ git_threadstate_global_init,
70
+ git_threads_global_init,
71
+ git_hash_global_init,
72
+ git_sysdir_global_init,
73
+ git_filter_global_init,
74
+ git_merge_driver_global_init,
75
+ git_transport_ssh_global_init,
76
+ git_stream_registry_global_init,
77
+ git_openssl_stream_global_init,
78
+ git_mbedtls_stream_global_init,
79
+ git_mwindow_global_init,
80
+ git_pool_global_init,
81
+ git_libgit2_settings_global_init
82
+ };
83
+
84
+ return git_runtime_init(init_fns, ARRAY_SIZE(init_fns));
85
+ }
86
+
87
+ int git_libgit2_init_count(void)
88
+ {
89
+ return git_runtime_init_count();
90
+ }
91
+
92
+ int git_libgit2_shutdown(void)
93
+ {
94
+ return git_runtime_shutdown();
95
+ }
31
96
 
32
97
  int git_libgit2_version(int *major, int *minor, int *rev)
33
98
  {
@@ -56,41 +121,30 @@ int git_libgit2_features(void)
56
121
  ;
57
122
  }
58
123
 
59
- /* Declarations for tuneable settings */
60
- extern size_t git_mwindow__window_size;
61
- extern size_t git_mwindow__mapped_limit;
62
- extern size_t git_mwindow__file_limit;
63
- extern size_t git_indexer__max_objects;
64
- extern bool git_disable_pack_keep_file_checks;
65
-
66
- static int config_level_to_sysdir(int config_level)
124
+ static int config_level_to_sysdir(int *out, int config_level)
67
125
  {
68
- int val = -1;
69
-
70
126
  switch (config_level) {
71
127
  case GIT_CONFIG_LEVEL_SYSTEM:
72
- val = GIT_SYSDIR_SYSTEM;
73
- break;
128
+ *out = GIT_SYSDIR_SYSTEM;
129
+ return 0;
74
130
  case GIT_CONFIG_LEVEL_XDG:
75
- val = GIT_SYSDIR_XDG;
76
- break;
131
+ *out = GIT_SYSDIR_XDG;
132
+ return 0;
77
133
  case GIT_CONFIG_LEVEL_GLOBAL:
78
- val = GIT_SYSDIR_GLOBAL;
79
- break;
134
+ *out = GIT_SYSDIR_GLOBAL;
135
+ return 0;
80
136
  case GIT_CONFIG_LEVEL_PROGRAMDATA:
81
- val = GIT_SYSDIR_PROGRAMDATA;
82
- break;
137
+ *out = GIT_SYSDIR_PROGRAMDATA;
138
+ return 0;
83
139
  default:
84
- git_error_set(
85
- GIT_ERROR_INVALID, "invalid config path selector %d", config_level);
140
+ break;
86
141
  }
87
142
 
88
- return val;
143
+ git_error_set(
144
+ GIT_ERROR_INVALID, "invalid config path selector %d", config_level);
145
+ return -1;
89
146
  }
90
147
 
91
- extern char *git__user_agent;
92
- extern char *git__ssl_ciphers;
93
-
94
148
  const char *git_libgit2__user_agent(void)
95
149
  {
96
150
  return git__user_agent;
@@ -134,12 +188,15 @@ int git_libgit2_opts(int key, ...)
134
188
  break;
135
189
 
136
190
  case GIT_OPT_GET_SEARCH_PATH:
137
- if ((error = config_level_to_sysdir(va_arg(ap, int))) >= 0) {
191
+ {
192
+ int sysdir = va_arg(ap, int);
138
193
  git_buf *out = va_arg(ap, git_buf *);
139
194
  const git_buf *tmp;
195
+ int level;
140
196
 
141
- git_buf_sanitize(out);
142
- if ((error = git_sysdir_get(&tmp, error)) < 0)
197
+ if ((error = config_level_to_sysdir(&level, sysdir)) < 0 ||
198
+ (error = git_buf_sanitize(out)) < 0 ||
199
+ (error = git_sysdir_get(&tmp, level)) < 0)
143
200
  break;
144
201
 
145
202
  error = git_buf_sets(out, tmp->ptr);
@@ -147,8 +204,12 @@ int git_libgit2_opts(int key, ...)
147
204
  break;
148
205
 
149
206
  case GIT_OPT_SET_SEARCH_PATH:
150
- if ((error = config_level_to_sysdir(va_arg(ap, int))) >= 0)
151
- error = git_sysdir_set(error, va_arg(ap, const char *));
207
+ {
208
+ int level;
209
+
210
+ if ((error = config_level_to_sysdir(&level, va_arg(ap, int))) >= 0)
211
+ error = git_sysdir_set(level, va_arg(ap, const char *));
212
+ }
152
213
  break;
153
214
 
154
215
  case GIT_OPT_SET_CACHE_OBJECT_LIMIT:
@@ -177,8 +238,8 @@ int git_libgit2_opts(int key, ...)
177
238
  git_buf *out = va_arg(ap, git_buf *);
178
239
  const git_buf *tmp;
179
240
 
180
- git_buf_sanitize(out);
181
- if ((error = git_sysdir_get(&tmp, GIT_SYSDIR_TEMPLATE)) < 0)
241
+ if ((error = git_buf_sanitize(out)) < 0 ||
242
+ (error = git_sysdir_get(&tmp, GIT_SYSDIR_TEMPLATE)) < 0)
182
243
  break;
183
244
 
184
245
  error = git_buf_sets(out, tmp->ptr);
@@ -200,10 +261,7 @@ int git_libgit2_opts(int key, ...)
200
261
  {
201
262
  const char *file = va_arg(ap, const char *);
202
263
  const char *path = va_arg(ap, const char *);
203
- if (file)
204
- error = git_mbedtls__set_cert_location(file, 0);
205
- if (error && path)
206
- error = git_mbedtls__set_cert_location(path, 1);
264
+ error = git_mbedtls__set_cert_location(file, path);
207
265
  }
208
266
  #else
209
267
  git_error_set(GIT_ERROR_SSL, "TLS backend doesn't support certificate locations");
@@ -247,7 +305,8 @@ int git_libgit2_opts(int key, ...)
247
305
  case GIT_OPT_GET_USER_AGENT:
248
306
  {
249
307
  git_buf *out = va_arg(ap, git_buf *);
250
- git_buf_sanitize(out);
308
+ if ((error = git_buf_sanitize(out)) < 0)
309
+ break;
251
310
  error = git_buf_sets(out, git__user_agent);
252
311
  }
253
312
  break;
@@ -300,6 +359,14 @@ int git_libgit2_opts(int key, ...)
300
359
  git_http__expect_continue = (va_arg(ap, int) != 0);
301
360
  break;
302
361
 
362
+ case GIT_OPT_SET_ODB_PACKED_PRIORITY:
363
+ git_odb__packed_priority = va_arg(ap, int);
364
+ break;
365
+
366
+ case GIT_OPT_SET_ODB_LOOSE_PRIORITY:
367
+ git_odb__loose_priority = va_arg(ap, int);
368
+ break;
369
+
303
370
  default:
304
371
  git_error_set(GIT_ERROR_INVALID, "invalid option key");
305
372
  error = -1;
@@ -0,0 +1,15 @@
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_libgit2_h__
8
+ #define INCLUDE_libgit2_h__
9
+
10
+ extern int git_libgit2_init_count(void);
11
+
12
+ extern const char *git_libgit2__user_agent(void);
13
+ extern const char *git_libgit2__ssl_ciphers(void);
14
+
15
+ #endif
@@ -43,7 +43,8 @@ static int mailmap_entry_cmp(const void *a_raw, const void *b_raw)
43
43
  const git_mailmap_entry *b = (const git_mailmap_entry *)b_raw;
44
44
  int cmp;
45
45
 
46
- assert(a && b && a->replace_email && b->replace_email);
46
+ GIT_ASSERT_ARG(a && a->replace_email);
47
+ GIT_ASSERT_ARG(b && b->replace_email);
47
48
 
48
49
  cmp = git__strcmp(a->replace_email, b->replace_email);
49
50
  if (cmp)
@@ -185,7 +186,8 @@ static int mailmap_add_entry_unterminated(
185
186
  git_mailmap_entry *entry = git__calloc(1, sizeof(git_mailmap_entry));
186
187
  GIT_ERROR_CHECK_ALLOC(entry);
187
188
 
188
- assert(mm && replace_email && *replace_email);
189
+ GIT_ASSERT_ARG(mm);
190
+ GIT_ASSERT_ARG(replace_email && *replace_email);
189
191
 
190
192
  if (real_name_size > 0) {
191
193
  entry->real_name = git__substrdup(real_name, real_name_size);
@@ -290,7 +292,8 @@ static int mailmap_add_blob(
290
292
  git_buf content = GIT_BUF_INIT;
291
293
  int error;
292
294
 
293
- assert(mm && repo);
295
+ GIT_ASSERT_ARG(mm);
296
+ GIT_ASSERT_ARG(repo);
294
297
 
295
298
  error = git_revparse_single(&object, repo, rev);
296
299
  if (error < 0)
@@ -327,6 +330,10 @@ static int mailmap_add_file_ondisk(
327
330
  if (error < 0)
328
331
  goto cleanup;
329
332
 
333
+ error = git_path_validate_workdir_buf(repo, &fullpath);
334
+ if (error < 0)
335
+ goto cleanup;
336
+
330
337
  error = git_futils_readbuffer(&content, fullpath.ptr);
331
338
  if (error < 0)
332
339
  goto cleanup;
@@ -350,8 +357,6 @@ static void mailmap_add_from_repository(git_mailmap *mm, git_repository *repo)
350
357
  const char *rev = NULL;
351
358
  const char *path = NULL;
352
359
 
353
- assert(mm && repo);
354
-
355
360
  /* If we're in a bare repo, default blob to 'HEAD:.mailmap' */
356
361
  if (repo->is_bare)
357
362
  rev = MM_BLOB_DEFAULT;
@@ -389,9 +394,14 @@ static void mailmap_add_from_repository(git_mailmap *mm, git_repository *repo)
389
394
 
390
395
  int git_mailmap_from_repository(git_mailmap **out, git_repository *repo)
391
396
  {
392
- int error = git_mailmap_new(out);
393
- if (error < 0)
397
+ int error;
398
+
399
+ GIT_ASSERT_ARG(out);
400
+ GIT_ASSERT_ARG(repo);
401
+
402
+ if ((error = git_mailmap_new(out)) < 0)
394
403
  return error;
404
+
395
405
  mailmap_add_from_repository(*out, repo);
396
406
  return 0;
397
407
  }
@@ -408,7 +418,7 @@ const git_mailmap_entry *git_mailmap_entry_lookup(
408
418
  git_mailmap_entry needle = { NULL };
409
419
  needle.replace_email = (char *)email;
410
420
 
411
- assert(email);
421
+ GIT_ASSERT_ARG_WITH_RETVAL(email, NULL);
412
422
 
413
423
  if (!mm)
414
424
  return NULL;
@@ -431,7 +441,8 @@ const git_mailmap_entry *git_mailmap_entry_lookup(
431
441
  if (git__strcmp(entry->replace_email, email))
432
442
  break; /* it's a different email, so we're done looking */
433
443
 
434
- assert(entry->replace_name); /* should be specific */
444
+ /* should be specific */
445
+ GIT_ASSERT_WITH_RETVAL(entry->replace_name, NULL);
435
446
  if (!name || !git__strcmp(entry->replace_name, name))
436
447
  return entry;
437
448
  }
@@ -447,7 +458,9 @@ int git_mailmap_resolve(
447
458
  const char *name, const char *email)
448
459
  {
449
460
  const git_mailmap_entry *entry = NULL;
450
- assert(name && email);
461
+
462
+ GIT_ASSERT(name);
463
+ GIT_ASSERT(email);
451
464
 
452
465
  *real_name = name;
453
466
  *real_email = email;
@@ -36,9 +36,9 @@ typedef struct { /* memory mapped buffer */
36
36
  } git_map;
37
37
 
38
38
  #define GIT_MMAP_VALIDATE(out, len, prot, flags) do { \
39
- assert(out != NULL && len > 0); \
40
- assert((prot & GIT_PROT_WRITE) || (prot & GIT_PROT_READ)); \
41
- assert((flags & GIT_MAP_FIXED) == 0); } while (0)
39
+ GIT_ASSERT(out != NULL && len > 0); \
40
+ GIT_ASSERT((prot & GIT_PROT_WRITE) || (prot & GIT_PROT_READ)); \
41
+ GIT_ASSERT((flags & GIT_MAP_FIXED) == 0); } while (0)
42
42
 
43
43
  extern int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, off64_t offset);
44
44
  extern int p_munmap(git_map *map);
@@ -112,7 +112,7 @@ static int merge_bases_many(git_commit_list **out, git_revwalk **walk_out, git_r
112
112
  if (commit == NULL)
113
113
  goto on_error;
114
114
 
115
- if (git_merge__bases_many(&result, walk, commit, &list) < 0)
115
+ if (git_merge__bases_many(&result, walk, commit, &list, 0) < 0)
116
116
  goto on_error;
117
117
 
118
118
  if (!result) {
@@ -139,7 +139,9 @@ int git_merge_base_many(git_oid *out, git_repository *repo, size_t length, const
139
139
  git_commit_list *result = NULL;
140
140
  int error = 0;
141
141
 
142
- assert(out && repo && input_array);
142
+ GIT_ASSERT_ARG(out);
143
+ GIT_ASSERT_ARG(repo);
144
+ GIT_ASSERT_ARG(input_array);
143
145
 
144
146
  if ((error = merge_bases_many(&result, &walk, repo, length, input_array)) < 0)
145
147
  return error;
@@ -159,7 +161,9 @@ int git_merge_bases_many(git_oidarray *out, git_repository *repo, size_t length,
159
161
  int error = 0;
160
162
  git_array_oid_t array;
161
163
 
162
- assert(out && repo && input_array);
164
+ GIT_ASSERT_ARG(out);
165
+ GIT_ASSERT_ARG(repo);
166
+ GIT_ASSERT_ARG(input_array);
163
167
 
164
168
  if ((error = merge_bases_many(&result, &walk, repo, length, input_array)) < 0)
165
169
  return error;
@@ -193,7 +197,9 @@ int git_merge_base_octopus(git_oid *out, git_repository *repo, size_t length, co
193
197
  unsigned int i;
194
198
  int error = -1;
195
199
 
196
- assert(out && repo && input_array);
200
+ GIT_ASSERT_ARG(out);
201
+ GIT_ASSERT_ARG(repo);
202
+ GIT_ASSERT_ARG(input_array);
197
203
 
198
204
  if (length < 2) {
199
205
  git_error_set(GIT_ERROR_INVALID, "at least two commits are required to find an ancestor");
@@ -237,7 +243,7 @@ static int merge_bases(git_commit_list **out, git_revwalk **walk_out, git_reposi
237
243
  if (commit == NULL)
238
244
  goto on_error;
239
245
 
240
- if (git_merge__bases_many(&result, walk, commit, &list) < 0)
246
+ if (git_merge__bases_many(&result, walk, commit, &list, 0) < 0)
241
247
  goto on_error;
242
248
 
243
249
  if (!result) {
@@ -372,7 +378,11 @@ static int clear_commit_marks(git_commit_list_node *commit, unsigned int mark)
372
378
  }
373
379
 
374
380
  static int paint_down_to_common(
375
- git_commit_list **out, git_revwalk *walk, git_commit_list_node *one, git_vector *twos)
381
+ git_commit_list **out,
382
+ git_revwalk *walk,
383
+ git_commit_list_node *one,
384
+ git_vector *twos,
385
+ uint32_t minimum_generation)
376
386
  {
377
387
  git_pqueue list;
378
388
  git_commit_list *result = NULL;
@@ -381,7 +391,7 @@ static int paint_down_to_common(
381
391
  int error;
382
392
  unsigned int i;
383
393
 
384
- if (git_pqueue_init(&list, 0, twos->length * 2, git_commit_list_time_cmp) < 0)
394
+ if (git_pqueue_init(&list, 0, twos->length * 2, git_commit_list_generation_cmp) < 0)
385
395
  return -1;
386
396
 
387
397
  one->flags |= PARENT1;
@@ -393,7 +403,6 @@ static int paint_down_to_common(
393
403
  return -1;
394
404
 
395
405
  two->flags |= PARENT2;
396
-
397
406
  if (git_pqueue_insert(&list, two) < 0)
398
407
  return -1;
399
408
  }
@@ -421,6 +430,8 @@ static int paint_down_to_common(
421
430
  git_commit_list_node *p = commit->parents[i];
422
431
  if ((p->flags & flags) == flags)
423
432
  continue;
433
+ if (p->generation < minimum_generation)
434
+ continue;
424
435
 
425
436
  if ((error = git_commit_list_parse(walk, p)) < 0)
426
437
  return error;
@@ -436,7 +447,7 @@ static int paint_down_to_common(
436
447
  return 0;
437
448
  }
438
449
 
439
- static int remove_redundant(git_revwalk *walk, git_vector *commits)
450
+ static int remove_redundant(git_revwalk *walk, git_vector *commits, uint32_t minimum_generation)
440
451
  {
441
452
  git_vector work = GIT_VECTOR_INIT;
442
453
  unsigned char *redundant;
@@ -472,7 +483,7 @@ static int remove_redundant(git_revwalk *walk, git_vector *commits)
472
483
  goto done;
473
484
  }
474
485
 
475
- error = paint_down_to_common(&common, walk, commit, &work);
486
+ error = paint_down_to_common(&common, walk, commit, &work, minimum_generation);
476
487
  if (error < 0)
477
488
  goto done;
478
489
 
@@ -504,7 +515,12 @@ done:
504
515
  return error;
505
516
  }
506
517
 
507
- int git_merge__bases_many(git_commit_list **out, git_revwalk *walk, git_commit_list_node *one, git_vector *twos)
518
+ int git_merge__bases_many(
519
+ git_commit_list **out,
520
+ git_revwalk *walk,
521
+ git_commit_list_node *one,
522
+ git_vector *twos,
523
+ uint32_t minimum_generation)
508
524
  {
509
525
  int error;
510
526
  unsigned int i;
@@ -526,7 +542,7 @@ int git_merge__bases_many(git_commit_list **out, git_revwalk *walk, git_commit_l
526
542
  if (git_commit_list_parse(walk, one) < 0)
527
543
  return -1;
528
544
 
529
- error = paint_down_to_common(&result, walk, one, twos);
545
+ error = paint_down_to_common(&result, walk, one, twos, minimum_generation);
530
546
  if (error < 0)
531
547
  return error;
532
548
 
@@ -553,7 +569,7 @@ int git_merge__bases_many(git_commit_list **out, git_revwalk *walk, git_commit_l
553
569
 
554
570
  if ((error = clear_commit_marks(one, ALL_FLAGS)) < 0 ||
555
571
  (error = clear_commit_marks_many(twos, ALL_FLAGS)) < 0 ||
556
- (error = remove_redundant(walk, &redundant)) < 0) {
572
+ (error = remove_redundant(walk, &redundant, minimum_generation)) < 0) {
557
573
  git_vector_free(&redundant);
558
574
  return error;
559
575
  }
@@ -581,7 +597,8 @@ int git_repository_mergehead_foreach(
581
597
  git_oid oid;
582
598
  int error = 0;
583
599
 
584
- assert(repo && cb);
600
+ GIT_ASSERT_ARG(repo);
601
+ GIT_ASSERT_ARG(cb);
585
602
 
586
603
  if ((error = git_buf_joinpath(&merge_head_path, repo->gitdir,
587
604
  GIT_MERGE_HEAD_FILE)) < 0)
@@ -650,7 +667,9 @@ static int merge_conflict_resolve_trivial(
650
667
  git_index_entry const *result = NULL;
651
668
  int error = 0;
652
669
 
653
- assert(resolved && diff_list && conflict);
670
+ GIT_ASSERT_ARG(resolved);
671
+ GIT_ASSERT_ARG(diff_list);
672
+ GIT_ASSERT_ARG(conflict);
654
673
 
655
674
  *resolved = 0;
656
675
 
@@ -733,7 +752,9 @@ static int merge_conflict_resolve_one_removed(
733
752
  int ours_changed, theirs_changed;
734
753
  int error = 0;
735
754
 
736
- assert(resolved && diff_list && conflict);
755
+ GIT_ASSERT_ARG(resolved);
756
+ GIT_ASSERT_ARG(diff_list);
757
+ GIT_ASSERT_ARG(conflict);
737
758
 
738
759
  *resolved = 0;
739
760
 
@@ -773,7 +794,9 @@ static int merge_conflict_resolve_one_renamed(
773
794
  git_index_entry *merged;
774
795
  int error = 0;
775
796
 
776
- assert(resolved && diff_list && conflict);
797
+ GIT_ASSERT_ARG(resolved);
798
+ GIT_ASSERT_ARG(diff_list);
799
+ GIT_ASSERT_ARG(conflict);
777
800
 
778
801
  *resolved = 0;
779
802
 
@@ -917,7 +940,9 @@ static int merge_conflict_resolve_contents(
917
940
  bool fallback = false;
918
941
  int error;
919
942
 
920
- assert(resolved && diff_list && conflict);
943
+ GIT_ASSERT_ARG(resolved);
944
+ GIT_ASSERT_ARG(diff_list);
945
+ GIT_ASSERT_ARG(conflict);
921
946
 
922
947
  *resolved = 0;
923
948
 
@@ -1517,9 +1542,11 @@ int git_merge_diff_list__find_renames(
1517
1542
  size_t src_count, tgt_count, i;
1518
1543
  int error = 0;
1519
1544
 
1520
- assert(diff_list && opts);
1545
+ GIT_ASSERT_ARG(diff_list);
1546
+ GIT_ASSERT_ARG(opts);
1521
1547
 
1522
- if ((opts->flags & GIT_MERGE_FIND_RENAMES) == 0)
1548
+ if ((opts->flags & GIT_MERGE_FIND_RENAMES) == 0 ||
1549
+ !diff_list->conflicts.length)
1523
1550
  return 0;
1524
1551
 
1525
1552
  similarity_ours = git__calloc(diff_list->conflicts.length,
@@ -1843,7 +1870,8 @@ static int merge_normalize_opts(
1843
1870
  git_config_entry *entry = NULL;
1844
1871
  int error = 0;
1845
1872
 
1846
- assert(repo && opts);
1873
+ GIT_ASSERT_ARG(repo);
1874
+ GIT_ASSERT_ARG(opts);
1847
1875
 
1848
1876
  if ((error = git_repository_config__weakptr(&cfg, repo)) < 0)
1849
1877
  return error;
@@ -2070,7 +2098,8 @@ int git_merge__iterators(
2070
2098
  size_t i;
2071
2099
  int error = 0;
2072
2100
 
2073
- assert(out && repo);
2101
+ GIT_ASSERT_ARG(out);
2102
+ GIT_ASSERT_ARG(repo);
2074
2103
 
2075
2104
  *out = NULL;
2076
2105
 
@@ -2154,7 +2183,8 @@ int git_merge_trees(
2154
2183
  git_iterator_options iter_opts = GIT_ITERATOR_OPTIONS_INIT;
2155
2184
  int error;
2156
2185
 
2157
- assert(out && repo);
2186
+ GIT_ASSERT_ARG(out);
2187
+ GIT_ASSERT_ARG(repo);
2158
2188
 
2159
2189
  /* if one side is treesame to the ancestor, take the other side */
2160
2190
  if (ancestor_tree && merge_opts && (merge_opts->flags & GIT_MERGE_SKIP_REUC)) {
@@ -2444,7 +2474,8 @@ static int write_merge_head(
2444
2474
  size_t i;
2445
2475
  int error = 0;
2446
2476
 
2447
- assert(repo && heads);
2477
+ GIT_ASSERT_ARG(repo);
2478
+ GIT_ASSERT_ARG(heads);
2448
2479
 
2449
2480
  if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_MERGE_HEAD_FILE)) < 0 ||
2450
2481
  (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_CREATE_LEADING_DIRS, GIT_MERGE_FILE_MODE)) < 0)
@@ -2472,7 +2503,7 @@ static int write_merge_mode(git_repository *repo)
2472
2503
  git_buf file_path = GIT_BUF_INIT;
2473
2504
  int error = 0;
2474
2505
 
2475
- assert(repo);
2506
+ GIT_ASSERT_ARG(repo);
2476
2507
 
2477
2508
  if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_MERGE_MODE_FILE)) < 0 ||
2478
2509
  (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_CREATE_LEADING_DIRS, GIT_MERGE_FILE_MODE)) < 0)
@@ -2692,7 +2723,8 @@ static int write_merge_msg(
2692
2723
  char sep = 0;
2693
2724
  int error = 0;
2694
2725
 
2695
- assert(repo && heads);
2726
+ GIT_ASSERT_ARG(repo);
2727
+ GIT_ASSERT_ARG(heads);
2696
2728
 
2697
2729
  entries = git__calloc(heads_len, sizeof(struct merge_msg_entry));
2698
2730
  GIT_ERROR_CHECK_ALLOC(entries);
@@ -2803,7 +2835,9 @@ int git_merge__setup(
2803
2835
  {
2804
2836
  int error = 0;
2805
2837
 
2806
- assert (repo && our_head && heads);
2838
+ GIT_ASSERT_ARG(repo);
2839
+ GIT_ASSERT_ARG(our_head);
2840
+ GIT_ASSERT_ARG(heads);
2807
2841
 
2808
2842
  if ((error = git_repository__set_orig_head(repo, git_annotated_commit_id(our_head))) == 0 &&
2809
2843
  (error = write_merge_head(repo, heads, heads_len)) == 0 &&
@@ -2827,7 +2861,9 @@ static int merge_ancestor_head(
2827
2861
  size_t i, alloc_len;
2828
2862
  int error = 0;
2829
2863
 
2830
- assert(repo && our_head && their_heads);
2864
+ GIT_ASSERT_ARG(repo);
2865
+ GIT_ASSERT_ARG(our_head);
2866
+ GIT_ASSERT_ARG(their_heads);
2831
2867
 
2832
2868
  GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, their_heads_len, 1);
2833
2869
  oids = git__calloc(alloc_len, sizeof(git_oid));
@@ -3205,7 +3241,10 @@ int git_merge_analysis_for_ref(
3205
3241
  int error = 0;
3206
3242
  bool unborn;
3207
3243
 
3208
- assert(analysis_out && preference_out && repo && their_heads && their_heads_len > 0);
3244
+ GIT_ASSERT_ARG(analysis_out);
3245
+ GIT_ASSERT_ARG(preference_out);
3246
+ GIT_ASSERT_ARG(repo);
3247
+ GIT_ASSERT_ARG(their_heads && their_heads_len > 0);
3209
3248
 
3210
3249
  if (their_heads_len != 1) {
3211
3250
  git_error_set(GIT_ERROR_MERGE, "can only merge a single branch");
@@ -3287,7 +3326,8 @@ int git_merge(
3287
3326
  unsigned int checkout_strategy;
3288
3327
  int error = 0;
3289
3328
 
3290
- assert(repo && their_heads && their_heads_len > 0);
3329
+ GIT_ASSERT_ARG(repo);
3330
+ GIT_ASSERT_ARG(their_heads && their_heads_len > 0);
3291
3331
 
3292
3332
  if (their_heads_len != 1) {
3293
3333
  git_error_set(GIT_ERROR_MERGE, "can only merge a single branch");