rugged 0.27.10.1 → 0.28.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (297) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rugged/extconf.rb +23 -2
  3. data/ext/rugged/rugged.c +48 -2
  4. data/ext/rugged/rugged.h +5 -0
  5. data/ext/rugged/rugged_allocator.c +89 -0
  6. data/ext/rugged/rugged_blob.c +3 -3
  7. data/ext/rugged/rugged_branch.c +1 -1
  8. data/ext/rugged/rugged_commit.c +8 -8
  9. data/ext/rugged/rugged_config.c +1 -1
  10. data/ext/rugged/rugged_diff.c +24 -4
  11. data/ext/rugged/rugged_note.c +1 -1
  12. data/ext/rugged/rugged_repo.c +10 -10
  13. data/ext/rugged/rugged_settings.c +1 -1
  14. data/lib/rugged/version.rb +1 -1
  15. data/vendor/libgit2/CMakeLists.txt +69 -47
  16. data/vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake +15 -1
  17. data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +5 -8
  18. data/vendor/libgit2/cmake/Modules/FindmbedTLS.cmake +93 -0
  19. data/vendor/libgit2/deps/http-parser/CMakeLists.txt +2 -0
  20. data/vendor/libgit2/deps/http-parser/{LICENSE-MIT → COPYING} +0 -0
  21. data/vendor/libgit2/deps/regex/COPYING +502 -0
  22. data/vendor/libgit2/deps/winhttp/COPYING.GPL +993 -0
  23. data/vendor/libgit2/deps/winhttp/COPYING.LGPL +502 -0
  24. data/vendor/libgit2/deps/zlib/CMakeLists.txt +1 -0
  25. data/vendor/libgit2/deps/zlib/COPYING +27 -0
  26. data/vendor/libgit2/include/git2.h +3 -0
  27. data/vendor/libgit2/include/git2/annotated_commit.h +9 -0
  28. data/vendor/libgit2/include/git2/apply.h +129 -0
  29. data/vendor/libgit2/include/git2/attr.h +19 -8
  30. data/vendor/libgit2/include/git2/blame.h +41 -24
  31. data/vendor/libgit2/include/git2/blob.h +1 -1
  32. data/vendor/libgit2/include/git2/branch.h +1 -1
  33. data/vendor/libgit2/include/git2/buffer.h +2 -2
  34. data/vendor/libgit2/include/git2/checkout.h +20 -19
  35. data/vendor/libgit2/include/git2/cherrypick.h +6 -4
  36. data/vendor/libgit2/include/git2/clone.h +11 -9
  37. data/vendor/libgit2/include/git2/commit.h +30 -2
  38. data/vendor/libgit2/include/git2/common.h +54 -4
  39. data/vendor/libgit2/include/git2/config.h +18 -7
  40. data/vendor/libgit2/include/git2/deprecated.h +253 -0
  41. data/vendor/libgit2/include/git2/describe.h +30 -7
  42. data/vendor/libgit2/include/git2/diff.h +193 -143
  43. data/vendor/libgit2/include/git2/errors.h +54 -46
  44. data/vendor/libgit2/include/git2/ignore.h +2 -2
  45. data/vendor/libgit2/include/git2/index.h +72 -51
  46. data/vendor/libgit2/include/git2/indexer.h +30 -4
  47. data/vendor/libgit2/include/git2/mailmap.h +115 -0
  48. data/vendor/libgit2/include/git2/merge.h +29 -8
  49. data/vendor/libgit2/include/git2/net.h +1 -1
  50. data/vendor/libgit2/include/git2/notes.h +1 -1
  51. data/vendor/libgit2/include/git2/object.h +16 -16
  52. data/vendor/libgit2/include/git2/odb.h +10 -10
  53. data/vendor/libgit2/include/git2/odb_backend.h +7 -7
  54. data/vendor/libgit2/include/git2/oid.h +1 -1
  55. data/vendor/libgit2/include/git2/pack.h +2 -2
  56. data/vendor/libgit2/include/git2/proxy.h +9 -5
  57. data/vendor/libgit2/include/git2/rebase.h +7 -4
  58. data/vendor/libgit2/include/git2/refs.h +14 -15
  59. data/vendor/libgit2/include/git2/refspec.h +17 -0
  60. data/vendor/libgit2/include/git2/remote.h +92 -16
  61. data/vendor/libgit2/include/git2/repository.h +52 -37
  62. data/vendor/libgit2/include/git2/revert.h +5 -3
  63. data/vendor/libgit2/include/git2/revwalk.h +7 -7
  64. data/vendor/libgit2/include/git2/signature.h +2 -2
  65. data/vendor/libgit2/include/git2/stash.h +13 -10
  66. data/vendor/libgit2/include/git2/status.h +8 -4
  67. data/vendor/libgit2/include/git2/submodule.h +11 -10
  68. data/vendor/libgit2/include/git2/sys/alloc.h +101 -0
  69. data/vendor/libgit2/include/git2/sys/commit.h +1 -1
  70. data/vendor/libgit2/include/git2/sys/config.h +13 -13
  71. data/vendor/libgit2/include/git2/sys/filter.h +6 -6
  72. data/vendor/libgit2/include/git2/sys/index.h +3 -0
  73. data/vendor/libgit2/include/git2/sys/mempack.h +35 -35
  74. data/vendor/libgit2/include/git2/sys/merge.h +9 -4
  75. data/vendor/libgit2/include/git2/sys/odb_backend.h +19 -19
  76. data/vendor/libgit2/include/git2/sys/path.h +64 -0
  77. data/vendor/libgit2/include/git2/sys/refdb_backend.h +19 -19
  78. data/vendor/libgit2/include/git2/sys/stream.h +92 -12
  79. data/vendor/libgit2/include/git2/sys/transport.h +127 -81
  80. data/vendor/libgit2/include/git2/tag.h +2 -2
  81. data/vendor/libgit2/include/git2/trace.h +1 -1
  82. data/vendor/libgit2/include/git2/transaction.h +1 -0
  83. data/vendor/libgit2/include/git2/transport.h +47 -18
  84. data/vendor/libgit2/include/git2/tree.h +3 -3
  85. data/vendor/libgit2/include/git2/types.h +35 -28
  86. data/vendor/libgit2/include/git2/version.h +4 -4
  87. data/vendor/libgit2/include/git2/worktree.h +47 -12
  88. data/vendor/libgit2/src/CMakeLists.txt +87 -26
  89. data/vendor/libgit2/src/alloc.c +55 -0
  90. data/vendor/libgit2/src/alloc.h +40 -0
  91. data/vendor/libgit2/src/annotated_commit.c +15 -8
  92. data/vendor/libgit2/src/apply.c +490 -14
  93. data/vendor/libgit2/src/apply.h +3 -1
  94. data/vendor/libgit2/src/array.h +2 -2
  95. data/vendor/libgit2/src/attr.c +11 -11
  96. data/vendor/libgit2/src/attr_file.c +20 -15
  97. data/vendor/libgit2/src/attrcache.c +11 -11
  98. data/vendor/libgit2/src/blame.c +30 -15
  99. data/vendor/libgit2/src/blame.h +1 -0
  100. data/vendor/libgit2/src/blame_git.c +16 -13
  101. data/vendor/libgit2/src/blob.c +50 -28
  102. data/vendor/libgit2/src/blob.h +18 -1
  103. data/vendor/libgit2/src/branch.c +38 -38
  104. data/vendor/libgit2/src/buf_text.c +7 -6
  105. data/vendor/libgit2/src/buffer.c +55 -50
  106. data/vendor/libgit2/src/buffer.h +1 -1
  107. data/vendor/libgit2/src/cache.c +16 -16
  108. data/vendor/libgit2/src/cache.h +2 -2
  109. data/vendor/libgit2/src/cc-compat.h +15 -3
  110. data/vendor/libgit2/src/checkout.c +83 -74
  111. data/vendor/libgit2/src/cherrypick.c +6 -6
  112. data/vendor/libgit2/src/clone.c +20 -20
  113. data/vendor/libgit2/src/commit.c +53 -33
  114. data/vendor/libgit2/src/commit.h +1 -0
  115. data/vendor/libgit2/src/commit_list.c +6 -10
  116. data/vendor/libgit2/src/common.h +32 -30
  117. data/vendor/libgit2/src/config.c +167 -147
  118. data/vendor/libgit2/src/config.h +1 -14
  119. data/vendor/libgit2/src/config_backend.h +84 -0
  120. data/vendor/libgit2/src/config_cache.c +7 -1
  121. data/vendor/libgit2/src/config_entries.c +259 -0
  122. data/vendor/libgit2/src/config_entries.h +23 -0
  123. data/vendor/libgit2/src/config_file.c +167 -439
  124. data/vendor/libgit2/src/config_mem.c +224 -0
  125. data/vendor/libgit2/src/config_parse.c +69 -38
  126. data/vendor/libgit2/src/config_parse.h +4 -4
  127. data/vendor/libgit2/src/crlf.c +215 -186
  128. data/vendor/libgit2/src/delta.c +25 -18
  129. data/vendor/libgit2/src/describe.c +23 -23
  130. data/vendor/libgit2/src/diff.c +12 -12
  131. data/vendor/libgit2/src/diff_driver.c +14 -15
  132. data/vendor/libgit2/src/diff_file.c +10 -10
  133. data/vendor/libgit2/src/diff_generate.c +29 -23
  134. data/vendor/libgit2/src/diff_generate.h +1 -1
  135. data/vendor/libgit2/src/diff_parse.c +3 -3
  136. data/vendor/libgit2/src/diff_print.c +17 -17
  137. data/vendor/libgit2/src/diff_stats.c +22 -7
  138. data/vendor/libgit2/src/diff_tform.c +12 -12
  139. data/vendor/libgit2/src/diff_xdiff.c +15 -3
  140. data/vendor/libgit2/src/errors.c +42 -20
  141. data/vendor/libgit2/src/features.h.in +2 -1
  142. data/vendor/libgit2/src/fetch.c +3 -3
  143. data/vendor/libgit2/src/fetchhead.c +16 -16
  144. data/vendor/libgit2/src/filebuf.c +28 -28
  145. data/vendor/libgit2/src/fileops.c +54 -54
  146. data/vendor/libgit2/src/fileops.h +1 -1
  147. data/vendor/libgit2/src/filter.c +30 -30
  148. data/vendor/libgit2/src/filter.h +0 -10
  149. data/vendor/libgit2/src/global.c +36 -23
  150. data/vendor/libgit2/src/hash.h +4 -1
  151. data/vendor/libgit2/src/hash/hash_collisiondetect.h +6 -2
  152. data/vendor/libgit2/src/hash/hash_common_crypto.h +5 -1
  153. data/vendor/libgit2/src/hash/hash_generic.h +5 -1
  154. data/vendor/libgit2/src/hash/hash_mbedtls.c +38 -0
  155. data/vendor/libgit2/src/hash/hash_mbedtls.h +24 -0
  156. data/vendor/libgit2/src/hash/hash_openssl.h +8 -4
  157. data/vendor/libgit2/src/hash/hash_win32.c +13 -13
  158. data/vendor/libgit2/src/hashsig.c +4 -4
  159. data/vendor/libgit2/src/idxmap.c +25 -5
  160. data/vendor/libgit2/src/idxmap.h +4 -18
  161. data/vendor/libgit2/src/ignore.c +9 -9
  162. data/vendor/libgit2/src/index.c +280 -198
  163. data/vendor/libgit2/src/index.h +16 -0
  164. data/vendor/libgit2/src/indexer.c +311 -139
  165. data/vendor/libgit2/src/integer.h +32 -22
  166. data/vendor/libgit2/src/iterator.c +116 -49
  167. data/vendor/libgit2/src/iterator.h +15 -0
  168. data/vendor/libgit2/src/khash.h +3 -1
  169. data/vendor/libgit2/src/mailmap.c +485 -0
  170. data/vendor/libgit2/src/mailmap.h +35 -0
  171. data/vendor/libgit2/src/merge.c +89 -59
  172. data/vendor/libgit2/src/merge_driver.c +7 -7
  173. data/vendor/libgit2/src/merge_file.c +1 -1
  174. data/vendor/libgit2/src/mwindow.c +8 -8
  175. data/vendor/libgit2/src/netops.c +22 -13
  176. data/vendor/libgit2/src/netops.h +2 -0
  177. data/vendor/libgit2/src/notes.c +15 -10
  178. data/vendor/libgit2/src/object.c +118 -67
  179. data/vendor/libgit2/src/object.h +20 -9
  180. data/vendor/libgit2/src/object_api.c +8 -8
  181. data/vendor/libgit2/src/odb.c +72 -72
  182. data/vendor/libgit2/src/odb.h +7 -7
  183. data/vendor/libgit2/src/odb_loose.c +46 -46
  184. data/vendor/libgit2/src/odb_mempack.c +14 -14
  185. data/vendor/libgit2/src/odb_pack.c +14 -10
  186. data/vendor/libgit2/src/offmap.c +30 -0
  187. data/vendor/libgit2/src/offmap.h +20 -11
  188. data/vendor/libgit2/src/oid.c +6 -6
  189. data/vendor/libgit2/src/oidmap.c +20 -0
  190. data/vendor/libgit2/src/oidmap.h +9 -12
  191. data/vendor/libgit2/src/pack-objects.c +71 -63
  192. data/vendor/libgit2/src/pack-objects.h +1 -7
  193. data/vendor/libgit2/src/pack.c +58 -58
  194. data/vendor/libgit2/src/pack.h +6 -6
  195. data/vendor/libgit2/src/parse.h +1 -1
  196. data/vendor/libgit2/src/patch.c +3 -3
  197. data/vendor/libgit2/src/patch_generate.c +18 -18
  198. data/vendor/libgit2/src/patch_parse.c +13 -13
  199. data/vendor/libgit2/src/path.c +93 -225
  200. data/vendor/libgit2/src/path.h +2 -84
  201. data/vendor/libgit2/src/pathspec.c +6 -6
  202. data/vendor/libgit2/src/posix.c +3 -3
  203. data/vendor/libgit2/src/proxy.c +1 -1
  204. data/vendor/libgit2/src/push.c +27 -26
  205. data/vendor/libgit2/src/push.h +2 -1
  206. data/vendor/libgit2/src/reader.c +265 -0
  207. data/vendor/libgit2/src/reader.h +107 -0
  208. data/vendor/libgit2/src/rebase.c +49 -52
  209. data/vendor/libgit2/src/refdb.c +3 -3
  210. data/vendor/libgit2/src/refdb_fs.c +181 -103
  211. data/vendor/libgit2/src/reflog.c +3 -3
  212. data/vendor/libgit2/src/refs.c +98 -74
  213. data/vendor/libgit2/src/refs.h +5 -3
  214. data/vendor/libgit2/src/refspec.c +47 -21
  215. data/vendor/libgit2/src/refspec.h +1 -1
  216. data/vendor/libgit2/src/remote.c +219 -166
  217. data/vendor/libgit2/src/remote.h +9 -0
  218. data/vendor/libgit2/src/repository.c +173 -133
  219. data/vendor/libgit2/src/repository.h +6 -3
  220. data/vendor/libgit2/src/reset.c +8 -8
  221. data/vendor/libgit2/src/revert.c +6 -6
  222. data/vendor/libgit2/src/revparse.c +30 -30
  223. data/vendor/libgit2/src/revwalk.c +60 -30
  224. data/vendor/libgit2/src/revwalk.h +2 -1
  225. data/vendor/libgit2/src/settings.c +42 -10
  226. data/vendor/libgit2/src/signature.c +11 -11
  227. data/vendor/libgit2/src/sortedcache.c +13 -13
  228. data/vendor/libgit2/src/stash.c +91 -45
  229. data/vendor/libgit2/src/status.c +13 -13
  230. data/vendor/libgit2/src/stdalloc.c +120 -0
  231. data/vendor/libgit2/src/{streams/curl.h → stdalloc.h} +6 -6
  232. data/vendor/libgit2/src/stream.h +17 -2
  233. data/vendor/libgit2/src/streams/mbedtls.c +483 -0
  234. data/vendor/libgit2/src/streams/mbedtls.h +23 -0
  235. data/vendor/libgit2/src/streams/openssl.c +204 -114
  236. data/vendor/libgit2/src/streams/openssl.h +4 -108
  237. data/vendor/libgit2/src/streams/registry.c +118 -0
  238. data/vendor/libgit2/src/streams/registry.h +19 -0
  239. data/vendor/libgit2/src/streams/socket.c +54 -29
  240. data/vendor/libgit2/src/streams/stransport.c +57 -32
  241. data/vendor/libgit2/src/streams/stransport.h +5 -0
  242. data/vendor/libgit2/src/streams/tls.c +50 -19
  243. data/vendor/libgit2/src/streams/tls.h +12 -4
  244. data/vendor/libgit2/src/strmap.c +22 -2
  245. data/vendor/libgit2/src/strmap.h +18 -15
  246. data/vendor/libgit2/src/submodule.c +179 -155
  247. data/vendor/libgit2/src/sysdir.c +18 -18
  248. data/vendor/libgit2/src/tag.c +31 -26
  249. data/vendor/libgit2/src/tag.h +2 -1
  250. data/vendor/libgit2/src/trace.c +1 -1
  251. data/vendor/libgit2/src/trace.h +1 -1
  252. data/vendor/libgit2/src/trailer.c +6 -6
  253. data/vendor/libgit2/src/transaction.c +23 -23
  254. data/vendor/libgit2/src/transport.c +5 -5
  255. data/vendor/libgit2/src/transports/auth.c +7 -4
  256. data/vendor/libgit2/src/transports/auth.h +1 -1
  257. data/vendor/libgit2/src/transports/auth_negotiate.c +12 -11
  258. data/vendor/libgit2/src/transports/cred.c +18 -18
  259. data/vendor/libgit2/src/transports/git.c +15 -15
  260. data/vendor/libgit2/src/transports/http.c +606 -216
  261. data/vendor/libgit2/src/transports/http.h +2 -0
  262. data/vendor/libgit2/src/transports/local.c +26 -26
  263. data/vendor/libgit2/src/transports/smart.c +54 -31
  264. data/vendor/libgit2/src/transports/smart.h +1 -2
  265. data/vendor/libgit2/src/transports/smart_pkt.c +43 -40
  266. data/vendor/libgit2/src/transports/smart_protocol.c +61 -57
  267. data/vendor/libgit2/src/transports/ssh.c +34 -33
  268. data/vendor/libgit2/src/transports/winhttp.c +99 -119
  269. data/vendor/libgit2/src/tree-cache.c +5 -5
  270. data/vendor/libgit2/src/tree.c +96 -121
  271. data/vendor/libgit2/src/tree.h +1 -12
  272. data/vendor/libgit2/src/unix/map.c +2 -2
  273. data/vendor/libgit2/src/util.c +22 -6
  274. data/vendor/libgit2/src/util.h +12 -135
  275. data/vendor/libgit2/src/vector.c +4 -4
  276. data/vendor/libgit2/src/win32/dir.c +3 -3
  277. data/vendor/libgit2/src/win32/findfile.c +3 -3
  278. data/vendor/libgit2/src/win32/map.c +6 -6
  279. data/vendor/libgit2/src/win32/msvc-compat.h +6 -0
  280. data/vendor/libgit2/src/win32/path_w32.c +101 -7
  281. data/vendor/libgit2/src/win32/path_w32.h +18 -0
  282. data/vendor/libgit2/src/win32/posix_w32.c +24 -43
  283. data/vendor/libgit2/src/win32/w32_buffer.c +2 -2
  284. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +96 -2
  285. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +28 -75
  286. data/vendor/libgit2/src/win32/w32_stack.c +2 -2
  287. data/vendor/libgit2/src/win32/w32_util.c +1 -69
  288. data/vendor/libgit2/src/win32/w32_util.h +1 -19
  289. data/vendor/libgit2/src/worktree.c +75 -54
  290. data/vendor/libgit2/src/worktree.h +2 -0
  291. data/vendor/libgit2/src/xdiff/xdiffi.c +7 -5
  292. data/vendor/libgit2/src/xdiff/xhistogram.c +1 -1
  293. data/vendor/libgit2/src/xdiff/xmerge.c +15 -15
  294. data/vendor/libgit2/src/zstream.c +4 -4
  295. metadata +33 -7
  296. data/vendor/libgit2/src/config_file.h +0 -73
  297. data/vendor/libgit2/src/streams/curl.c +0 -385
