rugged 1.3.2.3 → 1.4.2

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 (329) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rugged/extconf.rb +1 -1
  3. data/ext/rugged/rugged_config.c +7 -2
  4. data/ext/rugged/rugged_remote.c +17 -0
  5. data/lib/rugged/version.rb +1 -1
  6. data/vendor/libgit2/CMakeLists.txt +103 -276
  7. data/vendor/libgit2/COPYING +36 -19
  8. data/vendor/libgit2/cmake/AddCFlagIfSupported.cmake +21 -21
  9. data/vendor/libgit2/cmake/DefaultCFlags.cmake +154 -0
  10. data/vendor/libgit2/cmake/EnableWarnings.cmake +13 -13
  11. data/vendor/libgit2/cmake/FindCoreFoundation.cmake +13 -13
  12. data/vendor/libgit2/cmake/FindGSSAPI.cmake +171 -287
  13. data/vendor/libgit2/cmake/FindGSSFramework.cmake +13 -13
  14. data/vendor/libgit2/cmake/{FindHTTP_Parser.cmake → FindHTTPParser.cmake} +17 -17
  15. data/vendor/libgit2/cmake/FindIconv.cmake +27 -27
  16. data/vendor/libgit2/cmake/FindLibSSH2.cmake +5 -5
  17. data/vendor/libgit2/cmake/FindPCRE.cmake +13 -13
  18. data/vendor/libgit2/cmake/FindPCRE2.cmake +12 -12
  19. data/vendor/libgit2/cmake/FindPkgLibraries.cmake +19 -19
  20. data/vendor/libgit2/cmake/FindSecurity.cmake +14 -14
  21. data/vendor/libgit2/cmake/FindStatNsec.cmake +12 -18
  22. data/vendor/libgit2/cmake/Findfutimens.cmake +8 -8
  23. data/vendor/libgit2/cmake/FindmbedTLS.cmake +63 -70
  24. data/vendor/libgit2/cmake/IdeSplitSources.cmake +18 -18
  25. data/vendor/libgit2/cmake/PkgBuildConfig.cmake +60 -60
  26. data/vendor/libgit2/cmake/SanitizeBool.cmake +20 -20
  27. data/vendor/libgit2/cmake/SelectGSSAPI.cmake +37 -37
  28. data/vendor/libgit2/cmake/SelectHTTPParser.cmake +19 -0
  29. data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +100 -100
  30. data/vendor/libgit2/cmake/SelectHashes.cmake +39 -49
  31. data/vendor/libgit2/cmake/SelectRegex.cmake +51 -0
  32. data/vendor/libgit2/cmake/SelectSSH.cmake +41 -0
  33. data/vendor/libgit2/cmake/SelectWinHTTP.cmake +17 -0
  34. data/vendor/libgit2/cmake/SelectZlib.cmake +34 -0
  35. data/vendor/libgit2/deps/chromium-zlib/CMakeLists.txt +6 -6
  36. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +31 -31
  37. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +1 -1
  38. data/vendor/libgit2/deps/ntlmclient/ntlm.c +4 -4
  39. data/vendor/libgit2/deps/ntlmclient/ntlm.h +4 -4
  40. data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +2 -2
  41. data/vendor/libgit2/deps/pcre/CMakeLists.txt +88 -88
  42. data/vendor/libgit2/deps/winhttp/CMakeLists.txt +14 -16
  43. data/vendor/libgit2/deps/zlib/adler32.c +0 -7
  44. data/vendor/libgit2/deps/zlib/crc32.c +288 -975
  45. data/vendor/libgit2/deps/zlib/crc32.h +436 -9441
  46. data/vendor/libgit2/deps/zlib/deflate.c +31 -83
  47. data/vendor/libgit2/deps/zlib/deflate.h +15 -12
  48. data/vendor/libgit2/deps/zlib/gzguts.h +2 -3
  49. data/vendor/libgit2/deps/zlib/infback.c +1 -2
  50. data/vendor/libgit2/deps/zlib/inffast.c +14 -14
  51. data/vendor/libgit2/deps/zlib/inflate.c +8 -39
  52. data/vendor/libgit2/deps/zlib/inflate.h +2 -3
  53. data/vendor/libgit2/deps/zlib/inftrees.c +3 -3
  54. data/vendor/libgit2/deps/zlib/trees.c +48 -27
  55. data/vendor/libgit2/deps/zlib/zlib.h +100 -126
  56. data/vendor/libgit2/deps/zlib/zutil.c +2 -2
  57. data/vendor/libgit2/deps/zlib/zutil.h +9 -12
  58. data/vendor/libgit2/include/git2/apply.h +16 -2
  59. data/vendor/libgit2/include/git2/attr.h +11 -2
  60. data/vendor/libgit2/include/git2/blame.h +4 -1
  61. data/vendor/libgit2/include/git2/blob.h +14 -1
  62. data/vendor/libgit2/include/git2/branch.h +2 -0
  63. data/vendor/libgit2/include/git2/buffer.h +18 -78
  64. data/vendor/libgit2/include/git2/cert.h +2 -2
  65. data/vendor/libgit2/include/git2/checkout.h +5 -2
  66. data/vendor/libgit2/include/git2/clone.h +3 -3
  67. data/vendor/libgit2/include/git2/commit.h +2 -0
  68. data/vendor/libgit2/include/git2/common.h +5 -12
  69. data/vendor/libgit2/include/git2/config.h +19 -3
  70. data/vendor/libgit2/include/git2/credential.h +2 -1
  71. data/vendor/libgit2/include/git2/credential_helpers.h +1 -0
  72. data/vendor/libgit2/include/git2/deprecated.h +1 -1
  73. data/vendor/libgit2/include/git2/describe.h +7 -2
  74. data/vendor/libgit2/include/git2/diff.h +17 -9
  75. data/vendor/libgit2/include/git2/email.h +1 -1
  76. data/vendor/libgit2/include/git2/errors.h +1 -2
  77. data/vendor/libgit2/include/git2/filter.h +7 -2
  78. data/vendor/libgit2/include/git2/graph.h +1 -0
  79. data/vendor/libgit2/include/git2/ignore.h +1 -1
  80. data/vendor/libgit2/include/git2/index.h +11 -5
  81. data/vendor/libgit2/include/git2/indexer.h +19 -0
  82. data/vendor/libgit2/include/git2/merge.h +23 -3
  83. data/vendor/libgit2/include/git2/message.h +2 -0
  84. data/vendor/libgit2/include/git2/object.h +23 -0
  85. data/vendor/libgit2/include/git2/odb.h +37 -7
  86. data/vendor/libgit2/include/git2/odb_backend.h +1 -1
  87. data/vendor/libgit2/include/git2/pack.h +24 -8
  88. data/vendor/libgit2/include/git2/patch.h +8 -0
  89. data/vendor/libgit2/include/git2/pathspec.h +1 -1
  90. data/vendor/libgit2/include/git2/proxy.h +1 -1
  91. data/vendor/libgit2/include/git2/rebase.h +9 -1
  92. data/vendor/libgit2/include/git2/refdb.h +3 -0
  93. data/vendor/libgit2/include/git2/reflog.h +1 -1
  94. data/vendor/libgit2/include/git2/refs.h +2 -2
  95. data/vendor/libgit2/include/git2/remote.h +184 -37
  96. data/vendor/libgit2/include/git2/repository.h +14 -9
  97. data/vendor/libgit2/include/git2/reset.h +2 -2
  98. data/vendor/libgit2/include/git2/revparse.h +1 -1
  99. data/vendor/libgit2/include/git2/revwalk.h +4 -1
  100. data/vendor/libgit2/include/git2/signature.h +1 -1
  101. data/vendor/libgit2/include/git2/stash.h +3 -3
  102. data/vendor/libgit2/include/git2/status.h +9 -3
  103. data/vendor/libgit2/include/git2/submodule.h +7 -2
  104. data/vendor/libgit2/include/git2/sys/commit_graph.h +1 -1
  105. data/vendor/libgit2/include/git2/sys/odb_backend.h +2 -5
  106. data/vendor/libgit2/include/git2/sys/remote.h +31 -0
  107. data/vendor/libgit2/include/git2/sys/stream.h +1 -1
  108. data/vendor/libgit2/include/git2/sys/transport.h +25 -34
  109. data/vendor/libgit2/include/git2/tag.h +1 -0
  110. data/vendor/libgit2/include/git2/tree.h +4 -3
  111. data/vendor/libgit2/include/git2/types.h +7 -7
  112. data/vendor/libgit2/include/git2/version.h +3 -3
  113. data/vendor/libgit2/include/git2/worktree.h +12 -2
  114. data/vendor/libgit2/src/CMakeLists.txt +189 -315
  115. data/vendor/libgit2/src/annotated_commit.h +1 -1
  116. data/vendor/libgit2/src/apply.c +18 -18
  117. data/vendor/libgit2/src/apply.h +2 -2
  118. data/vendor/libgit2/src/attr.c +18 -18
  119. data/vendor/libgit2/src/attr_file.c +17 -17
  120. data/vendor/libgit2/src/attr_file.h +4 -4
  121. data/vendor/libgit2/src/attrcache.c +17 -12
  122. data/vendor/libgit2/src/blame_git.c +1 -1
  123. data/vendor/libgit2/src/blob.c +33 -26
  124. data/vendor/libgit2/src/blob.h +1 -1
  125. data/vendor/libgit2/src/branch.c +150 -109
  126. data/vendor/libgit2/src/branch.h +15 -3
  127. data/vendor/libgit2/src/buf.c +126 -0
  128. data/vendor/libgit2/src/buf.h +50 -0
  129. data/vendor/libgit2/src/cc-compat.h +1 -1
  130. data/vendor/libgit2/src/checkout.c +74 -68
  131. data/vendor/libgit2/src/cherrypick.c +10 -10
  132. data/vendor/libgit2/src/clone.c +66 -66
  133. data/vendor/libgit2/src/commit.c +128 -58
  134. data/vendor/libgit2/src/commit.h +24 -1
  135. data/vendor/libgit2/src/commit_graph.c +68 -53
  136. data/vendor/libgit2/src/commit_graph.h +10 -3
  137. data/vendor/libgit2/src/commit_list.c +2 -3
  138. data/vendor/libgit2/src/common.h +10 -3
  139. data/vendor/libgit2/src/config.c +99 -77
  140. data/vendor/libgit2/src/config.h +15 -2
  141. data/vendor/libgit2/src/config_file.c +103 -91
  142. data/vendor/libgit2/src/config_mem.c +9 -9
  143. data/vendor/libgit2/src/config_parse.c +27 -23
  144. data/vendor/libgit2/src/crlf.c +24 -21
  145. data/vendor/libgit2/src/date.c +10 -17
  146. data/vendor/libgit2/src/date.h +33 -0
  147. data/vendor/libgit2/src/describe.c +27 -19
  148. data/vendor/libgit2/src/diff.c +25 -8
  149. data/vendor/libgit2/src/diff.h +2 -4
  150. data/vendor/libgit2/src/diff_driver.c +34 -36
  151. data/vendor/libgit2/src/diff_driver.h +3 -3
  152. data/vendor/libgit2/src/diff_file.c +29 -20
  153. data/vendor/libgit2/src/diff_generate.c +30 -6
  154. data/vendor/libgit2/src/diff_generate.h +5 -3
  155. data/vendor/libgit2/src/diff_print.c +102 -95
  156. data/vendor/libgit2/src/diff_stats.c +40 -29
  157. data/vendor/libgit2/src/{message.h → diff_stats.h} +7 -6
  158. data/vendor/libgit2/src/diff_tform.c +9 -8
  159. data/vendor/libgit2/src/diff_xdiff.c +3 -8
  160. data/vendor/libgit2/src/email.c +54 -38
  161. data/vendor/libgit2/src/email.h +1 -1
  162. data/vendor/libgit2/src/errors.c +18 -18
  163. data/vendor/libgit2/src/features.h.in +6 -1
  164. data/vendor/libgit2/src/fetch.c +69 -24
  165. data/vendor/libgit2/src/fetch.h +1 -1
  166. data/vendor/libgit2/src/fetchhead.c +19 -19
  167. data/vendor/libgit2/src/filebuf.c +28 -28
  168. data/vendor/libgit2/src/filebuf.h +1 -1
  169. data/vendor/libgit2/src/filter.c +96 -52
  170. data/vendor/libgit2/src/filter.h +26 -5
  171. data/vendor/libgit2/src/fs_path.c +1912 -0
  172. data/vendor/libgit2/src/fs_path.h +752 -0
  173. data/vendor/libgit2/src/futils.c +91 -85
  174. data/vendor/libgit2/src/futils.h +26 -14
  175. data/vendor/libgit2/src/hash/sha1/collisiondetect.c +2 -2
  176. data/vendor/libgit2/src/hash/sha1/common_crypto.c +2 -2
  177. data/vendor/libgit2/src/hash/sha1/generic.c +2 -2
  178. data/vendor/libgit2/src/hash/sha1/mbedtls.c +2 -2
  179. data/vendor/libgit2/src/hash/sha1/openssl.c +2 -2
  180. data/vendor/libgit2/src/hash/sha1/sha1dc/sha1.c +1 -1
  181. data/vendor/libgit2/src/hash/sha1/win32.c +6 -6
  182. data/vendor/libgit2/src/hash/sha1.h +3 -1
  183. data/vendor/libgit2/src/hash.c +67 -35
  184. data/vendor/libgit2/src/hash.h +12 -12
  185. data/vendor/libgit2/src/ident.c +18 -18
  186. data/vendor/libgit2/src/ignore.c +35 -34
  187. data/vendor/libgit2/src/ignore.h +2 -2
  188. data/vendor/libgit2/src/index.c +79 -80
  189. data/vendor/libgit2/src/index.h +6 -3
  190. data/vendor/libgit2/src/indexer.c +75 -57
  191. data/vendor/libgit2/src/iterator.c +64 -56
  192. data/vendor/libgit2/src/iterator.h +5 -5
  193. data/vendor/libgit2/src/khash.h +1 -1
  194. data/vendor/libgit2/src/libgit2.c +22 -19
  195. data/vendor/libgit2/src/mailmap.c +38 -36
  196. data/vendor/libgit2/src/merge.c +27 -27
  197. data/vendor/libgit2/src/merge.h +1 -14
  198. data/vendor/libgit2/src/merge_driver.c +2 -2
  199. data/vendor/libgit2/src/merge_file.c +13 -3
  200. data/vendor/libgit2/src/message.c +21 -10
  201. data/vendor/libgit2/src/midx.c +83 -66
  202. data/vendor/libgit2/src/midx.h +3 -3
  203. data/vendor/libgit2/src/mwindow.c +1 -1
  204. data/vendor/libgit2/src/net.c +278 -68
  205. data/vendor/libgit2/src/net.h +10 -3
  206. data/vendor/libgit2/src/netops.c +1 -1
  207. data/vendor/libgit2/src/netops.h +1 -1
  208. data/vendor/libgit2/src/notes.c +20 -29
  209. data/vendor/libgit2/src/object.c +49 -9
  210. data/vendor/libgit2/src/object.h +1 -1
  211. data/vendor/libgit2/src/odb.c +35 -32
  212. data/vendor/libgit2/src/odb.h +1 -1
  213. data/vendor/libgit2/src/odb_loose.c +68 -68
  214. data/vendor/libgit2/src/odb_mempack.c +18 -5
  215. data/vendor/libgit2/src/odb_pack.c +43 -43
  216. data/vendor/libgit2/src/oid.c +11 -4
  217. data/vendor/libgit2/src/oid.h +15 -0
  218. data/vendor/libgit2/src/pack-objects.c +41 -26
  219. data/vendor/libgit2/src/pack-objects.h +11 -6
  220. data/vendor/libgit2/src/pack.c +10 -10
  221. data/vendor/libgit2/src/patch.c +3 -3
  222. data/vendor/libgit2/src/patch.h +1 -0
  223. data/vendor/libgit2/src/patch_generate.c +27 -11
  224. data/vendor/libgit2/src/patch_generate.h +5 -5
  225. data/vendor/libgit2/src/patch_parse.c +24 -24
  226. data/vendor/libgit2/src/path.c +76 -1951
  227. data/vendor/libgit2/src/path.h +34 -741
  228. data/vendor/libgit2/src/pathspec.c +6 -6
  229. data/vendor/libgit2/src/pathspec.h +2 -2
  230. data/vendor/libgit2/src/posix.c +3 -3
  231. data/vendor/libgit2/src/posix.h +1 -0
  232. data/vendor/libgit2/src/pqueue.h +1 -1
  233. data/vendor/libgit2/src/proxy.c +4 -1
  234. data/vendor/libgit2/src/proxy.h +1 -1
  235. data/vendor/libgit2/src/push.c +30 -35
  236. data/vendor/libgit2/src/push.h +4 -16
  237. data/vendor/libgit2/src/rand.c +226 -0
  238. data/vendor/libgit2/src/rand.h +37 -0
  239. data/vendor/libgit2/src/reader.c +8 -8
  240. data/vendor/libgit2/src/reader.h +2 -2
  241. data/vendor/libgit2/src/rebase.c +89 -88
  242. data/vendor/libgit2/src/refdb_fs.c +447 -173
  243. data/vendor/libgit2/src/refs.c +32 -32
  244. data/vendor/libgit2/src/refs.h +2 -2
  245. data/vendor/libgit2/src/refspec.c +32 -37
  246. data/vendor/libgit2/src/refspec.h +5 -2
  247. data/vendor/libgit2/src/regexp.c +1 -1
  248. data/vendor/libgit2/src/remote.c +713 -419
  249. data/vendor/libgit2/src/remote.h +15 -10
  250. data/vendor/libgit2/src/repository.c +350 -467
  251. data/vendor/libgit2/src/repository.h +11 -10
  252. data/vendor/libgit2/src/reset.c +8 -5
  253. data/vendor/libgit2/src/revert.c +10 -10
  254. data/vendor/libgit2/src/revparse.c +48 -35
  255. data/vendor/libgit2/src/revwalk.c +7 -7
  256. data/vendor/libgit2/src/signature.c +12 -6
  257. data/vendor/libgit2/src/signature.h +1 -1
  258. data/vendor/libgit2/src/sortedcache.c +1 -1
  259. data/vendor/libgit2/src/sortedcache.h +1 -1
  260. data/vendor/libgit2/src/stash.c +36 -37
  261. data/vendor/libgit2/src/status.c +4 -1
  262. data/vendor/libgit2/src/{buffer.c → str.c} +157 -151
  263. data/vendor/libgit2/src/str.h +357 -0
  264. data/vendor/libgit2/src/streams/mbedtls.c +8 -6
  265. data/vendor/libgit2/src/streams/openssl_dynamic.h +3 -3
  266. data/vendor/libgit2/src/submodule.c +171 -159
  267. data/vendor/libgit2/src/submodule.h +1 -1
  268. data/vendor/libgit2/src/sysdir.c +68 -52
  269. data/vendor/libgit2/src/sysdir.h +15 -10
  270. data/vendor/libgit2/src/tag.c +29 -27
  271. data/vendor/libgit2/src/thread.h +3 -3
  272. data/vendor/libgit2/src/threadstate.c +3 -3
  273. data/vendor/libgit2/src/threadstate.h +1 -1
  274. data/vendor/libgit2/src/trace.c +1 -14
  275. data/vendor/libgit2/src/trace.h +5 -22
  276. data/vendor/libgit2/src/trailer.c +1 -1
  277. data/vendor/libgit2/src/transaction.c +1 -1
  278. data/vendor/libgit2/src/transport.c +10 -10
  279. data/vendor/libgit2/src/transports/auth.c +7 -9
  280. data/vendor/libgit2/src/transports/auth.h +2 -3
  281. data/vendor/libgit2/src/transports/auth_negotiate.c +12 -13
  282. data/vendor/libgit2/src/transports/auth_ntlm.c +10 -10
  283. data/vendor/libgit2/src/transports/auth_ntlm.h +0 -1
  284. data/vendor/libgit2/src/transports/git.c +9 -11
  285. data/vendor/libgit2/src/transports/http.c +37 -17
  286. data/vendor/libgit2/src/transports/http.h +2 -3
  287. data/vendor/libgit2/src/transports/httpclient.c +65 -65
  288. data/vendor/libgit2/src/transports/local.c +124 -116
  289. data/vendor/libgit2/src/transports/smart.c +51 -139
  290. data/vendor/libgit2/src/transports/smart.h +25 -31
  291. data/vendor/libgit2/src/transports/smart_pkt.c +33 -33
  292. data/vendor/libgit2/src/transports/smart_protocol.c +57 -39
  293. data/vendor/libgit2/src/transports/ssh.c +47 -112
  294. data/vendor/libgit2/src/transports/winhttp.c +50 -56
  295. data/vendor/libgit2/src/tree-cache.c +5 -5
  296. data/vendor/libgit2/src/tree-cache.h +2 -2
  297. data/vendor/libgit2/src/tree.c +59 -48
  298. data/vendor/libgit2/src/tree.h +1 -1
  299. data/vendor/libgit2/src/unix/map.c +0 -2
  300. data/vendor/libgit2/src/unix/posix.h +1 -4
  301. data/vendor/libgit2/src/unix/realpath.c +0 -2
  302. data/vendor/libgit2/src/util.c +14 -14
  303. data/vendor/libgit2/src/util.h +2 -28
  304. data/vendor/libgit2/src/vector.h +1 -1
  305. data/vendor/libgit2/src/win32/findfile.c +172 -116
  306. data/vendor/libgit2/src/win32/findfile.h +7 -4
  307. data/vendor/libgit2/src/win32/path_w32.c +140 -9
  308. data/vendor/libgit2/src/win32/path_w32.h +2 -0
  309. data/vendor/libgit2/src/win32/posix.h +0 -1
  310. data/vendor/libgit2/src/win32/posix_w32.c +11 -27
  311. data/vendor/libgit2/src/win32/w32_buffer.c +2 -3
  312. data/vendor/libgit2/src/win32/w32_buffer.h +2 -3
  313. data/vendor/libgit2/src/win32/w32_leakcheck.c +1 -1
  314. data/vendor/libgit2/src/worktree.c +116 -94
  315. data/vendor/libgit2/src/worktree.h +1 -1
  316. data/vendor/libgit2/src/xdiff/git-xdiff.h +53 -0
  317. data/vendor/libgit2/src/xdiff/xdiff.h +15 -15
  318. data/vendor/libgit2/src/xdiff/xdiffi.c +134 -108
  319. data/vendor/libgit2/src/xdiff/xemit.c +23 -7
  320. data/vendor/libgit2/src/xdiff/xhistogram.c +87 -78
  321. data/vendor/libgit2/src/xdiff/xinclude.h +1 -12
  322. data/vendor/libgit2/src/xdiff/xmerge.c +104 -117
  323. data/vendor/libgit2/src/xdiff/xpatience.c +6 -17
  324. data/vendor/libgit2/src/xdiff/xprepare.c +15 -20
  325. data/vendor/libgit2/src/xdiff/xutils.c +18 -7
  326. data/vendor/libgit2/src/zstream.c +5 -5
  327. data/vendor/libgit2/src/zstream.h +4 -4
  328. metadata +25 -10
  329. data/vendor/libgit2/src/buffer.h +0 -374
