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
@@ -7,32 +7,34 @@
7
7
 
8
8
  #include "worktree.h"
9
9
 
10
+ #include "buf.h"
11
+ #include "repository.h"
12
+ #include "path.h"
13
+
10
14
  #include "git2/branch.h"
11
15
  #include "git2/commit.h"
12
16
  #include "git2/worktree.h"
13
17
 
14
- #include "repository.h"
15
-
16
18
  static bool is_worktree_dir(const char *dir)
17
19
  {
18
- git_buf buf = GIT_BUF_INIT;
20
+ git_str buf = GIT_STR_INIT;
19
21
  int error;
20
22
 
21
- if (git_buf_sets(&buf, dir) < 0)
23
+ if (git_str_sets(&buf, dir) < 0)
22
24
  return -1;
23
25
 
24
- error = git_path_contains_file(&buf, "commondir")
25
- && git_path_contains_file(&buf, "gitdir")
26
- && git_path_contains_file(&buf, "HEAD");
26
+ error = git_fs_path_contains_file(&buf, "commondir")
27
+ && git_fs_path_contains_file(&buf, "gitdir")
28
+ && git_fs_path_contains_file(&buf, "HEAD");
27
29
 
28
- git_buf_dispose(&buf);
30
+ git_str_dispose(&buf);
29
31
  return error;
30
32
  }
31
33
 
32
34
  int git_worktree_list(git_strarray *wts, git_repository *repo)
