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
@@ -36,10 +36,9 @@ typedef enum {
36
36
  /**
37
37
  * Describe options structure
38
38
  *
39
- * Initialize with `GIT_DESCRIBE_OPTIONS_INIT` macro to correctly set
40
- * the `version` field. E.g.
39
+ * Initialize with `GIT_DESCRIBE_OPTIONS_INIT`. Alternatively, you can
40
+ * use `git_describe_init_options`.
41
41
  *
42
- * git_describe_options opts = GIT_DESCRIBE_OPTIONS_INIT;
43
42
  */
44
43
  typedef struct git_describe_options {
45
44
  unsigned int version;
@@ -70,10 +69,24 @@ typedef struct git_describe_options {
70
69
  GIT_DESCRIBE_DEFAULT_MAX_CANDIDATES_TAGS, \
71
70
  }
72
71
 
72
+ /**
73
+ * Initialize git_describe_options structure
74
+ *
75
+ * Initializes a `git_describe_options` with default values. Equivalent to creating
76
+ * an instance with GIT_DESCRIBE_OPTIONS_INIT.
77
+ *
78
+ * @param opts The `git_describe_options` struct to initialize.
79
+ * @param version The struct version; pass `GIT_DESCRIBE_OPTIONS_VERSION`.
80
+ * @return Zero on success; -1 on failure.
81
+ */
73
82
  GIT_EXTERN(int) git_describe_init_options(git_describe_options *opts, unsigned int version);
74
83
 
75
84
  /**
76
- * Options for formatting the describe string
85
+ * Describe format options structure
86
+ *
87
+ * Initialize with `GIT_DESCRIBE_FORMAT_OPTIONS_INIT`. Alternatively, you can
88
+ * use `git_describe_format_init_options`.
89
+ *
77
90
  */
78
91
  typedef struct {
79
92
  unsigned int version;
@@ -103,6 +116,16 @@ typedef struct {
103
116
  GIT_DESCRIBE_DEFAULT_ABBREVIATED_SIZE, \
104
117
  }
105
118
 
119
+ /**
120
+ * Initialize git_describe_format_options structure
121
+ *
122
+ * Initializes a `git_describe_format_options` with default values. Equivalent to creating
123
+ * an instance with GIT_DESCRIBE_FORMAT_OPTIONS_INIT.
124
+ *
125
+ * @param opts The `git_describe_format_options` struct to initialize.
126
+ * @param version The struct version; pass `GIT_DESCRIBE_FORMAT_OPTIONS_VERSION`.
127
+ * @return Zero on success; -1 on failure.
128
+ */
106
129
  GIT_EXTERN(int) git_describe_init_format_options(git_describe_format_options *opts, unsigned int version);
107
130
 
108
131
  /**
@@ -118,7 +141,7 @@ typedef struct git_describe_result git_describe_result;
118
141
  * @param result pointer to store the result. You must free this once
119
142
  * you're done with it.
120
143
  * @param committish a committish to describe
121
- * @param opts the lookup options
144
+ * @param opts the lookup options (or NULL for defaults)
122
145
  */
123
146
  GIT_EXTERN(int) git_describe_commit(
124
147
  git_describe_result **result,
@@ -135,7 +158,7 @@ GIT_EXTERN(int) git_describe_commit(
135
158
  * @param out pointer to store the result. You must free this once
136
159
  * you're done with it.
137
160
  * @param repo the repository in which to perform the describe
138
- * @param opts the lookup options
161
+ * @param opts the lookup options (or NULL for defaults)
139
162
  */
140
163
  GIT_EXTERN(int) git_describe_workdir(
141
164
  git_describe_result **out,
@@ -148,7 +171,7 @@ GIT_EXTERN(int) git_describe_workdir(
148
171
  * @param out The buffer to store the result
149
172
  * @param result the result from `git_describe_commit()` or
150
173
  * `git_describe_workdir()`.
151
- * @param opts the formatting options
174
+ * @param opts the formatting options (or NULL for defaults)
152
175
  */
153
176
  GIT_EXTERN(int) git_describe_format(
154
177
  git_buf *out,
@@ -16,50 +16,6 @@
16
16
  /**
17
17
  * @file git2/diff.h
18
18
  * @brief Git tree and file differencing routines.
19
- *
20
- * Overview
21
- * --------
22
- *
23
- * Calculating diffs is generally done in two phases: building a list of
24
- * diffs then traversing it. This makes is easier to share logic across
25
- * the various types of diffs (tree vs tree, workdir vs index, etc.), and
26
- * also allows you to insert optional diff post-processing phases,
27
- * such as rename detection, in between the steps. When you are done with
28
- * a diff object, it must be freed.
29
- *
30
- * Terminology
31
- * -----------
32
- *
33
- * To understand the diff APIs, you should know the following terms:
34
- *
35
- * - A `diff` represents the cumulative list of differences between two
36
- * snapshots of a repository (possibly filtered by a set of file name
37
- * patterns). This is the `git_diff` object.
38
- *
39
- * - A `delta` is a file pair with an old and new revision. The old version
40
- * may be absent if the file was just created and the new version may be
41
- * absent if the file was deleted. A diff is mostly just a list of deltas.
42
- *
43
- * - A `binary` file / delta is a file (or pair) for which no text diffs
44
- * should be generated. A diff can contain delta entries that are
45
- * binary, but no diff content will be output for those files. There is
46
- * a base heuristic for binary detection and you can further tune the
47
- * behavior with git attributes or diff flags and option settings.
48
- *
49
- * - A `hunk` is a span of modified lines in a delta along with some stable
50
- * surrounding context. You can configure the amount of context and other
51
- * properties of how hunks are generated. Each hunk also comes with a
52
- * header that described where it starts and ends in both the old and new
53
- * versions in the delta.
54
- *
55
- * - A `line` is a range of characters inside a hunk. It could be a context
56
- * line (i.e. in both old and new versions), an added line (i.e. only in
57
- * the new version), or a removed line (i.e. only in the old version).
58
- * Unfortunately, we don't know anything about the encoding of data in the
59
- * file being diffed, so we cannot tell you much about the line content.
60
- * Line data will not be NUL-byte terminated, however, because it will be
61
- * just a span of bytes inside the larger file.
62
- *
63
19
  * @ingroup Git
64
20
  * @{
65
21
  */
@@ -171,6 +127,12 @@ typedef enum {
171
127
  * Options controlling how output will be generated
172
128
  */
173
129
 
130
+ /** Use a heuristic that takes indentation and whitespace into account
131
+ * which generally can produce better diffs when dealing with ambiguous
132
+ * diff hunks.
133
+ */
134
+ GIT_DIFF_INDENT_HEURISTIC = (1u << 18),
135
+
174
136
  /** Treat all files as text, disabling binary attributes & detection */
175
137
  GIT_DIFF_FORCE_TEXT = (1u << 20),
176
138
  /** Treat all files as binary, disabling text diffs */
@@ -206,21 +168,27 @@ typedef enum {
206
168
  * can apply given diff information to binary files.
207
169
  */
208
170
  GIT_DIFF_SHOW_BINARY = (1u << 30),
209
-
210
- /** Use a heuristic that takes indentation and whitespace into account
211
- * which generally can produce better diffs when dealing with ambiguous
212
- * diff hunks.
213
- */
214
- GIT_DIFF_INDENT_HEURISTIC = (1u << 31),
215
171
  } git_diff_option_t;
216
172
 
217
173
  /**
218
174
  * The diff object that contains all individual file deltas.
219
175
  *
176
+ * A `diff` represents the cumulative list of differences between two
177
+ * snapshots of a repository (possibly filtered by a set of file name
178
+ * patterns).
179
+ *
180
+ * Calculating diffs is generally done in two phases: building a list of
181
+ * diffs then traversing it. This makes is easier to share logic across
182
+ * the various types of diffs (tree vs tree, workdir vs index, etc.), and
183
+ * also allows you to insert optional diff post-processing phases,
184
+ * such as rename detection, in between the steps. When you are done with
185
+ * a diff object, it must be freed.
186
+ *
220
187
  * This is an opaque structure which will be allocated by one of the diff
221
- * generator functions below (such as `git_diff_tree_to_tree`). You are
188
+ * generator functions below (such as `git_diff_tree_to_tree`). You are
222
189
  * responsible for releasing the object memory when done, using the
223
190
  * `git_diff_free()` function.
191
+ *
224
192
  */
225
193
  typedef struct git_diff git_diff;
226
194
 
@@ -301,6 +269,10 @@ typedef struct {
301
269
  /**
302
270
  * Description of changes to one entry.
303
271
  *
272
+ * A `delta` is a file pair with an old and new revision. The old version
273
+ * may be absent if the file was just created and the new version may be
274
+ * absent if the file was deleted. A diff is mostly just a list of deltas.
275
+ *
304
276
  * When iterating over a diff, this will be passed to most callbacks and
305
277
  * you can use the contents to understand exactly what has changed.
306
278
  *
@@ -346,7 +318,7 @@ typedef struct {
346
318
  /**
347
319
  * Diff notification callback function.
348
320
  *
349
- * The callback will be called for each file, just before the `git_delta_t`
321
+ * The callback will be called for each file, just before the `git_diff_delta`
350
322
  * gets inserted into the diff.
351
323
  *
352
324
  * When the callback:
@@ -356,7 +328,7 @@ typedef struct {
356
328
  * - returns 0, the delta is inserted into the diff, and the diff process
357
329
  * continues.
358
330
  */
359
- typedef int (*git_diff_notify_cb)(
331
+ typedef int GIT_CALLBACK(git_diff_notify_cb)(
360
332
  const git_diff *diff_so_far,
361
333
  const git_diff_delta *delta_to_add,
362
334
  const char *matched_pathspec,
@@ -372,7 +344,7 @@ typedef int (*git_diff_notify_cb)(
372
344
  * @param new_path The path to the new file or NULL.
373
345
  * @return Non-zero to abort the diff.
374
346
  */
375
- typedef int (*git_diff_progress_cb)(
347
+ typedef int GIT_CALLBACK(git_diff_progress_cb)(
376
348
  const git_diff *diff_so_far,
377
349
  const char *old_path,
378
350
  const char *new_path,
@@ -385,46 +357,79 @@ typedef int (*git_diff_progress_cb)(
385
357
  * values. Similarly, passing NULL for the options structure will
386
358
  * give the defaults. The default values are marked below.
387
359
  *
388
- * - `flags` is a combination of the `git_diff_option_t` values above
389
- * - `context_lines` is the number of unchanged lines that define the
390
- * boundary of a hunk (and to display before and after)
391
- * - `interhunk_lines` is the maximum number of unchanged lines between
392
- * hunk boundaries before the hunks will be merged into a one.
393
- * - `old_prefix` is the virtual "directory" to prefix to old file names
394
- * in hunk headers (default "a")
395
- * - `new_prefix` is the virtual "directory" to prefix to new file names
396
- * in hunk headers (default "b")
397
- * - `pathspec` is an array of paths / fnmatch patterns to constrain diff
398
- * - `max_size` is a file size (in bytes) above which a blob will be marked
399
- * as binary automatically; pass a negative value to disable.
400
- * - `notify_cb` is an optional callback function, notifying the consumer of
401
- * changes to the diff as new deltas are added.
402
- * - `progress_cb` is an optional callback function, notifying the consumer of
403
- * which files are being examined as the diff is generated.
404
- * - `payload` is the payload to pass to the callback functions.
405
- * - `ignore_submodules` overrides the submodule ignore setting for all
406
- * submodules in the diff.
407
360
  */
408
361
  typedef struct {
409
362
  unsigned int version; /**< version for the struct */
410
- uint32_t flags; /**< defaults to GIT_DIFF_NORMAL */
363
+
364
+ /**
365
+ * A combination of `git_diff_option_t` values above.
366
+ * Defaults to GIT_DIFF_NORMAL
367
+ */
368
+ uint32_t flags;
411
369
 
412
370
  /* options controlling which files are in the diff */
413
371
 
414
- git_submodule_ignore_t ignore_submodules; /**< submodule ignore rule */
415
- git_strarray pathspec; /**< defaults to include all paths */
372
+ /** Overrides the submodule ignore setting for all submodules in the diff. */
373
+ git_submodule_ignore_t ignore_submodules;
374
+
375
+ /**
376
+ * An array of paths / fnmatch patterns to constrain diff.
377
+ * All paths are included by default.
378
+ */
379
+ git_strarray pathspec;
380
+
381
+ /**
382
+ * An optional callback function, notifying the consumer of changes to
383
+ * the diff as new deltas are added.
384
+ */
416
385
  git_diff_notify_cb notify_cb;
386
+
387
+ /**
388
+ * An optional callback function, notifying the consumer of which files
389
+ * are being examined as the diff is generated.
390
+ */
417
391
  git_diff_progress_cb progress_cb;
392
+
393
+ /** The payload to pass to the callback functions. */
418
394
  void *payload;
419
395
 
420
396
  /* options controlling how to diff text is generated */
421
397
 
422
- uint32_t context_lines; /**< defaults to 3 */
423
- uint32_t interhunk_lines; /**< defaults to 0 */
424
- uint16_t id_abbrev; /**< default 'core.abbrev' or 7 if unset */
425
- git_off_t max_size; /**< defaults to 512MB */
426
- const char *old_prefix; /**< defaults to "a" */
427
- const char *new_prefix; /**< defaults to "b" */
398
+ /**
399
+ * The number of unchanged lines that define the boundary of a hunk
400
+ * (and to display before and after). Defaults to 3.
401
+ */
402
+ uint32_t context_lines;
403
+ /**
404
+ * The maximum number of unchanged lines between hunk boundaries before
405
+ * the hunks will be merged into one. Defaults to 0.
406
+ */
407
+ uint32_t interhunk_lines;
408
+
409
+ /**
410
+ * The abbreviation length to use when formatting object ids.
411
+ * Defaults to the value of 'core.abbrev' from the config, or 7 if unset.
412
+ */
413
+ uint16_t id_abbrev;
414
+
415
+ /**
416
+ * A size (in bytes) above which a blob will be marked as binary
417
+ * automatically; pass a negative value to disable.
418
+ * Defaults to 512MB.
419
+ */
420
+ git_off_t max_size;
421
+
422
+ /**
423
+ * The virtual "directory" prefix for old file names in hunk headers.
424
+ * Default is "a".
425
+ */
426
+ const char *old_prefix;
427
+
428
+ /**
429
+ * The virtual "directory" prefix for new file names in hunk headers.
430
+ * Defaults to "b".
431
+ */
432
+ const char *new_prefix;
428
433
  } git_diff_options;
429
434
 
430
435
  /* The current version of the diff options structure */
@@ -437,11 +442,13 @@ typedef struct {
437
442
  {GIT_DIFF_OPTIONS_VERSION, 0, GIT_SUBMODULE_IGNORE_UNSPECIFIED, {NULL,0}, NULL, NULL, NULL, 3}
438
443
 
439
444
  /**
440
- * Initializes a `git_diff_options` with default values. Equivalent to
441
- * creating an instance with GIT_DIFF_OPTIONS_INIT.
445
+ * Initialize git_diff_options structure
446
+ *
447
+ * Initializes a `git_diff_options` with default values. Equivalent to creating
448
+ * an instance with GIT_DIFF_OPTIONS_INIT.
442
449
  *
443
- * @param opts The `git_diff_options` struct to initialize
444
- * @param version Version of struct; pass `GIT_DIFF_OPTIONS_VERSION`
450
+ * @param opts The `git_diff_options` struct to initialize.
451
+ * @param version The struct version; pass `GIT_DIFF_OPTIONS_VERSION`.
445
452
  * @return Zero on success; -1 on failure.
446
453
  */
447
454
  GIT_EXTERN(int) git_diff_init_options(
@@ -455,7 +462,7 @@ GIT_EXTERN(int) git_diff_init_options(
455
462
  * @param progress Goes from 0 to 1 over the diff
456
463
  * @param payload User-specified pointer from foreach function
457
464
  */
458
- typedef int (*git_diff_file_cb)(
465
+ typedef int GIT_CALLBACK(git_diff_file_cb)(
459
466
  const git_diff_delta *delta,
460
467
  float progress,
461
468
  void *payload);
@@ -494,12 +501,21 @@ typedef struct {
494
501
  size_t inflatedlen;
495
502
  } git_diff_binary_file;
496
503
 
497
- /** Structure describing the binary contents of a diff. */
504
+ /**
505
+ * Structure describing the binary contents of a diff.
506
+ *
507
+ * A `binary` file / delta is a file (or pair) for which no text diffs
508
+ * should be generated. A diff can contain delta entries that are
509
+ * binary, but no diff content will be output for those files. There is
510
+ * a base heuristic for binary detection and you can further tune the
511
+ * behavior with git attributes or diff flags and option settings.
512
+ */
498
513
  typedef struct {
499
514
  /**
500
- * Whether there is data in this binary structure or not. If this
501
- * is `1`, then this was produced and included binary content. If
502
- * this is `0` then this was generated knowing only that a binary
515
+ * Whether there is data in this binary structure or not.
516
+ *
517
+ * If this is `1`, then this was produced and included binary content.
518
+ * If this is `0` then this was generated knowing only that a binary
503
519
  * file changed but without providing the data, probably from a patch
504
520
  * that said `Binary files a/file.txt and b/file.txt differ`.
505
521
  */
@@ -509,16 +525,22 @@ typedef struct {
509
525
  } git_diff_binary;
510
526
 
511
527
  /**
512
- * When iterating over a diff, callback that will be made for
513
- * binary content within the diff.
514
- */
515
- typedef int(*git_diff_binary_cb)(
528
+ * When iterating over a diff, callback that will be made for
529
+ * binary content within the diff.
530
+ */
531
+ typedef int GIT_CALLBACK(git_diff_binary_cb)(
516
532
  const git_diff_delta *delta,
517
533
  const git_diff_binary *binary,
518
534
  void *payload);
519
535
 
520
536
  /**
521
537
  * Structure describing a hunk of a diff.
538
+ *
539
+ * A `hunk` is a span of modified lines in a delta along with some stable
540
+ * surrounding context. You can configure the amount of context and other
541
+ * properties of how hunks are generated. Each hunk also comes with a
542
+ * header that described where it starts and ends in both the old and new
543
+ * versions in the delta.
522
544
  */
523
545
  typedef struct {
524
546
  int old_start; /**< Starting line number in old_file */
@@ -532,7 +554,7 @@ typedef struct {
532
554
  /**
533
555
  * When iterating over a diff, callback that will be made per hunk.
534
556
  */
535
- typedef int (*git_diff_hunk_cb)(
557
+ typedef int GIT_CALLBACK(git_diff_hunk_cb)(
536
558
  const git_diff_delta *delta,
537
559
  const git_diff_hunk *hunk,
538
560
  void *payload);
@@ -566,6 +588,14 @@ typedef enum {
566
588
 
567
589
  /**
568
590
  * Structure describing a line (or data span) of a diff.
591
+ *
592
+ * A `line` is a range of characters inside a hunk. It could be a context
593
+ * line (i.e. in both old and new versions), an added line (i.e. only in
594
+ * the new version), or a removed line (i.e. only in the old version).
595
+ * Unfortunately, we don't know anything about the encoding of data in the
596
+ * file being diffed, so we cannot tell you much about the line content.
597
+ * Line data will not be NUL-byte terminated, however, because it will be
598
+ * just a span of bytes inside the larger file.
569
599
  */
570
600
  typedef struct {
571
601
  char origin; /**< A git_diff_line_t value */
@@ -585,7 +615,7 @@ typedef struct {
585
615
  * of text. This uses some extra GIT_DIFF_LINE_... constants for output
586
616
  * of lines of file and hunk headers.
587
617
  */
588
- typedef int (*git_diff_line_cb)(
618
+ typedef int GIT_CALLBACK(git_diff_line_cb)(
589
619
  const git_diff_delta *delta, /**< delta that contains this data */
590
620
  const git_diff_hunk *hunk, /**< hunk containing this data */
591
621
  const git_diff_line *line, /**< line data */
@@ -669,14 +699,14 @@ typedef enum {
669
699
  * Pluggable similarity metric
670
700
  */
671
701
  typedef struct {
672
- int (*file_signature)(
702
+ int GIT_CALLBACK(file_signature)(
673
703
  void **out, const git_diff_file *file,
674
704
  const char *fullpath, void *payload);
675
- int (*buffer_signature)(
705
+ int GIT_CALLBACK(buffer_signature)(
676
706
  void **out, const git_diff_file *file,
677
707
  const char *buf, size_t buflen, void *payload);
678
- void (*free_signature)(void *sig, void *payload);
679
- int (*similarity)(int *score, void *siga, void *sigb, void *payload);
708
+ void GIT_CALLBACK(free_signature)(void *sig, void *payload);
709
+ int GIT_CALLBACK(similarity)(int *score, void *siga, void *sigb, void *payload);
680
710
  void *payload;
681
711
  } git_diff_similarity_metric;
682
712
 
@@ -684,21 +714,6 @@ typedef struct {
684
714
  * Control behavior of rename and copy detection
685
715
  *
686
716
  * These options mostly mimic parameters that can be passed to git-diff.
687
- *
688
- * - `rename_threshold` is the same as the -M option with a value
689
- * - `copy_threshold` is the same as the -C option with a value
690
- * - `rename_from_rewrite_threshold` matches the top of the -B option
691
- * - `break_rewrite_threshold` matches the bottom of the -B option
692
- * - `rename_limit` is the maximum number of matches to consider for
693
- * a particular file. This is a little different from the `-l` option
694
- * to regular Git because we will still process up to this many matches
695
- * before abandoning the search.
696
- *
697
- * The `metric` option allows you to plug in a custom similarity metric.
698
- * Set it to NULL for the default internal metric which is based on sampling
699
- * hashes of ranges of data in the file. The default metric is a pretty
700
- * good similarity approximation that should work fairly well for both text
701
- * and binary data, and is pretty fast with fixed memory overhead.
702
717
  */
703
718
  typedef struct {
704
719
  unsigned int version;
@@ -710,21 +725,49 @@ typedef struct {
710
725
  */
711
726
  uint32_t flags;
712
727
 
713
- /** Similarity to consider a file renamed (default 50) */
728
+ /**
729
+ * Threshold above which similar files will be considered renames.
730
+ * This is equivalent to the -M option. Defaults to 50.
731
+ */
714
732
  uint16_t rename_threshold;
715
- /** Similarity of modified to be eligible rename source (default 50) */
733
+
734
+ /**
735
+ * Threshold below which similar files will be eligible to be a rename source.
736
+ * This is equivalent to the first part of the -B option. Defaults to 50.
737
+ */
716
738
  uint16_t rename_from_rewrite_threshold;
717
- /** Similarity to consider a file a copy (default 50) */
739
+
740
+ /**
741
+ * Threshold above which similar files will be considered copies.
742
+ * This is equivalent to the -C option. Defaults to 50.
743
+ */
718
744
  uint16_t copy_threshold;
719
- /** Similarity to split modify into delete/add pair (default 60) */
745
+
746
+ /**
747
+ * Treshold below which similar files will be split into a delete/add pair.
748
+ * This is equivalent to the last part of the -B option. Defaults to 60.
749
+ */
720
750
  uint16_t break_rewrite_threshold;
721
751
 
722
- /** Maximum similarity sources to examine for a file (somewhat like
723
- * git-diff's `-l` option or `diff.renameLimit` config) (default 200)
752
+ /**
753
+ * Maximum number of matches to consider for a particular file.
754
+ *
755
+ * This is a little different from the `-l` option from Git because we
756
+ * will still process up to this many matches before abandoning the search.
757
+ * Defaults to 200.
724
758
  */
725
759
  size_t rename_limit;
726
760
 
727
- /** Pluggable similarity metric; pass NULL to use internal metric */
761
+ /**
762
+ * The `metric` option allows you to plug in a custom similarity metric.
763
+ *
764
+ * Set it to NULL to use the default internal metric.
765
+ *
766
+ * The default metric is based on sampling hashes of ranges of data in
767
+ * the file, which is a pretty good similarity approximation that should
768
+ * work fairly well for both text and binary data while still being
769
+ * pretty fast with a fixed memory overhead.
770
+ */
728
771
  git_diff_similarity_metric *metric;
729
772
  } git_diff_find_options;
730
773
 
@@ -732,11 +775,13 @@ typedef struct {
732
775
  #define GIT_DIFF_FIND_OPTIONS_INIT {GIT_DIFF_FIND_OPTIONS_VERSION}
733
776
 
734
777
  /**
735
- * Initializes a `git_diff_find_options` with default values. Equivalent to
736
- * creating an instance with GIT_DIFF_FIND_OPTIONS_INIT.
778
+ * Initialize git_diff_find_options structure
779
+ *
780
+ * Initializes a `git_diff_find_options` with default values. Equivalent to creating
781
+ * an instance with GIT_DIFF_FIND_OPTIONS_INIT.
737
782
  *
738
- * @param opts The `git_diff_find_options` struct to initialize
739
- * @param version Version of struct; pass `GIT_DIFF_FIND_OPTIONS_VERSION`
783
+ * @param opts The `git_diff_find_options` struct to initialize.
784
+ * @param version The struct version; pass `GIT_DIFF_FIND_OPTIONS_VERSION`.
740
785
  * @return Zero on success; -1 on failure.
741
786
  */
742
787
  GIT_EXTERN(int) git_diff_find_init_options(
@@ -778,7 +823,7 @@ GIT_EXTERN(int) git_diff_tree_to_tree(
778
823
  git_repository *repo,
779
824
  git_tree *old_tree,
780
825
  git_tree *new_tree,
781
- const git_diff_options *opts); /**< can be NULL for defaults */
826
+ const git_diff_options *opts);
782
827
 
783
828
  /**
784
829
  * Create a diff between a tree and repository index.
@@ -804,7 +849,7 @@ GIT_EXTERN(int) git_diff_tree_to_index(
804
849
  git_repository *repo,
805
850
  git_tree *old_tree,
806
851
  git_index *index,
807
- const git_diff_options *opts); /**< can be NULL for defaults */
852
+ const git_diff_options *opts);
808
853
 
809
854
  /**
810
855
  * Create a diff between the repository index and the workdir directory.
@@ -830,7 +875,7 @@ GIT_EXTERN(int) git_diff_index_to_workdir(
830
875
  git_diff **diff,
831
876
  git_repository *repo,
832
877
  git_index *index,
833
- const git_diff_options *opts); /**< can be NULL for defaults */
878
+ const git_diff_options *opts);
834
879
 
835
880
  /**
836
881
  * Create a diff between a tree and the working directory.
@@ -859,7 +904,7 @@ GIT_EXTERN(int) git_diff_tree_to_workdir(
859
904
  git_diff **diff,
860
905
  git_repository *repo,
861
906
  git_tree *old_tree,
862
- const git_diff_options *opts); /**< can be NULL for defaults */
907
+ const git_diff_options *opts);
863
908
 
864
909
  /**
865
910
  * Create a diff between a tree and the working directory using index data
@@ -878,7 +923,7 @@ GIT_EXTERN(int) git_diff_tree_to_workdir_with_index(
878
923
  git_diff **diff,
879
924
  git_repository *repo,
880
925
  git_tree *old_tree,
881
- const git_diff_options *opts); /**< can be NULL for defaults */
926
+ const git_diff_options *opts);
882
927
 
883
928
  /**
884
929
  * Create a diff with the difference between two index objects.
@@ -897,7 +942,7 @@ GIT_EXTERN(int) git_diff_index_to_index(
897
942
  git_repository *repo,
898
943
  git_index *old_index,
899
944
  git_index *new_index,
900
- const git_diff_options *opts); /**< can be NULL for defaults */
945
+ const git_diff_options *opts);
901
946
 
902
947
  /**
903
948
  * Merge one diff into another.
@@ -1394,12 +1439,13 @@ GIT_EXTERN(int) git_diff_commit_as_email(
1394
1439
  const git_diff_options *diff_opts);
1395
1440
 
1396
1441
  /**
1397
- * Initializes a `git_diff_format_email_options` with default values.
1442
+ * Initialize git_diff_format_email_options structure
1398
1443
  *
1399
- * Equivalent to creating an instance with GIT_DIFF_FORMAT_EMAIL_OPTIONS_INIT.
1444
+ * Initializes a `git_diff_format_email_options` with default values. Equivalent
1445
+ * to creating an instance with GIT_DIFF_FORMAT_EMAIL_OPTIONS_INIT.
1400
1446
  *
1401
- * @param opts The `git_diff_format_email_options` struct to initialize
1402
- * @param version Version of struct; pass `GIT_DIFF_FORMAT_EMAIL_OPTIONS_VERSION`
1447
+ * @param opts The `git_blame_options` struct to initialize.
1448
+ * @param version The struct version; pass `GIT_DIFF_FORMAT_EMAIL_OPTIONS_VERSION`.
1403
1449
  * @return Zero on success; -1 on failure.
1404
1450
  */
1405
1451
  GIT_EXTERN(int) git_diff_format_email_init_options(
@@ -1409,8 +1455,9 @@ GIT_EXTERN(int) git_diff_format_email_init_options(
1409
1455
  /**
1410
1456
  * Patch ID options structure
1411
1457
  *
1412
- * Initialize with `GIT_DIFF_PATCHID_OPTIONS_INIT` macro to
1413
- * correctly set the default values and version.
1458
+ * Initialize with `GIT_PATCHID_OPTIONS_INIT`. Alternatively, you can
1459
+ * use `git_patchid_init_options`.
1460
+ *
1414
1461
  */
1415
1462
  typedef struct git_diff_patchid_options {
1416
1463
  unsigned int version;
@@ -1420,10 +1467,14 @@ typedef struct git_diff_patchid_options {
1420
1467
  #define GIT_DIFF_PATCHID_OPTIONS_INIT { GIT_DIFF_PATCHID_OPTIONS_VERSION }
1421
1468
 
1422
1469
  /**
1423
- * Initialize `git_diff_patchid_options` structure.
1470
+ * Initialize git_diff_patchid_options structure
1424
1471
  *
1425
- * Initializes the structure with default values. Equivalent to
1472
+ * Initializes a `git_diff_patchid_options` with default values. Equivalent to
1426
1473
  * creating an instance with `GIT_DIFF_PATCHID_OPTIONS_INIT`.
1474
+ *
1475
+ * @param opts The `git_diff_patchid_options` struct to initialize.
1476
+ * @param version The struct version; pass `GIT_DIFF_PATCHID_OPTIONS_VERSION`.
1477
+ * @return Zero on success; -1 on failure.
1427
1478
  */
1428
1479
  GIT_EXTERN(int) git_diff_patchid_init_options(
1429
1480
  git_diff_patchid_options *opts,
@@ -1441,8 +1492,7 @@ GIT_EXTERN(int) git_diff_patchid_init_options(
1441
1492
  * defined in git-patch-id(1), and should in fact generate the
1442
1493
  * same IDs as the upstream git project does.
1443
1494
  *
1444
- * @param out Pointer where the calculated patch ID shoul be
1445
- * stored
1495
+ * @param out Pointer where the calculated patch ID should be stored
1446
1496
  * @param diff The diff to calculate the ID for
1447
1497
  * @param opts Options for how to calculate the patch ID. This is
1448
1498
  * intended for future changes, as currently no options are