rugged 0.26.7 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (341) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/ext/rugged/rugged_blame.c +6 -3
  4. data/ext/rugged/rugged_branch_collection.c +3 -6
  5. data/ext/rugged/rugged_commit.c +56 -0
  6. data/ext/rugged/rugged_config.c +44 -9
  7. data/ext/rugged/rugged_diff.c +3 -14
  8. data/ext/rugged/rugged_diff_hunk.c +1 -3
  9. data/ext/rugged/rugged_index.c +1 -5
  10. data/ext/rugged/rugged_note.c +1 -4
  11. data/ext/rugged/rugged_patch.c +1 -4
  12. data/ext/rugged/rugged_reference_collection.c +1 -7
  13. data/ext/rugged/rugged_remote.c +5 -8
  14. data/ext/rugged/rugged_remote_collection.c +1 -6
  15. data/ext/rugged/rugged_repo.c +16 -48
  16. data/ext/rugged/rugged_revwalk.c +7 -16
  17. data/ext/rugged/rugged_settings.c +28 -0
  18. data/ext/rugged/rugged_submodule_collection.c +3 -4
  19. data/ext/rugged/rugged_tag_collection.c +1 -5
  20. data/ext/rugged/rugged_tree.c +2 -3
  21. data/lib/rugged/repository.rb +43 -0
  22. data/lib/rugged/version.rb +1 -1
  23. data/vendor/libgit2/AUTHORS +1 -0
  24. data/vendor/libgit2/CMakeLists.txt +61 -510
  25. data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +14 -0
  26. data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +25 -8
  27. data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +27 -8
  28. data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +20 -0
  29. data/vendor/libgit2/cmake/Modules/IdeSplitSources.cmake +22 -0
  30. data/vendor/libgit2/deps/http-parser/CMakeLists.txt +3 -0
  31. data/vendor/libgit2/deps/regex/CMakeLists.txt +2 -0
  32. data/vendor/libgit2/deps/winhttp/CMakeLists.txt +26 -0
  33. data/vendor/libgit2/deps/zlib/CMakeLists.txt +4 -0
  34. data/vendor/libgit2/include/git2/config.h +29 -2
  35. data/vendor/libgit2/include/git2/describe.h +1 -1
  36. data/vendor/libgit2/include/git2/diff.h +59 -8
  37. data/vendor/libgit2/include/git2/graph.h +3 -0
  38. data/vendor/libgit2/include/git2/merge.h +6 -0
  39. data/vendor/libgit2/include/git2/message.h +43 -3
  40. data/vendor/libgit2/include/git2/notes.h +89 -0
  41. data/vendor/libgit2/include/git2/odb.h +8 -1
  42. data/vendor/libgit2/include/git2/patch.h +2 -2
  43. data/vendor/libgit2/include/git2/pathspec.h +35 -18
  44. data/vendor/libgit2/include/git2/refs.h +3 -0
  45. data/vendor/libgit2/include/git2/remote.h +34 -4
  46. data/vendor/libgit2/include/git2/repository.h +6 -6
  47. data/vendor/libgit2/include/git2/reset.h +4 -4
  48. data/vendor/libgit2/include/git2/status.h +4 -0
  49. data/vendor/libgit2/include/git2/sys/config.h +4 -1
  50. data/vendor/libgit2/include/git2/sys/odb_backend.h +2 -1
  51. data/vendor/libgit2/include/git2/tree.h +4 -3
  52. data/vendor/libgit2/include/git2/types.h +1 -0
  53. data/vendor/libgit2/include/git2/version.h +4 -4
  54. data/vendor/libgit2/include/git2/worktree.h +1 -1
  55. data/vendor/libgit2/src/CMakeLists.txt +463 -0
  56. data/vendor/libgit2/src/annotated_commit.c +1 -1
  57. data/vendor/libgit2/src/annotated_commit.h +2 -0
  58. data/vendor/libgit2/src/apply.c +2 -1
  59. data/vendor/libgit2/src/apply.h +2 -0
  60. data/vendor/libgit2/src/attr.c +24 -4
  61. data/vendor/libgit2/src/attr.h +2 -0
  62. data/vendor/libgit2/src/attr_file.c +9 -2
  63. data/vendor/libgit2/src/attr_file.h +2 -0
  64. data/vendor/libgit2/src/attrcache.c +9 -1
  65. data/vendor/libgit2/src/attrcache.h +2 -0
  66. data/vendor/libgit2/src/blame.c +1 -0
  67. data/vendor/libgit2/src/blame.h +2 -1
  68. data/vendor/libgit2/src/blame_git.c +1 -0
  69. data/vendor/libgit2/src/blame_git.h +2 -0
  70. data/vendor/libgit2/src/blob.c +2 -2
  71. data/vendor/libgit2/src/blob.h +2 -0
  72. data/vendor/libgit2/src/branch.c +8 -1
  73. data/vendor/libgit2/src/branch.h +2 -0
  74. data/vendor/libgit2/src/buf_text.c +7 -7
  75. data/vendor/libgit2/src/buf_text.h +3 -3
  76. data/vendor/libgit2/src/buffer.c +31 -1
  77. data/vendor/libgit2/src/buffer.h +3 -0
  78. data/vendor/libgit2/src/cache.c +2 -2
  79. data/vendor/libgit2/src/cache.h +2 -0
  80. data/vendor/libgit2/src/cc-compat.h +3 -3
  81. data/vendor/libgit2/src/checkout.c +30 -19
  82. data/vendor/libgit2/src/checkout.h +2 -0
  83. data/vendor/libgit2/src/cherrypick.c +1 -0
  84. data/vendor/libgit2/src/clone.c +2 -1
  85. data/vendor/libgit2/src/clone.h +4 -0
  86. data/vendor/libgit2/src/commit.c +2 -1
  87. data/vendor/libgit2/src/commit.h +2 -0
  88. data/vendor/libgit2/src/commit_list.c +1 -1
  89. data/vendor/libgit2/src/commit_list.h +2 -0
  90. data/vendor/libgit2/src/common.h +11 -5
  91. data/vendor/libgit2/src/config.c +12 -10
  92. data/vendor/libgit2/src/config.h +2 -0
  93. data/vendor/libgit2/src/config_cache.c +1 -0
  94. data/vendor/libgit2/src/config_file.c +287 -786
  95. data/vendor/libgit2/src/config_file.h +4 -3
  96. data/vendor/libgit2/src/config_parse.c +525 -0
  97. data/vendor/libgit2/src/config_parse.h +64 -0
  98. data/vendor/libgit2/src/crlf.c +2 -1
  99. data/vendor/libgit2/src/delta.c +28 -30
  100. data/vendor/libgit2/src/delta.h +1 -0
  101. data/vendor/libgit2/src/describe.c +3 -1
  102. data/vendor/libgit2/src/diff.c +148 -2
  103. data/vendor/libgit2/src/diff.h +3 -1
  104. data/vendor/libgit2/src/diff_driver.c +12 -9
  105. data/vendor/libgit2/src/diff_driver.h +4 -1
  106. data/vendor/libgit2/src/diff_file.c +7 -4
  107. data/vendor/libgit2/src/diff_file.h +1 -0
  108. data/vendor/libgit2/src/diff_generate.c +6 -3
  109. data/vendor/libgit2/src/diff_generate.h +6 -1
  110. data/vendor/libgit2/src/diff_parse.c +5 -4
  111. data/vendor/libgit2/src/diff_parse.h +2 -0
  112. data/vendor/libgit2/src/diff_print.c +2 -0
  113. data/vendor/libgit2/src/diff_stats.c +2 -0
  114. data/vendor/libgit2/src/diff_tform.c +2 -1
  115. data/vendor/libgit2/src/diff_tform.h +4 -1
  116. data/vendor/libgit2/src/diff_xdiff.c +5 -2
  117. data/vendor/libgit2/src/diff_xdiff.h +2 -0
  118. data/vendor/libgit2/src/errors.c +2 -0
  119. data/vendor/libgit2/src/features.h.in +36 -0
  120. data/vendor/libgit2/src/fetch.c +2 -2
  121. data/vendor/libgit2/src/fetch.h +4 -0
  122. data/vendor/libgit2/src/fetchhead.c +3 -3
  123. data/vendor/libgit2/src/fetchhead.h +3 -0
  124. data/vendor/libgit2/src/filebuf.c +2 -1
  125. data/vendor/libgit2/src/filebuf.h +2 -0
  126. data/vendor/libgit2/src/fileops.c +12 -1
  127. data/vendor/libgit2/src/fileops.h +7 -1
  128. data/vendor/libgit2/src/filter.c +2 -1
  129. data/vendor/libgit2/src/filter.h +1 -0
  130. data/vendor/libgit2/src/fnmatch.c +2 -2
  131. data/vendor/libgit2/src/fnmatch.h +3 -4
  132. data/vendor/libgit2/src/global.c +4 -3
  133. data/vendor/libgit2/src/global.h +1 -5
  134. data/vendor/libgit2/src/graph.c +2 -0
  135. data/vendor/libgit2/src/hash.c +0 -1
  136. data/vendor/libgit2/src/hash.h +3 -1
  137. data/vendor/libgit2/src/hash/hash_collisiondetect.h +3 -3
  138. data/vendor/libgit2/src/hash/hash_common_crypto.h +18 -5
  139. data/vendor/libgit2/src/hash/hash_generic.c +2 -2
  140. data/vendor/libgit2/src/hash/hash_generic.h +5 -3
  141. data/vendor/libgit2/src/hash/hash_openssl.h +3 -3
  142. data/vendor/libgit2/src/hash/hash_win32.c +57 -14
  143. data/vendor/libgit2/src/hash/hash_win32.h +4 -3
  144. data/vendor/libgit2/src/hashsig.c +3 -0
  145. data/vendor/libgit2/src/ident.c +2 -0
  146. data/vendor/libgit2/src/idxmap.h +2 -1
  147. data/vendor/libgit2/src/ignore.c +14 -2
  148. data/vendor/libgit2/src/ignore.h +2 -0
  149. data/vendor/libgit2/src/index.c +20 -40
  150. data/vendor/libgit2/src/index.h +2 -0
  151. data/vendor/libgit2/src/indexer.c +13 -5
  152. data/vendor/libgit2/src/indexer.h +5 -1
  153. data/vendor/libgit2/src/integer.h +1 -1
  154. data/vendor/libgit2/src/iterator.c +44 -3
  155. data/vendor/libgit2/src/iterator.h +3 -0
  156. data/vendor/libgit2/src/map.h +1 -1
  157. data/vendor/libgit2/src/merge.c +155 -33
  158. data/vendor/libgit2/src/merge.h +2 -0
  159. data/vendor/libgit2/src/merge_driver.c +2 -2
  160. data/vendor/libgit2/src/merge_driver.h +2 -0
  161. data/vendor/libgit2/src/merge_file.c +3 -0
  162. data/vendor/libgit2/src/message.h +3 -1
  163. data/vendor/libgit2/src/mwindow.c +1 -1
  164. data/vendor/libgit2/src/mwindow.h +2 -0
  165. data/vendor/libgit2/src/netops.c +75 -62
  166. data/vendor/libgit2/src/netops.h +2 -1
  167. data/vendor/libgit2/src/notes.c +164 -48
  168. data/vendor/libgit2/src/notes.h +1 -1
  169. data/vendor/libgit2/src/object.c +14 -3
  170. data/vendor/libgit2/src/object.h +4 -0
  171. data/vendor/libgit2/src/object_api.c +3 -2
  172. data/vendor/libgit2/src/odb.c +104 -38
  173. data/vendor/libgit2/src/odb.h +3 -1
  174. data/vendor/libgit2/src/odb_loose.c +414 -267
  175. data/vendor/libgit2/src/odb_mempack.c +1 -0
  176. data/vendor/libgit2/src/odb_pack.c +2 -1
  177. data/vendor/libgit2/src/offmap.h +1 -0
  178. data/vendor/libgit2/src/oid.c +2 -1
  179. data/vendor/libgit2/src/oid.h +3 -8
  180. data/vendor/libgit2/src/oidarray.c +2 -1
  181. data/vendor/libgit2/src/oidarray.h +1 -0
  182. data/vendor/libgit2/src/oidmap.h +1 -0
  183. data/vendor/libgit2/src/pack-objects.c +5 -1
  184. data/vendor/libgit2/src/pack-objects.h +1 -1
  185. data/vendor/libgit2/src/pack.c +2 -6
  186. data/vendor/libgit2/src/pack.h +2 -1
  187. data/vendor/libgit2/src/parse.c +121 -0
  188. data/vendor/libgit2/src/parse.h +61 -0
  189. data/vendor/libgit2/src/patch.c +9 -2
  190. data/vendor/libgit2/src/patch.h +2 -0
  191. data/vendor/libgit2/src/patch_generate.c +6 -5
  192. data/vendor/libgit2/src/patch_generate.h +1 -0
  193. data/vendor/libgit2/src/patch_parse.c +265 -276
  194. data/vendor/libgit2/src/patch_parse.h +6 -11
  195. data/vendor/libgit2/src/path.c +24 -181
  196. data/vendor/libgit2/src/path.h +14 -73
  197. data/vendor/libgit2/src/pathspec.c +2 -1
  198. data/vendor/libgit2/src/pathspec.h +2 -1
  199. data/vendor/libgit2/src/pool.c +8 -0
  200. data/vendor/libgit2/src/pool.h +1 -0
  201. data/vendor/libgit2/src/posix.c +2 -1
  202. data/vendor/libgit2/src/posix.h +1 -0
  203. data/vendor/libgit2/src/pqueue.c +1 -0
  204. data/vendor/libgit2/src/pqueue.h +2 -0
  205. data/vendor/libgit2/src/proxy.c +2 -1
  206. data/vendor/libgit2/src/proxy.h +3 -1
  207. data/vendor/libgit2/src/push.c +4 -171
  208. data/vendor/libgit2/src/push.h +2 -0
  209. data/vendor/libgit2/src/rebase.c +1 -0
  210. data/vendor/libgit2/src/refdb.c +2 -3
  211. data/vendor/libgit2/src/refdb.h +2 -0
  212. data/vendor/libgit2/src/refdb_fs.c +5 -3
  213. data/vendor/libgit2/src/refdb_fs.h +4 -0
  214. data/vendor/libgit2/src/reflog.c +1 -0
  215. data/vendor/libgit2/src/reflog.h +2 -1
  216. data/vendor/libgit2/src/refs.c +1 -0
  217. data/vendor/libgit2/src/refs.h +2 -1
  218. data/vendor/libgit2/src/refspec.c +2 -2
  219. data/vendor/libgit2/src/refspec.h +2 -0
  220. data/vendor/libgit2/src/remote.c +56 -10
  221. data/vendor/libgit2/src/remote.h +2 -0
  222. data/vendor/libgit2/src/repository.c +16 -14
  223. data/vendor/libgit2/src/repository.h +2 -0
  224. data/vendor/libgit2/src/reset.c +6 -5
  225. data/vendor/libgit2/src/revert.c +1 -0
  226. data/vendor/libgit2/src/revparse.c +3 -5
  227. data/vendor/libgit2/src/revwalk.c +2 -2
  228. data/vendor/libgit2/src/revwalk.h +2 -0
  229. data/vendor/libgit2/src/settings.c +6 -8
  230. data/vendor/libgit2/src/sha1_lookup.c +2 -216
  231. data/vendor/libgit2/src/sha1_lookup.h +2 -6
  232. data/vendor/libgit2/src/signature.c +8 -3
  233. data/vendor/libgit2/src/signature.h +2 -0
  234. data/vendor/libgit2/src/sortedcache.c +7 -0
  235. data/vendor/libgit2/src/sortedcache.h +2 -0
  236. data/vendor/libgit2/src/stash.c +1 -0
  237. data/vendor/libgit2/src/status.c +14 -9
  238. data/vendor/libgit2/src/status.h +2 -0
  239. data/vendor/libgit2/src/{curl_stream.c → streams/curl.c} +2 -0
  240. data/vendor/libgit2/src/{curl_stream.h → streams/curl.h} +4 -2
  241. data/vendor/libgit2/src/{openssl_stream.c → streams/openssl.c} +47 -18
  242. data/vendor/libgit2/src/{openssl_stream.h → streams/openssl.h} +6 -2
  243. data/vendor/libgit2/src/{socket_stream.c → streams/socket.c} +2 -2
  244. data/vendor/libgit2/src/{socket_stream.h → streams/socket.h} +4 -2
  245. data/vendor/libgit2/src/{stransport_stream.c → streams/stransport.c} +4 -2
  246. data/vendor/libgit2/src/{stransport_stream.h → streams/stransport.h} +4 -2
  247. data/vendor/libgit2/src/{tls_stream.c → streams/tls.c} +4 -3
  248. data/vendor/libgit2/src/{tls_stream.h → streams/tls.h} +4 -2
  249. data/vendor/libgit2/src/submodule.c +28 -80
  250. data/vendor/libgit2/src/submodule.h +2 -13
  251. data/vendor/libgit2/src/sysdir.c +75 -8
  252. data/vendor/libgit2/src/sysdir.h +2 -1
  253. data/vendor/libgit2/src/tag.c +2 -2
  254. data/vendor/libgit2/src/tag.h +2 -0
  255. data/vendor/libgit2/src/thread-utils.c +1 -0
  256. data/vendor/libgit2/src/thread-utils.h +1 -1
  257. data/vendor/libgit2/src/trace.c +2 -2
  258. data/vendor/libgit2/src/trace.h +2 -0
  259. data/vendor/libgit2/src/trailer.c +416 -0
  260. data/vendor/libgit2/src/transaction.c +2 -1
  261. data/vendor/libgit2/src/transport.c +2 -0
  262. data/vendor/libgit2/src/transports/auth.c +2 -1
  263. data/vendor/libgit2/src/transports/auth.h +4 -3
  264. data/vendor/libgit2/src/transports/auth_negotiate.c +2 -1
  265. data/vendor/libgit2/src/transports/auth_negotiate.h +3 -3
  266. data/vendor/libgit2/src/transports/cred.c +2 -0
  267. data/vendor/libgit2/src/transports/cred.h +4 -2
  268. data/vendor/libgit2/src/transports/cred_helpers.c +1 -0
  269. data/vendor/libgit2/src/transports/git.c +3 -1
  270. data/vendor/libgit2/src/transports/http.c +10 -14
  271. data/vendor/libgit2/src/transports/http.h +23 -0
  272. data/vendor/libgit2/src/transports/local.c +23 -5
  273. data/vendor/libgit2/src/transports/smart.c +3 -1
  274. data/vendor/libgit2/src/transports/smart.h +23 -16
  275. data/vendor/libgit2/src/transports/smart_pkt.c +114 -130
  276. data/vendor/libgit2/src/transports/smart_protocol.c +26 -22
  277. data/vendor/libgit2/src/transports/ssh.c +12 -7
  278. data/vendor/libgit2/src/transports/ssh.h +4 -2
  279. data/vendor/libgit2/src/transports/winhttp.c +19 -21
  280. data/vendor/libgit2/src/tree-cache.c +1 -0
  281. data/vendor/libgit2/src/tree-cache.h +1 -0
  282. data/vendor/libgit2/src/tree.c +20 -14
  283. data/vendor/libgit2/src/tree.h +2 -0
  284. data/vendor/libgit2/src/tsort.c +0 -1
  285. data/vendor/libgit2/src/unix/map.c +4 -1
  286. data/vendor/libgit2/src/unix/posix.h +8 -4
  287. data/vendor/libgit2/src/unix/pthread.h +1 -1
  288. data/vendor/libgit2/src/unix/realpath.c +4 -1
  289. data/vendor/libgit2/src/util.c +6 -5
  290. data/vendor/libgit2/src/util.h +39 -111
  291. data/vendor/libgit2/src/varint.c +0 -1
  292. data/vendor/libgit2/src/varint.h +2 -0
  293. data/vendor/libgit2/src/vector.c +1 -1
  294. data/vendor/libgit2/src/win32/dir.c +3 -0
  295. data/vendor/libgit2/src/win32/dir.h +4 -3
  296. data/vendor/libgit2/src/win32/error.c +1 -1
  297. data/vendor/libgit2/src/win32/error.h +4 -2
  298. data/vendor/libgit2/src/win32/findfile.c +2 -1
  299. data/vendor/libgit2/src/win32/findfile.h +4 -2
  300. data/vendor/libgit2/src/win32/map.c +2 -0
  301. data/vendor/libgit2/src/win32/mingw-compat.h +3 -3
  302. data/vendor/libgit2/src/win32/msvc-compat.h +3 -3
  303. data/vendor/libgit2/src/win32/path_w32.c +7 -12
  304. data/vendor/libgit2/src/win32/path_w32.h +3 -2
  305. data/vendor/libgit2/src/win32/posix.h +2 -2
  306. data/vendor/libgit2/src/win32/posix_w32.c +11 -5
  307. data/vendor/libgit2/src/win32/precompiled.h +2 -1
  308. data/vendor/libgit2/src/win32/reparse.h +2 -2
  309. data/vendor/libgit2/src/win32/thread.c +1 -0
  310. data/vendor/libgit2/src/win32/thread.h +2 -2
  311. data/vendor/libgit2/src/win32/utf-conv.c +0 -1
  312. data/vendor/libgit2/src/win32/utf-conv.h +4 -3
  313. data/vendor/libgit2/src/win32/w32_buffer.c +1 -1
  314. data/vendor/libgit2/src/win32/w32_buffer.h +4 -2
  315. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +2 -1
  316. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +85 -2
  317. data/vendor/libgit2/src/win32/w32_stack.c +2 -1
  318. data/vendor/libgit2/src/win32/w32_stack.h +5 -3
  319. data/vendor/libgit2/src/win32/w32_util.h +4 -2
  320. data/vendor/libgit2/src/win32/win32-compat.h +3 -3
  321. data/vendor/libgit2/src/worktree.c +4 -5
  322. data/vendor/libgit2/src/worktree.h +2 -0
  323. data/vendor/libgit2/src/xdiff/xdiff.h +22 -13
  324. data/vendor/libgit2/src/xdiff/xdiffi.c +523 -81
  325. data/vendor/libgit2/src/xdiff/xdiffi.h +2 -2
  326. data/vendor/libgit2/src/xdiff/xemit.c +63 -39
  327. data/vendor/libgit2/src/xdiff/xemit.h +2 -2
  328. data/vendor/libgit2/src/xdiff/xhistogram.c +0 -1
  329. data/vendor/libgit2/src/xdiff/xinclude.h +3 -2
  330. data/vendor/libgit2/src/xdiff/xmacros.h +2 -2
  331. data/vendor/libgit2/src/xdiff/xmerge.c +80 -20
  332. data/vendor/libgit2/src/xdiff/xpatience.c +41 -9
  333. data/vendor/libgit2/src/xdiff/xprepare.c +2 -2
  334. data/vendor/libgit2/src/xdiff/xprepare.h +2 -2
  335. data/vendor/libgit2/src/xdiff/xtypes.h +2 -2
  336. data/vendor/libgit2/src/xdiff/xutils.c +47 -27
  337. data/vendor/libgit2/src/xdiff/xutils.h +2 -5
  338. data/vendor/libgit2/src/zstream.c +65 -45
  339. data/vendor/libgit2/src/zstream.h +9 -2
  340. metadata +27 -13
  341. data/vendor/libgit2/include/git2/sys/remote.h +0 -16
