rugged 0.27.10 → 0.27.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (420) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rugged/version.rb +1 -1
  3. data/vendor/libgit2/AUTHORS +0 -1
  4. data/vendor/libgit2/CMakeLists.txt +54 -98
  5. data/vendor/libgit2/COPYING +0 -28
  6. data/vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake +1 -15
  7. data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +8 -9
  8. data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +2 -2
  9. data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +1 -1
  10. data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +2 -2
  11. data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +0 -6
  12. data/vendor/libgit2/deps/http-parser/CMakeLists.txt +0 -2
  13. data/vendor/libgit2/deps/http-parser/{COPYING → LICENSE-MIT} +0 -0
  14. data/vendor/libgit2/deps/http-parser/http_parser.c +6 -11
  15. data/vendor/libgit2/deps/regex/CMakeLists.txt +2 -0
  16. data/vendor/libgit2/deps/regex/config.h +7 -0
  17. data/vendor/libgit2/deps/regex/regcomp.c +3857 -0
  18. data/vendor/libgit2/deps/regex/regex.c +92 -0
  19. data/vendor/libgit2/deps/regex/regex.h +582 -0
  20. data/vendor/libgit2/deps/regex/regex_internal.c +1744 -0
  21. data/vendor/libgit2/deps/regex/regex_internal.h +819 -0
  22. data/vendor/libgit2/deps/regex/regexec.c +4369 -0
  23. data/vendor/libgit2/deps/zlib/CMakeLists.txt +0 -1
  24. data/vendor/libgit2/deps/zlib/adler32.c +7 -0
  25. data/vendor/libgit2/deps/zlib/crc32.c +7 -0
  26. data/vendor/libgit2/include/git2.h +0 -5
  27. data/vendor/libgit2/include/git2/annotated_commit.h +0 -9
  28. data/vendor/libgit2/include/git2/attr.h +20 -38
  29. data/vendor/libgit2/include/git2/blame.h +25 -42
  30. data/vendor/libgit2/include/git2/blob.h +13 -45
  31. data/vendor/libgit2/include/git2/branch.h +1 -1
  32. data/vendor/libgit2/include/git2/buffer.h +16 -22
  33. data/vendor/libgit2/include/git2/checkout.h +32 -65
  34. data/vendor/libgit2/include/git2/cherrypick.h +7 -9
  35. data/vendor/libgit2/include/git2/clone.h +10 -12
  36. data/vendor/libgit2/include/git2/commit.h +3 -53
  37. data/vendor/libgit2/include/git2/common.h +8 -60
  38. data/vendor/libgit2/include/git2/config.h +19 -30
  39. data/vendor/libgit2/include/git2/describe.h +9 -32
  40. data/vendor/libgit2/include/git2/diff.h +156 -208
  41. data/vendor/libgit2/include/git2/errors.h +46 -54
  42. data/vendor/libgit2/include/git2/filter.h +0 -8
  43. data/vendor/libgit2/include/git2/ignore.h +2 -2
  44. data/vendor/libgit2/include/git2/index.h +52 -74
  45. data/vendor/libgit2/include/git2/indexer.h +6 -76
  46. data/vendor/libgit2/include/git2/inttypes.h +309 -0
  47. data/vendor/libgit2/include/git2/merge.h +18 -35
  48. data/vendor/libgit2/include/git2/net.h +5 -0
  49. data/vendor/libgit2/include/git2/notes.h +1 -1
  50. data/vendor/libgit2/include/git2/object.h +29 -17
  51. data/vendor/libgit2/include/git2/odb.h +11 -12
  52. data/vendor/libgit2/include/git2/odb_backend.h +9 -10
  53. data/vendor/libgit2/include/git2/oid.h +2 -2
  54. data/vendor/libgit2/include/git2/pack.h +3 -14
  55. data/vendor/libgit2/include/git2/proxy.h +8 -14
  56. data/vendor/libgit2/include/git2/rebase.h +6 -53
  57. data/vendor/libgit2/include/git2/refs.h +15 -33
  58. data/vendor/libgit2/include/git2/refspec.h +0 -17
  59. data/vendor/libgit2/include/git2/remote.h +24 -123
  60. data/vendor/libgit2/include/git2/repository.h +39 -76
  61. data/vendor/libgit2/include/git2/revert.h +4 -6
  62. data/vendor/libgit2/include/git2/revwalk.h +7 -7
  63. data/vendor/libgit2/include/git2/signature.h +2 -2
  64. data/vendor/libgit2/include/git2/stash.h +12 -15
  65. data/vendor/libgit2/include/git2/status.h +20 -33
  66. data/vendor/libgit2/include/git2/submodule.h +12 -30
  67. data/vendor/libgit2/include/git2/sys/commit.h +1 -1
  68. data/vendor/libgit2/include/git2/sys/config.h +13 -13
  69. data/vendor/libgit2/include/git2/sys/filter.h +6 -6
  70. data/vendor/libgit2/include/git2/sys/index.h +0 -3
  71. data/vendor/libgit2/include/git2/sys/mempack.h +35 -35
  72. data/vendor/libgit2/include/git2/sys/merge.h +4 -9
  73. data/vendor/libgit2/include/git2/sys/odb_backend.h +22 -66
  74. data/vendor/libgit2/include/git2/sys/refdb_backend.h +40 -76
  75. data/vendor/libgit2/include/git2/sys/repository.h +1 -5
  76. data/vendor/libgit2/include/git2/sys/stream.h +12 -92
  77. data/vendor/libgit2/include/git2/sys/time.h +31 -0
  78. data/vendor/libgit2/include/git2/sys/transport.h +83 -129
  79. data/vendor/libgit2/include/git2/tag.h +4 -13
  80. data/vendor/libgit2/include/git2/trace.h +2 -2
  81. data/vendor/libgit2/include/git2/transaction.h +0 -1
  82. data/vendor/libgit2/include/git2/transport.h +311 -11
  83. data/vendor/libgit2/include/git2/tree.h +4 -4
  84. data/vendor/libgit2/include/git2/types.h +111 -33
  85. data/vendor/libgit2/include/git2/version.h +4 -4
  86. data/vendor/libgit2/include/git2/worktree.h +13 -48
  87. data/vendor/libgit2/libgit2.pc.in +13 -0
  88. data/vendor/libgit2/src/CMakeLists.txt +164 -96
  89. data/vendor/libgit2/src/annotated_commit.c +8 -15
  90. data/vendor/libgit2/src/apply.c +31 -537
  91. data/vendor/libgit2/src/apply.h +1 -3
  92. data/vendor/libgit2/src/array.h +2 -2
  93. data/vendor/libgit2/src/attr.c +75 -81
  94. data/vendor/libgit2/src/attr_file.c +121 -207
  95. data/vendor/libgit2/src/attr_file.h +9 -9
  96. data/vendor/libgit2/src/attrcache.c +53 -51
  97. data/vendor/libgit2/src/attrcache.h +1 -2
  98. data/vendor/libgit2/src/blame.c +20 -47
  99. data/vendor/libgit2/src/blame.h +1 -2
  100. data/vendor/libgit2/src/blame_git.c +20 -37
  101. data/vendor/libgit2/src/blob.c +42 -128
  102. data/vendor/libgit2/src/blob.h +2 -19
  103. data/vendor/libgit2/src/branch.c +43 -67
  104. data/vendor/libgit2/src/buf_text.c +6 -7
  105. data/vendor/libgit2/src/buffer.c +57 -69
  106. data/vendor/libgit2/src/buffer.h +1 -1
  107. data/vendor/libgit2/src/cache.c +45 -38
  108. data/vendor/libgit2/src/cache.h +3 -3
  109. data/vendor/libgit2/src/cc-compat.h +3 -20
  110. data/vendor/libgit2/src/checkout.c +90 -109
  111. data/vendor/libgit2/src/cherrypick.c +9 -15
  112. data/vendor/libgit2/src/clone.c +27 -49
  113. data/vendor/libgit2/src/clone.h +0 -4
  114. data/vendor/libgit2/src/commit.c +49 -117
  115. data/vendor/libgit2/src/commit.h +0 -7
  116. data/vendor/libgit2/src/commit_list.c +78 -30
  117. data/vendor/libgit2/src/commit_list.h +2 -2
  118. data/vendor/libgit2/src/common.h +91 -27
  119. data/vendor/libgit2/src/config.c +176 -194
  120. data/vendor/libgit2/src/config.h +20 -8
  121. data/vendor/libgit2/src/config_cache.c +35 -41
  122. data/vendor/libgit2/src/config_file.c +753 -439
  123. data/vendor/libgit2/src/config_file.h +73 -0
  124. data/vendor/libgit2/src/config_parse.c +63 -114
  125. data/vendor/libgit2/src/config_parse.h +16 -17
  126. data/vendor/libgit2/src/crlf.c +190 -219
  127. data/vendor/libgit2/src/delta.c +18 -25
  128. data/vendor/libgit2/src/describe.c +41 -42
  129. data/vendor/libgit2/src/diff.c +68 -53
  130. data/vendor/libgit2/src/diff.h +1 -2
  131. data/vendor/libgit2/src/diff_driver.c +49 -47
  132. data/vendor/libgit2/src/diff_file.c +17 -19
  133. data/vendor/libgit2/src/diff_file.h +1 -1
  134. data/vendor/libgit2/src/diff_generate.c +106 -162
  135. data/vendor/libgit2/src/diff_generate.h +3 -3
  136. data/vendor/libgit2/src/diff_parse.c +4 -4
  137. data/vendor/libgit2/src/diff_print.c +30 -42
  138. data/vendor/libgit2/src/diff_stats.c +7 -22
  139. data/vendor/libgit2/src/diff_tform.c +16 -16
  140. data/vendor/libgit2/src/diff_xdiff.c +3 -15
  141. data/vendor/libgit2/src/errors.c +39 -51
  142. data/vendor/libgit2/src/features.h.in +3 -11
  143. data/vendor/libgit2/src/fetch.c +5 -10
  144. data/vendor/libgit2/src/fetchhead.c +17 -17
  145. data/vendor/libgit2/src/filebuf.c +36 -32
  146. data/vendor/libgit2/src/filebuf.h +2 -2
  147. data/vendor/libgit2/src/{futils.c → fileops.c} +73 -80
  148. data/vendor/libgit2/src/{futils.h → fileops.h} +6 -6
  149. data/vendor/libgit2/src/filter.c +38 -46
  150. data/vendor/libgit2/src/filter.h +10 -0
  151. data/vendor/libgit2/src/fnmatch.c +248 -0
  152. data/vendor/libgit2/src/fnmatch.h +48 -0
  153. data/vendor/libgit2/src/global.c +63 -48
  154. data/vendor/libgit2/src/global.h +2 -0
  155. data/vendor/libgit2/src/hash.c +0 -61
  156. data/vendor/libgit2/src/hash.h +19 -20
  157. data/vendor/libgit2/src/hash/hash_collisiondetect.h +47 -0
  158. data/vendor/libgit2/src/hash/{sha1/common_crypto.c → hash_common_crypto.h} +17 -17
  159. data/vendor/libgit2/src/hash/{sha1/generic.c → hash_generic.c} +10 -22
  160. data/vendor/libgit2/src/hash/{sha1/generic.h → hash_generic.h} +10 -4
  161. data/vendor/libgit2/src/hash/hash_openssl.h +59 -0
  162. data/vendor/libgit2/src/hash/{sha1/win32.c → hash_win32.c} +37 -47
  163. data/vendor/libgit2/src/hash/{sha1/win32.h → hash_win32.h} +19 -6
  164. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/sha1.c +3 -14
  165. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/sha1.h +0 -0
  166. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/ubc_check.c +0 -0
  167. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/ubc_check.h +0 -0
  168. data/vendor/libgit2/src/hashsig.c +5 -5
  169. data/vendor/libgit2/src/idxmap.c +61 -107
  170. data/vendor/libgit2/src/idxmap.h +31 -153
  171. data/vendor/libgit2/src/ignore.c +47 -43
  172. data/vendor/libgit2/src/index.c +232 -337
  173. data/vendor/libgit2/src/index.h +1 -17
  174. data/vendor/libgit2/src/indexer.c +175 -346
  175. data/vendor/libgit2/src/integer.h +26 -71
  176. data/vendor/libgit2/src/iterator.c +70 -142
  177. data/vendor/libgit2/src/iterator.h +0 -15
  178. data/vendor/libgit2/src/khash.h +1 -3
  179. data/vendor/libgit2/src/map.h +1 -1
  180. data/vendor/libgit2/src/merge.c +100 -144
  181. data/vendor/libgit2/src/merge_driver.c +11 -11
  182. data/vendor/libgit2/src/merge_file.c +2 -2
  183. data/vendor/libgit2/src/mwindow.c +29 -24
  184. data/vendor/libgit2/src/mwindow.h +4 -4
  185. data/vendor/libgit2/src/netops.c +156 -55
  186. data/vendor/libgit2/src/netops.h +23 -3
  187. data/vendor/libgit2/src/notes.c +11 -16
  188. data/vendor/libgit2/src/object.c +69 -120
  189. data/vendor/libgit2/src/object.h +9 -22
  190. data/vendor/libgit2/src/object_api.c +8 -8
  191. data/vendor/libgit2/src/odb.c +93 -116
  192. data/vendor/libgit2/src/odb.h +7 -8
  193. data/vendor/libgit2/src/odb_loose.c +55 -62
  194. data/vendor/libgit2/src/odb_mempack.c +34 -21
  195. data/vendor/libgit2/src/odb_pack.c +14 -18
  196. data/vendor/libgit2/src/offmap.c +35 -53
  197. data/vendor/libgit2/src/offmap.h +21 -108
  198. data/vendor/libgit2/src/oid.c +7 -12
  199. data/vendor/libgit2/src/oidmap.c +47 -49
  200. data/vendor/libgit2/src/oidmap.h +24 -101
  201. data/vendor/libgit2/src/pack-objects.c +87 -88
  202. data/vendor/libgit2/src/pack-objects.h +8 -2
  203. data/vendor/libgit2/src/pack.c +101 -99
  204. data/vendor/libgit2/src/pack.h +19 -17
  205. data/vendor/libgit2/src/parse.c +0 -10
  206. data/vendor/libgit2/src/parse.h +3 -3
  207. data/vendor/libgit2/src/patch.c +4 -4
  208. data/vendor/libgit2/src/patch_generate.c +20 -20
  209. data/vendor/libgit2/src/patch_parse.c +63 -151
  210. data/vendor/libgit2/src/path.c +104 -117
  211. data/vendor/libgit2/src/path.h +71 -3
  212. data/vendor/libgit2/src/pathspec.c +19 -19
  213. data/vendor/libgit2/src/pool.c +22 -26
  214. data/vendor/libgit2/src/pool.h +7 -7
  215. data/vendor/libgit2/src/posix.c +10 -10
  216. data/vendor/libgit2/src/posix.h +1 -12
  217. data/vendor/libgit2/src/proxy.c +3 -8
  218. data/vendor/libgit2/src/push.c +31 -37
  219. data/vendor/libgit2/src/push.h +1 -2
  220. data/vendor/libgit2/src/rebase.c +59 -115
  221. data/vendor/libgit2/src/refdb.c +3 -15
  222. data/vendor/libgit2/src/refdb_fs.c +254 -381
  223. data/vendor/libgit2/src/reflog.c +15 -13
  224. data/vendor/libgit2/src/refs.c +88 -118
  225. data/vendor/libgit2/src/refs.h +3 -5
  226. data/vendor/libgit2/src/refspec.c +37 -56
  227. data/vendor/libgit2/src/refspec.h +1 -1
  228. data/vendor/libgit2/src/remote.c +215 -266
  229. data/vendor/libgit2/src/remote.h +2 -11
  230. data/vendor/libgit2/src/repository.c +225 -280
  231. data/vendor/libgit2/src/repository.h +40 -52
  232. data/vendor/libgit2/src/reset.c +8 -8
  233. data/vendor/libgit2/src/revert.c +9 -14
  234. data/vendor/libgit2/src/revparse.c +48 -47
  235. data/vendor/libgit2/src/revwalk.c +57 -120
  236. data/vendor/libgit2/src/revwalk.h +1 -22
  237. data/vendor/libgit2/src/settings.c +10 -47
  238. data/vendor/libgit2/src/signature.c +11 -11
  239. data/vendor/libgit2/src/sortedcache.c +36 -22
  240. data/vendor/libgit2/src/sortedcache.h +1 -1
  241. data/vendor/libgit2/src/stash.c +99 -125
  242. data/vendor/libgit2/src/status.c +22 -28
  243. data/vendor/libgit2/src/stream.h +2 -17
  244. data/vendor/libgit2/src/streams/curl.c +385 -0
  245. data/vendor/libgit2/src/{allocators/stdalloc.h → streams/curl.h} +5 -5
  246. data/vendor/libgit2/src/streams/openssl.c +114 -224
  247. data/vendor/libgit2/src/streams/openssl.h +108 -4
  248. data/vendor/libgit2/src/streams/socket.c +30 -55
  249. data/vendor/libgit2/src/streams/stransport.c +32 -57
  250. data/vendor/libgit2/src/streams/stransport.h +0 -5
  251. data/vendor/libgit2/src/streams/tls.c +19 -50
  252. data/vendor/libgit2/src/streams/tls.h +4 -12
  253. data/vendor/libgit2/src/strmap.c +74 -47
  254. data/vendor/libgit2/src/strmap.h +33 -108
  255. data/vendor/libgit2/src/submodule.c +216 -272
  256. data/vendor/libgit2/src/submodule.h +1 -1
  257. data/vendor/libgit2/src/sysdir.c +19 -29
  258. data/vendor/libgit2/src/tag.c +28 -41
  259. data/vendor/libgit2/src/tag.h +1 -2
  260. data/vendor/libgit2/src/trace.c +2 -2
  261. data/vendor/libgit2/src/trace.h +3 -3
  262. data/vendor/libgit2/src/trailer.c +38 -52
  263. data/vendor/libgit2/src/transaction.c +29 -30
  264. data/vendor/libgit2/src/transport.c +5 -5
  265. data/vendor/libgit2/src/transports/auth.c +11 -15
  266. data/vendor/libgit2/src/transports/auth.h +3 -10
  267. data/vendor/libgit2/src/transports/auth_negotiate.c +18 -33
  268. data/vendor/libgit2/src/transports/auth_negotiate.h +2 -2
  269. data/vendor/libgit2/src/transports/cred.c +24 -24
  270. data/vendor/libgit2/src/{allocators/win32_crtdbg.h → transports/cred.h} +4 -5
  271. data/vendor/libgit2/src/transports/git.c +31 -26
  272. data/vendor/libgit2/src/transports/http.c +348 -881
  273. data/vendor/libgit2/src/transports/http.h +0 -2
  274. data/vendor/libgit2/src/transports/local.c +35 -35
  275. data/vendor/libgit2/src/transports/smart.c +47 -70
  276. data/vendor/libgit2/src/transports/smart.h +4 -3
  277. data/vendor/libgit2/src/transports/smart_pkt.c +40 -43
  278. data/vendor/libgit2/src/transports/smart_protocol.c +116 -96
  279. data/vendor/libgit2/src/transports/ssh.c +66 -77
  280. data/vendor/libgit2/src/transports/winhttp.c +314 -318
  281. data/vendor/libgit2/src/tree-cache.c +12 -19
  282. data/vendor/libgit2/src/tree.c +142 -103
  283. data/vendor/libgit2/src/tree.h +12 -1
  284. data/vendor/libgit2/src/unix/map.c +3 -3
  285. data/vendor/libgit2/src/unix/posix.h +11 -1
  286. data/vendor/libgit2/src/userdiff.h +1 -3
  287. data/vendor/libgit2/src/util.c +56 -70
  288. data/vendor/libgit2/src/util.h +156 -28
  289. data/vendor/libgit2/src/vector.c +4 -4
  290. data/vendor/libgit2/src/win32/dir.c +3 -3
  291. data/vendor/libgit2/src/win32/findfile.c +3 -3
  292. data/vendor/libgit2/src/win32/map.c +11 -9
  293. data/vendor/libgit2/src/win32/msvc-compat.h +0 -6
  294. data/vendor/libgit2/src/win32/path_w32.c +9 -113
  295. data/vendor/libgit2/src/win32/path_w32.h +29 -18
  296. data/vendor/libgit2/src/win32/posix.h +4 -1
  297. data/vendor/libgit2/src/win32/posix_w32.c +45 -70
  298. data/vendor/libgit2/src/win32/precompiled.h +2 -0
  299. data/vendor/libgit2/src/win32/thread.c +10 -5
  300. data/vendor/libgit2/src/win32/w32_buffer.c +5 -9
  301. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +2 -3
  302. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +75 -26
  303. data/vendor/libgit2/src/win32/w32_stack.c +11 -6
  304. data/vendor/libgit2/src/win32/w32_stack.h +3 -3
  305. data/vendor/libgit2/src/win32/w32_util.c +64 -27
  306. data/vendor/libgit2/src/win32/w32_util.h +49 -5
  307. data/vendor/libgit2/src/worktree.c +60 -95
  308. data/vendor/libgit2/src/worktree.h +0 -2
  309. data/vendor/libgit2/src/xdiff/xdiffi.c +5 -7
  310. data/vendor/libgit2/src/xdiff/xhistogram.c +1 -1
  311. data/vendor/libgit2/src/xdiff/xmerge.c +15 -27
  312. data/vendor/libgit2/src/xdiff/xpatience.c +0 -3
  313. data/vendor/libgit2/src/zstream.c +4 -4
  314. metadata +33 -122
  315. data/vendor/libgit2/cmake/Modules/FindGSSFramework.cmake +0 -28
  316. data/vendor/libgit2/cmake/Modules/FindPCRE.cmake +0 -38
  317. data/vendor/libgit2/cmake/Modules/FindPCRE2.cmake +0 -37
  318. data/vendor/libgit2/cmake/Modules/FindmbedTLS.cmake +0 -93
  319. data/vendor/libgit2/cmake/Modules/PkgBuildConfig.cmake +0 -110
  320. data/vendor/libgit2/cmake/Modules/SelectGSSAPI.cmake +0 -53
  321. data/vendor/libgit2/cmake/Modules/SelectHTTPSBackend.cmake +0 -124
  322. data/vendor/libgit2/cmake/Modules/SelectHashes.cmake +0 -66
  323. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +0 -21
  324. data/vendor/libgit2/deps/ntlmclient/compat.h +0 -33
  325. data/vendor/libgit2/deps/ntlmclient/crypt.h +0 -64
  326. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +0 -120
  327. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +0 -18
  328. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +0 -145
  329. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +0 -18
  330. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +0 -130
  331. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +0 -21
  332. data/vendor/libgit2/deps/ntlmclient/ntlm.c +0 -1420
  333. data/vendor/libgit2/deps/ntlmclient/ntlm.h +0 -174
  334. data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +0 -320
  335. data/vendor/libgit2/deps/ntlmclient/unicode.h +0 -36
  336. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +0 -445
  337. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +0 -201
  338. data/vendor/libgit2/deps/ntlmclient/utf8.h +0 -1257
  339. data/vendor/libgit2/deps/ntlmclient/util.c +0 -21
  340. data/vendor/libgit2/deps/ntlmclient/util.h +0 -14
  341. data/vendor/libgit2/deps/pcre/CMakeLists.txt +0 -140
  342. data/vendor/libgit2/deps/pcre/COPYING +0 -5
  343. data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +0 -22
  344. data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +0 -17
  345. data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +0 -58
  346. data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +0 -29
  347. data/vendor/libgit2/deps/pcre/config.h.in +0 -57
  348. data/vendor/libgit2/deps/pcre/pcre.h +0 -641
  349. data/vendor/libgit2/deps/pcre/pcre_byte_order.c +0 -319
  350. data/vendor/libgit2/deps/pcre/pcre_chartables.c +0 -198
  351. data/vendor/libgit2/deps/pcre/pcre_compile.c +0 -9800
  352. data/vendor/libgit2/deps/pcre/pcre_config.c +0 -190
  353. data/vendor/libgit2/deps/pcre/pcre_dfa_exec.c +0 -3676
  354. data/vendor/libgit2/deps/pcre/pcre_exec.c +0 -7173
  355. data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +0 -245
  356. data/vendor/libgit2/deps/pcre/pcre_get.c +0 -669
  357. data/vendor/libgit2/deps/pcre/pcre_globals.c +0 -86
  358. data/vendor/libgit2/deps/pcre/pcre_internal.h +0 -2787
  359. data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +0 -11913
  360. data/vendor/libgit2/deps/pcre/pcre_maketables.c +0 -156
  361. data/vendor/libgit2/deps/pcre/pcre_newline.c +0 -210
  362. data/vendor/libgit2/deps/pcre/pcre_ord2utf8.c +0 -94
  363. data/vendor/libgit2/deps/pcre/pcre_printint.c +0 -834
  364. data/vendor/libgit2/deps/pcre/pcre_refcount.c +0 -92
  365. data/vendor/libgit2/deps/pcre/pcre_string_utils.c +0 -211
  366. data/vendor/libgit2/deps/pcre/pcre_study.c +0 -1686
  367. data/vendor/libgit2/deps/pcre/pcre_tables.c +0 -727
  368. data/vendor/libgit2/deps/pcre/pcre_ucd.c +0 -3644
  369. data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +0 -301
  370. data/vendor/libgit2/deps/pcre/pcre_version.c +0 -98
  371. data/vendor/libgit2/deps/pcre/pcre_xclass.c +0 -268
  372. data/vendor/libgit2/deps/pcre/pcreposix.c +0 -421
  373. data/vendor/libgit2/deps/pcre/pcreposix.h +0 -117
  374. data/vendor/libgit2/deps/pcre/ucp.h +0 -224
  375. data/vendor/libgit2/deps/winhttp/COPYING.GPL +0 -993
  376. data/vendor/libgit2/deps/winhttp/COPYING.LGPL +0 -502
  377. data/vendor/libgit2/deps/zlib/COPYING +0 -27
  378. data/vendor/libgit2/include/git2/apply.h +0 -149
  379. data/vendor/libgit2/include/git2/cert.h +0 -135
  380. data/vendor/libgit2/include/git2/cred.h +0 -308
  381. data/vendor/libgit2/include/git2/deprecated.h +0 -493
  382. data/vendor/libgit2/include/git2/mailmap.h +0 -115
  383. data/vendor/libgit2/include/git2/sys/alloc.h +0 -101
  384. data/vendor/libgit2/include/git2/sys/cred.h +0 -90
  385. data/vendor/libgit2/include/git2/sys/path.h +0 -64
  386. data/vendor/libgit2/src/alloc.c +0 -43
  387. data/vendor/libgit2/src/alloc.h +0 -40
  388. data/vendor/libgit2/src/allocators/stdalloc.c +0 -119
  389. data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
  390. data/vendor/libgit2/src/config_backend.h +0 -96
  391. data/vendor/libgit2/src/config_entries.c +0 -229
  392. data/vendor/libgit2/src/config_entries.h +0 -24
  393. data/vendor/libgit2/src/config_mem.c +0 -220
  394. data/vendor/libgit2/src/config_snapshot.c +0 -206
  395. data/vendor/libgit2/src/errors.h +0 -81
  396. data/vendor/libgit2/src/hash/sha1.h +0 -38
  397. data/vendor/libgit2/src/hash/sha1/collisiondetect.c +0 -48
  398. data/vendor/libgit2/src/hash/sha1/collisiondetect.h +0 -19
  399. data/vendor/libgit2/src/hash/sha1/common_crypto.h +0 -19
  400. data/vendor/libgit2/src/hash/sha1/mbedtls.c +0 -46
  401. data/vendor/libgit2/src/hash/sha1/mbedtls.h +0 -19
  402. data/vendor/libgit2/src/hash/sha1/openssl.c +0 -59
  403. data/vendor/libgit2/src/hash/sha1/openssl.h +0 -19
  404. data/vendor/libgit2/src/mailmap.c +0 -485
  405. data/vendor/libgit2/src/mailmap.h +0 -35
  406. data/vendor/libgit2/src/net.c +0 -184
  407. data/vendor/libgit2/src/net.h +0 -36
  408. data/vendor/libgit2/src/reader.c +0 -265
  409. data/vendor/libgit2/src/reader.h +0 -107
  410. data/vendor/libgit2/src/regexp.c +0 -221
  411. data/vendor/libgit2/src/regexp.h +0 -97
  412. data/vendor/libgit2/src/streams/mbedtls.c +0 -483
  413. data/vendor/libgit2/src/streams/mbedtls.h +0 -23
  414. data/vendor/libgit2/src/streams/registry.c +0 -118
  415. data/vendor/libgit2/src/streams/registry.h +0 -19
  416. data/vendor/libgit2/src/transports/auth_ntlm.c +0 -223
  417. data/vendor/libgit2/src/transports/auth_ntlm.h +0 -35
  418. data/vendor/libgit2/src/wildmatch.c +0 -320
  419. data/vendor/libgit2/src/wildmatch.h +0 -23
  420. data/vendor/libgit2/src/win32/w32_common.h +0 -39
