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
@@ -20,6 +20,7 @@
20
20
  #include "idxmap.h"
21
21
  #include "diff.h"
22
22
  #include "varint.h"
23
+ #include "path.h"
23
24
 
24
25
  #include "git2/odb.h"
25
26
  #include "git2/oid.h"
@@ -33,7 +34,6 @@ static int index_apply_to_wd_diff(git_index *index, int action, const git_strarr
33
34
 
34
35
  #define minimal_entry_size (offsetof(struct entry_short, path))
35
36
 
36
- static const size_t INDEX_FOOTER_SIZE = GIT_OID_RAWSZ;
37
37
  static const size_t INDEX_HEADER_SIZE = 12;
38
38
 
39
39
  static const unsigned int INDEX_VERSION_NUMBER_DEFAULT = 2;
@@ -120,7 +120,7 @@ static int read_header(struct index_header *dest, const void *buffer);
120
120
 
121
121
  static int parse_index(git_index *index, const char *buffer, size_t buffer_size);
122
122
  static bool is_index_extended(git_index *index);
123
- static int write_index(git_oid *checksum, git_index *index, git_filebuf *file);
123
+ static int write_index(unsigned char checksum[GIT_HASH_SHA1_SIZE], size_t *checksum_size, git_index *index, git_filebuf *file);
124
124
 
125
125
  static void index_entry_free(git_index_entry *entry);
126
126
  static void index_entry_reuc_free(git_index_reuc_entry *reuc);
@@ -420,7 +420,7 @@ int git_index_open(git_index **index_out, const char *index_path)
420
420
  goto fail;
421
421
 
422
422
  /* Check if index file is stored on disk already */
423
- if (git_path_exists(index->index_file_path) == true)
423
+ if (git_fs_path_exists(index->index_file_path) == true)
424
424
  index->on_disk = 1;
425
425
  }
426
426
 
@@ -606,10 +606,12 @@ int git_index_caps(const git_index *index)
606
606
  (index->no_symlinks ? GIT_INDEX_CAPABILITY_NO_SYMLINKS : 0));
607
607
  }
608
608
 
609
+ #ifndef GIT_DEPRECATE_HARD
609
610
  const git_oid *git_index_checksum(git_index *index)
610
611
  {
611
- return &index->checksum;
612
+ return (git_oid *)index->checksum;
612
613
  }
614
+ #endif
613
615
 
614
616
  /**
615
617
  * Returns 1 for changed, 0 for not changed and <0 for errors
@@ -618,37 +620,38 @@ static int compare_checksum(git_index *index)
618
620
  {
619
621
  int fd;
620
622
  ssize_t bytes_read;
621
- git_oid checksum = {{ 0 }};
623
+ unsigned char checksum[GIT_HASH_SHA1_SIZE];
624
+ size_t checksum_size = GIT_HASH_SHA1_SIZE;
622
625
 
623
626
  if ((fd = p_open(index->index_file_path, O_RDONLY)) < 0)
624
627
  return fd;
625
628
 
626
- if (p_lseek(fd, -20, SEEK_END) < 0) {
629
+ if (p_lseek(fd, (0 - (ssize_t)checksum_size), SEEK_END) < 0) {
627
630
  p_close(fd);
628
631
  git_error_set(GIT_ERROR_OS, "failed to seek to end of file");
629
632
  return -1;
630
633
  }
631
634
 
632
- bytes_read = p_read(fd, &checksum, GIT_OID_RAWSZ);
635
+ bytes_read = p_read(fd, checksum, checksum_size);
633
636
  p_close(fd);
634
637
 
635
- if (bytes_read < 0)
638
+ if (bytes_read < (ssize_t)checksum_size)
636
639
  return -1;
637
640
 
638
- return !!git_oid_cmp(&checksum, &index->checksum);
641
+ return !!memcmp(checksum, index->checksum, checksum_size);
639
642
  }
640
643
 
641
644
  int git_index_read(git_index *index, int force)
642
645
  {
643
646
  int error = 0, updated;
644
- git_buf buffer = GIT_BUF_INIT;
647
+ git_str buffer = GIT_STR_INIT;
645
648
  git_futils_filestamp stamp = index->stamp;
646
649
 
647
650
  if (!index->index_file_path)
648
651
  return create_index_error(-1,
649
652
  "failed to read index: The index is in-memory only");
650
653
 
651
- index->on_disk = git_path_exists(index->index_file_path);
654
+ index->on_disk = git_fs_path_exists(index->index_file_path);
652
655
 
653
656
  if (!index->on_disk) {
654
657
  if (force && (error = git_index_clear(index)) < 0)
@@ -687,7 +690,7 @@ int git_index_read(git_index *index, int force)
687
690
  index->dirty = 0;
688
691
  }
689
692
 
690
- git_buf_dispose(&buffer);
693
+ git_str_dispose(&buffer);
691
694
  return error;
692
695
  }
693
696
 
@@ -702,16 +705,6 @@ int git_index_read_safely(git_index *index)
702
705
  return git_index_read(index, false);
703
706
  }
704
707
 
705
- int git_index__changed_relative_to(
706
- git_index *index, const git_oid *checksum)
707
- {
708
- /* attempt to update index (ignoring errors) */
709
- if (git_index_read(index, false) < 0)
710
- git_error_clear();
711
-
712
- return !!git_oid_cmp(&index->checksum, checksum);
713
- }
714
-
715
708
  static bool is_racy_entry(git_index *index, const git_index_entry *entry)