33
35
  {
34
36
  git_vector worktrees = GIT_VECTOR_INIT;
35
- git_buf path = GIT_BUF_INIT;
37
+ git_str path = GIT_STR_INIT;
36
38
  char *worktree;
37
39
  size_t i, len;
38
40
  int error;
@@ -43,18 +45,18 @@ int git_worktree_list(git_strarray *wts, git_repository *repo)
43
45
  wts->count = 0;
44
46
  wts->strings = NULL;
45
47
 
46
- if ((error = git_buf_joinpath(&path, repo->commondir, "worktrees/")) < 0)
48
+ if ((error = git_str_joinpath(&path, repo->commondir, "worktrees/")) < 0)
47
49
  goto exit;
48
- if (!git_path_exists(path.ptr) || git_path_is_empty_dir(path.ptr))
50
+ if (!git_fs_path_exists(path.ptr) || git_fs_path_is_empty_dir(path.ptr))
49
51
  goto exit;
50
- if ((error = git_path_dirload(&worktrees, path.ptr, path.size, 0x0)) < 0)
52
+ if ((error = git_fs_path_dirload(&worktrees, path.ptr, path.size, 0x0)) < 0)
51
53
  goto exit;
52
54
 
53
55
  len = path.size;
54
56
 
55
57
  git_vector_foreach(&worktrees, i, worktree) {
56
- git_buf_truncate(&path, len);
57
- git_buf_puts(&path, worktree);
58
+ git_str_truncate(&path, len);
59
+ git_str_puts(&path, worktree);
58
60
 
59
61
  if (!is_worktree_dir(path.ptr)) {
60
62
  git_vector_remove(&worktrees, i);
@@ -65,68 +67,68 @@ int git_worktree_list(git_strarray *wts, git_repository *repo)
65
67
  wts->strings = (char **)git_vector_detach(&wts->count, NULL, &worktrees);
66
68
 
67
69
  exit:
68
- git_buf_dispose(&path);
70
+ git_str_dispose(&path);
69
71
 
70
72
  return error;
71
73
  }
72
74
 
73
75
  char *git_worktree__read_link(const char *base, const char *file)
74
76
  {
75
- git_buf path = GIT_BUF_INIT, buf = GIT_BUF_INIT;
77
+ git_str path = GIT_STR_INIT, buf = GIT_STR_INIT;
76
78
 
77
79
  GIT_ASSERT_ARG_WITH_RETVAL(base, NULL);
78
80
  GIT_ASSERT_ARG_WITH_RETVAL(file, NULL);
79
81
 
80
- if (git_buf_joinpath(&path, base, file) < 0)
82
+ if (git_str_joinpath(&path, base, file) < 0)
81
83
  goto err;
82
84
  if (git_futils_readbuffer(&buf, path.ptr) < 0)
83
85
  goto err;
84
- git_buf_dispose(&path);
86
+ git_str_dispose(&path);
85
87
 
86
- git_buf_rtrim(&buf);
88
+ git_str_rtrim(&buf);
87
89
 
88
- if (!git_path_is_relative(buf.ptr))
89
- return git_buf_detach(&buf);
90
+ if (!git_fs_path_is_relative(buf.ptr))
91
+ return git_str_detach(&buf);
90
92
 
91
- if (git_buf_sets(&path, base) < 0)
93
+ if (git_str_sets(&path, base) < 0)
92
94
  goto err;
93
- if (git_path_apply_relative(&path, buf.ptr) < 0)
95
+ if (git_fs_path_apply_relative(&path, buf.ptr) < 0)
94
96
  goto err;
95
- git_buf_dispose(&buf);
97
+ git_str_dispose(&buf);
96
98
 
97
- return git_buf_detach(&path);
99
+ return git_str_detach(&path);
98
100
 
99
101
  err:
100
- git_buf_dispose(&buf);
101
- git_buf_dispose(&path);
102
+ git_str_dispose(&buf);
103
+ git_str_dispose(&path);
102
104
 
103
105
  return NULL;
104
106
  }
105
107
 
106
- static int write_wtfile(const char *base, const char *file, const git_buf *buf)
108
+ static int write_wtfile(const char *base, const char *file, const git_str *buf)
107
109
  {
108
- git_buf path = GIT_BUF_INIT;
110
+ git_str path = GIT_STR_INIT;
109
111
  int err;
110
112
 
111
113
  GIT_ASSERT_ARG(base);
112
114
  GIT_ASSERT_ARG(file);
113
115
  GIT_ASSERT_ARG(buf);
114
116
 
115
- if ((err = git_buf_joinpath(&path, base, file)) < 0)
117
+ if ((err = git_str_joinpath(&path, base, file)) < 0)
116
118
  goto out;
117
119
 
118
120
  if ((err = git_futils_writebuffer(buf, path.ptr, O_CREAT|O_EXCL|O_WRONLY, 0644)) < 0)
119
121
  goto out;
120
122
 
121
123
  out:
122
- git_buf_dispose(&path);
124
+ git_str_dispose(&path);
123
125
 
124
126
  return err;
125
127
  }
126
128
 
127
129
  static int open_worktree_dir(git_worktree **out, const char *parent, const char *dir, const char *name)
128
130
  {
129
- git_buf gitdir = GIT_BUF_INIT;
131
+ git_str gitdir = GIT_STR_INIT;
130
132
  git_worktree *wt = NULL;
131
133
  int error = 0;
132
134
 
@@ -135,7 +137,7 @@ static int open_worktree_dir(git_worktree **out, const char *parent, const char
135
137
  goto out;
136
138
  }
137
139
 
138
- if ((error = git_path_validate_workdir(NULL, dir)) < 0)
140
+ if ((error = git_path_validate_length(NULL, dir)) < 0)
139
141
  goto out;
140
142
 
141
143
  if ((wt = git__calloc(1, sizeof(*wt))) == NULL) {
@@ -147,14 +149,14 @@ static int open_worktree_dir(git_worktree **out, const char *parent, const char
147
149
  (wt->commondir_path = git_worktree__read_link(dir, "commondir")) == NULL ||
148
150
  (wt->gitlink_path = git_worktree__read_link(dir, "gitdir")) == NULL ||
149
151
  (parent && (wt->parent_path = git__strdup(parent)) == NULL) ||
150
- (wt->worktree_path = git_path_dirname(wt->gitlink_path)) == NULL) {
152
+ (wt->worktree_path = git_fs_path_dirname(wt->gitlink_path)) == NULL) {
151
153
  error = -1;
152
154
  goto out;
153
155
  }
154
156
 
155
- if ((error = git_path_prettify_dir(&gitdir, dir, NULL)) < 0)
157
+ if ((error = git_fs_path_prettify_dir(&gitdir, dir, NULL)) < 0)
156
158
  goto out;
157
- wt->gitdir_path = git_buf_detach(&gitdir);
159
+ wt->gitdir_path = git_str_detach(&gitdir);
158
160
 
159
161
  if ((error = git_worktree_is_locked(NULL, wt)) < 0)
160
162
  goto out;
@@ -166,14 +168,14 @@ static int open_worktree_dir(git_worktree **out, const char *parent, const char
166
168
  out:
167
169
  if (error)
168
170
  git_worktree_free(wt);
169
- git_buf_dispose(&gitdir);
171
+ git_str_dispose(&gitdir);
170
172
 
171
173
  return error;
172
174
  }
173
175
 
174
176
  int git_worktree_lookup(git_worktree **out, git_repository *repo, const char *name)
175
177
  {
176
- git_buf path = GIT_BUF_INIT;
178
+ git_str path = GIT_STR_INIT;
177
179
  git_worktree *wt = NULL;
178
180
  int error;
179
181
 
@@ -182,14 +184,14 @@ int git_worktree_lookup(git_worktree **out, git_repository *repo, const char *na
182
184
 
183
185
  *out = NULL;
184
186
 
185
- if ((error = git_buf_join3(&path, '/', repo->commondir, "worktrees", name)) < 0)
187
+ if ((error = git_str_join3(&path, '/', repo->commondir, "worktrees", name)) < 0)
186
188
  goto out;
187
189
 
188
190
  if ((error = (open_worktree_dir(out, git_repository_workdir(repo), path.ptr, name))) < 0)
189
191
  goto out;
190
192
 
191
193
  out:
192
- git_buf_dispose(&path);
194
+ git_str_dispose(&path);
193
195
 
194
196
  if (error)
195
197
  git_worktree_free(wt);
@@ -199,7 +201,7 @@ out:
199
201
 
200
202
  int git_worktree_open_from_repository(git_worktree **out, git_repository *repo)
201
203
  {
202
- git_buf parent = GIT_BUF_INIT;
204
+ git_str parent = GIT_STR_INIT;
203
205
  const char *gitdir, *commondir;
204
206
  char *name = NULL;
205
207
  int error = 0;
@@ -213,18 +215,18 @@ int git_worktree_open_from_repository(git_worktree **out, git_repository *repo)
213
215
  gitdir = git_repository_path(repo);
214
216
  commondir = git_repository_commondir(repo);
215
217
 
216
- if ((error = git_path_prettify_dir(&parent, "..", commondir)) < 0)
218
+ if ((error = git_fs_path_prettify_dir(&parent, "..", commondir)) < 0)
217
219
  goto out;
218
220
 
219
221
  /* The name is defined by the last component in '.git/worktree/%s' */
220
- name = git_path_basename(gitdir);
222
+ name = git_fs_path_basename(gitdir);
221
223
 
222
224
  if ((error = open_worktree_dir(out, parent.ptr, gitdir, name)) < 0)
223
225
  goto out;
224
226
 
225
227
  out:
226
228
  git__free(name);
227
- git_buf_dispose(&parent);
229
+ git_str_dispose(&parent);
228
230
 
229
231
  return error;
230
232
  }
@@ -254,21 +256,21 @@ int git_worktree_validate(const git_worktree *wt)
254
256
  return GIT_ERROR;
255
257
  }
256
258
 
257
- if (wt->parent_path && !git_path_exists(wt->parent_path)) {
259
+ if (wt->parent_path && !git_fs_path_exists(wt->parent_path)) {
258
260
  git_error_set(GIT_ERROR_WORKTREE,
259
261
  "worktree parent directory ('%s') does not exist ",
260
262
  wt->parent_path);
261
263
  return GIT_ERROR;
262
264
  }
263
265
 
264
- if (!git_path_exists(wt->commondir_path)) {
266
+ if (!git_fs_path_exists(wt->commondir_path)) {
265
267
  git_error_set(GIT_ERROR_WORKTREE,
266
268
  "worktree common directory ('%s') does not exist ",
267
269
  wt->commondir_path);
268
270
  return GIT_ERROR;
269
271
  }
270
272
 
271
- if (!git_path_exists(wt->worktree_path)) {
273
+ if (!git_fs_path_exists(wt->worktree_path)) {
272
274
  git_error_set(GIT_ERROR_WORKTREE,
273
275
  "worktree directory '%s' does not exist",
274
276
  wt->worktree_path);
@@ -298,20 +300,17 @@ int git_worktree_add(git_worktree **out, git_repository *repo,
298
300
  const char *name, const char *worktree,
299
301
  const git_worktree_add_options *opts)
300
302
  {
301
- git_buf gitdir = GIT_BUF_INIT, wddir = GIT_BUF_INIT, buf = GIT_BUF_INIT;
303
+ git_str gitdir = GIT_STR_INIT, wddir = GIT_STR_INIT, buf = GIT_STR_INIT;
302
304
  git_reference *ref = NULL, *head = NULL;
303
305
  git_commit *commit = NULL;
304
306
  git_repository *wt = NULL;
305
- git_checkout_options coopts = GIT_CHECKOUT_OPTIONS_INIT;
307
+ git_checkout_options coopts;
306
308
  git_worktree_add_options wtopts = GIT_WORKTREE_ADD_OPTIONS_INIT;
307
309
  int err;
308
310
 
309
311
  GIT_ERROR_CHECK_VERSION(
310
312
  opts, GIT_WORKTREE_ADD_OPTIONS_VERSION, "git_worktree_add_options");
311
313
 
312
- if (opts)
313
- memcpy(&wtopts, opts, sizeof(wtopts));
314
-
315
314
  GIT_ASSERT_ARG(out);
316
315
  GIT_ASSERT_ARG(repo);
317
316
  GIT_ASSERT_ARG(name);
@@ -319,6 +318,11 @@ int git_worktree_add(git_worktree **out, git_repository *repo,
319
318
 
320
319
  *out = NULL;
321
320
 
321
+ if (opts)
322
+ memcpy(&wtopts, opts, sizeof(wtopts));
323
+
324
+ memcpy(&coopts, &wtopts.checkout_options, sizeof(coopts));
325
+
322
326
  if (wtopts.ref) {
323
327
  if (!git_reference_is_branch(wtopts.ref)) {
324
328
  git_error_set(GIT_ERROR_WORKTREE, "reference is not a branch");
@@ -334,28 +338,28 @@ int git_worktree_add(git_worktree **out, git_repository *repo,
334
338
  }
335
339
 
336
340
  /* Create gitdir directory ".git/worktrees/<name>" */
337
- if ((err = git_buf_joinpath(&gitdir, repo->commondir, "worktrees")) < 0)
341
+ if ((err = git_str_joinpath(&gitdir, repo->commondir, "worktrees")) < 0)
338
342
  goto out;
339
- if (!git_path_exists(gitdir.ptr))
343
+ if (!git_fs_path_exists(gitdir.ptr))
340
344
  if ((err = git_futils_mkdir(gitdir.ptr, 0755, GIT_MKDIR_EXCL)) < 0)
341
345
  goto out;
342
- if ((err = git_buf_joinpath(&gitdir, gitdir.ptr, name)) < 0)
346
+ if ((err = git_str_joinpath(&gitdir, gitdir.ptr, name)) < 0)
343
347
  goto out;
344
348
  if ((err = git_futils_mkdir(gitdir.ptr, 0755, GIT_MKDIR_EXCL)) < 0)
345
349
  goto out;
346
- if ((err = git_path_prettify_dir(&gitdir, gitdir.ptr, NULL)) < 0)
350
+ if ((err = git_fs_path_prettify_dir(&gitdir, gitdir.ptr, NULL)) < 0)
347
351
  goto out;
348
352
 
349
353
  /* Create worktree work dir */
350
354
  if ((err = git_futils_mkdir(worktree, 0755, GIT_MKDIR_EXCL)) < 0)
351
355
  goto out;
352
- if ((err = git_path_prettify_dir(&wddir, worktree, NULL)) < 0)
356
+ if ((err = git_fs_path_prettify_dir(&wddir, worktree, NULL)) < 0)
353
357
  goto out;
354
358
 
355
359
  if (wtopts.lock) {
356
360
  int fd;
357
361
 
358
- if ((err = git_buf_joinpath(&buf, gitdir.ptr, "locked")) < 0)
362
+ if ((err = git_str_joinpath(&buf, gitdir.ptr, "locked")) < 0)
359
363
  goto out;
360
364
 
361
365
  if ((fd = p_creat(buf.ptr, 0644)) < 0) {
@@ -364,22 +368,22 @@ int git_worktree_add(git_worktree **out, git_repository *repo,
364
368
  }
365
369
 
366
370
  p_close(fd);
367
- git_buf_clear(&buf);
371
+ git_str_clear(&buf);
368
372
  }
369
373
 
370
374
  /* Create worktree .git file */
371
- if ((err = git_buf_printf(&buf, "gitdir: %s\n", gitdir.ptr)) < 0)
375
+ if ((err = git_str_printf(&buf, "gitdir: %s\n", gitdir.ptr)) < 0)
372
376
  goto out;
373
377
  if ((err = write_wtfile(wddir.ptr, ".git", &buf)) < 0)
374
378
  goto out;
375
379
 
376
380
  /* Create gitdir files */
377
- if ((err = git_path_prettify_dir(&buf, repo->commondir, NULL) < 0)
378
- || (err = git_buf_putc(&buf, '\n')) < 0
381
+ if ((err = git_fs_path_prettify_dir(&buf, repo->commondir, NULL) < 0)
382
+ || (err = git_str_putc(&buf, '\n')) < 0
379
383
  || (err = write_wtfile(gitdir.ptr, "commondir", &buf)) < 0)
380
384
  goto out;
381
- if ((err = git_buf_joinpath(&buf, wddir.ptr, ".git")) < 0
382
- || (err = git_buf_putc(&buf, '\n')) < 0
385
+ if ((err = git_str_joinpath(&buf, wddir.ptr, ".git")) < 0
386
+ || (err = git_str_putc(&buf, '\n')) < 0
383
387
  || (err = write_wtfile(gitdir.ptr, "gitdir", &buf)) < 0)
384
388
  goto out;
385
389
 
@@ -403,7 +407,6 @@ int git_worktree_add(git_worktree **out, git_repository *repo,
403
407
  goto out;
404
408
 
405
409
  /* Checkout worktree's HEAD */
406
- coopts.checkout_strategy = GIT_CHECKOUT_FORCE;
407
410
  if ((err = git_checkout_head(wt, &coopts)) < 0)
408
411
  goto out;
409
412
 
@@ -412,9 +415,9 @@ int git_worktree_add(git_worktree **out, git_repository *repo,
412
415
  goto out;
413
416
 
414
417
  out:
415
- git_buf_dispose(&gitdir);
416
- git_buf_dispose(&wddir);
417
- git_buf_dispose(&buf);
418
+ git_str_dispose(&gitdir);
419
+ git_str_dispose(&wddir);
420
+ git_str_dispose(&buf);
418
421
  git_reference_free(ref);
419
422
  git_reference_free(head);
420
423
  git_commit_free(commit);
@@ -425,7 +428,7 @@ out:
425
428
 
426
429
  int git_worktree_lock(git_worktree *wt, const char *reason)
427
430
  {
428
- git_buf buf = GIT_BUF_INIT, path = GIT_BUF_INIT;
431
+ git_str buf = GIT_STR_INIT, path = GIT_STR_INIT;
429
432
  int error;
430
433
 
431
434
  GIT_ASSERT_ARG(wt);
@@ -437,11 +440,11 @@ int git_worktree_lock(git_worktree *wt, const char *reason)
437
440
  goto out;
438
441
  }
439
442
 
440
- if ((error = git_buf_joinpath(&path, wt->gitdir_path, "locked")) < 0)
443
+ if ((error = git_str_joinpath(&path, wt->gitdir_path, "locked")) < 0)
441
444
  goto out;
442
445
 
443
446
  if (reason)
444
- git_buf_attach_notowned(&buf, reason, strlen(reason));
447
+ git_str_attach_notowned(&buf, reason, strlen(reason));
445
448
 
446
449
  if ((error = git_futils_writebuffer(&buf, path.ptr, O_CREAT|O_EXCL|O_WRONLY, 0644)) < 0)
447
450
  goto out;
@@ -449,14 +452,14 @@ int git_worktree_lock(git_worktree *wt, const char *reason)
449
452
  wt->locked = 1;
450
453
 
451
454
  out:
452
- git_buf_dispose(&path);
455
+ git_str_dispose(&path);
453
456
 
454
457
  return error;
455
458
  }
456
459
 
457
460
  int git_worktree_unlock(git_worktree *wt)
458
461
  {
459
- git_buf path = GIT_BUF_INIT;
462
+ git_str path = GIT_STR_INIT;
460
463
  int error;
461
464
 
462
465
  GIT_ASSERT_ARG(wt);
@@ -466,42 +469,61 @@ int git_worktree_unlock(git_worktree *wt)
466
469
  if (!error)
467
470
  return 1;
468
471
 
469
- if (git_buf_joinpath(&path, wt->gitdir_path, "locked") < 0)
472
+ if (git_str_joinpath(&path, wt->gitdir_path, "locked") < 0)
470
473
  return -1;
471
474
 
472
475
  if (p_unlink(path.ptr) != 0) {
473
- git_buf_dispose(&path);
476
+ git_str_dispose(&path);
474
477
  return -1;
475
478
  }
476
479
 
477
480
  wt->locked = 0;
478
481
 
479
- git_buf_dispose(&path);
482
+ git_str_dispose(&path);
480
483
 
481
484
  return 0;
482
485
  }
483
486
 
484
- int git_worktree_is_locked(git_buf *reason, const git_worktree *wt)
487
+ static int git_worktree__is_locked(git_str *reason, const git_worktree *wt)
485
488
  {
486
- git_buf path = GIT_BUF_INIT;
489
+ git_str path = GIT_STR_INIT;
487
490
  int error, locked;
488
491
 
489
492
  GIT_ASSERT_ARG(wt);
490
493
 
491
494
  if (reason)
492
- git_buf_clear(reason);
495
+ git_str_clear(reason);
493
496
 
494
- if ((error = git_buf_joinpath(&path, wt->gitdir_path, "locked")) < 0)
497
+ if ((error = git_str_joinpath(&path, wt->gitdir_path, "locked")) < 0)
495
498
  goto out;
496
- locked = git_path_exists(path.ptr);
499
+ locked = git_fs_path_exists(path.ptr);
497
500
  if (locked && reason &&
498
501
  (error = git_futils_readbuffer(reason, path.ptr)) < 0)
499
502
  goto out;
500
503
 
501
504
  error = locked;
502
505
  out:
503
- git_buf_dispose(&path);
506
+ git_str_dispose(&path);
507
+
508
+ return error;
509
+ }
510
+
511
+ int git_worktree_is_locked(git_buf *reason, const git_worktree *wt)
512
+ {
513
+ git_str str = GIT_STR_INIT;
514
+ int error = 0;
515
+
516
+ if (reason && (error = git_buf_tostr(&str, reason)) < 0)
517
+ return error;
518
+
519
+ error = git_worktree__is_locked(reason ? &str : NULL, wt);
520
+
521
+ if (error >= 0 && reason) {
522
+ if (git_buf_fromstr(reason, &str) < 0)
523
+ error = -1;
524
+ }
504
525
 
526
+ git_str_dispose(&str);
505
527
  return error;
506
528
  }
507
529
 
@@ -547,17 +569,17 @@ int git_worktree_is_prunable(git_worktree *wt,
547
569
  memcpy(&popts, opts, sizeof(popts));
548
570
 
549
571
  if ((popts.flags & GIT_WORKTREE_PRUNE_LOCKED) == 0) {
550
- git_buf reason = GIT_BUF_INIT;
572
+ git_str reason = GIT_STR_INIT;
551
573
  int error;
552
574
 
553
- if ((error = git_worktree_is_locked(&reason, wt)) < 0)
575
+ if ((error = git_worktree__is_locked(&reason, wt)) < 0)
554
576
  return error;
555
577
 
556
578
  if (error) {
557
579
  if (!reason.size)
558
- git_buf_attach_notowned(&reason, "no reason given", 15);
580
+ git_str_attach_notowned(&reason, "no reason given", 15);
559
581
  git_error_set(GIT_ERROR_WORKTREE, "not pruning locked working tree: '%s'", reason.ptr);
560
- git_buf_dispose(&reason);
582
+ git_str_dispose(&reason);
561
583
  return 0;
562
584
  }
563
585
  }
@@ -575,7 +597,7 @@ int git_worktree_prune(git_worktree *wt,
575
597
  git_worktree_prune_options *opts)
576
598
  {
577
599
  git_worktree_prune_options popts = GIT_WORKTREE_PRUNE_OPTIONS_INIT;
578
- git_buf path = GIT_BUF_INIT;
600
+ git_str path = GIT_STR_INIT;
579
601
  char *wtpath;
580
602
  int err;
581
603
 
@@ -592,9 +614,9 @@ int git_worktree_prune(git_worktree *wt,
592
614
  }
593
615
 
594
616
  /* Delete gitdir in parent repository */
595
- if ((err = git_buf_join3(&path, '/', wt->commondir_path, "worktrees", wt->name)) < 0)
617
+ if ((err = git_str_join3(&path, '/', wt->commondir_path, "worktrees", wt->name)) < 0)
596
618
  goto out;
597
- if (!git_path_exists(path.ptr))
619
+ if (!git_fs_path_exists(path.ptr))
598
620
  {
599
621
  git_error_set(GIT_ERROR_WORKTREE, "worktree gitdir '%s' does not exist", path.ptr);
600
622
  err = -1;
@@ -606,15 +628,15 @@ int git_worktree_prune(git_worktree *wt,
606
628
  /* Skip deletion of the actual working tree if it does
607
629
  * not exist or deletion was not requested */
608
630
  if ((popts.flags & GIT_WORKTREE_PRUNE_WORKING_TREE) == 0 ||
609
- !git_path_exists(wt->gitlink_path))
631
+ !git_fs_path_exists(wt->gitlink_path))
610
632
  {
611
633
  goto out;
612
634
  }
613
635
 
614
- if ((wtpath = git_path_dirname(wt->gitlink_path)) == NULL)
636
+ if ((wtpath = git_fs_path_dirname(wt->gitlink_path)) == NULL)
615
637
  goto out;
616
- git_buf_attach(&path, wtpath, 0);
617
- if (!git_path_exists(path.ptr))
638
+ git_str_attach(&path, wtpath, 0);
639
+ if (!git_fs_path_exists(path.ptr))
618
640
  {
619
641
  git_error_set(GIT_ERROR_WORKTREE, "working tree '%s' does not exist", path.ptr);
620
642
  err = -1;
@@ -624,7 +646,7 @@ int git_worktree_prune(git_worktree *wt,
624
646
  goto out;
625
647
 
626
648
  out:
627
- git_buf_dispose(&path);
649
+ git_str_dispose(&path);
628
650
 
629
651
  return err;
630
652
  }
@@ -31,7 +31,7 @@ struct git_worktree {
31
31
  /* Path to the parent's working directory */
32
32
  char *parent_path;
33
33
 
34
- int locked:1;
34
+ unsigned int locked:1;
35
35
  };
36
36
 
37
37
  char *git_worktree__read_link(const char *base, const char *file);
@@ -0,0 +1,53 @@
1
+ /*
2
+ * Copyright (C) the libgit2 contributors. All rights reserved.
3
+ *
4
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
5
+ * a Linking Exception. For full terms see the included COPYING file.
6
+ */
7
+
8
+ /*
9
+ * This file provides the necessary indirection between xdiff and
10
+ * libgit2. libgit2-specific functionality should live here, so
11
+ * that git and libgit2 can share a common xdiff implementation.
12
+ */
13
+
14
+ #ifndef INCLUDE_git_xdiff_h__
15
+ #define INCLUDE_git_xdiff_h__
16
+
17
+ #include "regexp.h"
18
+
19
+ /* Work around C90-conformance issues */
20
+ #if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
21
+ # if defined(_MSC_VER)
22
+ # define inline __inline
23
+ # elif defined(__GNUC__)
24
+ # define inline __inline__
25
+ # else
26
+ # define inline
27
+ # endif
28
+ #endif
29
+
30
+ #define xdl_malloc(x) git__malloc(x)
31
+ #define xdl_free(ptr) git__free(ptr)
32
+ #define xdl_realloc(ptr, x) git__realloc(ptr, x)
33
+
34
+ #define XDL_BUG(msg) GIT_ASSERT(msg)
35
+
36
+ #define xdl_regex_t git_regexp
37
+ #define xdl_regmatch_t git_regmatch
38
+
39
+ GIT_INLINE(int) xdl_regexec_buf(
40
+ const xdl_regex_t *preg, const char *buf, size_t size,
41
+ size_t nmatch, xdl_regmatch_t pmatch[], int eflags)
42
+ {
43
+ GIT_UNUSED(preg);
44
+ GIT_UNUSED(buf);
45
+ GIT_UNUSED(size);
46
+ GIT_UNUSED(nmatch);
47
+ GIT_UNUSED(pmatch);
48
+ GIT_UNUSED(eflags);
49
+ GIT_ASSERT("not implemented");
50
+ return -1;
51
+ }
52
+
53
+ #endif