@@ -1,3 +1,4 @@
1
+ DISABLE_WARNINGS(implicit-fallthrough)
1
2
  ADD_DEFINITIONS(-DNO_VIZ -DSTDC -DNO_GZIP)
2
3
  FILE(GLOB SRC_ZLIB "*.c" "*.h")
3
4
  INCLUDE_DIRECTORIES(".")
@@ -0,0 +1,27 @@
1
+ Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
2
+
3
+ This software is provided 'as-is', without any express or implied
4
+ warranty. In no event will the authors be held liable for any
5
+ damages arising from the use of this software.
6
+
7
+ Permission is granted to anyone to use this software for any
8
+ purpose, including commercial applications, and to alter it and
9
+ redistribute it freely, subject to the following restrictions:
10
+
11
+ 1. The origin of this software must not be misrepresented; you
12
+ must not claim that you wrote the original software. If you
13
+ use this software in a product, an acknowledgment in the
14
+ product documentation would be appreciated but is not
15
+ required.
16
+
17
+ 2. Altered source versions must be plainly marked as such, and
18
+ must not be misrepresented as being the original software.
19
+
20
+ 3. This notice may not be removed or altered from any source
21
+ distribution.
22
+
23
+ Jean-loup Gailly Mark Adler
24
+
25
+ The data format used by the zlib library is described by RFCs
26
+ (Request for Comments) 1950 to 1952 in the files rfc1950 (zlib
27
+ format), rfc1951 (deflate format) and rfc1952 (gzip format).
@@ -9,6 +9,7 @@
9
9
  #define INCLUDE_git_git_h__