716
709
  {
717
710
  /* Git special-cases submodules in the check */
@@ -944,7 +937,7 @@ static int index_entry_create(
944
937
  if (st)
945
938
  mode = st->st_mode;
946
939
 
947
- if (!git_path_validate(repo, path, mode, path_valid_flags)) {
940
+ if (!git_path_is_valid(repo, path, mode, path_valid_flags)) {
948
941
  git_error_set(GIT_ERROR_INDEX, "invalid path: '%s'", path);
949
942
  return -1;
950
943
  }
@@ -969,7 +962,7 @@ static int index_entry_init(
969
962
  {
970
963
  int error = 0;
971
964
  git_index_entry *entry = NULL;
972
- git_buf path = GIT_BUF_INIT;
965
+ git_str path = GIT_STR_INIT;
973
966
  struct stat st;
974
967
  git_oid oid;
975
968
  git_repository *repo;
@@ -991,8 +984,8 @@ static int index_entry_init(
991
984
  if (git_repository_workdir_path(&path, repo, rel_path) < 0)
992
985
  return -1;
993
986
 
994
- error = git_path_lstat(path.ptr, &st);
995
- git_buf_dispose(&path);
987
+ error = git_fs_path_lstat(path.ptr, &st);
988
+ git_str_dispose(&path);
996
989
 
997
990
  if (error < 0)
998
991
  return error;
@@ -1525,7 +1518,7 @@ int git_index_add_from_buffer(
1525
1518
  static int add_repo_as_submodule(git_index_entry **out, git_index *index, const char *path)
1526
1519
  {
1527
1520
  git_repository *sub;
1528
- git_buf abspath = GIT_BUF_INIT;
1521
+ git_str abspath = GIT_STR_INIT;
1529
1522
  git_repository *repo = INDEX_OWNER(index);
1530
1523
  git_reference *head;
1531
1524
  git_index_entry *entry;
@@ -1556,7 +1549,7 @@ static int add_repo_as_submodule(git_index_entry **out, git_index *index, const
1556
1549
 
1557
1550
  git_reference_free(head);
1558
1551
  git_repository_free(sub);
1559
- git_buf_dispose(&abspath);
1552
+ git_str_dispose(&abspath);
1560
1553
 
1561
1554
  *out = entry;
1562
1555
  return 0;
@@ -1722,13 +1715,13 @@ int git_index_remove(git_index *index, const char *path, int stage)
1722
1715
 
1723
1716
  int git_index_remove_directory(git_index *index, const char *dir, int stage)
1724
1717
  {
1725
- git_buf pfx = GIT_BUF_INIT;
1718
+ git_str pfx = GIT_STR_INIT;
1726
1719
  int error = 0;
1727
1720
  size_t pos;
1728
1721
  git_index_entry *entry;
1729
1722
 
1730
- if (!(error = git_buf_sets(&pfx, dir)) &&
1731
- !(error = git_path_to_dir(&pfx)))
1723
+ if (!(error = git_str_sets(&pfx, dir)) &&
1724
+ !(error = git_fs_path_to_dir(&pfx)))
1732
1725
  index_find(&pos, index, pfx.ptr, pfx.size, GIT_INDEX_STAGE_ANY);
1733
1726
 
1734
1727
  while (!error) {
@@ -1746,7 +1739,7 @@ int git_index_remove_directory(git_index *index, const char *dir, int stage)
1746
1739
  /* removed entry at 'pos' so we don't need to increment */
1747
1740
  }
1748
1741
 
1749
- git_buf_dispose(&pfx);
1742
+ git_str_dispose(&pfx);
1750
1743
 
1751
1744
  return error;
1752
1745
  }
@@ -2469,8 +2462,9 @@ static int read_entry(
2469
2462
  git_index_entry entry = {{0}};
2470
2463
  bool compressed = index->version >= INDEX_VERSION_NUMBER_COMP;
2471
2464
  char *tmp_path = NULL;
2465
+ size_t checksum_size = GIT_HASH_SHA1_SIZE;
2472
2466
 
2473
- if (INDEX_FOOTER_SIZE + minimal_entry_size > buffer_size)
2467
+ if (checksum_size + minimal_entry_size > buffer_size)
2474
2468
  return -1;
2475
2469
 
2476
2470
  /* buffer is not guaranteed to be aligned */
@@ -2551,7 +2545,7 @@ static int read_entry(
2551
2545
  if (entry_size == 0)
2552
2546
  return -1;
2553
2547
 
2554
- if (INDEX_FOOTER_SIZE + entry_size > buffer_size)
2548
+ if (checksum_size + entry_size > buffer_size)
2555
2549
  return -1;
2556
2550
 
2557
2551
  if (index_entry_dup(out, index, &entry) < 0) {
@@ -2585,6 +2579,7 @@ static int read_extension(size_t *read_len, git_index *index, const char *buffer
2585
2579
  {
2586
2580
  struct index_extension dest;
2587
2581
  size_t total_size;
2582
+ size_t checksum_size = GIT_HASH_SHA1_SIZE;
2588
2583
 
2589
2584
  /* buffer is not guaranteed to be aligned */
2590
2585
  memcpy(&dest, buffer, sizeof(struct index_extension));
@@ -2594,7 +2589,7 @@ static int read_extension(size_t *read_len, git_index *index, const char *buffer
2594
2589
 
2595
2590
  if (dest.extension_size > total_size ||
2596
2591
  buffer_size < total_size ||
2597
- buffer_size - total_size < INDEX_FOOTER_SIZE) {
2592
+ buffer_size - total_size < checksum_size) {
2598
2593
  index_error_invalid("extension is truncated");
2599
2594
  return -1;
2600
2595
  }
@@ -2631,7 +2626,8 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
2631
2626
  int error = 0;
2632
2627
  unsigned int i;
2633
2628
  struct index_header header = { 0 };
2634
- git_oid checksum_calculated, checksum_expected;
2629
+ unsigned char checksum[GIT_HASH_SHA1_SIZE];
2630
+ size_t checksum_size = GIT_HASH_SHA1_SIZE;
2635
2631
  const char *last = NULL;
2636
2632
  const char *empty = "";
2637
2633
 
@@ -2643,12 +2639,12 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
2643
2639
  buffer_size -= _increase;\
2644
2640
  }
2645
2641
 
2646
- if (buffer_size < INDEX_HEADER_SIZE + INDEX_FOOTER_SIZE)
2642
+ if (buffer_size < INDEX_HEADER_SIZE + checksum_size)
2647
2643
  return index_error_invalid("insufficient buffer space");
2648
2644
 
2649
2645
  /* Precalculate the SHA1 of the files's contents -- we'll match it to
2650
2646
  * the provided SHA1 in the footer */
2651
- git_hash_buf(&checksum_calculated, buffer, buffer_size - INDEX_FOOTER_SIZE);
2647
+ git_hash_buf(checksum, buffer, buffer_size - checksum_size, GIT_HASH_ALGORITHM_SHA1);
2652
2648
 
2653
2649
  /* Parse header */
2654
2650
  if ((error = read_header(&header, buffer)) < 0)
@@ -2666,7 +2662,7 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
2666
2662
  return error;
2667
2663
 
2668
2664
  /* Parse all the entries */
2669
- for (i = 0; i < header.entry_count && buffer_size > INDEX_FOOTER_SIZE; ++i) {
2665
+ for (i = 0; i < header.entry_count && buffer_size > checksum_size; ++i) {
2670
2666
  git_index_entry *entry = NULL;
2671
2667
  size_t entry_size;
2672
2668
 
@@ -2698,7 +2694,7 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
2698
2694
  }
2699
2695
 
2700
2696
  /* There's still space for some extensions! */
2701
- while (buffer_size > INDEX_FOOTER_SIZE) {
2697
+ while (buffer_size > checksum_size) {
2702
2698
  size_t extension_size;
2703
2699
 
2704
2700
  if ((error = read_extension(&extension_size, index, buffer, buffer_size)) < 0) {
@@ -2708,22 +2704,20 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
2708
2704
  seek_forward(extension_size);
2709
2705
  }
2710
2706
 
2711
- if (buffer_size != INDEX_FOOTER_SIZE) {
2707
+ if (buffer_size != checksum_size) {
2712
2708
  error = index_error_invalid(
2713
2709
  "buffer size does not match index footer size");
2714
2710
  goto done;
2715
2711
  }
2716
2712
 
2717
2713
  /* 160-bit SHA-1 over the content of the index file before this checksum. */
2718
- git_oid_fromraw(&checksum_expected, (const unsigned char *)buffer);
2719
-
2720
- if (git_oid__cmp(&checksum_calculated, &checksum_expected) != 0) {
2714
+ if (memcmp(checksum, buffer, checksum_size) != 0) {
2721
2715
  error = index_error_invalid(
2722
2716
  "calculated checksum does not match expected");
2723
2717
  goto done;
2724
2718
  }
2725
2719
 
2726
- git_oid_cpy(&index->checksum, &checksum_calculated);
2720
+ memcpy(index->checksum, checksum, checksum_size);
2727
2721
 
2728
2722
  #undef seek_forward
2729
2723
 
@@ -2892,7 +2886,7 @@ done:
2892
2886
  return error;
2893
2887
  }
2894
2888
 
2895
- static int write_extension(git_filebuf *file, struct index_extension *header, git_buf *data)
2889
+ static int write_extension(git_filebuf *file, struct index_extension *header, git_str *data)
2896
2890
  {
2897
2891
  struct index_extension ondisk;
2898
2892
 
@@ -2904,30 +2898,30 @@ static int write_extension(git_filebuf *file, struct index_extension *header, gi
2904
2898
  return git_filebuf_write(file, data->ptr, data->size);
2905
2899
  }
2906
2900
 
2907
- static int create_name_extension_data(git_buf *name_buf, git_index_name_entry *conflict_name)
2901
+ static int create_name_extension_data(git_str *name_buf, git_index_name_entry *conflict_name)
2908
2902
  {
2909
2903
  int error = 0;
2910
2904
 
2911
2905
  if (conflict_name->ancestor == NULL)
2912
- error = git_buf_put(name_buf, "\0", 1);
2906
+ error = git_str_put(name_buf, "\0", 1);
2913
2907
  else
2914
- error = git_buf_put(name_buf, conflict_name->ancestor, strlen(conflict_name->ancestor) + 1);
2908
+ error = git_str_put(name_buf, conflict_name->ancestor, strlen(conflict_name->ancestor) + 1);
2915
2909
 
2916
2910
  if (error != 0)
2917
2911
  goto on_error;
2918
2912
 
2919
2913
  if (conflict_name->ours == NULL)
2920
- error = git_buf_put(name_buf, "\0", 1);
2914
+ error = git_str_put(name_buf, "\0", 1);
2921
2915
  else
2922
- error = git_buf_put(name_buf, conflict_name->ours, strlen(conflict_name->ours) + 1);
2916
+ error = git_str_put(name_buf, conflict_name->ours, strlen(conflict_name->ours) + 1);
2923
2917
 
2924
2918
  if (error != 0)
2925
2919
  goto on_error;
2926
2920
 
2927
2921
  if (conflict_name->theirs == NULL)
2928
- error = git_buf_put(name_buf, "\0", 1);
2922
+ error = git_str_put(name_buf, "\0", 1);
2929
2923
  else
2930
- error = git_buf_put(name_buf, conflict_name->theirs, strlen(conflict_name->theirs) + 1);
2924
+ error = git_str_put(name_buf, conflict_name->theirs, strlen(conflict_name->theirs) + 1);
2931
2925
 
2932
2926
  on_error:
2933
2927
  return error;
@@ -2935,7 +2929,7 @@ on_error:
2935
2929
 
2936
2930
  static int write_name_extension(git_index *index, git_filebuf *file)
2937
2931
  {
2938
- git_buf name_buf = GIT_BUF_INIT;
2932
+ git_str name_buf = GIT_STR_INIT;
2939
2933
  git_vector *out = &index->names;
2940
2934
  git_index_name_entry *conflict_name;
2941
2935
  struct index_extension extension;
@@ -2953,28 +2947,28 @@ static int write_name_extension(git_index *index, git_filebuf *file)
2953
2947
 
2954
2948
  error = write_extension(file, &extension, &name_buf);
2955
2949
 
2956
- git_buf_dispose(&name_buf);
2950
+ git_str_dispose(&name_buf);
2957
2951
 
2958
2952
  done:
2959
2953
  return error;
2960
2954
  }
2961
2955
 
2962
- static int create_reuc_extension_data(git_buf *reuc_buf, git_index_reuc_entry *reuc)
2956
+ static int create_reuc_extension_data(git_str *reuc_buf, git_index_reuc_entry *reuc)
2963
2957
  {
2964
2958
  int i;
2965
2959
  int error = 0;
2966
2960
 
2967
- if ((error = git_buf_put(reuc_buf, reuc->path, strlen(reuc->path) + 1)) < 0)
2961
+ if ((error = git_str_put(reuc_buf, reuc->path, strlen(reuc->path) + 1)) < 0)
2968
2962
  return error;
2969
2963
 
2970
2964
  for (i = 0; i < 3; i++) {
2971
- if ((error = git_buf_printf(reuc_buf, "%o", reuc->mode[i])) < 0 ||
2972
- (error = git_buf_put(reuc_buf, "\0", 1)) < 0)
2965
+ if ((error = git_str_printf(reuc_buf, "%o", reuc->mode[i])) < 0 ||
2966
+ (error = git_str_put(reuc_buf, "\0", 1)) < 0)
2973
2967
  return error;
2974
2968
  }
2975
2969
 
2976
2970
  for (i = 0; i < 3; i++) {
2977
- if (reuc->mode[i] && (error = git_buf_put(reuc_buf, (char *)&reuc->oid[i].id, GIT_OID_RAWSZ)) < 0)
2971
+ if (reuc->mode[i] && (error = git_str_put(reuc_buf, (char *)&reuc->oid[i].id, GIT_OID_RAWSZ)) < 0)
2978
2972
  return error;
2979
2973
  }
2980
2974
 
@@ -2983,7 +2977,7 @@ static int create_reuc_extension_data(git_buf *reuc_buf, git_index_reuc_entry *r
2983
2977
 
2984
2978
  static int write_reuc_extension(git_index *index, git_filebuf *file)
2985
2979
  {
2986
- git_buf reuc_buf = GIT_BUF_INIT;
2980
+ git_str reuc_buf = GIT_STR_INIT;
2987
2981
  git_vector *out = &index->reuc;
2988
2982
  git_index_reuc_entry *reuc;
2989
2983
  struct index_extension extension;
@@ -3001,7 +2995,7 @@ static int write_reuc_extension(git_index *index, git_filebuf *file)
3001
2995
 
3002
2996
  error = write_extension(file, &extension, &reuc_buf);
3003
2997
 
3004
- git_buf_dispose(&reuc_buf);
2998
+ git_str_dispose(&reuc_buf);
3005
2999
 
3006
3000
  done:
3007
3001
  return error;
@@ -3010,7 +3004,7 @@ done:
3010
3004
  static int write_tree_extension(git_index *index, git_filebuf *file)
3011
3005
  {
3012
3006
  struct index_extension extension;
3013
- git_buf buf = GIT_BUF_INIT;
3007
+ git_str buf = GIT_STR_INIT;
3014
3008
  int error;
3015
3009
 
3016
3010
  if (index->tree == NULL)
@@ -3025,7 +3019,7 @@ static int write_tree_extension(git_index *index, git_filebuf *file)
3025
3019
 
3026
3020
  error = write_extension(file, &extension, &buf);
3027
3021
 
3028
- git_buf_dispose(&buf);
3022
+ git_str_dispose(&buf);
3029
3023
 
3030
3024
  return error;
3031
3025
  }
@@ -3039,9 +3033,12 @@ static void clear_uptodate(git_index *index)
3039
3033
  entry->flags_extended &= ~GIT_INDEX_ENTRY_UPTODATE;
3040
3034
  }
3041
3035
 
3042
- static int write_index(git_oid *checksum, git_index *index, git_filebuf *file)
3036
+ static int write_index(
3037
+ unsigned char checksum[GIT_HASH_SHA1_SIZE],
3038
+ size_t *checksum_size,
3039
+ git_index *index,
3040
+ git_filebuf *file)
3043
3041
  {
3044
- git_oid hash_final;
3045
3042
  struct index_header header;
3046
3043
  bool is_extended;
3047
3044
  uint32_t index_version_number;
@@ -3049,6 +3046,8 @@ static int write_index(git_oid *checksum, git_index *index, git_filebuf *file)
3049
3046
  GIT_ASSERT_ARG(index);
3050
3047
  GIT_ASSERT_ARG(file);
3051
3048
 
3049
+ *checksum_size = GIT_HASH_SHA1_SIZE;
3050
+
3052
3051
  if (index->version <= INDEX_VERSION_NUMBER_EXT) {
3053
3052
  is_extended = is_index_extended(index);
3054
3053
  index_version_number = is_extended ? INDEX_VERSION_NUMBER_EXT : INDEX_VERSION_NUMBER_LB;
@@ -3079,11 +3078,10 @@ static int write_index(git_oid *checksum, git_index *index, git_filebuf *file)
3079
3078
  return -1;
3080
3079
 
3081
3080
  /* get out the hash for all the contents we've appended to the file */
3082
- git_filebuf_hash(&hash_final, file);
3083
- git_oid_cpy(checksum, &hash_final);
3081
+ git_filebuf_hash(checksum, file);
3084
3082
 
3085
3083
  /* write it at the end of the file */
3086
- if (git_filebuf_write(file, hash_final.id, GIT_OID_RAWSZ) < 0)
3084
+ if (git_filebuf_write(file, checksum, *checksum_size) < 0)
3087
3085
  return -1;
3088
3086
 
3089
3087
  /* file entries are no longer up to date */
@@ -3115,13 +3113,13 @@ static int read_tree_cb(
3115
3113
  {
3116
3114
  read_tree_data *data = payload;
3117
3115
  git_index_entry *entry = NULL, *old_entry;
3118
- git_buf path = GIT_BUF_INIT;
3116
+ git_str path = GIT_STR_INIT;
3119
3117
  size_t pos;
3120
3118
 
3121
3119
  if (git_tree_entry__is_tree(tentry))
3122
3120
  return 0;
3123
3121
 
3124
- if (git_buf_joinpath(&path, root, tentry->filename) < 0)
3122
+ if (git_str_joinpath(&path, root, tentry->filename) < 0)
3125
3123
  return -1;
3126
3124
 
3127
3125
  if (index_entry_create(&entry, INDEX_OWNER(data->index), path.ptr, NULL, false) < 0)
@@ -3143,7 +3141,7 @@ static int read_tree_cb(
3143
3141
  }
3144
3142
 
3145
3143
  index_entry_adjust_namemask(entry, path.size);
3146
- git_buf_dispose(&path);
3144
+ git_str_dispose(&path);
3147
3145
 
3148
3146
  if (git_vector_insert(data->new_entries, entry) < 0) {
3149
3147
  index_entry_free(entry);
@@ -3385,7 +3383,7 @@ enum {
3385
3383
  INDEX_ACTION_NONE = 0,
3386
3384
  INDEX_ACTION_UPDATE = 1,
3387
3385
  INDEX_ACTION_REMOVE = 2,
3388
- INDEX_ACTION_ADDALL = 3,
3386
+ INDEX_ACTION_ADDALL = 3
3389
3387
  };
3390
3388
 
3391
3389
  int git_index_add_all(
@@ -3498,7 +3496,7 @@ static int index_apply_to_wd_diff(git_index *index, int action, const git_strarr
3498
3496
  }
3499
3497
 
3500
3498
  /*
3501
- * We do the matching ourselves intead of passing the list to
3499
+ * We do the matching ourselves instead of passing the list to
3502
3500
  * diff because we want to tell the callback which one
3503
3501
  * matched, which we do not know if we ask diff to filter for us.
3504
3502
  */
@@ -3540,7 +3538,7 @@ static int index_apply_to_all(
3540
3538
  size_t i;
3541
3539
  git_pathspec ps;
3542
3540
  const char *match;
3543
- git_buf path = GIT_BUF_INIT;
3541
+ git_str path = GIT_STR_INIT;
3544
3542
 
3545
3543
  GIT_ASSERT_ARG(index);
3546
3544
 
@@ -3569,7 +3567,7 @@ static int index_apply_to_all(
3569
3567
  }
3570
3568
 
3571
3569
  /* index manipulation may alter entry, so don't depend on it */
3572
- if ((error = git_buf_sets(&path, entry->path)) < 0)
3570
+ if ((error = git_str_sets(&path, entry->path)) < 0)
3573
3571
  break;
3574
3572
 
3575
3573
  switch (action) {
@@ -3598,7 +3596,7 @@ static int index_apply_to_all(
3598
3596
  }
3599
3597
  }
3600
3598
 
3601
- git_buf_dispose(&path);
3599
+ git_str_dispose(&path);
3602
3600
  git_pathspec__clear(&ps);
3603
3601
 
3604
3602
  return error;
@@ -3713,8 +3711,9 @@ int git_indexwriter_init_for_operation(
3713
3711
 
3714
3712
  int git_indexwriter_commit(git_indexwriter *writer)
3715
3713
  {
3714
+ unsigned char checksum[GIT_HASH_SHA1_SIZE];
3715
+ size_t checksum_size;
3716
3716
  int error;
3717
- git_oid checksum = {{ 0 }};
3718
3717
 
3719
3718
  if (!writer->should_write)
3720
3719
  return 0;
@@ -3722,7 +3721,7 @@ int git_indexwriter_commit(git_indexwriter *writer)
3722
3721
  git_vector_sort(&writer->index->entries);
3723
3722
  git_vector_sort(&writer->index->reuc);
3724
3723
 
3725
- if ((error = write_index(&checksum, writer->index, &writer->file)) < 0) {
3724
+ if ((error = write_index(checksum, &checksum_size, writer->index, &writer->file)) < 0) {
3726
3725
  git_indexwriter_cleanup(writer);
3727
3726
  return error;
3728
3727
  }
@@ -3738,7 +3737,7 @@ int git_indexwriter_commit(git_indexwriter *writer)
3738
3737
 
3739
3738
  writer->index->dirty = 0;
3740
3739
  writer->index->on_disk = 1;
3741
- git_oid_cpy(&writer->index->checksum, &checksum);
3740
+ memcpy(writer->index->checksum, checksum, checksum_size);
3742
3741
 
3743
3742
  git_index_free(writer->index);
3744
3743
  writer->index = NULL;
@@ -27,7 +27,7 @@ struct git_index {
27
27
 
28
28
  char *index_file_path;
29
29
  git_futils_filestamp stamp;
30
- git_oid checksum; /* checksum at the end of the file */
30
+ unsigned char checksum[GIT_HASH_SHA1_SIZE];
31
31
 
32
32
  git_vector entries;
33
33
  git_idxmap *entries_map;
@@ -133,10 +133,13 @@ extern unsigned int git_index__create_mode(unsigned int mode);
133
133
 
134
134
  GIT_INLINE(const git_futils_filestamp *) git_index__filestamp(git_index *index)
135
135
  {
136
- return &index->stamp;
136
+ return &index->stamp;
137
137
  }
138
138
 
139
- extern int git_index__changed_relative_to(git_index *index, const git_oid *checksum);
139
+ GIT_INLINE(unsigned char *) git_index__checksum(git_index *index)
140
+ {
141
+ return index->checksum;
142
+ }
140
143
 
141
144
  /* Copy the current entries vector *and* increment the index refcount.
142
145
  * Call `git_index__release_snapshot` when done.