rugged 1.3.2.3 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -110,7 +110,7 @@ enum {
110
110
  GIT_SUBMODULE_STATUS__HEAD_NOT_SUBMODULE = (1u << 24),
111
111
  GIT_SUBMODULE_STATUS__INDEX_NOT_SUBMODULE = (1u << 25),
112
112
  GIT_SUBMODULE_STATUS__WD_NOT_SUBMODULE = (1u << 26),
113
- GIT_SUBMODULE_STATUS__INDEX_MULTIPLE_ENTRIES = (1u << 27),
113
+ GIT_SUBMODULE_STATUS__INDEX_MULTIPLE_ENTRIES = (1u << 27)
114
114
  };
115
115
 
116
116
  #define GIT_SUBMODULE_STATUS__CLEAR_INTERNAL(S) \
@@ -8,8 +8,8 @@
8
8
  #include "sysdir.h"
9
9
 
10
10
  #include "runtime.h"
11
- #include "buffer.h"
12
- #include "path.h"
11
+ #include "str.h"
12
+ #include "fs_path.h"
13
13
  #include <ctype.h>
14
14
  #if GIT_WIN32
15
15
  #include "win32/findfile.h"
@@ -18,27 +18,27 @@
18
18
  #include <pwd.h>
19
19
  #endif
20
20
 
21
- static int git_sysdir_guess_programdata_dirs(git_buf *out)
21
+ static int git_sysdir_guess_programdata_dirs(git_str *out)
22
22
  {
23
23
  #ifdef GIT_WIN32
24
24
  return git_win32__find_programdata_dirs(out);
25
25
  #else
26
- git_buf_clear(out);
26
+ git_str_clear(out);
27
27
  return 0;
28
28
  #endif
29
29
  }
30
30
 
31
- static int git_sysdir_guess_system_dirs(git_buf *out)
31
+ static int git_sysdir_guess_system_dirs(git_str *out)
32
32
  {
33
33
  #ifdef GIT_WIN32
34
- return git_win32__find_system_dirs(out, L"etc\\");
34
+ return git_win32__find_system_dirs(out, "etc");
35
35
  #else
36
- return git_buf_sets(out, "/etc");
36
+ return git_str_sets(out, "/etc");
37
37
  #endif
38
38
  }
39
39
 
40
40
  #ifndef GIT_WIN32
41
- static int get_passwd_home(git_buf *out, uid_t uid)
41
+ static int get_passwd_home(git_str *out, uid_t uid)
42
42
  {
43
43
  struct passwd pwd, *pwdptr;
44
44
  char *buf = NULL;
@@ -66,7 +66,7 @@ static int get_passwd_home(git_buf *out, uid_t uid)
66
66
  goto out;
67
67
  }
68
68
 
69
- if ((error = git_buf_puts(out, pwdptr->pw_dir)) < 0)
69
+ if ((error = git_str_puts(out, pwdptr->pw_dir)) < 0)
70
70
  goto out;
71
71
 
72
72
  out:
@@ -75,7 +75,7 @@ out:
75
75
  }
76
76
  #endif
77
77
 
78
- static int git_sysdir_guess_global_dirs(git_buf *out)
78
+ static int git_sysdir_guess_global_dirs(git_str *out)
79
79
  {
80
80
  #ifdef GIT_WIN32
81
81
  return git_win32__find_global_dirs(out);
@@ -114,12 +114,12 @@ static int git_sysdir_guess_global_dirs(git_buf *out)
114
114
  #endif
115
115
  }
116
116
 