@@ -24,7 +24,7 @@ int git_refdb_new(git_refdb **out, git_repository *repo)
24
24
  assert(out && repo);
25
25
 
26
26
  db = git__calloc(1, sizeof(*db));
27
- GIT_ERROR_CHECK_ALLOC(db);
27
+ GITERR_CHECK_ALLOC(db);
28
28
 
29
29
  db->repo = repo;
30
30
 
@@ -66,18 +66,6 @@ static void refdb_free_backend(git_refdb *db)
66
66
 
67
67
  int git_refdb_set_backend(git_refdb *db, git_refdb_backend *backend)
68
68
  {
69
- GIT_ERROR_CHECK_VERSION(backend, GIT_REFDB_BACKEND_VERSION, "git_refdb_backend");
70
-
71
- if (!backend->exists || !backend->lookup || !backend->iterator ||
72
- !backend->write || !backend->rename || !backend->del ||
73
- !backend->has_log || !backend->ensure_log || !backend->free ||
74
- !backend->reflog_read || !backend->reflog_write ||
75
- !backend->reflog_rename || !backend->reflog_delete ||
76
- (backend->lock && !backend->unlock)) {
77
- git_error_set(GIT_ERROR_REFERENCE, "incomplete refdb backend implementation");
78
- return GIT_EINVALID;
79
- }
80
-
81
69
  refdb_free_backend(db);
82
70
  db->backend = backend;
83
71
 
@@ -139,7 +127,7 @@ int git_refdb_iterator(git_reference_iterator **out, git_refdb *db, const char *
139
127
  int error;
140
128
 
141
129
  if (!db->backend || !db->backend->iterator) {
142
- git_error_set(GIT_ERROR_REFERENCE, "this backend doesn't support iterators");
130
+ giterr_set(GITERR_REFERENCE, "this backend doesn't support iterators");
143
131
  return -1;
144
132
  }
145
133
 
@@ -257,7 +245,7 @@ int git_refdb_lock(void **payload, git_refdb *db, const char *refname)
257
245
  assert(payload && db && refname);
258
246
 
259
247
  if (!db->backend->lock) {
260
- git_error_set(GIT_ERROR_REFERENCE, "backend does not support locking");
248
+ giterr_set(GITERR_REFERENCE, "backend does not support locking");
261
249
  return -1;
262
250
  }
263
251
 
@@ -10,16 +10,14 @@
10
10
  #include "refs.h"
11
11
  #include "hash.h"
12
12
  #include "repository.h"
13
- #include "futils.h"
13
+ #include "fileops.h"
14
14
  #include "filebuf.h"
15
15
  #include "pack.h"
16
- #include "parse.h"
17
16
  #include "reflog.h"
18
17
  #include "refdb.h"
19
18
  #include "iterator.h"
20
19
  #include "sortedcache.h"
21
20
  #include "signature.h"
22
- #include "wildmatch.h"
23
21
 
24
22
  #include <git2/tag.h>
25
23
  #include <git2/object.h>
@@ -96,7 +94,7 @@ static int packed_reload(refdb_fs_backend *backend)
96
94
  if (error <= 0) {
97
95
  if (error == GIT_ENOTFOUND) {
98
96
  git_sortedcache_clear(backend->refcache, true);
99
- git_error_clear();
97
+ giterr_clear();
100
98
  error = 0;
101
99
  }
102
100
  return error;
@@ -185,16 +183,16 @@ static int packed_reload(refdb_fs_backend *backend)
185
183
  }
186
184
 
187
185
  git_sortedcache_wunlock(backend->refcache);
188
- git_buf_dispose(&packedrefs);
186
+ git_buf_free(&packedrefs);
189
187
 
190
188
  return 0;
191
189
 
192
190
  parse_failed:
193
- git_error_set(GIT_ERROR_REFERENCE, "corrupted packed references file");
191
+ giterr_set(GITERR_REFERENCE, "corrupted packed references file");
194
192
 
195
193
  git_sortedcache_clear(backend->refcache, false);
196
194
  git_sortedcache_wunlock(backend->refcache);
197
- git_buf_dispose(&packedrefs);
195
+ git_buf_free(&packedrefs);
198
196
 
199
197
  return -1;
200
198
  }
@@ -217,7 +215,7 @@ static int loose_parse_oid(
217
215
  return 0;
218
216
 
219
217
  corrupted:
220
- git_error_set(GIT_ERROR_REFERENCE, "corrupted loose reference file: %s", filename);
218
+ giterr_set(GITERR_REFERENCE, "corrupted loose reference file: %s", filename);
221
219
  return -1;
222
220
  }
223
221
 
@@ -228,7 +226,7 @@ static int loose_readbuffer(git_buf *buf, const char *base, const char *path)
228
226
  /* build full path to file */
229
227
  if ((error = git_buf_joinpath(buf, base, path)) < 0 ||
230
228
  (error = git_futils_readbuffer(buf, buf->ptr)) < 0)
231
- git_buf_dispose(buf);
229
+ git_buf_free(buf);
232
230
 
233
231
  return error;
234
232
  }
