rugged 0.17.0.b7 → 0.18.0.b1

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 (310) hide show
  1. data/LICENSE +1 -1
  2. data/README.md +88 -32
  3. data/ext/rugged/extconf.rb +4 -2
  4. data/ext/rugged/rugged.c +72 -10
  5. data/ext/rugged/rugged.h +14 -10
  6. data/ext/rugged/rugged_blob.c +8 -10
  7. data/ext/rugged/rugged_branch.c +11 -14
  8. data/ext/rugged/rugged_commit.c +31 -24
  9. data/ext/rugged/rugged_config.c +2 -2
  10. data/ext/rugged/rugged_index.c +133 -198
  11. data/ext/rugged/rugged_note.c +372 -0
  12. data/ext/rugged/rugged_object.c +50 -22
  13. data/ext/rugged/rugged_reference.c +122 -130
  14. data/ext/rugged/rugged_remote.c +72 -29
  15. data/ext/rugged/rugged_repo.c +402 -20
  16. data/ext/rugged/rugged_revwalk.c +7 -3
  17. data/ext/rugged/rugged_settings.c +110 -0
  18. data/ext/rugged/rugged_signature.c +23 -7
  19. data/ext/rugged/rugged_tag.c +32 -16
  20. data/ext/rugged/rugged_tree.c +44 -15
  21. data/lib/rugged.rb +1 -0
  22. data/lib/rugged/index.rb +8 -0
  23. data/lib/rugged/remote.rb +13 -0
  24. data/lib/rugged/repository.rb +3 -3
  25. data/lib/rugged/version.rb +1 -1
  26. data/test/blob_test.rb +13 -15
  27. data/test/branch_test.rb +32 -67
  28. data/test/commit_test.rb +50 -12
  29. data/test/config_test.rb +12 -11
  30. data/test/coverage/HEAD.json +1 -1
  31. data/test/coverage/cover.rb +40 -21
  32. data/test/errors_test.rb +34 -0
  33. data/test/fixtures/alternate/objects/14/6ae76773c91e3b1d00cf7a338ec55ae58297e2 +0 -0
  34. data/test/fixtures/alternate/objects/14/9c32d47e99d0a3572ff1e70a2e0051bbf347a9 +0 -0
  35. data/test/fixtures/alternate/objects/14/fb3108588f9421bf764041e5e3ac305eb6277f +0 -0
  36. data/test/fixtures/testrepo.git/logs/refs/notes/commits +1 -0
  37. data/test/fixtures/testrepo.git/objects/44/1034f860c1d5d90e4188d11ae0d325176869a8 +1 -0
  38. data/test/fixtures/testrepo.git/objects/60/d415052a33de2150bf68757f6461df4f563ae4 +0 -0
  39. data/test/fixtures/testrepo.git/objects/68/8a8f4ef7496901d15322972f96e212a9e466cc +1 -0
  40. data/test/fixtures/testrepo.git/objects/94/eca2de348d5f672faf56b0decafa5937e3235e +0 -0
  41. data/test/fixtures/testrepo.git/objects/9b/7384fe1676186192842f5d3e129457b62db9e3 +0 -0
  42. data/test/fixtures/testrepo.git/objects/b7/4713326bc972cc15751ed504dca6f6f3b91f7a +3 -0
  43. data/test/fixtures/testrepo.git/refs/notes/commits +1 -0
  44. data/test/index_test.rb +65 -69
  45. data/test/lib_test.rb +76 -11
  46. data/test/note_test.rb +158 -0
  47. data/test/object_test.rb +8 -11
  48. data/test/reference_test.rb +77 -85
  49. data/test/remote_test.rb +86 -8
  50. data/test/repo_pack_test.rb +9 -7
  51. data/test/repo_reset_test.rb +80 -0
  52. data/test/repo_test.rb +176 -53
  53. data/test/tag_test.rb +44 -7
  54. data/test/test_helper.rb +63 -35
  55. data/test/tree_test.rb +34 -13
  56. data/test/walker_test.rb +14 -14
  57. data/vendor/libgit2/Makefile.embed +1 -1
  58. data/vendor/libgit2/deps/http-parser/http_parser.c +974 -578
  59. data/vendor/libgit2/deps/http-parser/http_parser.h +106 -70
  60. data/vendor/libgit2/deps/regex/regcomp.c +7 -6
  61. data/vendor/libgit2/deps/regex/regex_internal.c +1 -1
  62. data/vendor/libgit2/deps/regex/regex_internal.h +12 -3
  63. data/vendor/libgit2/deps/regex/regexec.c +5 -5
  64. data/vendor/libgit2/include/git2.h +5 -1
  65. data/vendor/libgit2/include/git2/attr.h +4 -2
  66. data/vendor/libgit2/include/git2/blob.h +39 -12
  67. data/vendor/libgit2/include/git2/branch.h +123 -35
  68. data/vendor/libgit2/include/git2/checkout.h +206 -48
  69. data/vendor/libgit2/include/git2/clone.h +72 -27
  70. data/vendor/libgit2/include/git2/commit.h +20 -17
  71. data/vendor/libgit2/include/git2/common.h +67 -1
  72. data/vendor/libgit2/include/git2/config.h +81 -60
  73. data/vendor/libgit2/include/git2/cred_helpers.h +53 -0
  74. data/vendor/libgit2/include/git2/diff.h +459 -150
  75. data/vendor/libgit2/include/git2/errors.h +9 -1
  76. data/vendor/libgit2/include/git2/graph.h +41 -0
  77. data/vendor/libgit2/include/git2/ignore.h +7 -6
  78. data/vendor/libgit2/include/git2/index.h +323 -97
  79. data/vendor/libgit2/include/git2/indexer.h +27 -59
  80. data/vendor/libgit2/include/git2/inttypes.h +4 -0
  81. data/vendor/libgit2/include/git2/merge.h +13 -3
  82. data/vendor/libgit2/include/git2/message.h +14 -8
  83. data/vendor/libgit2/include/git2/net.h +9 -7
  84. data/vendor/libgit2/include/git2/notes.h +88 -29
  85. data/vendor/libgit2/include/git2/object.h +16 -6
  86. data/vendor/libgit2/include/git2/odb.h +80 -17
  87. data/vendor/libgit2/include/git2/odb_backend.h +47 -11
  88. data/vendor/libgit2/include/git2/oid.h +26 -17
  89. data/vendor/libgit2/include/git2/pack.h +62 -8
  90. data/vendor/libgit2/include/git2/push.h +131 -0
  91. data/vendor/libgit2/include/git2/refdb.h +103 -0
  92. data/vendor/libgit2/include/git2/refdb_backend.h +109 -0
  93. data/vendor/libgit2/include/git2/reflog.h +30 -21
  94. data/vendor/libgit2/include/git2/refs.h +215 -193
  95. data/vendor/libgit2/include/git2/refspec.h +22 -2
  96. data/vendor/libgit2/include/git2/remote.h +158 -37
  97. data/vendor/libgit2/include/git2/repository.h +150 -31
  98. data/vendor/libgit2/include/git2/reset.h +43 -9
  99. data/vendor/libgit2/include/git2/revparse.h +48 -4
  100. data/vendor/libgit2/include/git2/revwalk.h +25 -10
  101. data/vendor/libgit2/include/git2/signature.h +20 -12
  102. data/vendor/libgit2/include/git2/stash.h +121 -0
  103. data/vendor/libgit2/include/git2/status.h +122 -53
  104. data/vendor/libgit2/include/git2/strarray.h +17 -11
  105. data/vendor/libgit2/include/git2/submodule.h +42 -7
  106. data/vendor/libgit2/include/git2/tag.h +72 -59
  107. data/vendor/libgit2/include/git2/threads.h +4 -2
  108. data/vendor/libgit2/include/git2/trace.h +68 -0
  109. data/vendor/libgit2/include/git2/transport.h +328 -0
  110. data/vendor/libgit2/include/git2/tree.h +149 -120
  111. data/vendor/libgit2/include/git2/types.h +13 -12
  112. data/vendor/libgit2/include/git2/version.h +3 -3
  113. data/vendor/libgit2/src/amiga/map.c +2 -2
  114. data/vendor/libgit2/src/attr.c +58 -48
  115. data/vendor/libgit2/src/attr.h +4 -18
  116. data/vendor/libgit2/src/attr_file.c +30 -6
  117. data/vendor/libgit2/src/attr_file.h +6 -8
  118. data/vendor/libgit2/src/attrcache.h +24 -0
  119. data/vendor/libgit2/src/blob.c +30 -7
  120. data/vendor/libgit2/src/blob.h +1 -1
  121. data/vendor/libgit2/src/branch.c +361 -68
  122. data/vendor/libgit2/src/branch.h +17 -0
  123. data/vendor/libgit2/src/bswap.h +1 -1
  124. data/vendor/libgit2/src/buf_text.c +291 -0
  125. data/vendor/libgit2/src/buf_text.h +122 -0
  126. data/vendor/libgit2/src/buffer.c +27 -101
  127. data/vendor/libgit2/src/buffer.h +54 -39
  128. data/vendor/libgit2/src/cache.c +15 -6
  129. data/vendor/libgit2/src/cache.h +1 -1
  130. data/vendor/libgit2/src/cc-compat.h +3 -1
  131. data/vendor/libgit2/src/checkout.c +1165 -222
  132. data/vendor/libgit2/src/checkout.h +24 -0
  133. data/vendor/libgit2/src/clone.c +171 -86
  134. data/vendor/libgit2/src/commit.c +44 -45
  135. data/vendor/libgit2/src/commit.h +3 -3
  136. data/vendor/libgit2/src/commit_list.c +194 -0
  137. data/vendor/libgit2/src/commit_list.h +49 -0
  138. data/vendor/libgit2/src/common.h +44 -10
  139. data/vendor/libgit2/src/compress.c +1 -1
  140. data/vendor/libgit2/src/compress.h +1 -1
  141. data/vendor/libgit2/src/config.c +211 -124
  142. data/vendor/libgit2/src/config.h +23 -4
  143. data/vendor/libgit2/src/config_cache.c +2 -2
  144. data/vendor/libgit2/src/config_file.c +129 -53
  145. data/vendor/libgit2/src/config_file.h +10 -8
  146. data/vendor/libgit2/src/crlf.c +66 -67
  147. data/vendor/libgit2/src/date.c +12 -12
  148. data/vendor/libgit2/src/delta-apply.c +14 -1
  149. data/vendor/libgit2/src/delta-apply.h +18 -1
  150. data/vendor/libgit2/src/delta.c +40 -107
  151. data/vendor/libgit2/src/delta.h +19 -17
  152. data/vendor/libgit2/src/diff.c +347 -496
  153. data/vendor/libgit2/src/diff.h +27 -1
  154. data/vendor/libgit2/src/diff_output.c +564 -249
  155. data/vendor/libgit2/src/diff_output.h +15 -8
  156. data/vendor/libgit2/src/diff_tform.c +687 -0
  157. data/vendor/libgit2/src/errors.c +27 -36
  158. data/vendor/libgit2/src/fetch.c +13 -351
  159. data/vendor/libgit2/src/fetch.h +13 -3
  160. data/vendor/libgit2/src/fetchhead.c +295 -0
  161. data/vendor/libgit2/src/fetchhead.h +34 -0
  162. data/vendor/libgit2/src/filebuf.c +42 -15
  163. data/vendor/libgit2/src/filebuf.h +4 -2
  164. data/vendor/libgit2/src/fileops.c +466 -113
  165. data/vendor/libgit2/src/fileops.h +154 -28
  166. data/vendor/libgit2/src/filter.c +3 -75
  167. data/vendor/libgit2/src/filter.h +1 -29
  168. data/vendor/libgit2/src/fnmatch.c +1 -1
  169. data/vendor/libgit2/src/fnmatch.h +1 -1
  170. data/vendor/libgit2/src/global.c +54 -10
  171. data/vendor/libgit2/src/global.h +10 -1
  172. data/vendor/libgit2/src/graph.c +178 -0
  173. data/vendor/libgit2/src/hash.c +25 -52
  174. data/vendor/libgit2/src/hash.h +21 -9
  175. data/vendor/libgit2/src/{sha1/sha1.c → hash/hash_generic.c} +20 -12
  176. data/vendor/libgit2/src/hash/hash_generic.h +24 -0
  177. data/vendor/libgit2/src/hash/hash_openssl.h +45 -0
  178. data/vendor/libgit2/src/hash/hash_win32.c +291 -0
  179. data/vendor/libgit2/src/hash/hash_win32.h +140 -0
  180. data/vendor/libgit2/src/hashsig.c +368 -0
  181. data/vendor/libgit2/src/hashsig.h +72 -0
  182. data/vendor/libgit2/src/ignore.c +22 -15
  183. data/vendor/libgit2/src/ignore.h +6 -1
  184. data/vendor/libgit2/src/index.c +770 -171
  185. data/vendor/libgit2/src/index.h +13 -5
  186. data/vendor/libgit2/src/indexer.c +286 -431
  187. data/vendor/libgit2/src/iterator.c +854 -466
  188. data/vendor/libgit2/src/iterator.h +134 -109
  189. data/vendor/libgit2/src/map.h +1 -1
  190. data/vendor/libgit2/src/merge.c +296 -0
  191. data/vendor/libgit2/src/merge.h +22 -0
  192. data/vendor/libgit2/src/message.c +1 -1
  193. data/vendor/libgit2/src/message.h +1 -1
  194. data/vendor/libgit2/src/mwindow.c +35 -30
  195. data/vendor/libgit2/src/mwindow.h +2 -2
  196. data/vendor/libgit2/src/netops.c +162 -98
  197. data/vendor/libgit2/src/netops.h +50 -15
  198. data/vendor/libgit2/src/notes.c +109 -58
  199. data/vendor/libgit2/src/notes.h +2 -1
  200. data/vendor/libgit2/src/object.c +46 -57
  201. data/vendor/libgit2/src/object.h +1 -8
  202. data/vendor/libgit2/src/odb.c +151 -40
  203. data/vendor/libgit2/src/odb.h +5 -1
  204. data/vendor/libgit2/src/odb_loose.c +4 -5
  205. data/vendor/libgit2/src/odb_pack.c +122 -80
  206. data/vendor/libgit2/src/offmap.h +65 -0
  207. data/vendor/libgit2/src/oid.c +12 -4
  208. data/vendor/libgit2/src/oidmap.h +1 -1
  209. data/vendor/libgit2/src/pack-objects.c +88 -61
  210. data/vendor/libgit2/src/pack-objects.h +8 -8
  211. data/vendor/libgit2/src/pack.c +293 -28
  212. data/vendor/libgit2/src/pack.h +49 -4
  213. data/vendor/libgit2/src/path.c +103 -14
  214. data/vendor/libgit2/src/path.h +23 -7
  215. data/vendor/libgit2/src/pathspec.c +168 -0
  216. data/vendor/libgit2/src/pathspec.h +40 -0
  217. data/vendor/libgit2/src/pool.c +29 -4
  218. data/vendor/libgit2/src/pool.h +8 -1
  219. data/vendor/libgit2/src/posix.c +26 -27
  220. data/vendor/libgit2/src/posix.h +2 -3
  221. data/vendor/libgit2/src/pqueue.c +23 -1
  222. data/vendor/libgit2/src/pqueue.h +23 -1
  223. data/vendor/libgit2/src/push.c +653 -0
  224. data/vendor/libgit2/src/push.h +51 -0
  225. data/vendor/libgit2/src/refdb.c +185 -0
  226. data/vendor/libgit2/src/refdb.h +46 -0
  227. data/vendor/libgit2/src/refdb_fs.c +1024 -0
  228. data/vendor/libgit2/src/refdb_fs.h +15 -0
  229. data/vendor/libgit2/src/reflog.c +77 -45
  230. data/vendor/libgit2/src/reflog.h +1 -3
  231. data/vendor/libgit2/src/refs.c +366 -1326
  232. data/vendor/libgit2/src/refs.h +22 -13
  233. data/vendor/libgit2/src/refspec.c +46 -7
  234. data/vendor/libgit2/src/refspec.h +11 -1
  235. data/vendor/libgit2/src/remote.c +758 -120
  236. data/vendor/libgit2/src/remote.h +10 -5
  237. data/vendor/libgit2/src/repo_template.h +6 -6
  238. data/vendor/libgit2/src/repository.c +315 -96
  239. data/vendor/libgit2/src/repository.h +5 -3
  240. data/vendor/libgit2/src/reset.c +99 -81
  241. data/vendor/libgit2/src/revparse.c +157 -84
  242. data/vendor/libgit2/src/revwalk.c +68 -470
  243. data/vendor/libgit2/src/revwalk.h +44 -0
  244. data/vendor/libgit2/src/sha1_lookup.c +1 -1
  245. data/vendor/libgit2/src/sha1_lookup.h +1 -1
  246. data/vendor/libgit2/src/signature.c +68 -200
  247. data/vendor/libgit2/src/signature.h +1 -1
  248. data/vendor/libgit2/src/stash.c +663 -0
  249. data/vendor/libgit2/src/status.c +101 -79
  250. data/vendor/libgit2/src/strmap.h +1 -1
  251. data/vendor/libgit2/src/submodule.c +67 -51
  252. data/vendor/libgit2/src/submodule.h +1 -1
  253. data/vendor/libgit2/src/tag.c +35 -29
  254. data/vendor/libgit2/src/tag.h +1 -1
  255. data/vendor/libgit2/src/thread-utils.c +1 -1
  256. data/vendor/libgit2/src/thread-utils.h +2 -2
  257. data/vendor/libgit2/src/trace.c +39 -0
  258. data/vendor/libgit2/src/trace.h +56 -0
  259. data/vendor/libgit2/src/transport.c +81 -34
  260. data/vendor/libgit2/src/transports/cred.c +60 -0
  261. data/vendor/libgit2/src/transports/cred_helpers.c +49 -0
  262. data/vendor/libgit2/src/transports/git.c +234 -127
  263. data/vendor/libgit2/src/transports/http.c +761 -433
  264. data/vendor/libgit2/src/transports/local.c +460 -64
  265. data/vendor/libgit2/src/transports/smart.c +345 -0
  266. data/vendor/libgit2/src/transports/smart.h +179 -0
  267. data/vendor/libgit2/src/{pkt.c → transports/smart_pkt.c} +131 -12
  268. data/vendor/libgit2/src/transports/smart_protocol.c +856 -0
  269. data/vendor/libgit2/src/transports/winhttp.c +1136 -0
  270. data/vendor/libgit2/src/tree-cache.c +2 -2
  271. data/vendor/libgit2/src/tree-cache.h +1 -1
  272. data/vendor/libgit2/src/tree.c +239 -166
  273. data/vendor/libgit2/src/tree.h +11 -2
  274. data/vendor/libgit2/src/tsort.c +39 -23
  275. data/vendor/libgit2/src/unix/map.c +1 -1
  276. data/vendor/libgit2/src/unix/posix.h +12 -2
  277. data/vendor/libgit2/src/unix/realpath.c +30 -0
  278. data/vendor/libgit2/src/util.c +250 -13
  279. data/vendor/libgit2/src/util.h +71 -14
  280. data/vendor/libgit2/src/vector.c +123 -60
  281. data/vendor/libgit2/src/vector.h +24 -22
  282. data/vendor/libgit2/src/win32/dir.c +1 -1
  283. data/vendor/libgit2/src/win32/dir.h +1 -1
  284. data/vendor/libgit2/src/win32/error.c +77 -0
  285. data/vendor/libgit2/src/win32/error.h +13 -0
  286. data/vendor/libgit2/src/win32/findfile.c +143 -54
  287. data/vendor/libgit2/src/win32/findfile.h +10 -6
  288. data/vendor/libgit2/src/win32/map.c +1 -1
  289. data/vendor/libgit2/src/win32/mingw-compat.h +1 -1
  290. data/vendor/libgit2/src/win32/msvc-compat.h +10 -1
  291. data/vendor/libgit2/src/win32/posix.h +10 -1
  292. data/vendor/libgit2/src/win32/posix_w32.c +132 -63
  293. data/vendor/libgit2/src/win32/precompiled.c +1 -1
  294. data/vendor/libgit2/src/win32/pthread.c +1 -1
  295. data/vendor/libgit2/src/win32/pthread.h +1 -1
  296. data/vendor/libgit2/src/win32/utf-conv.c +5 -5
  297. data/vendor/libgit2/src/win32/utf-conv.h +3 -3
  298. data/vendor/libgit2/src/win32/version.h +20 -0
  299. metadata +308 -252
  300. data/test/fixtures/testrepo.git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 +0 -0
  301. data/test/fixtures/testrepo.git/objects/7f/043268ea43ce18e3540acaabf9e090c91965b0 +0 -0
  302. data/test/fixtures/testrepo.git/objects/a3/e05719b428a2d0ed7a55c4ce53dcc5768c6d5e +0 -0
  303. data/test/index_test.rb~ +0 -218
  304. data/vendor/libgit2/src/pkt.h +0 -91
  305. data/vendor/libgit2/src/ppc/sha1.c +0 -70
  306. data/vendor/libgit2/src/ppc/sha1.h +0 -26
  307. data/vendor/libgit2/src/protocol.c +0 -110
  308. data/vendor/libgit2/src/protocol.h +0 -21
  309. data/vendor/libgit2/src/sha1.h +0 -33
  310. data/vendor/libgit2/src/transport.h +0 -148
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2009-2012 the libgit2 contributors
2
+ * Copyright (C) the libgit2 contributors. All rights reserved.
3
3
  *