10
10
 
11
11
  #include "git2/annotated_commit.h"
12
+ #include "git2/apply.h"
12
13
  #include "git2/attr.h"
13
14
  #include "git2/blob.h"
14
15
  #include "git2/blame.h"
@@ -20,6 +21,7 @@
20
21
  #include "git2/commit.h"
21
22
  #include "git2/common.h"
22
23
  #include "git2/config.h"
24
+ #include "git2/deprecated.h"
23
25
  #include "git2/describe.h"
24
26
  #include "git2/diff.h"
25
27
  #include "git2/errors.h"
@@ -29,6 +31,7 @@
29
31
  #include "git2/ignore.h"
30
32
  #include "git2/index.h"
31
33
  #include "git2/indexer.h"
34
+ #include "git2/mailmap.h"
32
35
  #include "git2/merge.h"
33
36
  #include "git2/message.h"
34
37
  #include "git2/net.h"
@@ -103,6 +103,15 @@ GIT_EXTERN(int) git_annotated_commit_from_revspec(
103
103
  GIT_EXTERN(const git_oid *) git_annotated_commit_id(
104
104
  const git_annotated_commit *commit);
105
105
 
106
+ /**
107
+ * Get the refname that the given `git_annotated_commit` refers to.
108
+ *
109
+ * @param commit the given annotated commit
110
+ * @return ref name.
111
+ */
112
+ GIT_EXTERN(const char *) git_annotated_commit_ref(
113
+ const git_annotated_commit *commit);
114
+
106
115
  /**
107
116
  * Frees a `git_annotated_commit`.
108
117
  *
@@ -0,0 +1,129 @@
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_git_apply_h__
8
+ #define INCLUDE_git_apply_h__
9
+
10
+ #include "common.h"
11
+ #include "types.h"
12
+ #include "oid.h"
13
+ #include "diff.h"
14
+
15
+ /**
16
+ * @file git2/apply.h
17
+ * @brief Git patch application routines
18
+ * @defgroup git_apply Git patch application routines
19
+ * @ingroup Git
20
+ * @{
21
+ */
22
+ GIT_BEGIN_DECL
23
+
24
+ /**
25
+ * When applying a patch, callback that will be made per delta (file).
26
+ *
27
+ * When the callback:
28
+ * - returns < 0, the apply process will be aborted.
29
+ * - returns > 0, the delta will not be applied, but the apply process
30
+ * continues
31
+ * - returns 0, the delta is applied, and the apply process continues.
32
+ *
33
+ * @param delta The delta to be applied
34
+ * @param payload User-specified payload
35
+ */
36
+ typedef int GIT_CALLBACK(git_apply_delta_cb)(
37
+ const git_diff_delta *delta,
38
+ void *payload);
39
+
40
+ /**
41
+ * When applying a patch, callback that will be made per hunk.
42
+ *
43
+ * When the callback:
44
+ * - returns < 0, the apply process will be aborted.
45
+ * - returns > 0, the hunk will not be applied, but the apply process
46
+ * continues
47
+ * - returns 0, the hunk is applied, and the apply process continues.
48
+ *
49
+ * @param hunk The hunk to be applied
50
+ * @param payload User-specified payload
51
+ */
52
+ typedef int GIT_CALLBACK(git_apply_hunk_cb)(
53
+ const git_diff_hunk *hunk,
54
+ void *payload);
55
+
56
+ /**
57
+ * Apply options structure
58
+ *
59
+ * Initialize with `GIT_APPLY_OPTIONS_INIT`. Alternatively, you can
60
+ * use `git_apply_init_options`.
61
+ *
62
+ * @see git_apply_to_tree, git_apply
63
+ */
64
+ typedef struct {
65
+ unsigned int version;
66
+
67
+ git_apply_delta_cb delta_cb;
68
+ git_apply_hunk_cb hunk_cb;
69
+ void *payload;
70
+ } git_apply_options;
71
+
72
+ #define GIT_APPLY_OPTIONS_VERSION 1
73
+ #define GIT_APPLY_OPTIONS_INIT {GIT_APPLY_OPTIONS_VERSION}
74
+
75
+ /**
76
+ * Apply a `git_diff` to a `git_tree`, and return the resulting image
77
+ * as an index.
78
+ *
79
+ * @param out the postimage of the application
80
+ * @param repo the repository to apply
81
+ * @param preimage the tree to apply the diff to
82
+ * @param diff the diff to apply
83
+ * @param options the options for the apply (or null for defaults)
84
+ */
85
+ GIT_EXTERN(int) git_apply_to_tree(
86
+ git_index **out,
87
+ git_repository *repo,
88
+ git_tree *preimage,
89
+ git_diff *diff,
90
+ const git_apply_options *options);
91
+
92
+ typedef enum {
93
+ /**
94
+ * Apply the patch to the workdir, leaving the index untouched.
95
+ * This is the equivalent of `git apply` with no location argument.
96
+ */
97
+ GIT_APPLY_LOCATION_WORKDIR = 0,
98
+
99
+ /**
100
+ * Apply the patch to the index, leaving the working directory
101
+ * untouched. This is the equivalent of `git apply --cached`.
102
+ */
103
+ GIT_APPLY_LOCATION_INDEX = 1,
104
+
105
+ /**
106
+ * Apply the patch to both the working directory and the index.
107
+ * This is the equivalent of `git apply --index`.
108
+ */
109
+ GIT_APPLY_LOCATION_BOTH = 2,
110
+ } git_apply_location_t;
111
+
112
+ /**
113
+ * Apply a `git_diff` to the given repository, making changes directly
114
+ * in the working directory, the index, or both.
115
+ *
116
+ * @param repo the repository to apply to
117
+ * @param diff the diff to apply
118
+ * @param location the location to apply (workdir, index or both)
119
+ * @param options the options for the apply (or null for defaults)
120
+ */
121
+ GIT_EXTERN(int) git_apply(
122
+ git_repository *repo,
123
+ git_diff *diff,
124
+ git_apply_location_t location,
125
+ const git_apply_options *options);
126
+
127
+ /** @} */
128
+ GIT_END_DECL
129
+ #endif
@@ -186,7 +186,23 @@ GIT_EXTERN(int) git_attr_get_many(
186
186
  size_t num_attr,
187
187
  const char **names);
188
188
 
189
- typedef int (*git_attr_foreach_cb)(const char *name, const char *value, void *payload);
189
+ /**
190
+ * The callback used with git_attr_foreach.
191
+ *
192
+ * This callback will be invoked only once per attribute name, even if there
193
+ * are multiple rules for a given file. The highest priority rule will be
194
+ * used.
195
+ *
196
+ * @see git_attr_foreach.
197
+ *
198
+ * @param name The attribute name.
199
+ * @param value The attribute value. May be NULL if the attribute is explicitly
200
+ * set to UNSPECIFIED using the '!' sign.
201
+ * @param payload A user-specified pointer.
202
+ * @return 0 to continue looping, non-zero to stop. This value will be returned
203
+ * from git_attr_foreach.
204
+ */
205
+ typedef int GIT_CALLBACK(git_attr_foreach_cb)(const char *name, const char *value, void *payload);
190
206
 
191
207
  /**
192
208
  * Loop over all the git attributes for a path.
@@ -196,13 +212,8 @@ typedef int (*git_attr_foreach_cb)(const char *name, const char *value, void *pa
196
212
  * @param path Path inside the repo to check attributes. This does not have
197
213
  * to exist, but if it does not, then it will be treated as a
198
214
  * plain file (i.e. not a directory).
199
- * @param callback Function to invoke on each attribute name and value. The
200
- * value may be NULL is the attribute is explicitly set to
201
- * UNSPECIFIED using the '!' sign. Callback will be invoked
202
- * only once per attribute name, even if there are multiple
203
- * rules for a given file. The highest priority rule will be
204
- * used. Return a non-zero value from this to stop looping.
205
- * The value will be returned from `git_attr_foreach`.
215
+ * @param callback Function to invoke on each attribute name and value.
216
+ * See git_attr_foreach_cb.
206
217
  * @param payload Passed on as extra parameter to callback function.
207
218
  * @return 0 on success, non-zero callback return value, or error code
208
219
  */
@@ -43,38 +43,47 @@ typedef enum {
43
43
  /** Restrict the search of commits to those reachable following only the
44
44
  * first parents. */
45
45
  GIT_BLAME_FIRST_PARENT = (1<<4),
46
+ /** Use mailmap file to map author and committer names and email addresses
47
+ * to canonical real names and email addresses. The mailmap will be read
48
+ * from the working directory, or HEAD in a bare repository. */
49
+ GIT_BLAME_USE_MAILMAP = (1<<5),
46
50
  } git_blame_flag_t;
47
51
 
48
52
  /**
49
53
  * Blame options structure
50
54
  *
51
- * Use zeros to indicate default settings. It's easiest to use the
52
- * `GIT_BLAME_OPTIONS_INIT` macro:
53
- * git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
55
+ * Initialize with `GIT_BLAME_OPTIONS_INIT`. Alternatively, you can
56
+ * use `git_blame_init_options`.
54
57
  *
55
- * - `flags` is a combination of the `git_blame_flag_t` values above.
56
- * - `min_match_characters` is the lower bound on the number of alphanumeric
57
- * characters that must be detected as moving/copying within a file for it to
58
- * associate those lines with the parent commit. The default value is 20.
59
- * This value only takes effect if any of the `GIT_BLAME_TRACK_COPIES_*`
60
- * flags are specified.
61
- * - `newest_commit` is the id of the newest commit to consider. The default
62
- * is HEAD.
63
- * - `oldest_commit` is the id of the oldest commit to consider. The default
64
- * is the first commit encountered with a NULL parent.
65
- * - `min_line` is the first line in the file to blame. The default is 1 (line
66
- * numbers start with 1).
67
- * - `max_line` is the last line in the file to blame. The default is the last
68
- * line of the file.
69
58
  */
70
59
  typedef struct git_blame_options {
71
60
  unsigned int version;
72
61
 
62
+ /** A combination of `git_blame_flag_t` */
73
63
  uint32_t flags;
64
+ /** The lower bound on the number of alphanumeric
65
+ * characters that must be detected as moving/copying within a file for it to
66
+ * associate those lines with the parent commit. The default value is 20.
67
+ * This value only takes effect if any of the `GIT_BLAME_TRACK_COPIES_*`
68
+ * flags are specified.
69
+ */
74
70
  uint16_t min_match_characters;
71
+ /** The id of the newest commit to consider. The default is HEAD. */
75
72
  git_oid newest_commit;
73
+ /**
74
+ * The id of the oldest commit to consider.
75
+ * The default is the first commit encountered with a NULL parent.
76
+ */
76
77
  git_oid oldest_commit;
78
+ /**
79
+ * The first line in the file to blame.
80
+ * The default is 1 (line numbers start with 1).
81
+ */
77
82
  size_t min_line;
83
+ /**
84
+ * The last line in the file to blame.
85
+ * The default is the last line of the file.
86
+ */
78
87
  size_t max_line;
79
88
  } git_blame_options;
80
89
 
@@ -82,11 +91,13 @@ typedef struct git_blame_options {
82
91
  #define GIT_BLAME_OPTIONS_INIT {GIT_BLAME_OPTIONS_VERSION}
83
92
 
84
93
  /**
85
- * Initializes a `git_blame_options` with default values. Equivalent to
86
- * creating an instance with GIT_BLAME_OPTIONS_INIT.
94
+ * Initialize git_blame_options structure
87
95
  *
88
- * @param opts The `git_blame_options` struct to initialize
89
- * @param version Version of struct; pass `GIT_BLAME_OPTIONS_VERSION`
96
+ * Initializes a `git_blame_options` with default values. Equivalent to creating
97
+ * an instance with GIT_BLAME_OPTIONS_INIT.
98
+ *
99
+ * @param opts The `git_blame_options` struct to initialize.
100
+ * @param version The struct version; pass `GIT_BLAME_OPTIONS_VERSION`.
90
101
  * @return Zero on success; -1 on failure.
91
102
  */
92
103
  GIT_EXTERN(int) git_blame_init_options(
@@ -101,6 +112,9 @@ GIT_EXTERN(int) git_blame_init_options(
101
112
  * changed.
102
113
  * - `final_start_line_number` is the 1-based line number where this hunk
103
114
  * begins, in the final version of the file
115
+ * - `final_signature` is the author of `final_commit_id`. If
116
+ * `GIT_BLAME_USE_MAILMAP` has been specified, it will contain the canonical
117
+ * real name and email address.
104
118
  * - `orig_commit_id` is the OID of the commit where this hunk was found. This
105
119
  * will usually be the same as `final_commit_id`, except when
106
120
  * `GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES` has been specified.
@@ -109,6 +123,9 @@ GIT_EXTERN(int) git_blame_init_options(
109
123
  * - `orig_start_line_number` is the 1-based line number where this hunk begins
110
124
  * in the file named by `orig_path` in the commit specified by
111
125
  * `orig_commit_id`.
126
+ * - `orig_signature` is the author of `orig_commit_id`. If
127
+ * `GIT_BLAME_USE_MAILMAP` has been specified, it will contain the canonical
128
+ * real name and email address.
112
129
  * - `boundary` is 1 iff the hunk has been tracked to a boundary commit (the
113
130
  * root, or the commit specified in git_blame_options.oldest_commit)
114
131
  */
@@ -128,7 +145,7 @@ typedef struct git_blame_hunk {
128
145
  } git_blame_hunk;
129
146
 
130
147
 
131
- /* Opaque structure to hold blame results */
148
+ /** Opaque structure to hold blame results */
132
149
  typedef struct git_blame git_blame;
133
150
 
134
151
  /**
@@ -166,7 +183,7 @@ GIT_EXTERN(const git_blame_hunk*) git_blame_get_hunk_byline(
166
183
  * @param path path to file to consider
167
184
  * @param options options for the blame operation. If NULL, this is treated as
168
185
  * though GIT_BLAME_OPTIONS_INIT were passed.
169
- * @return 0 on success, or an error code. (use giterr_last for information
186
+ * @return 0 on success, or an error code. (use git_error_last for information
170
187
  * about the error.)
171
188
  */
172
189
  GIT_EXTERN(int) git_blame_file(
@@ -190,7 +207,7 @@ GIT_EXTERN(int) git_blame_file(
190
207
  * from git_blame_file)
191
208
  * @param buffer the (possibly) modified contents of the file
192
209
  * @param buffer_len number of valid bytes in the buffer
193
- * @return 0 on success, or an error code. (use giterr_last for information
210
+ * @return 0 on success, or an error code. (use git_error_last for information
194
211
  * about the error)
195
212
  */
196
213
  GIT_EXTERN(int) git_blame_buffer(
@@ -105,7 +105,7 @@ GIT_EXTERN(git_off_t) git_blob_rawsize(const git_blob *blob);
105
105
  * attributes set for the blob and the content detected in it.
106
106
  *
107
107
  * The output is written into a `git_buf` which the caller must free
108
- * when done (via `git_buf_free`).
108
+ * when done (via `git_buf_dispose`).
109
109
  *
110
110
  * If no filters need to be applied, then the `out` buffer will just
111
111
  * be populated with a pointer to the raw content of the blob. In
@@ -278,7 +278,7 @@ GIT_EXTERN(int) git_branch_remote_name(
278
278
 
279
279
 
280
280
  /**
281
- * Retrieve the name fo the upstream remote of a local branch
281
+ * Retrieve the name of the upstream remote of a local branch
282
282
  *
283
283
  * @param buf the buffer into which to write the name
284
284
  * @param repo the repository in which to look
@@ -25,7 +25,7 @@ GIT_BEGIN_DECL
25
25
  * caller and have the caller take responsibility for freeing that memory.
26
26
  * This can be awkward if the caller does not have easy access to the same
27
27
  * allocation functions that libgit2 is using. In those cases, libgit2
28
- * will fill in a `git_buf` and the caller can use `git_buf_free()` to
28
+ * will fill in a `git_buf` and the caller can use `git_buf_dispose()` to
29
29
  * release it when they are done.
30
30
  *
31
31
  * A `git_buf` may also be used for the caller to pass in a reference to
@@ -69,7 +69,7 @@ typedef struct {
69
69
  *
70
70
  * @param buffer The buffer to deallocate
71
71
  */
72
- GIT_EXTERN(void) git_buf_free(git_buf *buffer);
72
+ GIT_EXTERN(void) git_buf_dispose(git_buf *buffer);
73
73
 
74
74
  /**
75
75
  * Resize the buffer allocation to make more space.
@@ -67,7 +67,7 @@ GIT_BEGIN_DECL
67
67
  * To emulate `git checkout -f`, use `GIT_CHECKOUT_FORCE`.
68
68
  *
69
69
  *
70
- * There are some additional flags to modified the behavior of checkout:
70
+ * There are some additional flags to modify the behavior of checkout:
71
71
  *
72
72
  * - GIT_CHECKOUT_ALLOW_CONFLICTS makes SAFE mode apply safe file updates
73
73
  * even if there are conflicts (instead of cancelling the checkout).
@@ -220,7 +220,7 @@ typedef struct {
220
220
  } git_checkout_perfdata;
221
221
 
222
222
  /** Checkout notification callback function */
223
- typedef int (*git_checkout_notify_cb)(
223
+ typedef int GIT_CALLBACK(git_checkout_notify_cb)(
224
224
  git_checkout_notify_t why,
225
225
  const char *path,
226
226
  const git_diff_file *baseline,
@@ -229,29 +229,28 @@ typedef int (*git_checkout_notify_cb)(
229
229
  void *payload);
230
230
 
231
231
  /** Checkout progress notification function */
232
- typedef void (*git_checkout_progress_cb)(
232
+ typedef void GIT_CALLBACK(git_checkout_progress_cb)(
233
233
  const char *path,
234
234
  size_t completed_steps,
235
235
  size_t total_steps,
236
236
  void *payload);
237
237
 
238
238
  /** Checkout perfdata notification function */
239
- typedef void (*git_checkout_perfdata_cb)(
239
+ typedef void GIT_CALLBACK(git_checkout_perfdata_cb)(
240
240
  const git_checkout_perfdata *perfdata,
241
241
  void *payload);
242
242
 
243
243
  /**
244
244
  * Checkout options structure
245
245
  *
246
- * Zero out for defaults. Initialize with `GIT_CHECKOUT_OPTIONS_INIT` macro to
247
- * correctly set the `version` field. E.g.
246
+ * Initialize with `GIT_CHECKOUT_OPTIONS_INIT`. Alternatively, you can
247
+ * use `git_checkout_init_options`.
248
248
  *
249
- * git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
250
249
  */
251
250
  typedef struct git_checkout_options {
252
251
  unsigned int version;
253
252
 
254
- unsigned int checkout_strategy; /**< default will be a dry run */
253
+ unsigned int checkout_strategy; /**< default will be a safe checkout */
255
254
 
256
255
  int disable_filters; /**< don't apply filters like CRLF conversion */
257
256
  unsigned int dir_mode; /**< default is 0755 */
@@ -295,16 +294,18 @@ typedef struct git_checkout_options {
295
294
  } git_checkout_options;
296
295
 
297
296
  #define GIT_CHECKOUT_OPTIONS_VERSION 1
298
- #define GIT_CHECKOUT_OPTIONS_INIT {GIT_CHECKOUT_OPTIONS_VERSION}
297
+ #define GIT_CHECKOUT_OPTIONS_INIT {GIT_CHECKOUT_OPTIONS_VERSION, GIT_CHECKOUT_SAFE}
299
298
 
300
299
  /**
301
- * Initializes a `git_checkout_options` with default values. Equivalent to
302
- * creating an instance with GIT_CHECKOUT_OPTIONS_INIT.
303
- *
304
- * @param opts the `git_checkout_options` struct to initialize.
305
- * @param version Version of struct; pass `GIT_CHECKOUT_OPTIONS_VERSION`
306
- * @return Zero on success; -1 on failure.
307
- */
300
+ * Initialize git_checkout_options structure
301
+ *
302
+ * Initializes a `git_checkout_options` with default values. Equivalent to creating
303
+ * an instance with GIT_CHECKOUT_OPTIONS_INIT.
304
+ *
305
+ * @param opts The `git_checkout_options` struct to initialize.
306
+ * @param version The struct version; pass `GIT_CHECKOUT_OPTIONS_VERSION`.
307
+ * @return Zero on success; -1 on failure.
308
+ */
308
309
  GIT_EXTERN(int) git_checkout_init_options(
309
310
  git_checkout_options *opts,
310
311
  unsigned int version);
@@ -324,7 +325,7 @@ GIT_EXTERN(int) git_checkout_init_options(
324
325
  * @param opts specifies checkout options (may be NULL)
325
326
  * @return 0 on success, GIT_EUNBORNBRANCH if HEAD points to a non
326
327
  * existing branch, non-zero value returned by `notify_cb`, or
327
- * other error code < 0 (use giterr_last for error details)
328
+ * other error code < 0 (use git_error_last for error details)
328
329
  */
329
330
  GIT_EXTERN(int) git_checkout_head(
330
331
  git_repository *repo,
@@ -337,7 +338,7 @@ GIT_EXTERN(int) git_checkout_head(
337
338
  * @param index index to be checked out (or NULL to use repository index)
338
339
  * @param opts specifies checkout options (may be NULL)
339
340
  * @return 0 on success, non-zero return value from `notify_cb`, or error
340
- * code < 0 (use giterr_last for error details)
341
+ * code < 0 (use git_error_last for error details)
341
342
  */
342
343
  GIT_EXTERN(int) git_checkout_index(
343
344
  git_repository *repo,
@@ -353,7 +354,7 @@ GIT_EXTERN(int) git_checkout_index(
353
354
  * the working directory (or NULL to use HEAD)
354
355
  * @param opts specifies checkout options (may be NULL)
355
356
  * @return 0 on success, non-zero return value from `notify_cb`, or error
356
- * code < 0 (use giterr_last for error details)
357
+ * code < 0 (use git_error_last for error details)
357
358
  */
358
359
  GIT_EXTERN(int) git_checkout_tree(
359
360
  git_repository *repo,