117
- static int git_sysdir_guess_xdg_dirs(git_buf *out)
117
+ static int git_sysdir_guess_xdg_dirs(git_str *out)
118
118
  {
119
119
  #ifdef GIT_WIN32
120
120
  return git_win32__find_xdg_dirs(out);
121
121
  #else
122
- git_buf env = GIT_BUF_INIT;
122
+ git_str env = GIT_STR_INIT;
123
123
  int error;
124
124
  uid_t uid, euid;
125
125
 
@@ -132,13 +132,13 @@ static int git_sysdir_guess_xdg_dirs(git_buf *out)
132
132
  */
133
133
  if (uid == euid) {
134
134
  if ((error = git__getenv(&env, "XDG_CONFIG_HOME")) == 0)
135
- error = git_buf_joinpath(out, env.ptr, "git");
135
+ error = git_str_joinpath(out, env.ptr, "git");
136
136
 
137
137
  if (error == GIT_ENOTFOUND && (error = git__getenv(&env, "HOME")) == 0)
138
- error = git_buf_joinpath(out, env.ptr, ".config/git");
138
+ error = git_str_joinpath(out, env.ptr, ".config/git");
139
139
  } else {
140
140
  if ((error = get_passwd_home(&env, euid)) == 0)
141
- error = git_buf_joinpath(out, env.ptr, ".config/git");
141
+ error = git_str_joinpath(out, env.ptr, ".config/git");
142
142
  }
143
143
 
144
144
  if (error == GIT_ENOTFOUND) {
@@ -146,31 +146,31 @@ static int git_sysdir_guess_xdg_dirs(git_buf *out)
146
146
  error = 0;
147
147
  }
148
148
 
149
- git_buf_dispose(&env);
149
+ git_str_dispose(&env);
150
150
  return error;
151
151
  #endif
152
152
  }
153
153
 
154
- static int git_sysdir_guess_template_dirs(git_buf *out)
154
+ static int git_sysdir_guess_template_dirs(git_str *out)
155
155
  {
156
156
  #ifdef GIT_WIN32
157
- return git_win32__find_system_dirs(out, L"share\\git-core\\templates");
157
+ return git_win32__find_system_dirs(out, "share/git-core/templates");
158
158
  #else
159
- return git_buf_sets(out, "/usr/share/git-core/templates");
159
+ return git_str_sets(out, "/usr/share/git-core/templates");
160
160
  #endif
161
161
  }
162
162
 
163
163
  struct git_sysdir__dir {
164
- git_buf buf;
165
- int (*guess)(git_buf *out);
164
+ git_str buf;
165
+ int (*guess)(git_str *out);
166
166
  };
167
167
 
168
168
  static struct git_sysdir__dir git_sysdir__dirs[] = {
169
- { GIT_BUF_INIT, git_sysdir_guess_system_dirs },
170
- { GIT_BUF_INIT, git_sysdir_guess_global_dirs },
171
- { GIT_BUF_INIT, git_sysdir_guess_xdg_dirs },
172
- { GIT_BUF_INIT, git_sysdir_guess_programdata_dirs },
173
- { GIT_BUF_INIT, git_sysdir_guess_template_dirs },
169
+ { GIT_STR_INIT, git_sysdir_guess_system_dirs },
170
+ { GIT_STR_INIT, git_sysdir_guess_global_dirs },
171
+ { GIT_STR_INIT, git_sysdir_guess_xdg_dirs },
172
+ { GIT_STR_INIT, git_sysdir_guess_programdata_dirs },
173
+ { GIT_STR_INIT, git_sysdir_guess_template_dirs },
174
174
  };
175
175
 
176
176
  static void git_sysdir_global_shutdown(void)
@@ -178,7 +178,7 @@ static void git_sysdir_global_shutdown(void)
178
178
  size_t i;
179
179
 
180
180
  for (i = 0; i < ARRAY_SIZE(git_sysdir__dirs); ++i)
181
- git_buf_dispose(&git_sysdir__dirs[i].buf);
181
+ git_str_dispose(&git_sysdir__dirs[i].buf);
182
182
  }
183
183
 
184
184
  int git_sysdir_global_init(void)
@@ -189,9 +189,25 @@ int git_sysdir_global_init(void)
189
189
  for (i = 0; !error && i < ARRAY_SIZE(git_sysdir__dirs); i++)
190
190
  error = git_sysdir__dirs[i].guess(&git_sysdir__dirs[i].buf);
191
191
 
192
+ if (error)
193
+ return error;
194
+
192
195
  return git_runtime_shutdown_register(git_sysdir_global_shutdown);
193
196
  }
194
197
 
198
+ int git_sysdir_reset(void)
199
+ {
200
+ size_t i;
201
+ int error = 0;
202
+
203
+ for (i = 0; !error && i < ARRAY_SIZE(git_sysdir__dirs); ++i) {
204
+ git_str_dispose(&git_sysdir__dirs[i].buf);
205
+ error = git_sysdir__dirs[i].guess(&git_sysdir__dirs[i].buf);
206
+ }
207
+
208
+ return error;
209
+ }
210
+
195
211
  static int git_sysdir_check_selector(git_sysdir_t which)