@@ -4,8 +4,12 @@
4
4
  * This file is part of libgit2, distributed under the GNU GPL v2 with
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
- #ifndef INCLUDE_posix__unix_h__
8
- #define INCLUDE_posix__unix_h__
7
+ #ifndef INCLUDE_unix_posix_h__
8
+ #define INCLUDE_unix_posix_h__
9
+
10
+ #ifndef LIBGIT2_NO_FEATURES_H
11
+ # include "git2/sys/features.h"
12
+ #endif
9
13
 
10
14
  #include <stdio.h>
11
15
  #include <dirent.h>
@@ -71,7 +75,7 @@ GIT_INLINE(int) p_fsync(int fd)
71
75
 
72
76
  #define p_timeval timeval
73
77
 
74
- #ifdef HAVE_FUTIMENS
78
+ #ifdef GIT_USE_FUTIMENS
75
79
  GIT_INLINE(int) p_futimes(int f, const struct p_timeval t[2])
76
80
  {
77
81
  struct timespec s[2];
@@ -85,7 +89,7 @@ GIT_INLINE(int) p_futimes(int f, const struct p_timeval t[2])
85
89
  # define p_futimes futimes
86
90
  #endif
87
91
 
88
- #ifdef HAVE_REGCOMP_L
92
+ #ifdef GIT_USE_REGCOMP_L
89
93
  #include <xlocale.h>
90
94
  GIT_INLINE(int) p_regcomp(regex_t *preg, const char *pattern, int cflags)
91
95
  {
@@ -53,4 +53,4 @@ typedef struct {
53
53
  #define git_rwlock_free(a) pthread_rwlock_destroy(a)
54
54
  #define GIT_RWLOCK_STATIC_INIT PTHREAD_RWLOCK_INITIALIZER
55
55
 
56
- #endif /* INCLUDE_unix_pthread_h__ */
56
+ #endif
@@ -4,7 +4,10 @@
4
4
  * This file is part of libgit2, distributed under the GNU GPL v2 with
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
- #include <git2/common.h>
7
+
8
+ #include "common.h"
9
+
10
+ #include "git2/common.h"
8
11
 
9
12
  #ifndef GIT_WIN32
10
13
 
@@ -4,11 +4,10 @@
4
4
  * This file is part of libgit2, distributed under the GNU GPL v2 with
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
- #include <git2.h>
7
+
8
+ #include "util.h"
9
+
8
10
  #include "common.h"
9
- #include <stdio.h>
10
- #include <ctype.h>
11
- #include "posix.h"
12
11
 
13
12
  #ifdef GIT_WIN32
14
13
  # include "win32/w32_buffer.h"
@@ -476,9 +475,11 @@ uint32_t git__hash(const void *key, int len, uint32_t seed)
476
475
 
477
476
  switch(len & 3) {
478
477
  case 3: k1 ^= tail[2] << 16;
478
+ /* fall through */
479
479
  case 2: k1 ^= tail[1] << 8;
480
+ /* fall through */
480
481
  case 1: k1 ^= tail[0];
481
- MURMUR_BLOCK();
482
+ MURMUR_BLOCK();
482
483
  }
483
484
 
484
485
  h1 ^= len;
@@ -7,42 +7,18 @@
7
7
  #ifndef INCLUDE_util_h__
8
8
  #define INCLUDE_util_h__
9
9
 
10
- #include "git2/buffer.h"
11
- #include "buffer.h"
10
+ #include "common.h"
12
11
 
13
- #if defined(GIT_MSVC_CRTDBG)
14
- /* Enable MSVC CRTDBG memory leak reporting.
15
- *
16
- * We DO NOT use the "_CRTDBG_MAP_ALLOC" macro described in the MSVC
17
- * documentation because all allocs/frees in libgit2 already go through
18
- * the "git__" routines defined in this file. Simply using the normal
19
- * reporting mechanism causes all leaks to be attributed to a routine
20
- * here in util.h (ie, the actual call to calloc()) rather than the
21
- * caller of git__calloc().
22
- *
23
- * Therefore, we declare a set of "git__crtdbg__" routines to replace
24
- * the corresponding "git__" routines and re-define the "git__" symbols
25
- * as macros. This allows us to get and report the file:line info of
26
- * the real caller.
27
- *
28
- * We DO NOT replace the "git__free" routine because it needs to remain
29
- * a function pointer because it is used as a function argument when
30
- * setting up various structure "destructors".
31
- *
32
- * We also DO NOT use the "_CRTDBG_MAP_ALLOC" macro because it causes
33
- * "free" to be remapped to "_free_dbg" and this causes problems for
34
- * structures which define a field named "free".
35
- *
36
- * Finally, CRTDBG must be explicitly enabled and configured at program
37
- * startup. See tests/main.c for an example.
38
- */
39
- #include <stdlib.h>
40
- #include <crtdbg.h>
41
- #include "win32/w32_crtdbg_stacktrace.h"
12
+ #ifndef GIT_WIN32
13
+ # include <ctype.h>
42
14
  #endif
43
15
 
16
+ #include "git2/buffer.h"
17
+
18
+ #include "buffer.h"
44
19
  #include "common.h"
45
20
  #include "strnlen.h"
21
+ #include "thread-utils.h"
46
22
 
47
23
  #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
48
24
  #define bitsizeof(x) (CHAR_BIT * sizeof(x))
@@ -67,79 +43,33 @@
67
43
 
68
44
  #if defined(GIT_MSVC_CRTDBG)
69
45
 
70
- GIT_INLINE(void *) git__crtdbg__malloc(size_t len, const char *file, int line)
71
- {
72
- void *ptr = _malloc_dbg(len, _NORMAL_BLOCK, git_win32__crtdbg_stacktrace(1,file), line);
73
- if (!ptr) giterr_set_oom();
74
- return ptr;
75
- }
76
-
77
- GIT_INLINE(void *) git__crtdbg__calloc(size_t nelem, size_t elsize, const char *file, int line)
78
- {
79
- void *ptr = _calloc_dbg(nelem, elsize, _NORMAL_BLOCK, git_win32__crtdbg_stacktrace(1,file), line);
80
- if (!ptr) giterr_set_oom();
81
- return ptr;
82
- }
83
-
84
- GIT_INLINE(char *) git__crtdbg__strdup(const char *str, const char *file, int line)
85
- {
86
- char *ptr = _strdup_dbg(str, _NORMAL_BLOCK, git_win32__crtdbg_stacktrace(1,file), line);
87
- if (!ptr) giterr_set_oom();
88
- return ptr;
89
- }
90
-
91
- GIT_INLINE(char *) git__crtdbg__strndup(const char *str, size_t n, const char *file, int line)
92
- {
93
- size_t length = 0, alloclength;
94
- char *ptr;
95
-
96
- length = p_strnlen(str, n);
97
-
98
- if (GIT_ADD_SIZET_OVERFLOW(&alloclength, length, 1) ||
99
- !(ptr = git__crtdbg__malloc(alloclength, file, line)))
100
- return NULL;
101
-
102
- if (length)
103
- memcpy(ptr, str, length);
104
-
105
- ptr[length] = '\0';
106
-
107
- return ptr;
108
- }
109
-
110
- GIT_INLINE(char *) git__crtdbg__substrdup(const char *start, size_t n, const char *file, int line)
111
- {
112
- char *ptr;
113
- size_t alloclen;
114
-
115
- if (GIT_ADD_SIZET_OVERFLOW(&alloclen, n, 1) ||
116
- !(ptr = git__crtdbg__malloc(alloclen, file, line)))
117
- return NULL;
118
-
119
- memcpy(ptr, start, n);
120
- ptr[n] = '\0';
121
- return ptr;
122
- }
123
-
124
- GIT_INLINE(void *) git__crtdbg__realloc(void *ptr, size_t size, const char *file, int line)
125
- {
126
- void *new_ptr = _realloc_dbg(ptr, size, _NORMAL_BLOCK, git_win32__crtdbg_stacktrace(1,file), line);
127
- if (!new_ptr) giterr_set_oom();
128
- return new_ptr;
129
- }
130
-
131
- GIT_INLINE(void *) git__crtdbg__reallocarray(void *ptr, size_t nelem, size_t elsize, const char *file, int line)
132
- {
133
- size_t newsize;
134
-
135
- return GIT_MULTIPLY_SIZET_OVERFLOW(&newsize, nelem, elsize) ?
136
- NULL : _realloc_dbg(ptr, newsize, _NORMAL_BLOCK, git_win32__crtdbg_stacktrace(1,file), line);
137
- }
46
+ /* Enable MSVC CRTDBG memory leak reporting.
47
+ *
48
+ * We DO NOT use the "_CRTDBG_MAP_ALLOC" macro described in the MSVC
49
+ * documentation because all allocs/frees in libgit2 already go through
50
+ * the "git__" routines defined in this file. Simply using the normal
51
+ * reporting mechanism causes all leaks to be attributed to a routine
52
+ * here in util.h (ie, the actual call to calloc()) rather than the
53
+ * caller of git__calloc().
54
+ *
55
+ * Therefore, we declare a set of "git__crtdbg__" routines to replace
56
+ * the corresponding "git__" routines and re-define the "git__" symbols
57
+ * as macros. This allows us to get and report the file:line info of
58
+ * the real caller.
59
+ *
60
+ * We DO NOT replace the "git__free" routine because it needs to remain
61
+ * a function pointer because it is used as a function argument when
62
+ * setting up various structure "destructors".
63
+ *
64
+ * We also DO NOT use the "_CRTDBG_MAP_ALLOC" macro because it causes
65
+ * "free" to be remapped to "_free_dbg" and this causes problems for
66
+ * structures which define a field named "free".
67
+ *
68
+ * Finally, CRTDBG must be explicitly enabled and configured at program
69
+ * startup. See tests/main.c for an example.
70
+ */
138
71
 
139
- GIT_INLINE(void *) git__crtdbg__mallocarray(size_t nelem, size_t elsize, const char *file, int line)
140
- {
141
- return git__crtdbg__reallocarray(NULL, nelem, elsize, file, line);
142
- }
72
+ #include "win32/w32_crtdbg_stacktrace.h"
143
73
 
144
74
  #define git__malloc(len) git__crtdbg__malloc(len, __FILE__, __LINE__)
145
75
  #define git__calloc(nelem, elsize) git__crtdbg__calloc(nelem, elsize, __FILE__, __LINE__)
@@ -364,8 +294,6 @@ extern int git__strncasecmp(const char *a, const char *b, size_t sz);
364
294
 
365
295
  extern int git__strcasesort_cmp(const char *a, const char *b);
366
296
 
367
- #include "thread-utils.h"
368
-
369
297
  typedef struct {
370
298
  git_atomic refcount;
371
299
  void *owner;
@@ -374,22 +302,22 @@ typedef struct {
374
302
  typedef void (*git_refcount_freeptr)(void *r);
375
303
 
376
304
  #define GIT_REFCOUNT_INC(r) { \
377
- git_atomic_inc(&((git_refcount *)(r))->refcount); \
305
+ git_atomic_inc(&(r)->rc.refcount); \
378
306
  }
379
307
 
380
308
  #define GIT_REFCOUNT_DEC(_r, do_free) { \
381
- git_refcount *r = (git_refcount *)(_r); \
309
+ git_refcount *r = &(_r)->rc; \
382
310
  int val = git_atomic_dec(&r->refcount); \
383
311
  if (val <= 0 && r->owner == NULL) { do_free(_r); } \
384
312
  }
385
313
 
386
314
  #define GIT_REFCOUNT_OWN(r, o) { \
387
- ((git_refcount *)(r))->owner = o; \
315
+ (r)->rc.owner = o; \
388
316
  }
389
317
 
390
- #define GIT_REFCOUNT_OWNER(r) (((git_refcount *)(r))->owner)
318
+ #define GIT_REFCOUNT_OWNER(r) ((r)->rc.owner)
391
319
 
392
- #define GIT_REFCOUNT_VAL(r) git_atomic_get(&((git_refcount *)(r))->refcount)
320
+ #define GIT_REFCOUNT_VAL(r) git_atomic_get((r)->rc.refcount)
393
321
 
394
322
 
395
323
  static signed char from_hex[] = {
@@ -615,4 +543,4 @@ GIT_INLINE(double) git__timer(void)
615
543
 
616
544
  extern int git__getenv(git_buf *out, const char *name);
617
545
 
618
- #endif /* INCLUDE_util_h__ */
546
+ #endif
@@ -5,7 +5,6 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
- #include "common.h"
9
8
  #include "varint.h"
10
9
 
11
10
  uintmax_t git_decode_varint(const unsigned char *bufp, size_t *varint_len)
@@ -7,6 +7,8 @@
7
7
  #ifndef INCLUDE_varint_h__
8
8
  #define INCLUDE_varint_h__
9
9
 
10
+ #include "common.h"
11
+
10
12
  #include <stdint.h>
11
13
 
12
14
  extern int git_encode_varint(unsigned char *, size_t, uintmax_t);
@@ -5,8 +5,8 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
- #include "common.h"
9
8
  #include "vector.h"
9
+
10
10
  #include "integer.h"
11
11
 
12
12
  /* In elements, not bytes */
@@ -4,6 +4,9 @@
4
4
  * This file is part of libgit2, distributed under the GNU GPL v2 with
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
+
8
+ #include "dir.h"
9
+
7
10
  #define GIT__WIN32_NO_WRAP_DIR
8
11
  #include "posix.h"
9
12
 
@@ -4,10 +4,11 @@
4
4
  * This file is part of libgit2, distributed under the GNU GPL v2 with
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
- #ifndef INCLUDE_dir_h__
8
- #define INCLUDE_dir_h__
7
+ #ifndef INCLUDE_win32_dir_h__
8
+ #define INCLUDE_win32_dir_h__
9
9
 
10
10
  #include "common.h"
11
+
11
12
  #include "w32_util.h"
12
13
 
13
14
  struct git__dirent {
@@ -40,4 +41,4 @@ extern int git__closedir(git__DIR *);
40
41
  # define closedir git__closedir
41
42
  # endif
42
43
 
43
- #endif /* INCLUDE_dir_h__ */
44
+ #endif
@@ -5,8 +5,8 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
- #include "common.h"
9
8
  #include "error.h"
9
+
10
10
  #include "utf-conv.h"
11
11
 
12
12
  #ifdef GIT_WINHTTP
@@ -5,8 +5,10 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
- #ifndef INCLUDE_git_win32_error_h__
9
- #define INCLUDE_git_win32_error_h__
8
+ #ifndef INCLUDE_win32_error_h__
9
+ #define INCLUDE_win32_error_h__
10
+
11
+ #include "common.h"
10
12
 
11
13
  extern char *git_win32_get_error_message(DWORD error_code);
12
14
 
@@ -5,10 +5,11 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
+ #include "findfile.h"
9
+
8
10
  #include "path_w32.h"
9
11
  #include "utf-conv.h"
10
12
  #include "path.h"
11
- #include "findfile.h"
12
13
 
13
14
  #define REG_MSYSGIT_INSTALL_LOCAL L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Git_is1"
14
15
 
@@ -5,8 +5,10 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
- #ifndef INCLUDE_git_findfile_h__
9
- #define INCLUDE_git_findfile_h__
8
+ #ifndef INCLUDE_win32_findfile_h__
9
+ #define INCLUDE_win32_findfile_h__
10
+
11
+ #include "common.h"
10
12
 
11
13
  extern int git_win32__find_system_dirs(git_buf *out, const wchar_t *subpath);
12
14
  extern int git_win32__find_global_dirs(git_buf *out);
@@ -5,6 +5,8 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
+ #include "common.h"
9
+
8
10
  #include "map.h"
9
11
  #include <errno.h>
10
12
 
@@ -4,8 +4,8 @@
4
4
  * This file is part of libgit2, distributed under the GNU GPL v2 with
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
- #ifndef INCLUDE_mingw_compat__
8
- #define INCLUDE_mingw_compat__
7
+ #ifndef INCLUDE_win32_mingw_compat_h__
8
+ #define INCLUDE_win32_mingw_compat_h__
9
9
 
10
10
  #if defined(__MINGW32__)
11
11
 
@@ -20,4 +20,4 @@ void __mingworg_MemoryBarrier(void);
20
20
 
21
21
  #endif
22
22
 
23
- #endif /* INCLUDE_mingw_compat__ */
23
+ #endif
@@ -4,8 +4,8 @@
4
4
  * This file is part of libgit2, distributed under the GNU GPL v2 with
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
- #ifndef INCLUDE_msvc_compat__
8
- #define INCLUDE_msvc_compat__
7
+ #ifndef INCLUDE_win32_msvc_compat_h__
8
+ #define INCLUDE_win32_msvc_compat_h__
9
9
 
10
10
  #if defined(_MSC_VER)
11
11
 
@@ -19,4 +19,4 @@ typedef SSIZE_T ssize_t;
19
19
 
20
20
  #define GIT_STDLIB_CALL __cdecl
21
21
 
22
- #endif /* INCLUDE_msvc_compat__ */
22
+ #endif
@@ -5,9 +5,9 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
- #include "common.h"
9
- #include "path.h"
10
8
  #include "path_w32.h"
9
+
10
+ #include "path.h"
11
11
  #include "utf-conv.h"
12
12
  #include "posix.h"
13
13
  #include "reparse.h"
@@ -18,11 +18,6 @@
18
18
 
19
19
  #define PATH__ABSOLUTE_LEN 3
20
20
 
21
- #define path__is_dirsep(p) ((p) == '/' || (p) == '\\')
22
-
23
- #define path__is_absolute(p) \
24
- (git__isalpha((p)[0]) && (p)[1] == ':' && ((p)[2] == '\\' || (p)[2] == '/'))
25
-
26
21
  #define path__is_nt_namespace(p) \
27
22
  (((p)[0] == '\\' && (p)[1] == '\\' && (p)[2] == '?' && (p)[3] == '\\') || \
28
23
  ((p)[0] == '/' && (p)[1] == '/' && (p)[2] == '?' && (p)[3] == '/'))
@@ -59,7 +54,7 @@ static wchar_t *path__skip_server(wchar_t *path)
59
54
  wchar_t *c;
60
55
 
61
56
  for (c = path; *c; c++) {
62
- if (path__is_dirsep(*c))
57
+ if (git_path_is_dirsep(*c))
63
58
  return c + 1;
64
59
  }
65
60
 
@@ -73,9 +68,9 @@ static wchar_t *path__skip_prefix(wchar_t *path)
73
68
 
74
69
  if (wcsncmp(path, L"UNC\\", 4) == 0)
75
70
  path = path__skip_server(path + 4);
76
- else if (path__is_absolute(path))
71
+ else if (git_path_is_absolute(path))
77
72
  path += PATH__ABSOLUTE_LEN;
78
- } else if (path__is_absolute(path)) {
73
+ } else if (git_path_is_absolute(path)) {
79
74
  path += PATH__ABSOLUTE_LEN;
80
75
  } else if (path__is_unc(path)) {
81
76
  path = path__skip_server(path + 2);
@@ -196,7 +191,7 @@ int git_win32_path_from_utf8(git_win32_path out, const char *src)
196
191
  dest += PATH__NT_NAMESPACE_LEN;
197
192
 
198
193
  /* See if this is an absolute path (beginning with a drive letter) */
199
- if (path__is_absolute(src)) {
194
+ if (git_path_is_absolute(src)) {
200
195
  if (git__utf8_to_16(dest, MAX_PATH, src) < 0)
201
196
  goto on_error;
202
197
  }
@@ -220,7 +215,7 @@ int git_win32_path_from_utf8(git_win32_path out, const char *src)
220
215
  if (path__cwd(dest, MAX_PATH) < 0)
221
216
  goto on_error;
222
217
 
223
- if (!path__is_absolute(dest)) {
218
+ if (!git_path_is_absolute(dest)) {
224
219
  errno = ENOENT;
225
220
  goto on_error;
226
221
  }