@@ -244,7 +242,7 @@ static int loose_lookup_to_packfile(refdb_fs_backend *backend, const char *name)
244
242
  * the filesystem under us and skip it...
245
243
  */
246
244
  if (loose_readbuffer(&ref_file, backend->gitpath, name) < 0) {
247
- git_error_clear();
245
+ giterr_clear();
248
246
  goto done;
249
247
  }
250
248
 
@@ -268,7 +266,7 @@ static int loose_lookup_to_packfile(refdb_fs_backend *backend, const char *name)
268
266
  git_sortedcache_wunlock(backend->refcache);
269
267
 
270
268
  done:
271
- git_buf_dispose(&ref_file);
269
+ git_buf_free(&ref_file);
272
270
  return error;
273
271
  }
274
272
 
@@ -285,7 +283,7 @@ static int _dirent_loose_load(void *payload, git_buf *full_path)
285
283
  full_path, backend->direach_flags, _dirent_loose_load, backend);
286
284
  /* Race with the filesystem, ignore it */
287
285
  if (error == GIT_ENOTFOUND) {
288
- git_error_clear();
286
+ giterr_clear();
289
287
  return 0;
290
288
  }
291
289
 
@@ -319,7 +317,7 @@ static int packed_loadloose(refdb_fs_backend *backend)
319
317
  error = git_path_direach(
320
318
  &refs_path, backend->direach_flags, _dirent_loose_load, backend);
321
319
 
322
- git_buf_dispose(&refs_path);
320
+ git_buf_free(&refs_path);
323
321
 
324
322
  return error;
325
323
  }
@@ -329,33 +327,21 @@ static int refdb_fs_backend__exists(
329
327
  git_refdb_backend *_backend,
330
328
  const char *ref_name)