196
212
  {
197
213
  if (which < ARRAY_SIZE(git_sysdir__dirs))
@@ -202,7 +218,7 @@ static int git_sysdir_check_selector(git_sysdir_t which)
202
218
  }
203
219
 
204
220
 
205
- int git_sysdir_get(const git_buf **out, git_sysdir_t which)
221
+ int git_sysdir_get(const git_str **out, git_sysdir_t which)
206
222
  {
207
223
  GIT_ASSERT_ARG(out);
208
224
 
@@ -219,7 +235,7 @@ int git_sysdir_get(const git_buf **out, git_sysdir_t which)
219
235
  int git_sysdir_set(git_sysdir_t which, const char *search_path)
220
236
  {
221
237
  const char *expand_path = NULL;
222
- git_buf merge = GIT_BUF_INIT;
238
+ git_str merge = GIT_STR_INIT;
223
239
 
224
240
  GIT_ERROR_CHECK_ERROR(git_sysdir_check_selector(which));
225
241
 
@@ -233,48 +249,48 @@ int git_sysdir_set(git_sysdir_t which, const char *search_path)
233
249
  /* if $PATH is not referenced, then just set the path */
234
250
  if (!expand_path) {
235
251
  if (search_path)
236
- git_buf_sets(&git_sysdir__dirs[which].buf, search_path);
252
+ git_str_sets(&git_sysdir__dirs[which].buf, search_path);
237
253
 
238
254
  goto done;
239
255
  }
240
256
 
241
257
  /* otherwise set to join(before $PATH, old value, after $PATH) */
242
258
  if (expand_path > search_path)
243
- git_buf_set(&merge, search_path, expand_path - search_path);
259
+ git_str_set(&merge, search_path, expand_path - search_path);
244
260
 
245
- if (git_buf_len(&git_sysdir__dirs[which].buf))
246
- git_buf_join(&merge, GIT_PATH_LIST_SEPARATOR,
261
+ if (git_str_len(&git_sysdir__dirs[which].buf))
262
+ git_str_join(&merge, GIT_PATH_LIST_SEPARATOR,
247
263
  merge.ptr, git_sysdir__dirs[which].buf.ptr);
248
264
 
249
265
  expand_path += strlen(PATH_MAGIC);
250
266
  if (*expand_path)
251
- git_buf_join(&merge, GIT_PATH_LIST_SEPARATOR, merge.ptr, expand_path);
267
+ git_str_join(&merge, GIT_PATH_LIST_SEPARATOR, merge.ptr, expand_path);
252
268
 
253
- git_buf_swap(&git_sysdir__dirs[which].buf, &merge);
254
- git_buf_dispose(&merge);
269
+ git_str_swap(&git_sysdir__dirs[which].buf, &merge);
270
+ git_str_dispose(&merge);
255
271
 
256
272
  done:
257
- if (git_buf_oom(&git_sysdir__dirs[which].buf))
273
+ if (git_str_oom(&git_sysdir__dirs[which].buf))
258
274
  return -1;
259
275
 
260
276
  return 0;
261
277
  }
262
278
 
263
279
  static int git_sysdir_find_in_dirlist(
264
- git_buf *path,
280
+ git_str *path,
265
281
  const char *name,
266
282
  git_sysdir_t which,
267
283
  const char *label)
268
284
  {
269
285
  size_t len;
270
286
  const char *scan, *next = NULL;
271
- const git_buf *syspath;
287
+ const git_str *syspath;
272
288
 
273
289
  GIT_ERROR_CHECK_ERROR(git_sysdir_get(&syspath, which));
274
- if (!syspath || !git_buf_len(syspath))
290
+ if (!syspath || !git_str_len(syspath))
275
291
  goto done;
276
292
 
277
- for (scan = git_buf_cstr(syspath); scan; scan = next) {
293
+ for (scan = git_str_cstr(syspath); scan; scan = next) {
278
294
  /* find unescaped separator or end of string */
279
295
  for (next = scan; *next; ++next) {
280
296
  if (*next == GIT_PATH_LIST_SEPARATOR &&
@@ -287,11 +303,11 @@ static int git_sysdir_find_in_dirlist(
287
303
  if (!len)
288
304
  continue;
289
305
 
290
- GIT_ERROR_CHECK_ERROR(git_buf_set(path, scan, len));
306
+ GIT_ERROR_CHECK_ERROR(git_str_set(path, scan, len));
291
307
  if (name)
292
- GIT_ERROR_CHECK_ERROR(git_buf_joinpath(path, path->ptr, name));
308
+ GIT_ERROR_CHECK_ERROR(git_str_joinpath(path, path->ptr, name));
293
309
 
294
- if (git_path_exists(path->ptr))
310
+ if (git_fs_path_exists(path->ptr))
295
311
  return 0;
296
312
  }
297
313
 
@@ -300,47 +316,47 @@ done:
300
316
  git_error_set(GIT_ERROR_OS, "the %s file '%s' doesn't exist", label, name);
301
317
  else
302
318
  git_error_set(GIT_ERROR_OS, "the %s directory doesn't exist", label);
303
- git_buf_dispose(path);
319
+ git_str_dispose(path);
304
320
  return GIT_ENOTFOUND;
305
321
  }
306
322
 
307
- int git_sysdir_find_system_file(git_buf *path, const char *filename)
323
+ int git_sysdir_find_system_file(git_str *path, const char *filename)
308
324
  {
309
325
  return git_sysdir_find_in_dirlist(
310
326
  path, filename, GIT_SYSDIR_SYSTEM, "system");
311
327
  }
312
328
 
313
- int git_sysdir_find_global_file(git_buf *path, const char *filename)
329
+ int git_sysdir_find_global_file(git_str *path, const char *filename)
314
330
  {
315
331
  return git_sysdir_find_in_dirlist(
316
332
  path, filename, GIT_SYSDIR_GLOBAL, "global");
317
333
  }
318
334
 
319
- int git_sysdir_find_xdg_file(git_buf *path, const char *filename)
335
+ int git_sysdir_find_xdg_file(git_str *path, const char *filename)
320
336
  {
321
337
  return git_sysdir_find_in_dirlist(
322
338
  path, filename, GIT_SYSDIR_XDG, "global/xdg");
323
339
  }
324
340
 
325
- int git_sysdir_find_programdata_file(git_buf *path, const char *filename)
341
+ int git_sysdir_find_programdata_file(git_str *path, const char *filename)
326
342
  {
327
343
  return git_sysdir_find_in_dirlist(
328
344
  path, filename, GIT_SYSDIR_PROGRAMDATA, "ProgramData");
329
345
  }
330
346
 
331
- int git_sysdir_find_template_dir(git_buf *path)
347
+ int git_sysdir_find_template_dir(git_str *path)
332
348
  {
333
349
  return git_sysdir_find_in_dirlist(
334
350
  path, NULL, GIT_SYSDIR_TEMPLATE, "template");
335
351
  }
336
352
 
337
- int git_sysdir_expand_global_file(git_buf *path, const char *filename)
353
+ int git_sysdir_expand_global_file(git_str *path, const char *filename)
338
354
  {
339
355
  int error;
340
356
 
341
357
  if ((error = git_sysdir_find_global_file(path, NULL)) == 0) {
342
358
  if (filename)
343
- error = git_buf_joinpath(path, path->ptr, filename);
359
+ error = git_str_joinpath(path, path->ptr, filename);
344
360
  }
345
361
 
346
362
  return error;
@@ -10,7 +10,7 @@
10
10
  #include "common.h"
11
11
 
12
12
  #include "posix.h"
13
- #include "buffer.h"
13
+ #include "str.h"
14
14
 
15
15
  /**
16
16
  * Find a "global" file (i.e. one in a user's home directory).
@@ -19,7 +19,7 @@
19
19
  * @param filename name of file to find in the home directory
20
20
  * @return 0 if found, GIT_ENOTFOUND if not found, or -1 on other OS error
21
21
  */
22
- extern int git_sysdir_find_global_file(git_buf *path, const char *filename);
22
+ extern int git_sysdir_find_global_file(git_str *path, const char *filename);
23
23
 
24
24
  /**
25
25
  * Find an "XDG" file (i.e. one in user's XDG config path).
@@ -28,7 +28,7 @@ extern int git_sysdir_find_global_file(git_buf *path, const char *filename);
28
28
  * @param filename name of file to find in the home directory
29
29
  * @return 0 if found, GIT_ENOTFOUND if not found, or -1 on other OS error
30
30
  */
31
- extern int git_sysdir_find_xdg_file(git_buf *path, const char *filename);
31
+ extern int git_sysdir_find_xdg_file(git_str *path, const char *filename);
32
32
 
33
33
  /**
34
34
  * Find a "system" file (i.e. one shared for all users of the system).
@@ -37,7 +37,7 @@ extern int git_sysdir_find_xdg_file(git_buf *path, const char *filename);
37
37
  * @param filename name of file to find in the home directory
38
38
  * @return 0 if found, GIT_ENOTFOUND if not found, or -1 on other OS error
39
39
  */
40
- extern int git_sysdir_find_system_file(git_buf *path, const char *filename);
40
+ extern int git_sysdir_find_system_file(git_str *path, const char *filename);
41
41
 
42
42
  /**
43
43
  * Find a "ProgramData" file (i.e. one in %PROGRAMDATA%)
@@ -46,7 +46,7 @@ extern int git_sysdir_find_system_file(git_buf *path, const char *filename);
46
46
  * @param filename name of file to find in the ProgramData directory
47
47
  * @return 0 if found, GIT_ENOTFOUND if not found, or -1 on other OS error
48
48
  */
49
- extern int git_sysdir_find_programdata_file(git_buf *path, const char *filename);
49
+ extern int git_sysdir_find_programdata_file(git_str *path, const char *filename);
50
50
 
51
51
  /**
52
52
  * Find template directory.
@@ -54,7 +54,7 @@ extern int git_sysdir_find_programdata_file(git_buf *path, const char *filename)
54
54
  * @param path buffer to write the full path into
55
55
  * @return 0 if found, GIT_ENOTFOUND if not found, or -1 on other OS error
56
56
  */
57
- extern int git_sysdir_find_template_dir(git_buf *path);
57
+ extern int git_sysdir_find_template_dir(git_str *path);
58
58
 
59
59
  /**
60
60
  * Expand the name of a "global" file (i.e. one in a user's home
@@ -66,7 +66,7 @@ extern int git_sysdir_find_template_dir(git_buf *path);
66
66
  * @param filename name of file in the home directory
67
67
  * @return 0 on success or -1 on error
68
68
  */
69
- extern int git_sysdir_expand_global_file(git_buf *path, const char *filename);
69
+ extern int git_sysdir_expand_global_file(git_str *path, const char *filename);
70
70
 
71
71
  typedef enum {
72
72
  GIT_SYSDIR_SYSTEM = 0,
@@ -74,7 +74,7 @@ typedef enum {
74
74
  GIT_SYSDIR_XDG = 2,
75
75
  GIT_SYSDIR_PROGRAMDATA = 3,
76
76
  GIT_SYSDIR_TEMPLATE = 4,
77
- GIT_SYSDIR__MAX = 5,
77
+ GIT_SYSDIR__MAX = 5
78
78
  } git_sysdir_t;
79
79
 
80
80
  /**
@@ -87,11 +87,11 @@ extern int git_sysdir_global_init(void);
87
87
  /**
88
88
  * Get the search path for global/system/xdg files
89
89
  *
90
- * @param out pointer to git_buf containing search path
90
+ * @param out pointer to git_str containing search path
91
91
  * @param which which list of paths to return
92
92
  * @return 0 on success, <0 on failure
93
93
  */
94
- extern int git_sysdir_get(const git_buf **out, git_sysdir_t which);
94
+ extern int git_sysdir_get(const git_str **out, git_sysdir_t which);
95
95
 
96
96
  /**
97
97
  * Set search paths for global/system/xdg files
@@ -105,4 +105,9 @@ extern int git_sysdir_get(const git_buf **out, git_sysdir_t which);
105
105
  */
106
106
  extern int git_sysdir_set(git_sysdir_t which, const char *paths);
107
107
 
108
+ /**
109
+ * Reset search paths for global/system/xdg files.
110
+ */
111
+ extern int git_sysdir_reset(void);
112
+
108
113
  #endif
@@ -9,7 +9,6 @@
9
9
 
10
10
  #include "commit.h"
11
11
  #include "signature.h"
12
- #include "message.h"
13
12
  #include "wildmatch.h"
14
13
  #include "git2/object.h"
15
14
  #include "git2/repository.h"
@@ -63,7 +62,7 @@ const char *git_tag_message(const git_tag *t)
63
62
  static int tag_error(const char *str)
64
63
  {
65
64
  git_error_set(GIT_ERROR_TAG, "failed to parse tag: %s", str);
66
- return -1;
65
+ return GIT_EINVALID;
67
66
  }
68
67
 
69
68
  static int tag_parse(git_tag *tag, const char *buffer, const char *buffer_end)
@@ -74,6 +73,7 @@ static int tag_parse(git_tag *tag, const char *buffer, const char *buffer_end)
74
73
  size_t text_len, alloc_len;
75
74
  const char *search;
76
75
  unsigned int i;
76
+ int error;
77
77
 
78
78
  if (git_oid__parse(&tag->target, &buffer, buffer_end, "object ") < 0)
79
79
  return tag_error("object field invalid");
@@ -131,8 +131,8 @@ static int tag_parse(git_tag *tag, const char *buffer, const char *buffer_end)
131
131
  tag->tagger = git__malloc(sizeof(git_signature));
132
132
  GIT_ERROR_CHECK_ALLOC(tag->tagger);
133
133
 
134
- if (git_signature__parse(tag->tagger, &buffer, buffer_end, "tagger ", '\n') < 0)
135
- return -1;
134
+ if ((error = git_signature__parse(tag->tagger, &buffer, buffer_end, "tagger ", '\n')) < 0)
135
+ return error;
136
136
  }
137
137
 
138
138
  tag->message = NULL;
@@ -176,7 +176,7 @@ int git_tag__parse(void *_tag, git_odb_object *odb_obj)
176
176
 
177
177
  static int retrieve_tag_reference(
178
178
  git_reference **tag_reference_out,
179
- git_buf *ref_name_out,
179
+ git_str *ref_name_out,
180
180
  git_repository *repo,
181
181
  const char *tag_name)
182
182
  {
@@ -185,7 +185,7 @@ static int retrieve_tag_reference(
185
185
 
186
186
  *tag_reference_out = NULL;
187
187
 
188
- if (git_buf_joinpath(ref_name_out, GIT_REFS_TAGS_DIR, tag_name) < 0)
188
+ if (git_str_joinpath(ref_name_out, GIT_REFS_TAGS_DIR, tag_name) < 0)
189
189
  return -1;
190
190
 
191
191
  error = git_reference_lookup(&tag_ref, repo, ref_name_out->ptr);
@@ -199,11 +199,11 @@ static int retrieve_tag_reference(
199
199
 
200
200
  static int retrieve_tag_reference_oid(
201
201
  git_oid *oid,
202
- git_buf *ref_name_out,
202
+ git_str *ref_name_out,
203
203
  git_repository *repo,
204
204
  const char *tag_name)
205
205
  {
206
- if (git_buf_joinpath(ref_name_out, GIT_REFS_TAGS_DIR, tag_name) < 0)
206
+ if (git_str_joinpath(ref_name_out, GIT_REFS_TAGS_DIR, tag_name) < 0)
207
207
  return -1;
208
208
 
209
209
  return git_reference_name_to_id(oid, repo, ref_name_out->ptr);
@@ -217,16 +217,16 @@ static int write_tag_annotation(
217
217
  const git_signature *tagger,
218
218
  const char *message)
219
219
  {
220
- git_buf tag = GIT_BUF_INIT;
220
+ git_str tag = GIT_STR_INIT;
221
221
  git_odb *odb;
222
222
 
223
223
  git_oid__writebuf(&tag, "object ", git_object_id(target));
224
- git_buf_printf(&tag, "type %s\n", git_object_type2string(git_object_type(target)));
225
- git_buf_printf(&tag, "tag %s\n", tag_name);
224
+ git_str_printf(&tag, "type %s\n", git_object_type2string(git_object_type(target)));
225
+ git_str_printf(&tag, "tag %s\n", tag_name);
226
226
  git_signature__writebuf(&tag, "tagger ", tagger);
227
- git_buf_putc(&tag, '\n');
227
+ git_str_putc(&tag, '\n');
228
228
 
229
- if (git_buf_puts(&tag, message) < 0)
229
+ if (git_str_puts(&tag, message) < 0)
230
230
  goto on_error;
231
231
 
232
232
  if (git_repository_odb__weakptr(&odb, repo) < 0)
@@ -235,11 +235,11 @@ static int write_tag_annotation(
235
235
  if (git_odb_write(oid, odb, tag.ptr, tag.size, GIT_OBJECT_TAG) < 0)
236
236
  goto on_error;
237
237
 
238
- git_buf_dispose(&tag);
238
+ git_str_dispose(&tag);
239
239
  return 0;
240
240
 
241
241
  on_error:
242
- git_buf_dispose(&tag);
242
+ git_str_dispose(&tag);
243
243
  git_error_set(GIT_ERROR_OBJECT, "failed to create tag annotation");
244
244
  return -1;
245
245
  }
@@ -255,7 +255,7 @@ static int git_tag_create__internal(
255
255
  int create_tag_annotation)
256
256
  {
257
257
  git_reference *new_ref = NULL;
258
- git_buf ref_name = GIT_BUF_INIT;
258
+ git_str ref_name = GIT_STR_INIT;
259
259
 
260
260
  int error;
261
261
 
@@ -276,7 +276,7 @@ static int git_tag_create__internal(
276
276
  /** Ensure the tag name doesn't conflict with an already existing
277
277
  * reference unless overwriting has explicitly been requested **/
278
278
  if (error == 0 && !allow_ref_overwrite) {
279
- git_buf_dispose(&ref_name);
279
+ git_str_dispose(&ref_name);
280
280
  git_error_set(GIT_ERROR_TAG, "tag already exists");
281
281
  return GIT_EEXISTS;
282
282
  }
@@ -291,7 +291,7 @@ static int git_tag_create__internal(
291
291
 
292
292
  cleanup:
293
293
  git_reference_free(new_ref);
294
- git_buf_dispose(&ref_name);
294
+ git_str_dispose(&ref_name);
295
295
  return error;
296
296
  }
297
297
 
@@ -344,7 +344,7 @@ int git_tag_create_from_buffer(git_oid *oid, git_repository *repo, const char *b
344
344
  git_odb_object *target_obj;
345
345
 
346
346
  git_reference *new_ref = NULL;
347
- git_buf ref_name = GIT_BUF_INIT;
347
+ git_str ref_name = GIT_STR_INIT;
348
348
 
349
349
  GIT_ASSERT_ARG(oid);
350
350
  GIT_ASSERT_ARG(buffer);
@@ -395,7 +395,7 @@ int git_tag_create_from_buffer(git_oid *oid, git_repository *repo, const char *b
395
395
  git_odb_stream_free(stream);
396
396
 
397
397
  if (error < 0) {
398
- git_buf_dispose(&ref_name);
398
+ git_str_dispose(&ref_name);
399
399
  return error;
400
400
  }
401
401
 
@@ -403,7 +403,7 @@ int git_tag_create_from_buffer(git_oid *oid, git_repository *repo, const char *b
403
403
  &new_ref, repo, ref_name.ptr, oid, allow_ref_overwrite, NULL);
404
404
 
405
405
  git_reference_free(new_ref);
406
- git_buf_dispose(&ref_name);
406
+ git_str_dispose(&ref_name);
407
407
 
408
408
  return error;
409
409
 
@@ -418,12 +418,12 @@ on_error:
418
418
  int git_tag_delete(git_repository *repo, const char *tag_name)
419
419
  {
420
420
  git_reference *tag_ref;
421
- git_buf ref_name = GIT_BUF_INIT;
421
+ git_str ref_name = GIT_STR_INIT;
422
422
  int error;
423
423
 
424
424
  error = retrieve_tag_reference(&tag_ref, &ref_name, repo, tag_name);
425
425
 
426
- git_buf_dispose(&ref_name);
426
+ git_str_dispose(&ref_name);
427
427
 
428
428
  if (error < 0)
429
429
  return error;
@@ -535,11 +535,13 @@ int git_tag_peel(git_object **tag_target, const git_tag *tag)
535
535
 
536
536
  int git_tag_name_is_valid(int *valid, const char *name)
537
537
  {
538
- git_buf ref_name = GIT_BUF_INIT;
538
+ git_str ref_name = GIT_STR_INIT;
539
539
  int error = 0;
540
540
 
541
541
  GIT_ASSERT(valid);
542
542
 
543
+ *valid = 0;
544
+
543
545
  /*
544
546
  * Discourage tag name starting with dash,
545
547
  * https://github.com/git/git/commit/4f0accd638b8d2
@@ -547,14 +549,14 @@ int git_tag_name_is_valid(int *valid, const char *name)
547
549
  if (!name || name[0] == '-')
548
550
  goto done;
549
551
 
550
- if ((error = git_buf_puts(&ref_name, GIT_REFS_TAGS_DIR)) < 0 ||
551
- (error = git_buf_puts(&ref_name, name)) < 0)
552
+ if ((error = git_str_puts(&ref_name, GIT_REFS_TAGS_DIR)) < 0 ||
553
+ (error = git_str_puts(&ref_name, name)) < 0)
552
554
  goto done;
553
555
 
554
556
  error = git_reference_name_is_valid(valid, ref_name.ptr);
555
557
 
556
558
  done:
557
- git_buf_dispose(&ref_name);
559
+ git_str_dispose(&ref_name);
558
560
  return error;
559
561
  }
560
562
 
@@ -12,7 +12,7 @@
12
12
  #if defined(__clang__)
13
13
 
14
14
  # if (__clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 1))
15
- # error Atomic primitives do not exist on this version of clang; configure libgit2 with -DTHREADSAFE=OFF
15
+ # error Atomic primitives do not exist on this version of clang; configure libgit2 with -DUSE_THREADS=OFF
16
16
  # else
17
17
  # define GIT_BUILTIN_ATOMIC
18
18
  # endif
@@ -20,7 +20,7 @@
20
20
  #elif defined(__GNUC__)
21
21
 
22
22
  # if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1))
23
- # error Atomic primitives do not exist on this version of gcc; configure libgit2 with -DTHREADSAFE=OFF
23
+ # error Atomic primitives do not exist on this version of gcc; configure libgit2 with -DUSE_THREADS=OFF
24
24
  # elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
25
25
  # define GIT_BUILTIN_ATOMIC
26
26
  # else
@@ -180,7 +180,7 @@ GIT_INLINE(volatile void *) git_atomic__swap(
180
180
  #if defined(GIT_WIN32)
181
181
  return InterlockedExchangePointer(ptr, newval);
182
182
  #elif defined(GIT_BUILTIN_ATOMIC)
183
- void * volatile foundval = NULL;
183
+ void * foundval = NULL;
184
184
  __atomic_exchange(ptr, &newval, &foundval, __ATOMIC_SEQ_CST);
185
185
  return foundval;
186
186
  #elif defined(GIT_BUILTIN_SYNC)
@@ -36,8 +36,8 @@ static void threadstate_dispose(git_threadstate *threadstate)
36
36
  if (!threadstate)
37
37
  return;
38
38
 
39
- if (threadstate->error_t.message != git_buf__initbuf)
40
- git__free(threadstate->error_t.message);
39
+ if (threadstate->error_t.message != git_str__initstr)
40
+ git__free(threadstate->error_t.message);
41
41
  threadstate->error_t.message = NULL;
42
42
  }
43
43
 
@@ -76,7 +76,7 @@ git_threadstate *git_threadstate_get(void)
76
76
  return threadstate;
77
77
 
78
78
  if ((threadstate = git__calloc(1, sizeof(git_threadstate))) == NULL ||
79
- git_buf_init(&threadstate->error_buf, 0) < 0)
79
+ git_str_init(&threadstate->error_buf, 0) < 0)
80
80
  return NULL;
81
81
 
82
82
  git_tlsdata_set(tls_key, threadstate);
@@ -12,7 +12,7 @@
12
12
  typedef struct {
13
13
  git_error *last_error;
14
14
  git_error error_t;
15
- git_buf error_buf;
15
+ git_str error_buf;
16
16
  char oid_fmt[GIT_OID_HEXSZ+1];
17
17
  } git_threadstate;
18
18