@@ -19,7 +19,7 @@
19
19
  #include "array.h"
20
20
  #include "cache.h"
21
21
  #include "refs.h"
22
- #include "buffer.h"
22
+ #include "str.h"
23
23
  #include "object.h"
24
24
  #include "attrcache.h"
25
25
  #include "submodule.h"
@@ -34,7 +34,6 @@
34
34
  #define GIT_DIR_SHORTNAME "GIT~1"
35
35
 
36
36
  extern bool git_repository__fsync_gitdir;
37
- extern bool git_repository__validate_ownership;
38
37
 
39
38
  /** Cvar cache identifiers */
40
39
  typedef enum {
@@ -119,14 +118,14 @@ typedef enum {
119
118
  /* core.fsyncObjectFiles */
120
119
  GIT_FSYNCOBJECTFILES_DEFAULT = GIT_CONFIGMAP_FALSE,
121
120
  /* core.longpaths */
122
- GIT_LONGPATHS_DEFAULT = GIT_CONFIGMAP_FALSE,
121
+ GIT_LONGPATHS_DEFAULT = GIT_CONFIGMAP_FALSE
123
122
  } git_configmap_value;
124
123
 
125
124
  /* internal repository init flags */
126
125
  enum {
127
126
  GIT_REPOSITORY_INIT__HAS_DOTGIT = (1u << 16),
128
127
  GIT_REPOSITORY_INIT__NATURAL_WD = (1u << 17),
129
- GIT_REPOSITORY_INIT__IS_REINIT = (1u << 18),
128
+ GIT_REPOSITORY_INIT__IS_REINIT = (1u << 18)
130
129
  };
131
130
 
132
131
  /** Internal structure for repository object */
@@ -149,7 +148,7 @@ struct git_repository {
149
148
  char *ident_name;
150
149
  char *ident_email;
151
150
 
152
- git_array_t(git_buf) reserved_names;
151
+ git_array_t(git_str) reserved_names;
153
152
 
154
153
  unsigned is_bare:1;
155
154
  unsigned is_worktree:1;
@@ -197,6 +196,8 @@ int git_repository_index__weakptr(git_index **out, git_repository *repo);
197
196
  int git_repository__configmap_lookup(int *out, git_repository *repo, git_configmap_item item);
198
197
  void git_repository__configmap_lookup_cache_clear(git_repository *repo);
199
198
 
199
+ int git_repository__item_path(git_str *out, const git_repository *repo, git_repository_item_t item);
200
+
200
201
  GIT_INLINE(int) git_repository__ensure_not_bare(
201
202
  git_repository *repo,
202
203
  const char *operation_name)
@@ -217,10 +218,10 @@ int git_repository__set_orig_head(git_repository *repo, const git_oid *orig_head
217
218
  int git_repository__cleanup_files(git_repository *repo, const char *files[], size_t files_len);
218
219
 
219
220
  /* The default "reserved names" for a repository */
220
- extern git_buf git_repository__reserved_names_win32[];
221
+ extern git_str git_repository__reserved_names_win32[];
221
222
  extern size_t git_repository__reserved_names_win32_len;
222
223
 
223
- extern git_buf git_repository__reserved_names_posix[];
224
+ extern git_str git_repository__reserved_names_posix[];
224
225
  extern size_t git_repository__reserved_names_posix_len;
225
226
 
226
227
  /*
@@ -234,13 +235,13 @@ extern size_t git_repository__reserved_names_posix_len;
234
235
  * will still be populated with good defaults.
235
236
  */
236
237
  bool git_repository__reserved_names(
237
- git_buf **out, size_t *outlen, git_repository *repo, bool include_ntfs);
238
+ git_str **out, size_t *outlen, git_repository *repo, bool include_ntfs);
238
239
 
239
240
  /*
240
241
  * The default branch for the repository; the `init.defaultBranch`
241
242
  * configuration option, if set, or `master` if it is not.
242
243
  */
243
- int git_repository_initialbranch(git_buf *out, git_repository *repo);
244
+ int git_repository_initialbranch(git_str *out, git_repository *repo);
244
245
 
245
246
  /*
246
247
  * Given a relative `path`, this makes it absolute based on the
@@ -248,7 +249,7 @@ int git_repository_initialbranch(git_buf *out, git_repository *repo);
248
249
  * to ensure that the path is not longer than MAX_PATH on Windows
249
250
  * (unless `core.longpaths` is set in the repo config).
250
251
  */
251
- int git_repository_workdir_path(git_buf *out, git_repository *repo, const char *path);
252
+ int git_repository_workdir_path(git_str *out, git_repository *repo, const char *path);
252
253
 
253
254
  int git_repository__extensions(char ***out, size_t *out_len);
254
255
  int git_repository__set_extensions(const char **extensions, size_t len);
@@ -111,7 +111,7 @@ static int reset(
111
111
  git_tree *tree = NULL;
112
112
  int error = 0;
113
113
  git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
114
- git_buf log_message = GIT_BUF_INIT;
114
+ git_str log_message = GIT_STR_INIT;
115
115
 
116
116
  GIT_ASSERT_ARG(repo);
117
117
  GIT_ASSERT_ARG(target);
@@ -144,7 +144,7 @@ static int reset(
144
144
  goto cleanup;
145
145
  }
146
146
 
147
- if ((error = git_buf_printf(&log_message, "reset: moving to %s", to)) < 0)
147
+ if ((error = git_str_printf(&log_message, "reset: moving to %s", to)) < 0)
148
148
  return error;
149
149
 
150
150
  if (reset_type == GIT_RESET_HARD) {
@@ -157,7 +157,7 @@ static int reset(
157
157
 
158
158
  /* move HEAD to the new target */
159
159
  if ((error = git_reference__update_terminal(repo, GIT_HEAD_FILE,
160
- git_object_id(commit), NULL, git_buf_cstr(&log_message))) < 0)
160
+ git_object_id(commit), NULL, git_str_cstr(&log_message))) < 0)
161
161
  goto cleanup;
162
162
 
163
163
  if (reset_type > GIT_RESET_SOFT) {
@@ -177,7 +177,7 @@ cleanup:
177
177
  git_object_free(commit);
178
178
  git_index_free(index);
179
179
  git_tree_free(tree);
180
- git_buf_dispose(&log_message);
180
+ git_str_dispose(&log_message);
181
181
 
182
182
  return error;
183
183
  }
@@ -188,7 +188,10 @@ int git_reset(
188
188
  git_reset_t reset_type,
189
189
  const git_checkout_options *checkout_opts)
190
190
  {
191
- return reset(repo, target, git_oid_tostr_s(git_object_id(target)), reset_type, checkout_opts);
191
+ char to[GIT_OID_HEXSZ + 1];
192
+
193
+ git_oid_tostr(to, GIT_OID_HEXSZ + 1, git_object_id(target));
194
+ return reset(repo, target, to, reset_type, checkout_opts);
192
195
  }
193
196
 
194
197
  int git_reset_from_annotated(
@@ -25,10 +25,10 @@ static int write_revert_head(
25
25
  const char *commit_oidstr)
26
26
  {
27
27
  git_filebuf file = GIT_FILEBUF_INIT;
28
- git_buf file_path = GIT_BUF_INIT;
28
+ git_str file_path = GIT_STR_INIT;
29
29
  int error = 0;
30
30
 
31
- if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_REVERT_HEAD_FILE)) >= 0 &&
31
+ if ((error = git_str_joinpath(&file_path, repo->gitdir, GIT_REVERT_HEAD_FILE)) >= 0 &&
32
32
  (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_CREATE_LEADING_DIRS, GIT_REVERT_FILE_MODE)) >= 0 &&
33
33
  (error = git_filebuf_printf(&file, "%s\n", commit_oidstr)) >= 0)
34
34
  error = git_filebuf_commit(&file);
@@ -36,7 +36,7 @@ static int write_revert_head(
36
36
  if (error < 0)
37
37
  git_filebuf_cleanup(&file);
38
38
 
39
- git_buf_dispose(&file_path);
39
+ git_str_dispose(&file_path);
40
40
 
41
41
  return error;
42
42
  }
@@ -47,10 +47,10 @@ static int write_merge_msg(
47
47
  const char *commit_msgline)
48
48
  {
49
49
  git_filebuf file = GIT_FILEBUF_INIT;
50
- git_buf file_path = GIT_BUF_INIT;
50
+ git_str file_path = GIT_STR_INIT;
51
51
  int error = 0;
52
52
 
53
- if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_MERGE_MSG_FILE)) < 0 ||
53
+ if ((error = git_str_joinpath(&file_path, repo->gitdir, GIT_MERGE_MSG_FILE)) < 0 ||
54
54
  (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_CREATE_LEADING_DIRS, GIT_REVERT_FILE_MODE)) < 0 ||