331
329
  {
332
- refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
330
+ refdb_fs_backend *backend = (refdb_fs_backend *)_backend;
333
331
  git_buf ref_path = GIT_BUF_INIT;
334
332
  int error;
335
333
 
336
334
  assert(backend);
337
335
 
338
- *exists = 0;
339
-
340
- if ((error = git_buf_joinpath(&ref_path, backend->gitpath, ref_name)) < 0)
341
- goto out;
342
-
343
- if (git_path_isfile(ref_path.ptr)) {
344
- *exists = 1;
345
- goto out;
346
- }
347
-
348
- if ((error = packed_reload(backend)) < 0)
349
- goto out;
336
+ if ((error = packed_reload(backend)) < 0 ||
337
+ (error = git_buf_joinpath(&ref_path, backend->gitpath, ref_name)) < 0)
338
+ return error;
350
339
 
351
- if (git_sortedcache_lookup(backend->refcache, ref_name) != NULL) {
352
- *exists = 1;
353
- goto out;
354
- }
340
+ *exists = git_path_isfile(ref_path.ptr) ||
341
+ (git_sortedcache_lookup(backend->refcache, ref_name) != NULL);
355
342
 
356
- out:
357
- git_buf_dispose(&ref_path);
358
- return error;
343
+ git_buf_free(&ref_path);
344
+ return 0;
359
345
  }
360
346
 
361
347
  static const char *loose_parse_symbolic(git_buf *file_content)
@@ -366,7 +352,7 @@ static const char *loose_parse_symbolic(git_buf *file_content)
366
352
  refname_start = (const char *)file_content->ptr;
367
353
 
368
354
  if (git_buf_len(file_content) < header_len + 1) {
369
- git_error_set(GIT_ERROR_REFERENCE, "corrupted loose reference file");
355
+ giterr_set(GITERR_REFERENCE, "corrupted loose reference file");
370
356
  return NULL;
371
357
  }
372
358
 
@@ -428,13 +414,13 @@ static int loose_lookup(
428
414
  *out = git_reference__alloc(ref_name, &oid, NULL);
429
415
  }
430
416
 
431
- git_buf_dispose(&ref_file);
417
+ git_buf_free(&ref_file);
432
418
  return error;
433
419
  }
434
420
 
435
421
  static int ref_error_notfound(const char *name)
436
422
  {
437
- git_error_set(GIT_ERROR_REFERENCE, "reference '%s' not found", name);
423
+ giterr_set(GITERR_REFERENCE, "reference '%s' not found", name);
438
424
  return GIT_ENOTFOUND;
439
425
  }
440
426
 
@@ -471,7 +457,7 @@ static int refdb_fs_backend__lookup(
471
457
  git_refdb_backend *_backend,
472
458
  const char *ref_name)