4
4
  * This file is part of libgit2, distributed under the GNU GPL v2 with
5
5
  * a Linking Exception. For full terms see the included COPYING file.
@@ -28,6 +28,10 @@ enum {
28
28
  GIT_EUSER = -7,
29
29
  GIT_EBAREREPO = -8,
30
30
  GIT_EORPHANEDHEAD = -9,
31
+ GIT_EUNMERGED = -10,
32
+ GIT_ENONFASTFORWARD = -11,
33
+ GIT_EINVALIDSPEC = -12,
34
+ GIT_EMERGECONFLICT = -13,
31
35
 
32
36
  GIT_PASSTHROUGH = -30,
33
37
  GIT_ITEROVER = -31,
@@ -58,6 +62,10 @@ typedef enum {
58
62
  GITERR_SSL,
59
63
  GITERR_SUBMODULE,
60
64
  GITERR_THREAD,
65
+ GITERR_STASH,
66
+ GITERR_CHECKOUT,
67
+ GITERR_FETCHHEAD,
68
+ GITERR_MERGE,
61
69
  } git_error_t;
62
70
 
63
71
  /**
@@ -0,0 +1,41 @@
1
+ /*
2
+ * Copyright (C) the libgit2 contributors. All rights reserved.
3
+ *
4
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
5
+ * a Linking Exception. For full terms see the included COPYING file.
6
+ */
7
+ #ifndef INCLUDE_git_graph_h__
8
+ #define INCLUDE_git_graph_h__
9
+
10
+ #include "common.h"
11
+ #include "types.h"
12
+ #include "oid.h"
13
+
14
+ /**
15
+ * @file git2/graph.h
16
+ * @brief Git graph traversal routines
17
+ * @defgroup git_revwalk Git graph traversal routines
18
+ * @ingroup Git
19
+ * @{
20
+ */
21
+ GIT_BEGIN_DECL
22
+
23
+ /**
24
+ * Count the number of unique commits between two commit objects
25
+ *
26
+ * There is no need for branches containing the commits to have any
27
+ * upstream relationship, but it helps to think of one as a branch and
28
+ * the other as its upstream, the `ahead` and `behind` values will be
29
+ * what git would report for the branches.
30
+ *
31
+ * @param ahead number of unique from commits in `upstream`
32
+ * @param behind number of unique from commits in `local`
33
+ * @param repo the repository where the commits exist
34
+ * @param local the commit for local
35
+ * @param upstream the commit for upstream
36
+ */
37
+ GIT_EXTERN(int) git_graph_ahead_behind(size_t *ahead, size_t *behind, git_repository *repo, const git_oid *local, const git_oid *upstream);
38
+
39
+ /** @} */
40
+ GIT_END_DECL
41
+ #endif
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2012 the libgit2 contributors
2
+ * Copyright (C) the libgit2 contributors. All rights reserved.
3
3
  *
4
4
  * This file is part of libgit2, distributed under the GNU GPL v2 with
5
5
  * a Linking Exception. For full terms see the included COPYING file.
@@ -24,7 +24,7 @@ GIT_BEGIN_DECL
24
24
  *
25
25
  * Example usage:
26
26
  *
27
- * error = git_ignore_add(myrepo, "*.c\ndir/\nFile with space\n");
27
+ * error = git_ignore_add_rule(myrepo, "*.c\ndir/\nFile with space\n");
28
28
  *
29
29
  * This would add three rules to the ignores.
30
30
  *
@@ -41,9 +41,10 @@ GIT_EXTERN(int) git_ignore_add_rule(
41
41
  /**
42
42
  * Clear ignore rules that were explicitly added.
43
43
  *
44
- * Clears the internal ignore rules that have been set up. This will not
45
- * turn off the rules in .gitignore files that actually exist in the
46
- * filesystem.
44
+ * Resets to the default internal ignore rules. This will not turn off
45
+ * rules in .gitignore files that actually exist in the filesystem.
46
+ *
47
+ * The default internal ignores ignore ".", ".." and ".git" entries.
47
48
  *
48
49
  * @param repo The repository to remove ignore rules from.
49
50
  * @return 0 on success
@@ -56,7 +57,7 @@ GIT_EXTERN(int) git_ignore_clear_internal_rules(
56
57
  *
57
58
  * This function checks the ignore rules to see if they would apply to the
58
59
  * given file. This indicates if the file would be ignored regardless of
59
- * whether the file is already in the index or commited to the repository.
60
+ * whether the file is already in the index or committed to the repository.
60
61
  *
61
62
  * One way to think of this is if you were to do "git add ." on the
62
63
  * directory containing the file, would it be added or not?
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2009-2012 the libgit2 contributors
2
+ * Copyright (C) the libgit2 contributors. All rights reserved.
3
3
  *
4
4
  * This file is part of libgit2, distributed under the GNU GPL v2 with
5
5
  * a Linking Exception. For full terms see the included COPYING file.
@@ -21,10 +21,10 @@
21
21
  */
22
22
  GIT_BEGIN_DECL
23
23
 
24
- #define GIT_IDXENTRY_NAMEMASK (0x0fff)
24
+ #define GIT_IDXENTRY_NAMEMASK (0x0fff)
25
25
  #define GIT_IDXENTRY_STAGEMASK (0x3000)
26
- #define GIT_IDXENTRY_EXTENDED (0x4000)
27
- #define GIT_IDXENTRY_VALID (0x8000)
26
+ #define GIT_IDXENTRY_EXTENDED (0x4000)
27
+ #define GIT_IDXENTRY_VALID (0x8000)
28
28
  #define GIT_IDXENTRY_STAGESHIFT 12
29
29
 
30
30
  /*
@@ -34,26 +34,26 @@ GIT_BEGIN_DECL
34
34
  *
35
35
  * In-memory only flags:
36
36
  */
37
- #define GIT_IDXENTRY_UPDATE (1 << 0)
38
- #define GIT_IDXENTRY_REMOVE (1 << 1)
39
- #define GIT_IDXENTRY_UPTODATE (1 << 2)
40
- #define GIT_IDXENTRY_ADDED (1 << 3)
37
+ #define GIT_IDXENTRY_UPDATE (1 << 0)
38
+ #define GIT_IDXENTRY_REMOVE (1 << 1)
39
+ #define GIT_IDXENTRY_UPTODATE (1 << 2)
40
+ #define GIT_IDXENTRY_ADDED (1 << 3)
41
41
 
42
- #define GIT_IDXENTRY_HASHED (1 << 4)
43
- #define GIT_IDXENTRY_UNHASHED (1 << 5)
44
- #define GIT_IDXENTRY_WT_REMOVE (1 << 6) /* remove in work directory */
45
- #define GIT_IDXENTRY_CONFLICTED (1 << 7)
42
+ #define GIT_IDXENTRY_HASHED (1 << 4)
43
+ #define GIT_IDXENTRY_UNHASHED (1 << 5)
44
+ #define GIT_IDXENTRY_WT_REMOVE (1 << 6) /* remove in work directory */
45
+ #define GIT_IDXENTRY_CONFLICTED (1 << 7)
46
46
 
47
- #define GIT_IDXENTRY_UNPACKED (1 << 8)
47
+ #define GIT_IDXENTRY_UNPACKED (1 << 8)
48
48
  #define GIT_IDXENTRY_NEW_SKIP_WORKTREE (1 << 9)
49
49
 
50
50
  /*
51
51
  * Extended on-disk flags:
52
52
  */
53
- #define GIT_IDXENTRY_INTENT_TO_ADD (1 << 13)
54
- #define GIT_IDXENTRY_SKIP_WORKTREE (1 << 14)
53
+ #define GIT_IDXENTRY_INTENT_TO_ADD (1 << 13)
54
+ #define GIT_IDXENTRY_SKIP_WORKTREE (1 << 14)
55
55
  /* GIT_IDXENTRY_EXTENDED2 is for future extension */
56
- #define GIT_IDXENTRY_EXTENDED2 (1 << 15)
56
+ #define GIT_IDXENTRY_EXTENDED2 (1 << 15)
57
57
 
58
58
  #define GIT_IDXENTRY_EXTENDED_FLAGS (GIT_IDXENTRY_INTENT_TO_ADD | GIT_IDXENTRY_SKIP_WORKTREE)
59
59
 
@@ -84,12 +84,12 @@ typedef struct git_index_entry {
84
84
  char *path;
85
85
  } git_index_entry;
86
86
 
87
- /** Representation of an unmerged file entry in the index. */
88
- typedef struct git_index_entry_unmerged {
87
+ /** Representation of a resolve undo entry in the index. */
88
+ typedef struct git_index_reuc_entry {
89
89
  unsigned int mode[3];
90
90
  git_oid oid[3];
91
91
  char *path;
92
- } git_index_entry_unmerged;
92
+ } git_index_reuc_entry;
93
93
 
94
94
  /** Capabilities of system that affect index actions. */
95
95
  enum {
@@ -99,6 +99,12 @@ enum {
99
99
  GIT_INDEXCAP_FROM_OWNER = ~0u
100
100
  };
101
101
 
102
+ /** @name Index File Functions
103
+ *
104
+ * These functions work on the index file itself.
105
+ */
106
+ /**@{*/
107
+
102
108
  /**
103
109
  * Create a new bare Git index object as a memory representation
104
110
  * of the Git index file in 'index_path', without a repository
@@ -113,20 +119,24 @@ enum {
113
119
  *
114
120
  * The index must be freed once it's no longer in use.
115
121
  *
116
- * @param index the pointer for the new index
122
+ * @param out the pointer for the new index
117
123
  * @param index_path the path to the index file in disk
118
124
  * @return 0 or an error code
119
125
  */
120
- GIT_EXTERN(int) git_index_open(git_index **index, const char *index_path);
126
+ GIT_EXTERN(int) git_index_open(git_index **out, const char *index_path);
121
127
 
122
128
  /**
123
- * Clear the contents (all the entries) of an index object.
124
- * This clears the index object in memory; changes must be manually
125
- * written to disk for them to take effect.
129
+ * Create an in-memory index object.
126
130
  *
127
- * @param index an existing index object
131
+ * This index object cannot be read/written to the filesystem,
132
+ * but may be used to perform in-memory index operations.
133
+ *
134
+ * The index must be freed once it's no longer in use.
135
+ *
136
+ * @param out the pointer for the new index
137
+ * @return 0 or an error code
128
138
  */
129
- GIT_EXTERN(void) git_index_clear(git_index *index);
139
+ GIT_EXTERN(int) git_index_new(git_index **out);
130
140
 
131
141
  /**
132
142
  * Free an existing index object.
@@ -135,6 +145,14 @@ GIT_EXTERN(void) git_index_clear(git_index *index);
135
145
  */
136
146
  GIT_EXTERN(void) git_index_free(git_index *index);
137
147
 
148
+ /**
149
+ * Get the repository this index relates to
150
+ *
151
+ * @param index The index
152
+ * @return A pointer to the repository
153
+ */
154
+ GIT_EXTERN(git_repository *) git_index_owner(const git_index *index);
155
+
138
156
  /**
139
157
  * Read index capabilities flags.
140
158
  *
@@ -175,44 +193,143 @@ GIT_EXTERN(int) git_index_read(git_index *index);
175
193
  GIT_EXTERN(int) git_index_write(git_index *index);
176
194
 
177
195
  /**
178
- * Find the first index of any entries which point to given
179
- * path in the Git index.
196
+ * Read a tree into the index file with stats
197
+ *
198
+ * The current index contents will be replaced by the specified tree.
180
199
  *
181
200
  * @param index an existing index object
182
- * @param path path to search
183
- * @return an index >= 0 if found, -1 otherwise
201
+ * @param tree tree to read
202
+ * @return 0 or an error code
184
203
  */
185
- GIT_EXTERN(int) git_index_find(git_index *index, const char *path);
204
+ GIT_EXTERN(int) git_index_read_tree(git_index *index, const git_tree *tree);
186
205
 
187
206
  /**
188
- * Remove all entries with equal path except last added
207
+ * Write the index as a tree
208
+ *
209
+ * This method will scan the index and write a representation
210
+ * of its current state back to disk; it recursively creates
211
+ * tree objects for each of the subtrees stored in the index,
212
+ * but only returns the OID of the root tree. This is the OID
213
+ * that can be used e.g. to create a commit.
214
+ *
215
+ * The index instance cannot be bare, and needs to be associated
216
+ * to an existing repository.
217
+ *
218
+ * The index must not contain any file in conflict.
219
+ *
220
+ * @param out Pointer where to store the OID of the written tree
221
+ * @param index Index to write
222
+ * @return 0 on success, GIT_EUNMERGED when the index is not clean
223
+ * or an error code
224
+ */
225
+ GIT_EXTERN(int) git_index_write_tree(git_oid *out, git_index *index);
226
+
227
+ /**
228
+ * Write the index as a tree to the given repository
229
+ *
230
+ * This method will do the same as `git_index_write_tree`, but
231
+ * letting the user choose the repository where the tree will
232
+ * be written.
233
+ *
234
+ * The index must not contain any file in conflict.
235
+ *
236
+ * @param out Pointer where to store OID of the the written tree
237
+ * @param index Index to write
238
+ * @param repo Repository where to write the tree
239
+ * @return 0 on success, GIT_EUNMERGED when the index is not clean
240
+ * or an error code
241
+ */
242
+ GIT_EXTERN(int) git_index_write_tree_to(git_oid *out, git_index *index, git_repository *repo);
243
+
244
+ /**@}*/
245
+
246
+ /** @name Raw Index Entry Functions
247
+ *
248
+ * These functions work on index entries, and allow for raw manipulation
249
+ * of the entries.
250
+ */
251
+ /**@{*/
252
+
253
+ /* Index entry manipulation */
254
+
255
+ /**
256
+ * Get the count of entries currently in the index
189
257
  *
190
258
  * @param index an existing index object
259
+ * @return integer of count of current entries
191
260
  */
192
- GIT_EXTERN(void) git_index_uniq(git_index *index);
261
+ GIT_EXTERN(size_t) git_index_entrycount(const git_index *index);
193
262
 
194
263
  /**
195
- * Add or update an index entry from a file in disk
264
+ * Clear the contents (all the entries) of an index object.
265
+ * This clears the index object in memory; changes must be manually
266
+ * written to disk for them to take effect.
196
267
  *
197
- * The file `path` must be relative to the repository's
198
- * working folder and must be readable.
268
+ * @param index an existing index object
269
+ */
270
+ GIT_EXTERN(void) git_index_clear(git_index *index);
271
+
272
+ /**
273
+ * Get a pointer to one of the entries in the index
199
274
  *
200
- * This method will fail in bare index instances.
275
+ * The values of this entry can be modified (except the path)
276
+ * and the changes will be written back to disk on the next
277
+ * write() call.
201
278
  *
202
- * This forces the file to be added to the index, not looking
203
- * at gitignore rules. Those rules can be evaluated through
204
- * the git_status APIs (in status.h) before calling this.
279
+ * The entry should not be freed by the caller.
205
280
  *
206
281
  * @param index an existing index object
207
- * @param path filename to add
208
- * @param stage stage for the entry
282
+ * @param n the position of the entry
283
+ * @return a pointer to the entry; NULL if out of bounds
284
+ */
285
+ GIT_EXTERN(const git_index_entry *) git_index_get_byindex(
286
+ git_index *index, size_t n);
287
+
288
+ /**
289
+ * Get a pointer to one of the entries in the index
290
+ *
291
+ * The values of this entry can be modified (except the path)
292
+ * and the changes will be written back to disk on the next
293
+ * write() call.
294
+ *
295
+ * The entry should not be freed by the caller.
296
+ *
297
+ * @param index an existing index object
298
+ * @param path path to search
299
+ * @param stage stage to search
300
+ * @return a pointer to the entry; NULL if it was not found
301
+ */
302
+ GIT_EXTERN(const git_index_entry *) git_index_get_bypath(
303
+ git_index *index, const char *path, int stage);
304
+
305
+ /**
306
+ * Remove an entry from the index
307
+ *
308
+ * @param index an existing index object
309
+ * @param path path to search
310
+ * @param stage stage to search
311
+ * @return 0 or an error code
312
+ */
313
+ GIT_EXTERN(int) git_index_remove(git_index *index, const char *path, int stage);
314
+
315
+ /**
316
+ * Remove all entries from the index under a given directory
317
+ *
318
+ * @param index an existing index object
319
+ * @param dir container directory path
320
+ * @param stage stage to search
209
321
  * @return 0 or an error code
210
322
  */
211
- GIT_EXTERN(int) git_index_add(git_index *index, const char *path, int stage);
323
+ GIT_EXTERN(int) git_index_remove_directory(
324
+ git_index *index, const char *dir, int stage);
212
325
 
213
326
  /**
214
327
  * Add or update an index entry from an in-memory struct
215
328
  *
329
+ * If a previous index entry exists that has the same path and stage
330
+ * as the given 'source_entry', it will be replaced. Otherwise, the
331
+ * 'source_entry' will be added.
332
+ *
216
333
  * A full copy (including the 'path' string) of the given
217
334
  * 'source_entry' will be inserted on the index.
218
335
  *
@@ -220,133 +337,242 @@ GIT_EXTERN(int) git_index_add(git_index *index, const char *path, int stage);
220
337
  * @param source_entry new entry object
221
338
  * @return 0 or an error code
222
339
  */
223
- GIT_EXTERN(int) git_index_add2(git_index *index, const git_index_entry *source_entry);
340
+ GIT_EXTERN(int) git_index_add(git_index *index, const git_index_entry *source_entry);
224
341
 
225
342
  /**
226
- * Add (append) an index entry from a file in disk
343
+ * Return the stage number from a git index entry
344
+ *
345
+ * This entry is calculated from the entry's flag
346
+ * attribute like this:
227
347
  *
228
- * A new entry will always be inserted into the index;
229
- * if the index already contains an entry for such
230
- * path, the old entry will **not** be replaced.
348
+ * (entry->flags & GIT_IDXENTRY_STAGEMASK) >> GIT_IDXENTRY_STAGESHIFT
349
+ *
350
+ * @param entry The entry
351
+ * @returns the stage number
352
+ */
353
+ GIT_EXTERN(int) git_index_entry_stage(const git_index_entry *entry);
354
+
355
+ /**@}*/
356
+
357
+ /** @name Workdir Index Entry Functions
358
+ *
359
+ * These functions work on index entries specifically in the working
360
+ * directory (ie, stage 0).
361
+ */
362
+ /**@{*/
363
+
364
+ /**
365
+ * Add or update an index entry from a file on disk
231
366
  *
232
367
  * The file `path` must be relative to the repository's
233
368
  * working folder and must be readable.
234
369
  *
235
370
  * This method will fail in bare index instances.
236
371
  *
372
+ * This forces the file to be added to the index, not looking
373
+ * at gitignore rules. Those rules can be evaluated through
374
+ * the git_status APIs (in status.h) before calling this.
375
+ *
376
+ * If this file currently is the result of a merge conflict, this
377
+ * file will no longer be marked as conflicting. The data about
378
+ * the conflict will be moved to the "resolve undo" (REUC) section.
379
+ *
237
380
  * @param index an existing index object
238
381
  * @param path filename to add
239
- * @param stage stage for the entry
240
382
  * @return 0 or an error code
241
383
  */
242
- GIT_EXTERN(int) git_index_append(git_index *index, const char *path, int stage);
384
+ GIT_EXTERN(int) git_index_add_bypath(git_index *index, const char *path);
243
385
 
244
386
  /**
245
- * Add (append) an index entry from an in-memory struct
387
+ * Remove an index entry corresponding to a file on disk
246
388
  *
247
- * A new entry will always be inserted into the index;
248
- * if the index already contains an entry for the path
249
- * in the `entry` struct, the old entry will **not** be
250
- * replaced.
389
+ * The file `path` must be relative to the repository's
390
+ * working folder. It may exist.
251
391
  *
252
- * A full copy (including the 'path' string) of the given
253
- * 'source_entry' will be inserted on the index.
392
+ * If this file currently is the result of a merge conflict, this
393
+ * file will no longer be marked as conflicting. The data about
394
+ * the conflict will be moved to the "resolve undo" (REUC) section.
254
395
  *
255
396
  * @param index an existing index object
256
- * @param source_entry new entry object
397
+ * @param path filename to remove
257
398
  * @return 0 or an error code
258
399
  */
259
- GIT_EXTERN(int) git_index_append2(git_index *index, const git_index_entry *source_entry);
400
+ GIT_EXTERN(int) git_index_remove_bypath(git_index *index, const char *path);
260
401
 
261
402
  /**
262
- * Remove an entry from the index
403
+ * Find the first position of any entries which point to given
404
+ * path in the Git index.
263
405
  *
406
+ * @param at_pos the address to which the position of the index entry is written (optional)
264
407
  * @param index an existing index object
265
- * @param position position of the entry to remove
266
- * @return 0 or an error code
408
+ * @param path path to search
409
+ * @return a zero-based position in the index if found;
410
+ * GIT_ENOTFOUND otherwise
267
411
  */
268
- GIT_EXTERN(int) git_index_remove(git_index *index, int position);
412
+ GIT_EXTERN(int) git_index_find(size_t *at_pos, git_index *index, const char *path);
413
+
414
+ /**@}*/
269
415
 
416
+ /** @name Conflict Index Entry Functions
417
+ *
418
+ * These functions work on conflict index entries specifically (ie, stages 1-3)
419
+ */
420
+ /**@{*/
270
421
 
271
422
  /**
272
- * Get a pointer to one of the entries in the index
423
+ * Add or update index entries to represent a conflict
273
424
  *
274
- * This entry can be modified, and the changes will be written
275
- * back to disk on the next write() call.
425
+ * The entries are the entries from the tree included in the merge. Any
426
+ * entry may be null to indicate that that file was not present in the
427
+ * trees during the merge. For example, ancestor_entry may be NULL to
428
+ * indicate that a file was added in both branches and must be resolved.
276
429
  *
277
- * The entry should not be freed by the caller.
430
+ * @param index an existing index object
431
+ * @param ancestor_entry the entry data for the ancestor of the conflict
432
+ * @param our_entry the entry data for our side of the merge conflict
433
+ * @param their_entry the entry data for their side of the merge conflict
434
+ * @return 0 or an error code
435
+ */
436
+ GIT_EXTERN(int) git_index_conflict_add(
437
+ git_index *index,
438
+ const git_index_entry *ancestor_entry,
439
+ const git_index_entry *our_entry,
440
+ const git_index_entry *their_entry);
441
+
442
+ /**
443
+ * Get the index entries that represent a conflict of a single file.
444
+ *
445
+ * The values of this entry can be modified (except the paths)
446
+ * and the changes will be written back to disk on the next
447
+ * write() call.
278
448
  *
449
+ * @param ancestor_out Pointer to store the ancestor entry
450
+ * @param our_out Pointer to store the our entry
451
+ * @param their_out Pointer to store the their entry
279
452
  * @param index an existing index object
280
- * @param n the position of the entry
281
- * @return a pointer to the entry; NULL if out of bounds
453
+ * @param path path to search
282
454
  */
283
- GIT_EXTERN(git_index_entry *) git_index_get(git_index *index, size_t n);
455
+ GIT_EXTERN(int) git_index_conflict_get(git_index_entry **ancestor_out, git_index_entry **our_out, git_index_entry **their_out, git_index *index, const char *path);
284
456
 
285
457
  /**
286
- * Get the count of entries currently in the index
458
+ * Removes the index entries that represent a conflict of a single file.
287
459
  *
288
460
  * @param index an existing index object
289
- * @return integer of count of current entries
461
+ * @param path to search
462
+ */
463
+ GIT_EXTERN(int) git_index_conflict_remove(git_index *index, const char *path);
464
+
465
+ /**
466
+ * Remove all conflicts in the index (entries with a stage greater than 0.)
467
+ *
468
+ * @param index an existing index object
469
+ */
470
+ GIT_EXTERN(void) git_index_conflict_cleanup(git_index *index);
471
+
472
+ /**
473
+ * Determine if the index contains entries representing file conflicts.
474
+ *
475
+ * @return 1 if at least one conflict is found, 0 otherwise.
476
+ */
477
+ GIT_EXTERN(int) git_index_has_conflicts(const git_index *index);
478
+
479
+ /**@}*/
480
+
481
+ /** @name Resolve Undo (REUC) index entry manipulation.
482
+ *
483
+ * These functions work on the Resolve Undo index extension and contains
484
+ * data about the original files that led to a merge conflict.
485
+ */
486
+ /**@{*/
487
+
488
+ /**
489
+ * Get the count of resolve undo entries currently in the index.
490
+ *
491
+ * @param index an existing index object
492
+ * @return integer of count of current resolve undo entries
290
493
  */
291
- GIT_EXTERN(unsigned int) git_index_entrycount(git_index *index);
494
+ GIT_EXTERN(unsigned int) git_index_reuc_entrycount(git_index *index);
292
495
 
293
496
  /**
294
- * Get the count of unmerged entries currently in the index
497
+ * Finds the resolve undo entry that points to the given path in the Git
498
+ * index.
295
499
  *
500
+ * @param at_pos the address to which the position of the reuc entry is written (optional)
296
501
  * @param index an existing index object
297
- * @return integer of count of current unmerged entries
502
+ * @param path path to search
503
+ * @return 0 if found, < 0 otherwise (GIT_ENOTFOUND)
298
504
  */
299
- GIT_EXTERN(unsigned int) git_index_entrycount_unmerged(git_index *index);
505
+ GIT_EXTERN(int) git_index_reuc_find(size_t *at_pos, git_index *index, const char *path);
300
506
 
301
507
  /**
302
- * Get an unmerged entry from the index.
508
+ * Get a resolve undo entry from the index.
303
509
  *
304
510
  * The returned entry is read-only and should not be modified
305
- * of freed by the caller.
511
+ * or freed by the caller.
306
512
  *
307
513
  * @param index an existing index object
308
514
  * @param path path to search
309
- * @return the unmerged entry; NULL if not found
515
+ * @return the resolve undo entry; NULL if not found
310
516
  */
311
- GIT_EXTERN(const git_index_entry_unmerged *) git_index_get_unmerged_bypath(git_index *index, const char *path);
517
+ GIT_EXTERN(const git_index_reuc_entry *) git_index_reuc_get_bypath(git_index *index, const char *path);
312
518
 
313
519
  /**
314
- * Get an unmerged entry from the index.
520
+ * Get a resolve undo entry from the index.
315
521
  *
316
522
  * The returned entry is read-only and should not be modified
317
- * of freed by the caller.
523
+ * or freed by the caller.
318
524
  *
319
525
  * @param index an existing index object
320
526
  * @param n the position of the entry
321
- * @return a pointer to the unmerged entry; NULL if out of bounds
527
+ * @return a pointer to the resolve undo entry; NULL if out of bounds
322
528
  */
323
- GIT_EXTERN(const git_index_entry_unmerged *) git_index_get_unmerged_byindex(git_index *index, size_t n);
529
+ GIT_EXTERN(const git_index_reuc_entry *) git_index_reuc_get_byindex(git_index *index, size_t n);
324
530
 
325
531
  /**
326
- * Return the stage number from a git index entry
532
+ * Adds a resolve undo entry for a file based on the given parameters.
327
533
  *
328
- * This entry is calculated from the entry's flag
329
- * attribute like this:
534
+ * The resolve undo entry contains the OIDs of files that were involved
535
+ * in a merge conflict after the conflict has been resolved. This allows
536
+ * conflicts to be re-resolved later.
330
537
  *
331
- * (entry->flags & GIT_IDXENTRY_STAGEMASK) >> GIT_IDXENTRY_STAGESHIFT
538
+ * If there exists a resolve undo entry for the given path in the index,
539
+ * it will be removed.
332
540
  *
333
- * @param entry The entry
334
- * @returns the stage number
541
+ * This method will fail in bare index instances.
542
+ *
543
+ * @param index an existing index object
544
+ * @param path filename to add
545
+ * @param ancestor_mode mode of the ancestor file
546
+ * @param ancestor_id oid of the ancestor file
547
+ * @param our_mode mode of our file
548
+ * @param our_id oid of our file
549
+ * @param their_mode mode of their file
550
+ * @param their_id oid of their file
551
+ * @return 0 or an error code
335
552
  */
336
- GIT_EXTERN(int) git_index_entry_stage(const git_index_entry *entry);
553
+ GIT_EXTERN(int) git_index_reuc_add(git_index *index, const char *path,
554
+ int ancestor_mode, git_oid *ancestor_id,
555
+ int our_mode, git_oid *our_id,
556
+ int their_mode, git_oid *their_id);
337
557
 
338
558
  /**
339
- * Read a tree into the index file with stats
559
+ * Remove an resolve undo entry from the index
340
560
  *
341
- * The current index contents will be replaced by the specified tree. The total
342
- * node count is collected in stats.
561
+ * @param index an existing index object
562
+ * @param n position of the resolve undo entry to remove
563
+ * @return 0 or an error code
564
+ */
565
+ GIT_EXTERN(int) git_index_reuc_remove(git_index *index, size_t n);
566
+
567
+ /**
568
+ * Remove all resolve undo entries from the index
343
569
  *
344
570
  * @param index an existing index object
345
- * @param tree tree to read
346
- * @param stats structure that receives the total node count (may be NULL)
347
571
  * @return 0 or an error code
348
572
  */
349
- GIT_EXTERN(int) git_index_read_tree(git_index *index, git_tree *tree, git_indexer_stats *stats);
573
+ GIT_EXTERN(void) git_index_reuc_clear(git_index *index);
574
+
575
+ /**@}*/
350
576
 
351
577
  /** @} */
352
578
  GIT_END_DECL