55
55
  (error = git_filebuf_printf(&file, "Revert \"%s\"\n\nThis reverts commit %s.\n",
56
56
  commit_msgline, commit_oidstr)) < 0)
@@ -62,7 +62,7 @@ cleanup:
62
62
  if (error < 0)
63
63
  git_filebuf_cleanup(&file);
64
64
 
65
- git_buf_dispose(&file_path);
65
+ git_str_dispose(&file_path);
66
66
 
67
67
  return error;
68
68
  }
@@ -178,7 +178,7 @@ int git_revert(
178
178
  git_commit *our_commit = NULL;
179
179
  char commit_oidstr[GIT_OID_HEXSZ + 1];
180
180
  const char *commit_msg;
181
- git_buf their_label = GIT_BUF_INIT;
181
+ git_str their_label = GIT_STR_INIT;
182
182
  git_index *index = NULL;
183
183
  git_indexwriter indexwriter = GIT_INDEXWRITER_INIT;
184
184
  int error;
@@ -199,8 +199,8 @@ int git_revert(
199
199
  goto on_error;
200
200
  }
201
201
 
202
- if ((error = git_buf_printf(&their_label, "parent of %.7s... %s", commit_oidstr, commit_msg)) < 0 ||
203
- (error = revert_normalize_opts(repo, &opts, given_opts, git_buf_cstr(&their_label))) < 0 ||
202
+ if ((error = git_str_printf(&their_label, "parent of %.7s... %s", commit_oidstr, commit_msg)) < 0 ||
203
+ (error = revert_normalize_opts(repo, &opts, given_opts, git_str_cstr(&their_label))) < 0 ||
204
204
  (error = git_indexwriter_init_for_operation(&indexwriter, repo, &opts.checkout_opts.checkout_strategy)) < 0 ||
205
205
  (error = write_revert_head(repo, commit_oidstr)) < 0 ||
206
206
  (error = write_merge_msg(repo, commit_oidstr, commit_msg)) < 0 ||
@@ -223,7 +223,7 @@ done:
223
223
  git_index_free(index);
224
224
  git_commit_free(our_commit);
225
225
  git_reference_free(our_ref);
226
- git_buf_dispose(&their_label);
226
+ git_str_dispose(&their_label);
227
227
 
228
228
  return error;
229
229
  }
@@ -7,10 +7,11 @@
7
7
 
8
8
  #include "common.h"
9
9
 
10
- #include "buffer.h"
10
+ #include "str.h"
11
11
  #include "tree.h"
12
12
  #include "refdb.h"
13
13
  #include "regexp.h"
14
+ #include "date.h"
14
15
 
15
16
  #include "git2.h"
16
17
 
@@ -145,7 +146,7 @@ static int retrieve_previously_checked_out_branch_or_revision(git_object **out,
145
146
  size_t i, numentries, cur;
146
147
  const git_reflog_entry *entry;
147
148
  const char *msg;
148
- git_buf buf = GIT_BUF_INIT;
149
+ git_str buf = GIT_STR_INIT;
149
150
 
150
151
  cur = position;
151
152
 
@@ -179,16 +180,16 @@ static int retrieve_previously_checked_out_branch_or_revision(git_object **out,
179
180
  if (cur > 0)
180
181
  continue;
181
182
 
182
- if ((git_buf_put(&buf, msg+regexmatches[1].start, regexmatches[1].end - regexmatches[1].start)) < 0)
183
+ if ((git_str_put(&buf, msg+regexmatches[1].start, regexmatches[1].end - regexmatches[1].start)) < 0)
183
184
  goto cleanup;
184
185
 
185
- if ((error = git_reference_dwim(base_ref, repo, git_buf_cstr(&buf))) == 0)
186
+ if ((error = git_reference_dwim(base_ref, repo, git_str_cstr(&buf))) == 0)
186
187
  goto cleanup;
187
188
 
188
189
  if (error < 0 && error != GIT_ENOTFOUND)
189
190
  goto cleanup;
190
191
 
191
- error = maybe_abbrev(out, repo, git_buf_cstr(&buf));
192
+ error = maybe_abbrev(out, repo, git_str_cstr(&buf));
192
193
 
193
194
  goto cleanup;
194
195
  }
@@ -197,7 +198,7 @@ static int retrieve_previously_checked_out_branch_or_revision(git_object **out,
197
198
 
198
199
  cleanup:
199
200
  git_reference_free(ref);
200
- git_buf_dispose(&buf);
201
+ git_str_dispose(&buf);
201
202
  git_regexp_dispose(&preg);
202
203
  git_reflog_free(reflog);
203
204
  return error;
@@ -207,7 +208,7 @@ static int retrieve_oid_from_reflog(git_oid *oid, git_reference *ref, size_t ide
207
208
  {
208
209
  git_reflog *reflog;
209
210
  size_t numentries;
210
- const git_reflog_entry *entry;
211
+ const git_reflog_entry *entry = NULL;
211
212
  bool search_by_pos = (identifier <= 100000000);
212
213
 
213
214
  if (git_reflog_read(&reflog, git_reference_owner(ref), git_reference_name(ref)) < 0)
@@ -236,8 +237,15 @@ static int retrieve_oid_from_reflog(git_oid *oid, git_reference *ref, size_t ide
236
237
  break;
237
238
  }
238
239
 
239
- if (i == numentries)
240
- goto notfound;
240
+ if (i == numentries) {
241
+ if (entry == NULL)
242
+ goto notfound;
243
+
244
+ /*
245
+ * TODO: emit a warning (log for 'branch' only goes back to ...)
246
+ */
247
+ git_oid_cpy(oid, git_reflog_entry_id_new(entry));
248
+ }
241
249
  }
242
250
 
243
251
  git_reflog_free(reflog);
@@ -314,12 +322,12 @@ static int handle_at_syntax(git_object **out, git_reference **ref, const char *s
314
322
  {
315
323
  bool is_numeric;
316
324
  int parsed = 0, error = -1;
317
- git_buf identifier = GIT_BUF_INIT;
325
+ git_str identifier = GIT_STR_INIT;
318
326
  git_time_t timestamp;
319
327
 
320
328
  GIT_ASSERT(*out == NULL);
321
329
 
322
- if (git_buf_put(&identifier, spec, identifier_len) < 0)
330
+ if (git_str_put(&identifier, spec, identifier_len) < 0)
323
331
  return -1;
324
332
 
325
333
  is_numeric = !try_parse_numeric(&parsed, curly_braces_content);
@@ -331,26 +339,28 @@ static int handle_at_syntax(git_object **out, git_reference **ref, const char *s
331
339
 
332
340
  if (is_numeric) {
333
341
  if (parsed < 0)
334
- error = retrieve_previously_checked_out_branch_or_revision(out, ref, repo, git_buf_cstr(&identifier), -parsed);
342
+ error = retrieve_previously_checked_out_branch_or_revision(out, ref, repo, git_str_cstr(&identifier), -parsed);
335
343
  else
336
- error = retrieve_revobject_from_reflog(out, ref, repo, git_buf_cstr(&identifier), parsed);
344
+ error = retrieve_revobject_from_reflog(out, ref, repo, git_str_cstr(&identifier), parsed);
337
345
 
338
346
  goto cleanup;
339
347
  }
340
348
 
341
349
  if (!strcmp(curly_braces_content, "u") || !strcmp(curly_braces_content, "upstream")) {
342
- error = retrieve_remote_tracking_reference(ref, git_buf_cstr(&identifier), repo);
350
+ error = retrieve_remote_tracking_reference(ref, git_str_cstr(&identifier), repo);
343
351
 
344
352
  goto cleanup;
345
353
  }
346
354
 
347
- if (git__date_parse(&timestamp, curly_braces_content) < 0)
355
+ if (git_date_parse(&timestamp, curly_braces_content) < 0) {
356
+ error = GIT_EINVALIDSPEC;
348
357
  goto cleanup;
358
+ }
349
359
 
350
- error = retrieve_revobject_from_reflog(out, ref, repo, git_buf_cstr(&identifier), (size_t)timestamp);
360
+ error = retrieve_revobject_from_reflog(out, ref, repo, git_str_cstr(&identifier), (size_t)timestamp);
351
361
 
352
362
  cleanup:
353
- git_buf_dispose(&identifier);
363
+ git_str_dispose(&identifier);
354
364
  return error;
355
365
  }
356
366
 
@@ -520,9 +530,9 @@ static int handle_caret_curly_syntax(git_object **out, git_object *obj, const ch
520
530
  return git_object_peel(out, obj, expected_type);
521
531
  }
522
532
 
523
- static int extract_curly_braces_content(git_buf *buf, const char *spec, size_t *pos)
533
+ static int extract_curly_braces_content(git_str *buf, const char *spec, size_t *pos)
524
534
  {
525
- git_buf_clear(buf);
535
+ git_str_clear(buf);
526
536
 
527
537
  GIT_ASSERT_ARG(spec[*pos] == '^' || spec[*pos] == '@');
528
538
 
@@ -537,7 +547,7 @@ static int extract_curly_braces_content(git_buf *buf, const char *spec, size_t *
537
547
  if (spec[*pos] == '\0')
538
548
  return GIT_EINVALIDSPEC;
539
549
 
540
- if (git_buf_putc(buf, spec[(*pos)++]) < 0)
550
+ if (git_str_putc(buf, spec[(*pos)++]) < 0)
541
551
  return -1;
542
552
  }
543
553
 
@@ -546,18 +556,18 @@ static int extract_curly_braces_content(git_buf *buf, const char *spec, size_t *
546
556
  return 0;
547
557
  }
548
558
 
549
- static int extract_path(git_buf *buf, const char *spec, size_t *pos)
559
+ static int extract_path(git_str *buf, const char *spec, size_t *pos)
550
560
  {
551
- git_buf_clear(buf);
561
+ git_str_clear(buf);
552
562
 
553
563
  GIT_ASSERT_ARG(spec[*pos] == ':');
554
564
 
555
565
  (*pos)++;
556
566
 
557
- if (git_buf_puts(buf, spec + *pos) < 0)
567
+ if (git_str_puts(buf, spec + *pos) < 0)
558
568
  return -1;
559
569
 
560
- *pos += git_buf_len(buf);
570
+ *pos += git_str_len(buf);
561
571
 
562
572
  return 0;
563
573
  }
@@ -610,7 +620,7 @@ static int object_from_reference(git_object **object, git_reference *reference)
610
620
  static int ensure_base_rev_loaded(git_object **object, git_reference **reference, const char *spec, size_t identifier_len, git_repository *repo, bool allow_empty_identifier)
611
621
  {
612
622
  int error;
613
- git_buf identifier = GIT_BUF_INIT;
623
+ git_str identifier = GIT_STR_INIT;
614
624
 
615
625
  if (*object != NULL)
616
626
  return 0;
@@ -621,11 +631,11 @@ static int ensure_base_rev_loaded(git_object **object, git_reference **reference
621
631
  if (!allow_empty_identifier && identifier_len == 0)
622
632
  return GIT_EINVALIDSPEC;
623
633
 
624
- if (git_buf_put(&identifier, spec, identifier_len) < 0)
634
+ if (git_str_put(&identifier, spec, identifier_len) < 0)
625
635
  return -1;
626
636
 
627
- error = revparse_lookup_object(object, reference, repo, git_buf_cstr(&identifier));
628
- git_buf_dispose(&identifier);
637
+ error = revparse_lookup_object(object, reference, repo, git_str_cstr(&identifier));
638
+ git_str_dispose(&identifier);
629
639
 
630
640
  return error;
631
641
  }
@@ -669,7 +679,7 @@ static int revparse(
669
679
  {
670
680
  size_t pos = 0, identifier_len = 0;
671
681
  int error = -1, n;
672
- git_buf buf = GIT_BUF_INIT;
682
+ git_str buf = GIT_STR_INIT;
673
683
 
674
684
  git_reference *reference = NULL;
675
685
  git_object *base_rev = NULL;
@@ -698,7 +708,7 @@ static int revparse(
698
708
  if ((error = extract_curly_braces_content(&buf, spec, &pos)) < 0)
699
709
  goto cleanup;
700
710
 
701
- if ((error = handle_caret_curly_syntax(&temp_object, base_rev, git_buf_cstr(&buf))) < 0)
711
+ if ((error = handle_caret_curly_syntax(&temp_object, base_rev, git_str_cstr(&buf))) < 0)
702
712
  goto cleanup;
703
713
 
704
714
  git_object_free(base_rev);
@@ -750,11 +760,11 @@ static int revparse(
750
760
  if ((error = ensure_base_rev_loaded(&base_rev, &reference, spec, identifier_len, repo, true)) < 0)
751
761
  goto cleanup;
752
762
 
753
- if ((error = handle_colon_syntax(&temp_object, base_rev, git_buf_cstr(&buf))) < 0)
763
+ if ((error = handle_colon_syntax(&temp_object, base_rev, git_str_cstr(&buf))) < 0)
754
764
  goto cleanup;
755
765
  } else {
756
- if (*git_buf_cstr(&buf) == '/') {
757
- if ((error = handle_grep_syntax(&temp_object, repo, NULL, git_buf_cstr(&buf) + 1)) < 0)
766
+ if (*git_str_cstr(&buf) == '/') {
767
+ if ((error = handle_grep_syntax(&temp_object, repo, NULL, git_str_cstr(&buf) + 1)) < 0)
758
768
  goto cleanup;
759
769
  } else {
760
770
 
@@ -783,12 +793,15 @@ static int revparse(
783
793
  if ((error = ensure_base_rev_is_not_known_yet(base_rev)) < 0)
784
794
  goto cleanup;
785
795
 
786
- if ((error = handle_at_syntax(&temp_object, &reference, spec, identifier_len, repo, git_buf_cstr(&buf))) < 0)
796
+ if ((error = handle_at_syntax(&temp_object, &reference, spec, identifier_len, repo, git_str_cstr(&buf))) < 0)
787
797
  goto cleanup;
788
798
 
789
799
  if (temp_object != NULL)
790
800
  base_rev = temp_object;
791
801
  break;
802
+ } else if (spec[pos+1] == '\0') {
803
+ spec = "HEAD";
804
+ break;
792
805
  }
793
806
  /* fall through */
794
807
 
@@ -824,7 +837,7 @@ cleanup:
824
837
  git_reference_free(reference);
825
838
  }
826
839
 
827
- git_buf_dispose(&buf);
840
+ git_str_dispose(&buf);
828
841
  return error;
829
842
  }
830
843
 
@@ -131,7 +131,7 @@ int git_revwalk__push_glob(git_revwalk *walk, const char *glob, const git_revwal
131
131
  {
132
132
  git_revwalk__push_options opts = GIT_REVWALK__PUSH_OPTIONS_INIT;
133
133
  int error = 0;
134
- git_buf buf = GIT_BUF_INIT;
134
+ git_str buf = GIT_STR_INIT;
135
135
  git_reference *ref;
136
136
  git_reference_iterator *iter;
137
137
  size_t wildcard;
@@ -144,15 +144,15 @@ int git_revwalk__push_glob(git_revwalk *walk, const char *glob, const git_revwal
144
144
 
145
145
  /* refs/ is implied if not given in the glob */
146
146
  if (git__prefixcmp(glob, GIT_REFS_DIR) != 0)
147
- git_buf_joinpath(&buf, GIT_REFS_DIR, glob);
147
+ git_str_joinpath(&buf, GIT_REFS_DIR, glob);
148
148
  else
149
- git_buf_puts(&buf, glob);
150
- GIT_ERROR_CHECK_ALLOC_BUF(&buf);
149
+ git_str_puts(&buf, glob);
150
+ GIT_ERROR_CHECK_ALLOC_STR(&buf);
151
151
 
152
152
  /* If no '?', '*' or '[' exist, we append '/ *' to the glob */
153
153
  wildcard = strcspn(glob, "?*[");
154
154
  if (!glob[wildcard])
155
- git_buf_put(&buf, "/*", 2);
155
+ git_str_put(&buf, "/*", 2);
156
156
 
157
157
  if ((error = git_reference_iterator_glob_new(&iter, walk->repo, buf.ptr)) < 0)
158
158
  goto out;
@@ -169,7 +169,7 @@ int git_revwalk__push_glob(git_revwalk *walk, const char *glob, const git_revwal
169
169
  if (error == GIT_ITEROVER)
170
170
  error = 0;
171
171
  out:
172
- git_buf_dispose(&buf);
172
+ git_str_dispose(&buf);
173
173
  return error;
174
174
  }
175
175
 
@@ -427,7 +427,7 @@ static int add_parents_to_list(git_revwalk *walk, git_commit_list_node *commit,
427
427
  return 0;
428
428
  }
429
429
 
430
- /* How many unintersting commits we want to look at after we run out of interesting ones */
430
+ /* How many uninteresting commits we want to look at after we run out of interesting ones */
431
431
  #define SLOP 5
432
432
 
433
433
  static int still_interesting(git_commit_list *list, int64_t time, int slop)
@@ -23,6 +23,12 @@ void git_signature_free(git_signature *sig)
23
23
  git__free(sig);
24
24
  }
25
25
 
26
+ static int signature_parse_error(const char *msg)
27
+ {
28
+ git_error_set(GIT_ERROR_INVALID, "failed to parse signature - %s", msg);
29
+ return GIT_EINVALID;
30
+ }
31
+
26
32
  static int signature_error(const char *msg)
27
33
  {
28
34
  git_error_set(GIT_ERROR_INVALID, "failed to parse signature - %s", msg);
@@ -206,13 +212,13 @@ int git_signature__parse(git_signature *sig, const char **buffer_out,
206
212
 
207
213
  if (ender &&
208
214
  (buffer_end = memchr(buffer, ender, buffer_end - buffer)) == NULL)
209
- return signature_error("no newline given");
215
+ return signature_parse_error("no newline given");
210
216
 
211
217
  if (header) {
212
218
  const size_t header_len = strlen(header);
213
219
 
214
220
  if (buffer + header_len >= buffer_end || memcmp(buffer, header, header_len) != 0)
215
- return signature_error("expected prefix doesn't match actual");
221
+ return signature_parse_error("expected prefix doesn't match actual");
216
222
 
217
223
  buffer += header_len;
218
224
  }
@@ -221,7 +227,7 @@ int git_signature__parse(git_signature *sig, const char **buffer_out,
221
227
  email_end = git__memrchr(buffer, '>', buffer_end - buffer);
222
228
 
223
229
  if (!email_start || !email_end || email_end <= email_start)
224
- return signature_error("malformed e-mail");
230
+ return signature_parse_error("malformed e-mail");
225
231
 
226
232
  email_start += 1;
227
233
  sig->name = extract_trimmed(buffer, email_start - buffer - 1);
@@ -237,7 +243,7 @@ int git_signature__parse(git_signature *sig, const char **buffer_out,
237
243
  git__free(sig->name);
238
244
  git__free(sig->email);
239
245
  sig->name = sig->email = NULL;
240
- return signature_error("invalid Unix timestamp");
246
+ return signature_parse_error("invalid Unix timestamp");
241
247
  }
242
248
 
243
249
  /* do we have a timezone? */
@@ -299,7 +305,7 @@ int git_signature_from_buffer(git_signature **out, const char *buf)
299
305
  return error;
300
306
  }
301
307
 
302
- void git_signature__writebuf(git_buf *buf, const char *header, const git_signature *sig)
308
+ void git_signature__writebuf(git_str *buf, const char *header, const git_signature *sig)
303
309
  {
304
310
  int offset, hours, mins;
305
311
  char sign;
@@ -313,7 +319,7 @@ void git_signature__writebuf(git_buf *buf, const char *header, const git_signatu
313
319
  hours = offset / 60;
314
320
  mins = offset % 60;
315
321
 
316
- git_buf_printf(buf, "%s%s <%s> %u %c%02d%02d\n",
322
+ git_str_printf(buf, "%s%s <%s> %u %c%02d%02d\n",
317
323
  header ? header : "", sig->name, sig->email,
318
324
  (unsigned)sig->when.time, sign, hours, mins);
319
325
  }
@@ -15,7 +15,7 @@
15
15
  #include <time.h>
16
16
 
17
17
  int git_signature__parse(git_signature *sig, const char **buffer_out, const char *buffer_end, const char *header, char ender);
18
- void git_signature__writebuf(git_buf *buf, const char *header, const git_signature *sig);
18
+ void git_signature__writebuf(git_str *buf, const char *header, const git_signature *sig);
19
19
  bool git_signature__equal(const git_signature *one, const git_signature *two);
20
20
 
21
21
  int git_signature__pdup(git_signature **dest, const git_signature *source, git_pool *pool);
@@ -201,7 +201,7 @@ void git_sortedcache_runlock(git_sortedcache *sc)
201
201
  /* if the file has changed, lock cache and load file contents into buf;
202
202
  * returns <0 on error, >0 if file has not changed
203
203
  */
204
- int git_sortedcache_lockandload(git_sortedcache *sc, git_buf *buf)
204
+ int git_sortedcache_lockandload(git_sortedcache *sc, git_str *buf)
205
205
  {
206
206
  int error, fd;
207
207
  struct stat st;
@@ -121,7 +121,7 @@ void git_sortedcache_wunlock(git_sortedcache *sc);
121
121
  * @return 0 if up-to-date, 1 if out-of-date, <0 on error
122
122
  */
123
123
  GIT_WARN_UNUSED_RESULT int git_sortedcache_lockandload(
124
- git_sortedcache *sc, git_buf *buf);
124
+ git_sortedcache *sc, git_str *buf);
125
125
 
126
126
  /* Refresh file timestamp after write completes
127
127
  * You should already be holding the write lock when you call this.