473
459
  {
474
- refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
460
+ refdb_fs_backend *backend = (refdb_fs_backend *)_backend;
475
461
  int error;
476
462
 
477
463
  assert(backend);
@@ -482,7 +468,7 @@ static int refdb_fs_backend__lookup(
482
468
  /* only try to lookup this reference on the packfile if it
483
469
  * wasn't found on the loose refs; not if there was a critical error */
484
470
  if (error == GIT_ENOTFOUND) {
485
- git_error_clear();
471
+ giterr_clear();
486
472
  error = packed_lookup(out, backend, ref_name);
487
473
  }
488
474
 
@@ -504,7 +490,7 @@ typedef struct {
504
490
 
505
491
  static void refdb_fs_backend__iterator_free(git_reference_iterator *_iter)
506
492
  {
507
- refdb_fs_iter *iter = GIT_CONTAINER_OF(_iter, refdb_fs_iter, parent);
493
+ refdb_fs_iter *iter = (refdb_fs_iter *) _iter;
508
494
 
509
495
  git_vector_free(&iter->loose);
510
496
  git_pool_clear(&iter->pool);
@@ -519,63 +505,39 @@ static int iter_load_loose_paths(refdb_fs_backend *backend, refdb_fs_iter *iter)
519
505
  git_iterator *fsit = NULL;
520
506
  git_iterator_options fsit_opts = GIT_ITERATOR_OPTIONS_INIT;
521
507
  const git_index_entry *entry = NULL;
522
- const char *ref_prefix = GIT_REFS_DIR;
523
- size_t ref_prefix_len = strlen(ref_prefix);
524
508
 
525
509
  if (!backend->commonpath) /* do nothing if no commonpath for loose refs */
526
510
  return 0;
527
511
 
528
512
  fsit_opts.flags = backend->iterator_flags;
529
513
 
530
- if (iter->glob) {
531
- const char *last_sep = NULL;
532
- const char *pos;
533
- for (pos = iter->glob; *pos; ++pos) {
534
- switch (*pos) {
535
- case '?':
536
- case '*':
537
- case '[':
538
- case '\\':
539
- break;
540
- case '/':
541
- last_sep = pos;
542
- /* FALLTHROUGH */
543
- default:
544
- continue;
545
- }
546
- break;
547
- }
548
- if (last_sep) {
549
- ref_prefix = iter->glob;
550
- ref_prefix_len = (last_sep - ref_prefix) + 1;
551
- }
552
- }
553
-
554
- if ((error = git_buf_printf(&path, "%s/", backend->commonpath)) < 0 ||
555
- (error = git_buf_put(&path, ref_prefix, ref_prefix_len)) < 0) {
556
- git_buf_dispose(&path);
514
+ if ((error = git_buf_printf(&path, "%s/refs", backend->commonpath)) < 0 ||
515
+ (error = git_iterator_for_filesystem(&fsit, path.ptr, &fsit_opts)) < 0) {
516
+ git_buf_free(&path);
557
517
  return error;
558
518
  }
559
519
 
560
- if ((error = git_iterator_for_filesystem(&fsit, path.ptr, &fsit_opts)) < 0) {
561
- git_buf_dispose(&path);
562
- return (iter->glob && error == GIT_ENOTFOUND)? 0 : error;
563
- }
564
-
565
- error = git_buf_sets(&path, ref_prefix);
520
+ error = git_buf_sets(&path, GIT_REFS_DIR);
566
521
 
567
522
  while (!error && !git_iterator_advance(&entry, fsit)) {
568
523
  const char *ref_name;
524
+ struct packref *ref;
569
525
  char *ref_dup;
570
526
 
571
- git_buf_truncate(&path, ref_prefix_len);
527
+ git_buf_truncate(&path, strlen(GIT_REFS_DIR));
572
528
  git_buf_puts(&path, entry->path);
573
529
  ref_name = git_buf_cstr(&path);
574
530
 
575
531
  if (git__suffixcmp(ref_name, ".lock") == 0 ||
576
- (iter->glob && wildmatch(iter->glob, ref_name, 0) != 0))
532
+ (iter->glob && p_fnmatch(iter->glob, ref_name, 0) != 0))
577
533
  continue;
578
534
 
535
+ git_sortedcache_rlock(backend->refcache);
536
+ ref = git_sortedcache_lookup(backend->refcache, ref_name);
537
+ if (ref)
538
+ ref->flags |= PACKREF_SHADOWED;
539
+ git_sortedcache_runlock(backend->refcache);
540
+
579
541
  ref_dup = git_pool_strdup(&iter->pool, ref_name);
580
542
  if (!ref_dup)
581
543
  error = -1;
@@ -584,7 +546,7 @@ static int iter_load_loose_paths(refdb_fs_backend *backend, refdb_fs_iter *iter)
584
546
  }
585
547
 
586
548
  git_iterator_free(fsit);
587
- git_buf_dispose(&path);
549
+ git_buf_free(&path);
588
550
 
589
551
  return error;
590
552
  }
@@ -593,22 +555,22 @@ static int refdb_fs_backend__iterator_next(
593
555
  git_reference **out, git_reference_iterator *_iter)
594
556
  {
595
557
  int error = GIT_ITEROVER;
596
- refdb_fs_iter *iter = GIT_CONTAINER_OF(_iter, refdb_fs_iter, parent);
597
- refdb_fs_backend *backend = GIT_CONTAINER_OF(iter->parent.db->backend, refdb_fs_backend, parent);
558
+ refdb_fs_iter *iter = (refdb_fs_iter *)_iter;
559
+ refdb_fs_backend *backend = (refdb_fs_backend *)iter->parent.db->backend;
598
560
  struct packref *ref;
599
561
 
600
562
  while (iter->loose_pos < iter->loose.length) {
601
563
  const char *path = git_vector_get(&iter->loose, iter->loose_pos++);
602
564
 
603
- if (loose_lookup(out, backend, path) == 0) {
604
- ref = git_sortedcache_lookup(iter->cache, path);
605
- if (ref)
606
- ref->flags |= PACKREF_SHADOWED;
607
-
565
+ if (loose_lookup(out, backend, path) == 0)
608
566
  return 0;
609
- }
610
567
 
611
- git_error_clear();
568
+ giterr_clear();
569
+ }
570
+
571
+ if (!iter->cache) {
572
+ if ((error = git_sortedcache_copy(&iter->cache, backend->refcache, 1, NULL, NULL)) < 0)
573
+ return error;
612
574
  }
613
575
 
614
576
  error = GIT_ITEROVER;
@@ -619,7 +581,7 @@ static int refdb_fs_backend__iterator_next(
619
581
 
620
582
  if (ref->flags & PACKREF_SHADOWED)
621
583
  continue;
622
- if (iter->glob && wildmatch(iter->glob, ref->name, 0) != 0)
584
+ if (iter->glob && p_fnmatch(iter->glob, ref->name, 0) != 0)
623
585
  continue;
624
586
 
625
587
  *out = git_reference__alloc(ref->name, &ref->oid, &ref->peel);
@@ -634,24 +596,24 @@ static int refdb_fs_backend__iterator_next_name(
634
596
  const char **out, git_reference_iterator *_iter)
635
597
  {
636
598
  int error = GIT_ITEROVER;
637
- refdb_fs_iter *iter = GIT_CONTAINER_OF(_iter, refdb_fs_iter, parent);
638
- refdb_fs_backend *backend = GIT_CONTAINER_OF(iter->parent.db->backend, refdb_fs_backend, parent);
599
+ refdb_fs_iter *iter = (refdb_fs_iter *)_iter;
600
+ refdb_fs_backend *backend = (refdb_fs_backend *)iter->parent.db->backend;
639
601
  struct packref *ref;
640
602
 
641
603
  while (iter->loose_pos < iter->loose.length) {
642
604
  const char *path = git_vector_get(&iter->loose, iter->loose_pos++);
643
- struct packref *ref;
644
605
 
645
606
  if (loose_lookup(NULL, backend, path) == 0) {
646
- ref = git_sortedcache_lookup(iter->cache, path);
647
- if (ref)
648
- ref->flags |= PACKREF_SHADOWED;
649
-
650
607
  *out = path;
651
608
  return 0;
652
609
  }
653
610
 
654
- git_error_clear();
611
+ giterr_clear();
612
+ }
613
+
614
+ if (!iter->cache) {
615
+ if ((error = git_sortedcache_copy(&iter->cache, backend->refcache, 1, NULL, NULL)) < 0)
616
+ return error;
655
617
  }
656
618
 
657
619
  error = GIT_ITEROVER;
@@ -662,7 +624,7 @@ static int refdb_fs_backend__iterator_next_name(
662
624
 
663
625
  if (ref->flags & PACKREF_SHADOWED)
664
626
  continue;
665
- if (iter->glob && wildmatch(iter->glob, ref->name, 0) != 0)
627
+ if (iter->glob && p_fnmatch(iter->glob, ref->name, 0) != 0)
666
628
  continue;
667
629
 
668
630
  *out = ref->name;
@@ -676,44 +638,40 @@ static int refdb_fs_backend__iterator_next_name(
676
638
  static int refdb_fs_backend__iterator(
677
639
  git_reference_iterator **out, git_refdb_backend *_backend, const char *glob)
678
640
  {
679
- refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
680
- refdb_fs_iter *iter = NULL;
681
641
  int error;
642
+ refdb_fs_iter *iter;
643
+ refdb_fs_backend *backend = (refdb_fs_backend *)_backend;
682
644
 
683
645
  assert(backend);
684
646
 
647
+ if ((error = packed_reload(backend)) < 0)
648
+ return error;
649
+
685
650
  iter = git__calloc(1, sizeof(refdb_fs_iter));
686
- GIT_ERROR_CHECK_ALLOC(iter);
651
+ GITERR_CHECK_ALLOC(iter);
687
652
 
688
653
  git_pool_init(&iter->pool, 1);
689
654
 
690
- if ((error = git_vector_init(&iter->loose, 8, NULL)) < 0)
691
- goto out;
655
+ if (git_vector_init(&iter->loose, 8, NULL) < 0)
656
+ goto fail;
692
657
 
693
658
  if (glob != NULL &&
694
- (iter->glob = git_pool_strdup(&iter->pool, glob)) == NULL) {
695
- error = GIT_ERROR_NOMEMORY;
696
- goto out;
697
- }
698
-
699
- if ((error = iter_load_loose_paths(backend, iter)) < 0)
700
- goto out;
701
-
702
- if ((error = packed_reload(backend)) < 0)
703
- goto out;
704
-
705
- if ((error = git_sortedcache_copy(&iter->cache, backend->refcache, 1, NULL, NULL)) < 0)
706
- goto out;
659
+ (iter->glob = git_pool_strdup(&iter->pool, glob)) == NULL)
660
+ goto fail;
707
661
 
708
662
  iter->parent.next = refdb_fs_backend__iterator_next;
709
663
  iter->parent.next_name = refdb_fs_backend__iterator_next_name;
710
664
  iter->parent.free = refdb_fs_backend__iterator_free;
711
665
 
666
+ if (iter_load_loose_paths(backend, iter) < 0)
667
+ goto fail;
668
+
712
669
  *out = (git_reference_iterator *)iter;
713
- out:
714
- if (error)
715
- refdb_fs_backend__iterator_free((git_reference_iterator *)iter);
716
- return error;
670
+ return 0;
671
+
672
+ fail:
673
+ refdb_fs_backend__iterator_free((git_reference_iterator *)iter);
674
+ return -1;
717
675
  }
718
676
 
719
677
  static bool ref_is_available(
@@ -754,7 +712,7 @@ static int reference_path_available(
754
712
  }
755
713
 
756
714
  if (exists) {
757
- git_error_set(GIT_ERROR_REFERENCE,
715
+ giterr_set(GITERR_REFERENCE,
758
716
  "failed to write reference '%s': a reference with "
759
717
  "that name already exists.", new_ref);
760
718
  return GIT_EEXISTS;
@@ -768,7 +726,7 @@ static int reference_path_available(
768
726
 
769
727
  if (ref && !ref_is_available(old_ref, new_ref, ref->name)) {
770
728
  git_sortedcache_runlock(backend->refcache);
771
- git_error_set(GIT_ERROR_REFERENCE,
729
+ giterr_set(GITERR_REFERENCE,
772
730
  "path to reference '%s' collides with existing one", new_ref);
773
731
  return -1;
774
732
  }
@@ -787,7 +745,7 @@ static int loose_lock(git_filebuf *file, refdb_fs_backend *backend, const char *
787
745
  assert(file && backend && name);
788
746
 
789
747
  if (!git_path_isvalid(backend->repo, name, 0, GIT_PATH_REJECT_FILESYSTEM_DEFAULTS)) {
790
- git_error_set(GIT_ERROR_INVALID, "invalid reference name '%s'", name);
748
+ giterr_set(GITERR_INVALID, "invalid reference name '%s'", name);
791
749
  return GIT_EINVALIDSPEC;
792
750
  }
793
751
 
@@ -805,16 +763,16 @@ static int loose_lock(git_filebuf *file, refdb_fs_backend *backend, const char *
805
763
  if (git_buf_joinpath(&ref_path, basedir, name) < 0)
806
764
  return -1;
807
765
 
808
- filebuf_flags = GIT_FILEBUF_CREATE_LEADING_DIRS;
766
+ filebuf_flags = GIT_FILEBUF_FORCE;
809
767
  if (backend->fsync)
810
768
  filebuf_flags |= GIT_FILEBUF_FSYNC;
811
769
 
812
770
  error = git_filebuf_open(file, ref_path.ptr, filebuf_flags, GIT_REFS_FILE_MODE);
813
771
 
814
772
  if (error == GIT_EDIRECTORY)
815
- git_error_set(GIT_ERROR_REFERENCE, "cannot lock ref '%s', there are refs beneath that folder", name);
773
+ giterr_set(GITERR_REFERENCE, "cannot lock ref '%s', there are refs beneath that folder", name);
816
774
 
817
- git_buf_dispose(&ref_path);
775
+ git_buf_free(&ref_path);
818
776
  return error;
819
777
  }
820
778
 
@@ -822,12 +780,12 @@ static int loose_commit(git_filebuf *file, const git_reference *ref)
822
780
  {
823
781
  assert(file && ref);
824
782
 
825
- if (ref->type == GIT_REFERENCE_DIRECT) {
783
+ if (ref->type == GIT_REF_OID) {
826
784
  char oid[GIT_OID_HEXSZ + 1];
827
785
  git_oid_nfmt(oid, sizeof(oid), &ref->target.oid);
828
786
 
829
787
  git_filebuf_printf(file, "%s\n", oid);
830
- } else if (ref->type == GIT_REFERENCE_SYMBOLIC) {
788
+ } else if (ref->type == GIT_REF_SYMBOLIC) {
831
789
  git_filebuf_printf(file, GIT_SYMREF "%s\n", ref->target.symbolic);
832
790
  } else {
833
791
  assert(0); /* don't let this happen */
@@ -840,10 +798,10 @@ static int refdb_fs_backend__lock(void **out, git_refdb_backend *_backend, const
840
798
  {
841
799
  int error;
842
800
  git_filebuf *lock;
843
- refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
801
+ refdb_fs_backend *backend = (refdb_fs_backend *) _backend;
844
802
 
845
803
  lock = git__calloc(1, sizeof(git_filebuf));
846
- GIT_ERROR_CHECK_ALLOC(lock);
804
+ GITERR_CHECK_ALLOC(lock);
847
805
 
848
806
  if ((error = loose_lock(lock, backend, refname)) < 0) {
849
807
  git__free(lock);
@@ -859,17 +817,16 @@ static int refdb_fs_backend__write_tail(
859
817
  const git_reference *ref,
860
818
  git_filebuf *file,
861
819
  int update_reflog,
862
- const git_oid *old_id,
863
- const char *old_target,
864
820
  const git_signature *who,
865
- const char *message);
821
+ const char *message,
822
+ const git_oid *old_id,
823
+ const char *old_target);
866
824
 
867
825
  static int refdb_fs_backend__delete_tail(
868
826
  git_refdb_backend *_backend,
869
827
  git_filebuf *file,
870
828
  const char *ref_name,
871
- const git_oid *old_id,
872
- const char *old_target);
829
+ const git_oid *old_id, const char *old_target);
873
830
 
874
831
  static int refdb_fs_backend__unlock(git_refdb_backend *backend, void *payload, int success, int update_reflog,
875
832
  const git_reference *ref, const git_signature *sig, const char *message)
@@ -880,7 +837,7 @@ static int refdb_fs_backend__unlock(git_refdb_backend *backend, void *payload, i
880
837
  if (success == 2)
881
838
  error = refdb_fs_backend__delete_tail(backend, lock, ref->name, NULL, NULL);
882
839
  else if (success)
883
- error = refdb_fs_backend__write_tail(backend, ref, lock, update_reflog, NULL, NULL, sig, message);
840
+ error = refdb_fs_backend__write_tail(backend, ref, lock, update_reflog, sig, message, NULL, NULL);
884
841
  else
885
842
  git_filebuf_cleanup(lock);
886
843
 
@@ -906,7 +863,7 @@ static int packed_find_peel(refdb_fs_backend *backend, struct packref *ref)
906
863
  /*
907
864
  * Find the tagged object in the repository
908
865
  */
909
- if (git_object_lookup(&object, backend->repo, &ref->oid, GIT_OBJECT_ANY) < 0)
866
+ if (git_object_lookup(&object, backend->repo, &ref->oid, GIT_OBJ_ANY) < 0)
910
867
  return -1;
911
868
 
912
869
  /*
@@ -914,7 +871,7 @@ static int packed_find_peel(refdb_fs_backend *backend, struct packref *ref)
914
871
  * if the ref is actually a 'weak' ref, we don't need to resolve
915
872
  * anything.
916
873
  */
917
- if (git_object_type(object) == GIT_OBJECT_TAG) {
874
+ if (git_object_type(object) == GIT_OBJ_TAG) {
918
875
  git_tag *tag = (git_tag *)object;
919
876
 
920
877
  /*
@@ -1002,8 +959,8 @@ static int packed_remove_loose(refdb_fs_backend *backend)
1002
959
  continue;
1003
960
 
1004
961
  if (error < 0) {
1005
- git_buf_dispose(&ref_content);
1006
- git_error_set(GIT_ERROR_REFERENCE, "failed to lock loose reference '%s'", ref->name);
962
+ git_buf_free(&ref_content);
963
+ giterr_set(GITERR_REFERENCE, "failed to lock loose reference '%s'", ref->name);
1007
964
  return error;
1008
965
  }
1009
966
 
@@ -1033,7 +990,7 @@ static int packed_remove_loose(refdb_fs_backend *backend)
1033
990
  p_unlink(lock.path_original);
1034
991
  }
1035
992
 
1036
- git_buf_dispose(&ref_content);
993
+ git_buf_free(&ref_content);
1037
994
  git_filebuf_cleanup(&lock);
1038
995
  return 0;
1039
996
  }
@@ -1099,43 +1056,15 @@ fail:
1099
1056
  return error;
1100
1057
  }
1101
1058
 
1102
- static int packed_delete(refdb_fs_backend *backend, const char *ref_name)
1103
- {
1104
- size_t pack_pos;
1105
- int error, found = 0;
1106
-
1107
- if ((error = packed_reload(backend)) < 0)
1108
- goto cleanup;
1109
-
1110
- if ((error = git_sortedcache_wlock(backend->refcache)) < 0)
1111
- goto cleanup;
1112
-
1113
- /* If a packed reference exists, remove it from the packfile and repack if necessary */
1114
- error = git_sortedcache_lookup_index(&pack_pos, backend->refcache, ref_name);
1115
- if (error == 0) {
1116
- error = git_sortedcache_remove(backend->refcache, pack_pos);
1117
- found = 1;
1118
- }
1119
- if (error == GIT_ENOTFOUND)
1120
- error = 0;
1121
-
1122
- git_sortedcache_wunlock(backend->refcache);
1123
-
1124
- if (found)
1125
- error = packed_write(backend);
1126
-
1127
- cleanup:
1128
- return error;
1129
- }
1130
-
1131
1059
  static int reflog_append(refdb_fs_backend *backend, const git_reference *ref, const git_oid *old, const git_oid *new, const git_signature *author, const char *message);
1132
1060
  static int has_reflog(git_repository *repo, const char *name);
1133
1061
 
1062
+ /* We only write if it's under heads/, remotes/ or notes/ or if it already has a log */
1134
1063
  static int should_write_reflog(int *write, git_repository *repo, const char *name)
1135
1064
  {
1136
1065
  int error, logall;
1137
1066
 
1138
- error = git_repository__configmap_lookup(&logall, repo, GIT_CONFIGMAP_LOGALLREFUPDATES);
1067
+ error = git_repository__cvar(&logall, repo, GIT_CVAR_LOGALLREFUPDATES);
1139
1068
  if (error < 0)
1140
1069
  return error;
1141
1070
 
@@ -1143,26 +1072,17 @@ static int should_write_reflog(int *write, git_repository *repo, const char *nam
1143
1072
  if (logall == GIT_LOGALLREFUPDATES_UNSET)
1144
1073
  logall = !git_repository_is_bare(repo);
1145
1074
 
1146
- *write = 0;
1147
- switch (logall) {
1148
- case GIT_LOGALLREFUPDATES_FALSE:
1075
+ if (!logall) {
1149
1076
  *write = 0;
1150
- break;
1151
-
1152
- case GIT_LOGALLREFUPDATES_TRUE:
1153
- /* Only write if it already has a log,
1154
- * or if it's under heads/, remotes/ or notes/
1155
- */
1156
- *write = has_reflog(repo, name) ||
1157
- !git__prefixcmp(name, GIT_REFS_HEADS_DIR) ||
1158
- !git__strcmp(name, GIT_HEAD_FILE) ||
1159
- !git__prefixcmp(name, GIT_REFS_REMOTES_DIR) ||
1160
- !git__prefixcmp(name, GIT_REFS_NOTES_DIR);
1161
- break;
1162
-
1163
- case GIT_LOGALLREFUPDATES_ALWAYS:
1077
+ } else if (has_reflog(repo, name)) {
1164
1078
  *write = 1;
1165
- break;
1079
+ } else if (!git__prefixcmp(name, GIT_REFS_HEADS_DIR) ||
1080
+ !git__strcmp(name, GIT_HEAD_FILE) ||
1081
+ !git__prefixcmp(name, GIT_REFS_REMOTES_DIR) ||
1082
+ !git__prefixcmp(name, GIT_REFS_NOTES_DIR)) {
1083
+ *write = 1;
1084
+ } else {
1085
+ *write = 0;
1166
1086
  }
1167
1087
 
1168
1088
  return 0;
@@ -1183,19 +1103,19 @@ static int cmp_old_ref(int *cmp, git_refdb_backend *backend, const char *name,
1183
1103
  goto out;
1184
1104
 
1185
1105
  /* If the types don't match, there's no way the values do */
1186
- if (old_id && old_ref->type != GIT_REFERENCE_DIRECT) {
1106
+ if (old_id && old_ref->type != GIT_REF_OID) {
1187
1107
  *cmp = -1;
1188
1108
  goto out;
1189
1109
  }
1190
- if (old_target && old_ref->type != GIT_REFERENCE_SYMBOLIC) {
1110
+ if (old_target && old_ref->type != GIT_REF_SYMBOLIC) {
1191
1111
  *cmp = 1;
1192
1112
  goto out;
1193
1113
  }
1194
1114
 
1195
- if (old_id && old_ref->type == GIT_REFERENCE_DIRECT)
1115
+ if (old_id && old_ref->type == GIT_REF_OID)
1196
1116
  *cmp = git_oid_cmp(old_id, &old_ref->target.oid);
1197
1117
 
1198
- if (old_target && old_ref->type == GIT_REFERENCE_SYMBOLIC)
1118
+ if (old_target && old_ref->type == GIT_REF_SYMBOLIC)
1199
1119
  *cmp = git__strcmp(old_target, old_ref->target.symbolic);
1200
1120
 
1201
1121
  out:
@@ -1225,7 +1145,7 @@ static int maybe_append_head(refdb_fs_backend *backend, const git_reference *ref
1225
1145
  git_reference *tmp = NULL, *head = NULL, *peeled = NULL;
1226
1146
  const char *name;
1227
1147
 
1228
- if (ref->type == GIT_REFERENCE_SYMBOLIC)
1148
+ if (ref->type == GIT_REF_SYMBOLIC)
1229
1149
  return 0;
1230
1150
 
1231
1151
  /* if we can't resolve, we use {0}*40 as old id */
@@ -1235,14 +1155,14 @@ static int maybe_append_head(refdb_fs_backend *backend, const git_reference *ref
1235
1155
  if ((error = git_reference_lookup(&head, backend->repo, GIT_HEAD_FILE)) < 0)
1236
1156
  return error;
1237
1157
 
1238
- if (git_reference_type(head) == GIT_REFERENCE_DIRECT)
1158
+ if (git_reference_type(head) == GIT_REF_OID)
1239
1159
  goto cleanup;
1240
1160
 
1241
1161
  if ((error = git_reference_lookup(&tmp, backend->repo, GIT_HEAD_FILE)) < 0)
1242
1162
  goto cleanup;
1243
1163
 
1244
1164
  /* Go down the symref chain until we find the branch */
1245
- while (git_reference_type(tmp) == GIT_REFERENCE_SYMBOLIC) {
1165
+ while (git_reference_type(tmp) == GIT_REF_SYMBOLIC) {
1246
1166
  error = git_reference_lookup(&peeled, backend->repo, git_reference_symbolic_target(tmp));
1247
1167
  if (error < 0)
1248
1168
  break;
@@ -1280,7 +1200,7 @@ static int refdb_fs_backend__write(
1280
1200
  const git_oid *old_id,
1281
1201
  const char *old_target)
1282
1202
  {
1283
- refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
1203
+ refdb_fs_backend *backend = (refdb_fs_backend *)_backend;
1284
1204
  git_filebuf file = GIT_FILEBUF_INIT;
1285
1205
  int error = 0;
1286
1206
 
@@ -1293,7 +1213,7 @@ static int refdb_fs_backend__write(
1293
1213
  if ((error = loose_lock(&file, backend, ref->name)) < 0)
1294
1214
  return error;
1295
1215
 
1296
- return refdb_fs_backend__write_tail(_backend, ref, &file, true, old_id, old_target, who, message);
1216
+ return refdb_fs_backend__write_tail(_backend, ref, &file, true, who, message, old_id, old_target);
1297
1217
  }
1298
1218
 
1299
1219
  static int refdb_fs_backend__write_tail(
@@ -1301,12 +1221,12 @@ static int refdb_fs_backend__write_tail(
1301
1221
  const git_reference *ref,
1302
1222
  git_filebuf *file,
1303
1223
  int update_reflog,
1304
- const git_oid *old_id,
1305
- const char *old_target,
1306
1224
  const git_signature *who,
1307
- const char *message)
1225
+ const char *message,
1226
+ const git_oid *old_id,
1227
+ const char *old_target)
1308
1228
  {
1309
- refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
1229
+ refdb_fs_backend *backend = (refdb_fs_backend *)_backend;
1310
1230
  int error = 0, cmp = 0, should_write;
1311
1231
  const char *new_target = NULL;
1312
1232
  const git_oid *new_id = NULL;
@@ -1315,12 +1235,12 @@ static int refdb_fs_backend__write_tail(
1315
1235
  goto on_error;
1316
1236
 
1317
1237
  if (cmp) {
1318
- git_error_set(GIT_ERROR_REFERENCE, "old reference value does not match");
1238
+ giterr_set(GITERR_REFERENCE, "old reference value does not match");
1319
1239
  error = GIT_EMODIFIED;
1320
1240
  goto on_error;
1321
1241
  }
1322
1242
 
1323
- if (ref->type == GIT_REFERENCE_SYMBOLIC)
1243
+ if (ref->type == GIT_REF_SYMBOLIC)
1324
1244
  new_target = ref->target.symbolic;
1325
1245
  else
1326
1246
  new_id = &ref->target.oid;
@@ -1354,49 +1274,12 @@ on_error:
1354
1274
  return error;
1355
1275
  }
1356
1276
 
1357
- static void refdb_fs_backend__prune_refs(
1358
- refdb_fs_backend *backend,
1359
- const char *ref_name,
1360
- const char *prefix)
1361
- {
1362
- git_buf relative_path = GIT_BUF_INIT;
1363
- git_buf base_path = GIT_BUF_INIT;
1364
- size_t commonlen;
1365
-
1366
- assert(backend && ref_name);
1367
-
1368
- if (git_buf_sets(&relative_path, ref_name) < 0)
1369
- goto cleanup;
1370
-
1371
- git_path_squash_slashes(&relative_path);
1372
- if ((commonlen = git_path_common_dirlen("refs/heads/", git_buf_cstr(&relative_path))) == strlen("refs/heads/") ||
1373
- (commonlen = git_path_common_dirlen("refs/tags/", git_buf_cstr(&relative_path))) == strlen("refs/tags/") ||
1374
- (commonlen = git_path_common_dirlen("refs/remotes/", git_buf_cstr(&relative_path))) == strlen("refs/remotes/")) {
1375
-
1376
- git_buf_truncate(&relative_path, commonlen);
1377
-
1378
- if (prefix) {
1379
- if (git_buf_join3(&base_path, '/', backend->commonpath, prefix, git_buf_cstr(&relative_path)) < 0)
1380
- goto cleanup;
1381
- } else {
1382
- if (git_buf_joinpath(&base_path, backend->commonpath, git_buf_cstr(&relative_path)) < 0)
1383
- goto cleanup;
1384
- }
1385
-
1386
- git_futils_rmdir_r(ref_name + commonlen, git_buf_cstr(&base_path), GIT_RMDIR_EMPTY_PARENTS | GIT_RMDIR_SKIP_ROOT);
1387
- }
1388
-
1389
- cleanup:
1390
- git_buf_dispose(&relative_path);
1391
- git_buf_dispose(&base_path);
1392
- }
1393
-
1394
1277
  static int refdb_fs_backend__delete(
1395
1278
  git_refdb_backend *_backend,
1396
1279
  const char *ref_name,
1397
1280
  const git_oid *old_id, const char *old_target)
1398
1281
  {
1399
- refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
1282
+ refdb_fs_backend *backend = (refdb_fs_backend *)_backend;
1400
1283
  git_filebuf file = GIT_FILEBUF_INIT;
1401
1284
  int error = 0;
1402
1285
 
@@ -1413,80 +1296,65 @@ static int refdb_fs_backend__delete(
1413
1296
  return refdb_fs_backend__delete_tail(_backend, &file, ref_name, old_id, old_target);
1414
1297
  }
1415
1298
 
1416
- static int loose_delete(refdb_fs_backend *backend, const char *ref_name)
1417
- {
1418
- git_buf loose_path = GIT_BUF_INIT;
1419
- int error = 0;
1420
-
1421
- if (git_buf_joinpath(&loose_path, backend->commonpath, ref_name) < 0)
1422
- return -1;
1423
-
1424
- error = p_unlink(loose_path.ptr);
1425
- if (error < 0 && errno == ENOENT)
1426
- error = GIT_ENOTFOUND;
1427
- else if (error != 0)
1428
- error = -1;
1429
-
1430
- git_buf_dispose(&loose_path);
1431
-
1432
- return error;
1433
- }
1434
-
1435
1299
  static int refdb_fs_backend__delete_tail(
1436
1300
  git_refdb_backend *_backend,
1437
1301
  git_filebuf *file,
1438
1302
  const char *ref_name,
1439
1303
  const git_oid *old_id, const char *old_target)
1440
1304
  {
1441
- refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
1305
+ refdb_fs_backend *backend = (refdb_fs_backend *)_backend;
1306
+ git_buf loose_path = GIT_BUF_INIT;
1307
+ size_t pack_pos;
1442
1308
  int error = 0, cmp = 0;
1443
- bool packed_deleted = 0;
1309
+ bool loose_deleted = 0;
1444
1310
 
1445
1311
  error = cmp_old_ref(&cmp, _backend, ref_name, old_id, old_target);
1446
1312
  if (error < 0)
1447
1313
  goto cleanup;
1448
1314
 
1449
1315
  if (cmp) {
1450
- git_error_set(GIT_ERROR_REFERENCE, "old reference value does not match");
1316
+ giterr_set(GITERR_REFERENCE, "old reference value does not match");
1451
1317
  error = GIT_EMODIFIED;
1452
1318
  goto cleanup;
1453
1319
  }
1454
1320
 
1455
- /*
1456
- * To ensure that an external observer will see either the current ref value
1457
- * (because the loose ref still exists), or a missing ref (after the packed-file is
1458
- * unlocked, there will be nothing left), we must ensure things happen in the
1459
- * following order:
1460
- *
1461
- * - the packed-ref file is locked and loaded, as well as a loose one, if it exists
1462
- * - we optimistically delete a packed ref, keeping track of whether it existed
1463
- * - we delete the loose ref, note that we have its .lock
1464
- * - the loose ref is "unlocked", then the packed-ref file is rewritten and unlocked
1465
- * - we should prune the path components if a loose ref was deleted
1466
- *
1467
- * Note that, because our packed backend doesn't expose its filesystem lock,
1468
- * we might not be able to guarantee that this is what actually happens (ie.
1469
- * as our current code never write packed-refs.lock, nothing stops observers
1470
- * from grabbing a "stale" value from there).
1471
- */
1472
- if ((error = packed_delete(backend, ref_name)) < 0 && error != GIT_ENOTFOUND)
1321
+ /* If a loose reference exists, remove it from the filesystem */
1322
+ if (git_buf_joinpath(&loose_path, backend->gitpath, ref_name) < 0)
1323
+ return -1;
1324
+
1325
+
1326
+ error = p_unlink(loose_path.ptr);
1327
+ if (error < 0 && errno == ENOENT)
1328
+ error = 0;
1329
+ else if (error < 0)
1473
1330
  goto cleanup;
1331
+ else if (error == 0)
1332
+ loose_deleted = 1;
1474
1333
 
1475
- if (error == 0)
1476
- packed_deleted = 1;
1334
+ if ((error = packed_reload(backend)) < 0)
1335
+ goto cleanup;
1477
1336
 
1478
- if ((error = loose_delete(backend, ref_name)) < 0 && error != GIT_ENOTFOUND)
1337
+ /* If a packed reference exists, remove it from the packfile and repack */
1338
+ if ((error = git_sortedcache_wlock(backend->refcache)) < 0)
1479
1339
  goto cleanup;
1480
1340
 
1341
+ if (!(error = git_sortedcache_lookup_index(
1342
+ &pack_pos, backend->refcache, ref_name)))
1343
+ error = git_sortedcache_remove(backend->refcache, pack_pos);
1344
+
1345
+ git_sortedcache_wunlock(backend->refcache);
1346
+
1481
1347
  if (error == GIT_ENOTFOUND) {
1482
- error = packed_deleted ? 0 : ref_error_notfound(ref_name);
1348
+ error = loose_deleted ? 0 : ref_error_notfound(ref_name);
1483
1349
  goto cleanup;
1484
1350
  }
1485
1351
 
1352
+ error = packed_write(backend);
1353
+
1486
1354
  cleanup:
1355
+ git_buf_free(&loose_path);
1487
1356
  git_filebuf_cleanup(file);
1488
- if (error == 0)
1489
- refdb_fs_backend__prune_refs(backend, ref_name, "");
1357
+
1490
1358
  return error;
1491
1359
  }
1492
1360
 
@@ -1501,7 +1369,7 @@ static int refdb_fs_backend__rename(
1501
1369
  const git_signature *who,
1502
1370
  const char *message)
1503
1371
  {
1504
- refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
1372
+ refdb_fs_backend *backend = (refdb_fs_backend *)_backend;
1505
1373
  git_reference *old, *new;
1506
1374
  git_filebuf file = GIT_FILEBUF_INIT;
1507
1375
  int error;
@@ -1557,7 +1425,7 @@ static int refdb_fs_backend__rename(
1557
1425
  static int refdb_fs_backend__compress(git_refdb_backend *_backend)
1558
1426
  {
1559
1427
  int error;
1560
- refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
1428
+ refdb_fs_backend *backend = (refdb_fs_backend *)_backend;
1561
1429
 
1562
1430
  assert(backend);
1563
1431
 
@@ -1571,7 +1439,7 @@ static int refdb_fs_backend__compress(git_refdb_backend *_backend)
1571
1439
 
1572
1440
  static void refdb_fs_backend__free(git_refdb_backend *_backend)
1573
1441
  {
1574
- refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
1442
+ refdb_fs_backend *backend = (refdb_fs_backend *)_backend;
1575
1443
 
1576
1444
  assert(backend);
1577
1445
 
@@ -1623,7 +1491,7 @@ static char *setup_namespace(git_repository *repo, const char *in)
1623
1491
  out = git_buf_detach(&path);
1624
1492
 
1625
1493
  done:
1626
- git_buf_dispose(&path);
1494
+ git_buf_free(&path);
1627
1495
  return out;
1628
1496
  }
1629
1497
 
@@ -1634,10 +1502,10 @@ static int reflog_alloc(git_reflog **reflog, const char *name)
1634
1502
  *reflog = NULL;
1635
1503
 
1636
1504
  log = git__calloc(1, sizeof(git_reflog));
1637
- GIT_ERROR_CHECK_ALLOC(log);
1505
+ GITERR_CHECK_ALLOC(log);
1638
1506
 
1639
1507
  log->ref_name = git__strdup(name);
1640
- GIT_ERROR_CHECK_ALLOC(log->ref_name);
1508
+ GITERR_CHECK_ALLOC(log->ref_name);
1641
1509
 
1642
1510
  if (git_vector_init(&log->entries, 0, NULL) < 0) {
1643
1511
  git__free(log->ref_name);
@@ -1652,57 +1520,70 @@ static int reflog_alloc(git_reflog **reflog, const char *name)
1652
1520
 
1653
1521
  static int reflog_parse(git_reflog *log, const char *buf, size_t buf_size)
1654
1522
  {
1655
- git_parse_ctx parser = GIT_PARSE_CTX_INIT;
1523
+ const char *ptr;
1524
+ git_reflog_entry *entry;
1656
1525
 
1657
- if ((git_parse_ctx_init(&parser, buf, buf_size)) < 0)
1658
- return -1;
1526
+ #define seek_forward(_increase) do { \
1527
+ if (_increase >= buf_size) { \
1528
+ giterr_set(GITERR_INVALID, "ran out of data while parsing reflog"); \
1529
+ goto fail; \
1530
+ } \
1531
+ buf += _increase; \
1532
+ buf_size -= _increase; \
1533
+ } while (0)
1659
1534
 
1660
- for (; parser.remain_len; git_parse_advance_line(&parser)) {
1661
- git_reflog_entry *entry;
1662
- const char *sig;
1663
- char c;
1535
+ while (buf_size > GIT_REFLOG_SIZE_MIN) {
1536
+ entry = git__calloc(1, sizeof(git_reflog_entry));
1537
+ GITERR_CHECK_ALLOC(entry);
1664
1538
 
1665
- entry = git__calloc(1, sizeof(*entry));
1666
- GIT_ERROR_CHECK_ALLOC(entry);
1667
- entry->committer = git__calloc(1, sizeof(*entry->committer));
1668
- GIT_ERROR_CHECK_ALLOC(entry->committer);
1539
+ entry->committer = git__calloc(1, sizeof(git_signature));
1540
+ GITERR_CHECK_ALLOC(entry->committer);
1669
1541
 
1670
- if (git_parse_advance_oid(&entry->oid_old, &parser) < 0 ||
1671
- git_parse_advance_expected(&parser, " ", 1) < 0 ||
1672
- git_parse_advance_oid(&entry->oid_cur, &parser) < 0)
1673
- goto next;
1542
+ if (git_oid_fromstrn(&entry->oid_old, buf, GIT_OID_HEXSZ) < 0)
1543
+ goto fail;
1544
+ seek_forward(GIT_OID_HEXSZ + 1);
1674
1545
 
1675
- sig = parser.line;
1676
- while (git_parse_peek(&c, &parser, 0) == 0 && c != '\t' && c != '\n')
1677
- git_parse_advance_chars(&parser, 1);
1546
+ if (git_oid_fromstrn(&entry->oid_cur, buf, GIT_OID_HEXSZ) < 0)
1547
+ goto fail;
1548
+ seek_forward(GIT_OID_HEXSZ + 1);
1678
1549
 
1679
- if (git_signature__parse(entry->committer, &sig, parser.line, NULL, 0) < 0)
1680
- goto next;
1550
+ ptr = buf;
1681
1551
 
1682
- if (c == '\t') {
1683
- size_t len;
1684
- git_parse_advance_chars(&parser, 1);
1552
+ /* Seek forward to the end of the signature. */
1553
+ while (*buf && *buf != '\t' && *buf != '\n')
1554
+ seek_forward(1);
1685
1555
 
1686
- len = parser.line_len;
1687
- if (parser.line[len - 1] == '\n')
1688
- len--;
1556
+ if (git_signature__parse(entry->committer, &ptr, buf + 1, NULL, *buf) < 0)
1557
+ goto fail;
1689
1558
 
1690
- entry->msg = git__strndup(parser.line, len);
1691
- GIT_ERROR_CHECK_ALLOC(entry->msg);
1692
- }
1559
+ if (*buf == '\t') {
1560
+ /* We got a message. Read everything till we reach LF. */
1561
+ seek_forward(1);
1562
+ ptr = buf;
1693
1563
 
1694
- if ((git_vector_insert(&log->entries, entry)) < 0) {
1695
- git_reflog_entry__free(entry);
1696
- return -1;
1697
- }
1564
+ while (*buf && *buf != '\n')
1565
+ seek_forward(1);
1698
1566
 
1699
- continue;
1567
+ entry->msg = git__strndup(ptr, buf - ptr);
1568
+ GITERR_CHECK_ALLOC(entry->msg);
1569
+ } else
1570
+ entry->msg = NULL;
1700
1571
 
1701
- next:
1702
- git_reflog_entry__free(entry);
1572
+ while (*buf && *buf == '\n' && buf_size > 1)
1573
+ seek_forward(1);
1574
+
1575
+ if (git_vector_insert(&log->entries, entry) < 0)
1576
+ goto fail;
1703
1577
  }
1704
1578
 
1705
1579
  return 0;
1580
+
1581
+ #undef seek_forward
1582
+
1583
+ fail:
1584
+ git_reflog_entry__free(entry);
1585
+
1586
+ return -1;
1706
1587
  }
1707
1588
 
1708
1589
  static int create_new_reflog_file(const char *filepath)
@@ -1736,14 +1617,14 @@ static int refdb_reflog_fs__ensure_log(git_refdb_backend *_backend, const char *
1736
1617
 
1737
1618
  assert(_backend && name);
1738
1619
 
1739
- backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
1620
+ backend = (refdb_fs_backend *) _backend;
1740
1621
  repo = backend->repo;
1741
1622
 
1742
1623
  if ((error = retrieve_reflog_path(&path, repo, name)) < 0)
1743
1624
  return error;
1744
1625
 
1745
1626
  error = create_new_reflog_file(git_buf_cstr(&path));
1746
- git_buf_dispose(&path);
1627
+ git_buf_free(&path);
1747
1628
 
1748
1629
  return error;
1749
1630
  }
@@ -1759,7 +1640,7 @@ static int has_reflog(git_repository *repo, const char *name)
1759
1640
  ret = git_path_isfile(git_buf_cstr(&path));
1760
1641
 
1761
1642
  cleanup:
1762
- git_buf_dispose(&path);
1643
+ git_buf_free(&path);
1763
1644
  return ret;
1764
1645
  }
1765
1646
 
@@ -1769,7 +1650,7 @@ static int refdb_reflog_fs__has_log(git_refdb_backend *_backend, const char *nam
1769
1650
 
1770
1651
  assert(_backend && name);
1771
1652
 
1772
- backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
1653
+ backend = (refdb_fs_backend *) _backend;
1773
1654
 
1774
1655
  return has_reflog(backend->repo, name);
1775
1656
  }
@@ -1785,7 +1666,7 @@ static int refdb_reflog_fs__read(git_reflog **out, git_refdb_backend *_backend,
1785
1666
 
1786
1667
  assert(out && _backend && name);
1787
1668
 
1788
- backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
1669
+ backend = (refdb_fs_backend *) _backend;
1789
1670
  repo = backend->repo;
1790
1671
 
1791
1672
  if (reflog_alloc(&log, name) < 0)
@@ -1801,7 +1682,7 @@ static int refdb_reflog_fs__read(git_reflog **out, git_refdb_backend *_backend,
1801
1682
  if ((error == GIT_ENOTFOUND) &&
1802
1683
  ((error = create_new_reflog_file(git_buf_cstr(&log_path))) < 0))
1803
1684
  goto cleanup;
1804
-
1685
+
1805
1686
  if ((error = reflog_parse(log,
1806
1687
  git_buf_cstr(&log_file), git_buf_len(&log_file))) < 0)
1807
1688
  goto cleanup;
@@ -1813,8 +1694,8 @@ cleanup:
1813
1694
  git_reflog_free(log);
1814
1695
 
1815
1696
  success:
1816
- git_buf_dispose(&log_file);
1817
- git_buf_dispose(&log_path);
1697
+ git_buf_free(&log_file);
1698
+ git_buf_free(&log_path);
1818
1699
 
1819
1700
  return error;
1820
1701
  }
@@ -1844,15 +1725,8 @@ static int serialize_reflog_entry(
1844
1725
  git_buf_rtrim(buf);
1845
1726
 
1846
1727
  if (msg) {
1847
- size_t i;
1848
-
1849
1728
  git_buf_putc(buf, '\t');
1850
1729
  git_buf_puts(buf, msg);
1851
-
1852
- for (i = 0; i < buf->size - 2; i++)
1853
- if (buf->ptr[i] == '\n')
1854
- buf->ptr[i] = ' ';
1855
- git_buf_rtrim(buf);
1856
1730
  }
1857
1731
 
1858
1732
  git_buf_putc(buf, '\n');
@@ -1869,7 +1743,7 @@ static int lock_reflog(git_filebuf *file, refdb_fs_backend *backend, const char
1869
1743
  repo = backend->repo;
1870
1744
 
1871
1745
  if (!git_path_isvalid(backend->repo, refname, 0, GIT_PATH_REJECT_FILESYSTEM_DEFAULTS)) {
1872
- git_error_set(GIT_ERROR_INVALID, "invalid reference name '%s'", refname);
1746
+ giterr_set(GITERR_INVALID, "invalid reference name '%s'", refname);
1873
1747
  return GIT_EINVALIDSPEC;
1874
1748
  }
1875
1749
 
@@ -1877,7 +1751,7 @@ static int lock_reflog(git_filebuf *file, refdb_fs_backend *backend, const char
1877
1751
  return -1;
1878
1752
 
1879
1753
  if (!git_path_isfile(git_buf_cstr(&log_path))) {
1880
- git_error_set(GIT_ERROR_INVALID,
1754
+ giterr_set(GITERR_INVALID,
1881
1755
  "log file for reference '%s' doesn't exist", refname);
1882
1756
  error = -1;
1883
1757
  goto cleanup;
@@ -1886,7 +1760,7 @@ static int lock_reflog(git_filebuf *file, refdb_fs_backend *backend, const char
1886
1760
  error = git_filebuf_open(file, git_buf_cstr(&log_path), 0, GIT_REFLOG_FILE_MODE);
1887
1761
 
1888
1762
  cleanup:
1889
- git_buf_dispose(&log_path);
1763
+ git_buf_free(&log_path);
1890
1764
 
1891
1765
  return error;
1892
1766
  }
@@ -1902,7 +1776,7 @@ static int refdb_reflog_fs__write(git_refdb_backend *_backend, git_reflog *reflo
1902
1776
 
1903
1777
  assert(_backend && reflog);
1904
1778
 
1905
- backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
1779
+ backend = (refdb_fs_backend *) _backend;
1906
1780
 
1907
1781
  if ((error = lock_reflog(&fbuf, backend, reflog->ref_name)) < 0)
1908
1782
  return -1;
@@ -1922,7 +1796,7 @@ cleanup:
1922
1796
  git_filebuf_cleanup(&fbuf);
1923
1797
 
1924
1798
  success:
1925
- git_buf_dispose(&log);
1799
+ git_buf_free(&log);
1926
1800
 
1927
1801
  return error;
1928
1802
  }
@@ -1935,7 +1809,7 @@ static int reflog_append(refdb_fs_backend *backend, const git_reference *ref, co
1935
1809
  git_buf buf = GIT_BUF_INIT, path = GIT_BUF_INIT;
1936
1810
  git_repository *repo = backend->repo;
1937
1811
 
1938
- is_symbolic = ref->type == GIT_REFERENCE_SYMBOLIC;
1812
+ is_symbolic = ref->type == GIT_REF_SYMBOLIC;
1939
1813
 
1940
1814
  /* "normal" symbolic updates do not write */
1941
1815
  if (is_symbolic &&
@@ -1943,7 +1817,7 @@ static int reflog_append(refdb_fs_backend *backend, const git_reference *ref, co
1943
1817
  !(old && new))
1944
1818
  return 0;
1945
1819
 
1946
- /* From here on is_symbolic also means that it's HEAD */
1820
+ /* From here on is_symoblic also means that it's HEAD */
1947
1821
 
1948
1822
  if (old) {
1949
1823
  git_oid_cpy(&old_id, old);
@@ -1966,7 +1840,7 @@ static int reflog_append(refdb_fs_backend *backend, const git_reference *ref, co
1966
1840
  if (error == GIT_ENOTFOUND)
1967
1841
  return 0;
1968
1842
 
1969
- git_error_clear();
1843
+ giterr_clear();
1970
1844
  }
1971
1845
  }
1972
1846
 
@@ -1989,7 +1863,7 @@ static int reflog_append(refdb_fs_backend *backend, const git_reference *ref, co
1989
1863
  if (error == GIT_ENOTFOUND)
1990
1864
  error = 0;
1991
1865
  } else if (git_path_isdir(git_buf_cstr(&path))) {
1992
- git_error_set(GIT_ERROR_REFERENCE, "cannot create reflog at '%s', there are reflogs beneath that folder",
1866
+ giterr_set(GITERR_REFERENCE, "cannot create reflog at '%s', there are reflogs beneath that folder",
1993
1867
  ref->name);
1994
1868
  error = GIT_EDIRECTORY;
1995
1869
  }
@@ -2006,8 +1880,8 @@ static int reflog_append(refdb_fs_backend *backend, const git_reference *ref, co
2006
1880
  error = git_futils_writebuffer(&buf, git_buf_cstr(&path), open_flags, GIT_REFLOG_FILE_MODE);
2007
1881
 
2008
1882
  cleanup:
2009
- git_buf_dispose(&buf);
2010
- git_buf_dispose(&path);
1883
+ git_buf_free(&buf);
1884
+ git_buf_free(&path);
2011
1885
 
2012
1886
  return error;
2013
1887
  }
@@ -2024,11 +1898,11 @@ static int refdb_reflog_fs__rename(git_refdb_backend *_backend, const char *old_
2024
1898
 
2025
1899
  assert(_backend && old_name && new_name);
2026
1900
 
2027
- backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
1901
+ backend = (refdb_fs_backend *) _backend;
2028
1902
  repo = backend->repo;
2029
1903
 
2030
1904
  if ((error = git_reference__normalize_name(
2031
- &normalized, new_name, GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL)) < 0)
1905
+ &normalized, new_name, GIT_REF_FORMAT_ALLOW_ONELEVEL)) < 0)
2032
1906
  return error;
2033
1907
 
2034
1908
  if (git_buf_joinpath(&temp_path, repo->gitdir, GIT_REFLOG_DIR) < 0)
@@ -2063,12 +1937,12 @@ static int refdb_reflog_fs__rename(git_refdb_backend *_backend, const char *old_
2063
1937
  p_close(fd);
2064
1938
 
2065
1939
  if (p_rename(git_buf_cstr(&old_path), git_buf_cstr(&temp_path)) < 0) {
2066
- git_error_set(GIT_ERROR_OS, "failed to rename reflog for %s", new_name);
1940
+ giterr_set(GITERR_OS, "failed to rename reflog for %s", new_name);
2067
1941
  error = -1;
2068
1942
  goto cleanup;
2069
1943
  }
2070
1944
 
2071
- if (git_path_isdir(git_buf_cstr(&new_path)) &&
1945
+ if (git_path_isdir(git_buf_cstr(&new_path)) &&
2072
1946
  (git_futils_rmdir_r(git_buf_cstr(&new_path), NULL, GIT_RMDIR_SKIP_NONEMPTY) < 0)) {
2073
1947
  error = -1;
2074
1948
  goto cleanup;
@@ -2080,42 +1954,41 @@ static int refdb_reflog_fs__rename(git_refdb_backend *_backend, const char *old_
2080
1954
  }
2081
1955
 
2082
1956
  if (p_rename(git_buf_cstr(&temp_path), git_buf_cstr(&new_path)) < 0) {
2083
- git_error_set(GIT_ERROR_OS, "failed to rename reflog for %s", new_name);
1957
+ giterr_set(GITERR_OS, "failed to rename reflog for %s", new_name);
2084
1958
  error = -1;
2085
1959
  }
2086
1960
 
2087
1961
  cleanup:
2088
- git_buf_dispose(&temp_path);
2089
- git_buf_dispose(&old_path);
2090
- git_buf_dispose(&new_path);
2091
- git_buf_dispose(&normalized);
1962
+ git_buf_free(&temp_path);
1963
+ git_buf_free(&old_path);
1964
+ git_buf_free(&new_path);
1965
+ git_buf_free(&normalized);
2092
1966
 
2093
1967
  return error;
2094
1968
  }
2095
1969
 
2096
1970
  static int refdb_reflog_fs__delete(git_refdb_backend *_backend, const char *name)
2097
1971
  {
2098
- refdb_fs_backend *backend = GIT_CONTAINER_OF(_backend, refdb_fs_backend, parent);
2099
- git_buf path = GIT_BUF_INIT;
2100
1972
  int error;
1973
+ git_buf path = GIT_BUF_INIT;
2101
1974
 
2102
- assert(_backend && name);
1975
+ git_repository *repo;
1976
+ refdb_fs_backend *backend;
2103
1977
 
2104
- if ((error = retrieve_reflog_path(&path, backend->repo, name)) < 0)
2105
- goto out;
1978
+ assert(_backend && name);
2106
1979
 
2107
- if (!git_path_exists(path.ptr))
2108
- goto out;
1980
+ backend = (refdb_fs_backend *) _backend;
1981
+ repo = backend->repo;
2109
1982
 
2110
- if ((error = p_unlink(path.ptr)) < 0)
2111
- goto out;
1983
+ error = retrieve_reflog_path(&path, repo, name);
2112
1984
 
2113
- refdb_fs_backend__prune_refs(backend, name, GIT_REFLOG_DIR);
1985
+ if (!error && git_path_exists(path.ptr))
1986
+ error = p_unlink(path.ptr);
2114
1987
 
2115
- out:
2116
- git_buf_dispose(&path);
1988
+ git_buf_free(&path);
2117
1989
 
2118
1990
  return error;
1991
+
2119
1992
  }
2120
1993
 
2121
1994
  int git_refdb_backend_fs(
@@ -2127,7 +2000,7 @@ int git_refdb_backend_fs(
2127
2000
  refdb_fs_backend *backend;
2128
2001
 
2129
2002
  backend = git__calloc(1, sizeof(refdb_fs_backend));
2130
- GIT_ERROR_CHECK_ALLOC(backend);
2003
+ GITERR_CHECK_ALLOC(backend);
2131
2004
 
2132
2005
  backend->repo = repository;
2133
2006
 
@@ -2151,17 +2024,17 @@ int git_refdb_backend_fs(
2151
2024
  NULL, NULL, packref_cmp, git_buf_cstr(&gitpath)) < 0)
2152
2025
  goto fail;
2153
2026
 
2154
- git_buf_dispose(&gitpath);
2027
+ git_buf_free(&gitpath);
2155
2028
 
2156
- if (!git_repository__configmap_lookup(&t, backend->repo, GIT_CONFIGMAP_IGNORECASE) && t) {
2029
+ if (!git_repository__cvar(&t, backend->repo, GIT_CVAR_IGNORECASE) && t) {
2157
2030
  backend->iterator_flags |= GIT_ITERATOR_IGNORE_CASE;
2158
2031
  backend->direach_flags |= GIT_PATH_DIR_IGNORE_CASE;
2159
2032
  }
2160
- if (!git_repository__configmap_lookup(&t, backend->repo, GIT_CONFIGMAP_PRECOMPOSE) && t) {
2033
+ if (!git_repository__cvar(&t, backend->repo, GIT_CVAR_PRECOMPOSE) && t) {
2161
2034
  backend->iterator_flags |= GIT_ITERATOR_PRECOMPOSE_UNICODE;
2162
2035
  backend->direach_flags |= GIT_PATH_DIR_PRECOMPOSE_UNICODE;
2163
2036
  }
2164
- if ((!git_repository__configmap_lookup(&t, backend->repo, GIT_CONFIGMAP_FSYNCOBJECTFILES) && t) ||
2037
+ if ((!git_repository__cvar(&t, backend->repo, GIT_CVAR_FSYNCOBJECTFILES) && t) ||
2165
2038
  git_repository__fsync_gitdir)
2166
2039
  backend->fsync = 1;
2167
2040
  backend->iterator_flags |= GIT_ITERATOR_DESCEND_SYMLINKS;
@@ -2187,7 +2060,7 @@ int git_refdb_backend_fs(
2187
2060
  return 0;
2188
2061
 
2189
2062
  fail:
2190
- git_buf_dispose(&gitpath);
2063
+ git_buf_free(&gitpath);
2191
2064
  git__free(backend->gitpath);
2192
2065
  git__free(backend->commonpath);
2193
2066
  git__free(backend);