rugged 0.16.0 → 0.17.0b1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (392) hide show
  1. data/README.md +373 -243
  2. data/Rakefile +22 -0
  3. data/ext/rugged/extconf.rb +9 -6
  4. data/ext/rugged/rugged.c +123 -31
  5. data/ext/rugged/rugged.h +11 -10
  6. data/ext/rugged/rugged_blob.c +181 -18
  7. data/ext/rugged/rugged_commit.c +196 -18
  8. data/ext/rugged/rugged_config.c +94 -5
  9. data/ext/rugged/rugged_object.c +54 -1
  10. data/ext/rugged/rugged_reference.c +203 -15
  11. data/ext/rugged/{remote.c → rugged_remote.c} +35 -10
  12. data/ext/rugged/rugged_repo.c +323 -81
  13. data/ext/rugged/rugged_revwalk.c +57 -4
  14. data/ext/rugged/rugged_signature.c +3 -3
  15. data/ext/rugged/rugged_tag.c +72 -1
  16. data/ext/rugged/rugged_tree.c +70 -2
  17. data/ext/rugged/vendor/libgit2-dist/deps/regex/config.h +7 -0
  18. data/ext/rugged/vendor/libgit2-dist/deps/regex/regcomp.c +3856 -0
  19. data/ext/rugged/vendor/libgit2-dist/deps/regex/regex.c +85 -0
  20. data/ext/rugged/vendor/libgit2-dist/deps/regex/regex.h +582 -0
  21. data/ext/rugged/vendor/libgit2-dist/deps/regex/regex_internal.c +1744 -0
  22. data/ext/rugged/vendor/libgit2-dist/deps/regex/regex_internal.h +810 -0
  23. data/ext/rugged/vendor/libgit2-dist/deps/regex/regexec.c +4369 -0
  24. data/ext/rugged/vendor/libgit2-dist/examples/diff.c +238 -0
  25. data/ext/rugged/vendor/libgit2-dist/examples/general.c +4 -4
  26. data/ext/rugged/vendor/libgit2-dist/examples/network/fetch.c +101 -85
  27. data/ext/rugged/vendor/libgit2-dist/examples/network/git2.c +7 -3
  28. data/ext/rugged/vendor/libgit2-dist/examples/network/index-pack.c +80 -25
  29. data/ext/rugged/vendor/libgit2-dist/examples/network/ls-remote.c +6 -6
  30. data/ext/rugged/vendor/libgit2-dist/include/git2/attr.h +224 -0
  31. data/ext/rugged/vendor/libgit2-dist/include/git2/blob.h +59 -5
  32. data/ext/rugged/vendor/libgit2-dist/include/git2/branch.h +114 -7
  33. data/ext/rugged/vendor/libgit2-dist/include/git2/commit.h +14 -7
  34. data/ext/rugged/vendor/libgit2-dist/include/git2/common.h +4 -3
  35. data/ext/rugged/vendor/libgit2-dist/include/git2/config.h +105 -27
  36. data/ext/rugged/vendor/libgit2-dist/include/git2/diff.h +409 -0
  37. data/ext/rugged/vendor/libgit2-dist/include/git2/errors.h +47 -82
  38. data/ext/rugged/vendor/libgit2-dist/include/git2/index.h +25 -10
  39. data/ext/rugged/vendor/libgit2-dist/include/git2/indexer.h +46 -1
  40. data/ext/rugged/vendor/libgit2-dist/include/git2/merge.h +35 -0
  41. data/ext/rugged/vendor/libgit2-dist/include/git2/net.h +1 -1
  42. data/ext/rugged/vendor/libgit2-dist/include/git2/notes.h +139 -0
  43. data/ext/rugged/vendor/libgit2-dist/include/git2/object.h +5 -5
  44. data/ext/rugged/vendor/libgit2-dist/include/git2/odb.h +13 -13
  45. data/ext/rugged/vendor/libgit2-dist/include/git2/odb_backend.h +8 -8
  46. data/ext/rugged/vendor/libgit2-dist/include/git2/oid.h +14 -9
  47. data/ext/rugged/vendor/libgit2-dist/include/git2/reflog.h +5 -5
  48. data/ext/rugged/vendor/libgit2-dist/include/git2/refs.h +37 -17
  49. data/ext/rugged/vendor/libgit2-dist/include/git2/refspec.h +17 -9
  50. data/ext/rugged/vendor/libgit2-dist/include/git2/remote.h +83 -16
  51. data/ext/rugged/vendor/libgit2-dist/include/git2/repository.h +24 -10
  52. data/ext/rugged/vendor/libgit2-dist/include/git2/reset.h +44 -0
  53. data/ext/rugged/vendor/libgit2-dist/include/git2/revparse.h +36 -0
  54. data/ext/rugged/vendor/libgit2-dist/include/git2/revwalk.h +74 -6
  55. data/ext/rugged/vendor/libgit2-dist/include/git2/signature.h +3 -3
  56. data/ext/rugged/vendor/libgit2-dist/include/git2/status.h +120 -19
  57. data/ext/rugged/vendor/libgit2-dist/include/git2/submodule.h +103 -0
  58. data/ext/rugged/vendor/libgit2-dist/include/git2/tag.h +28 -10
  59. data/ext/rugged/vendor/libgit2-dist/include/git2/threads.h +1 -1
  60. data/ext/rugged/vendor/libgit2-dist/include/git2/tree.h +13 -13
  61. data/ext/rugged/vendor/libgit2-dist/include/git2/types.h +16 -2
  62. data/ext/rugged/vendor/libgit2-dist/include/git2/version.h +3 -3
  63. data/ext/rugged/vendor/libgit2-dist/include/git2/windows.h +1 -1
  64. data/ext/rugged/vendor/libgit2-dist/include/git2.h +7 -2
  65. data/ext/rugged/vendor/libgit2-dist/src/attr.c +677 -0
  66. data/ext/rugged/vendor/libgit2-dist/src/attr.h +56 -0
  67. data/ext/rugged/vendor/libgit2-dist/src/attr_file.c +609 -0
  68. data/ext/rugged/vendor/libgit2-dist/src/attr_file.h +145 -0
  69. data/ext/rugged/vendor/libgit2-dist/src/blob.c +213 -60
  70. data/ext/rugged/vendor/libgit2-dist/src/blob.h +2 -1
  71. data/ext/rugged/vendor/libgit2-dist/src/branch.c +208 -0
  72. data/ext/rugged/vendor/libgit2-dist/src/branch.h +17 -0
  73. data/ext/rugged/vendor/libgit2-dist/src/bswap.h +1 -1
  74. data/ext/rugged/vendor/libgit2-dist/src/buffer.c +395 -46
  75. data/ext/rugged/vendor/libgit2-dist/src/buffer.h +112 -9
  76. data/ext/rugged/vendor/libgit2-dist/src/cache.c +37 -49
  77. data/ext/rugged/vendor/libgit2-dist/src/cache.h +7 -17
  78. data/ext/rugged/vendor/libgit2-dist/src/cc-compat.h +18 -16
  79. data/ext/rugged/vendor/libgit2-dist/src/commit.c +56 -90
  80. data/ext/rugged/vendor/libgit2-dist/src/commit.h +1 -1
  81. data/ext/rugged/vendor/libgit2-dist/src/common.h +12 -5
  82. data/ext/rugged/vendor/libgit2-dist/src/{win32 → compat}/fnmatch.c +1 -1
  83. data/ext/rugged/vendor/libgit2-dist/src/{win32 → compat}/fnmatch.h +3 -3
  84. data/ext/rugged/vendor/libgit2-dist/src/config.c +247 -158
  85. data/ext/rugged/vendor/libgit2-dist/src/config.h +10 -1
  86. data/ext/rugged/vendor/libgit2-dist/src/config_cache.c +94 -0
  87. data/ext/rugged/vendor/libgit2-dist/src/config_file.c +606 -496
  88. data/ext/rugged/vendor/libgit2-dist/src/config_file.h +31 -0
  89. data/ext/rugged/vendor/libgit2-dist/src/crlf.c +228 -0
  90. data/ext/rugged/vendor/libgit2-dist/src/date.c +876 -0
  91. data/ext/rugged/vendor/libgit2-dist/src/delta-apply.c +15 -9
  92. data/ext/rugged/vendor/libgit2-dist/src/delta-apply.h +2 -2
  93. data/ext/rugged/vendor/libgit2-dist/src/diff.c +814 -0
  94. data/ext/rugged/vendor/libgit2-dist/src/diff.h +43 -0
  95. data/ext/rugged/vendor/libgit2-dist/src/diff_output.c +794 -0
  96. data/ext/rugged/vendor/libgit2-dist/src/errors.c +89 -74
  97. data/ext/rugged/vendor/libgit2-dist/src/fetch.c +94 -66
  98. data/ext/rugged/vendor/libgit2-dist/src/fetch.h +5 -4
  99. data/ext/rugged/vendor/libgit2-dist/src/filebuf.c +157 -100
  100. data/ext/rugged/vendor/libgit2-dist/src/filebuf.h +22 -8
  101. data/ext/rugged/vendor/libgit2-dist/src/fileops.c +330 -206
  102. data/ext/rugged/vendor/libgit2-dist/src/fileops.h +82 -51
  103. data/ext/rugged/vendor/libgit2-dist/src/filter.c +165 -0
  104. data/ext/rugged/vendor/libgit2-dist/src/filter.h +119 -0
  105. data/ext/rugged/vendor/libgit2-dist/src/global.c +4 -4
  106. data/ext/rugged/vendor/libgit2-dist/src/global.h +4 -1
  107. data/ext/rugged/vendor/libgit2-dist/src/hash.c +1 -1
  108. data/ext/rugged/vendor/libgit2-dist/src/hash.h +1 -1
  109. data/ext/rugged/vendor/libgit2-dist/src/ignore.c +203 -0
  110. data/ext/rugged/vendor/libgit2-dist/src/ignore.h +38 -0
  111. data/ext/rugged/vendor/libgit2-dist/src/index.c +220 -169
  112. data/ext/rugged/vendor/libgit2-dist/src/index.h +5 -1
  113. data/ext/rugged/vendor/libgit2-dist/src/indexer.c +601 -102
  114. data/ext/rugged/vendor/libgit2-dist/src/iterator.c +748 -0
  115. data/ext/rugged/vendor/libgit2-dist/src/iterator.h +151 -0
  116. data/ext/rugged/vendor/libgit2-dist/src/khash.h +608 -0
  117. data/ext/rugged/vendor/libgit2-dist/src/map.h +6 -1
  118. data/ext/rugged/vendor/libgit2-dist/src/message.c +61 -0
  119. data/ext/rugged/vendor/libgit2-dist/src/message.h +14 -0
  120. data/ext/rugged/vendor/libgit2-dist/src/mwindow.c +27 -29
  121. data/ext/rugged/vendor/libgit2-dist/src/mwindow.h +4 -4
  122. data/ext/rugged/vendor/libgit2-dist/src/netops.c +375 -56
  123. data/ext/rugged/vendor/libgit2-dist/src/netops.h +12 -9
  124. data/ext/rugged/vendor/libgit2-dist/src/notes.c +548 -0
  125. data/ext/rugged/vendor/libgit2-dist/src/notes.h +28 -0
  126. data/ext/rugged/vendor/libgit2-dist/src/object.c +59 -21
  127. data/ext/rugged/vendor/libgit2-dist/src/odb.c +212 -175
  128. data/ext/rugged/vendor/libgit2-dist/src/odb.h +39 -2
  129. data/ext/rugged/vendor/libgit2-dist/src/odb_loose.c +238 -241
  130. data/ext/rugged/vendor/libgit2-dist/src/odb_pack.c +94 -106
  131. data/ext/rugged/vendor/libgit2-dist/src/oid.c +59 -60
  132. data/ext/rugged/vendor/libgit2-dist/src/oidmap.h +42 -0
  133. data/ext/rugged/vendor/libgit2-dist/src/pack.c +198 -170
  134. data/ext/rugged/vendor/libgit2-dist/src/pack.h +16 -9
  135. data/ext/rugged/vendor/libgit2-dist/src/path.c +496 -106
  136. data/ext/rugged/vendor/libgit2-dist/src/path.h +214 -20
  137. data/ext/rugged/vendor/libgit2-dist/src/pkt.c +88 -159
  138. data/ext/rugged/vendor/libgit2-dist/src/pkt.h +9 -5
  139. data/ext/rugged/vendor/libgit2-dist/src/pool.c +294 -0
  140. data/ext/rugged/vendor/libgit2-dist/src/pool.h +125 -0
  141. data/ext/rugged/vendor/libgit2-dist/src/posix.c +38 -16
  142. data/ext/rugged/vendor/libgit2-dist/src/posix.h +20 -2
  143. data/ext/rugged/vendor/libgit2-dist/src/ppc/sha1.c +1 -1
  144. data/ext/rugged/vendor/libgit2-dist/src/ppc/sha1.h +1 -1
  145. data/ext/rugged/vendor/libgit2-dist/src/pqueue.c +7 -7
  146. data/ext/rugged/vendor/libgit2-dist/src/pqueue.h +1 -1
  147. data/ext/rugged/vendor/libgit2-dist/src/protocol.c +21 -13
  148. data/ext/rugged/vendor/libgit2-dist/src/protocol.h +1 -1
  149. data/ext/rugged/vendor/libgit2-dist/src/reflog.c +125 -103
  150. data/ext/rugged/vendor/libgit2-dist/src/reflog.h +1 -1
  151. data/ext/rugged/vendor/libgit2-dist/src/refs.c +713 -640
  152. data/ext/rugged/vendor/libgit2-dist/src/refs.h +27 -3
  153. data/ext/rugged/vendor/libgit2-dist/src/refspec.c +51 -17
  154. data/ext/rugged/vendor/libgit2-dist/src/refspec.h +13 -1
  155. data/ext/rugged/vendor/libgit2-dist/src/remote.c +307 -119
  156. data/ext/rugged/vendor/libgit2-dist/src/remote.h +3 -2
  157. data/ext/rugged/vendor/libgit2-dist/src/repository.c +593 -442
  158. data/ext/rugged/vendor/libgit2-dist/src/repository.h +80 -2
  159. data/ext/rugged/vendor/libgit2-dist/src/reset.c +103 -0
  160. data/ext/rugged/vendor/libgit2-dist/src/revparse.c +753 -0
  161. data/ext/rugged/vendor/libgit2-dist/src/revwalk.c +434 -158
  162. data/ext/rugged/vendor/libgit2-dist/src/sha1.c +3 -3
  163. data/ext/rugged/vendor/libgit2-dist/src/sha1.h +2 -2
  164. data/ext/rugged/vendor/libgit2-dist/src/sha1_lookup.c +3 -2
  165. data/ext/rugged/vendor/libgit2-dist/src/sha1_lookup.h +1 -1
  166. data/ext/rugged/vendor/libgit2-dist/src/signature.c +69 -80
  167. data/ext/rugged/vendor/libgit2-dist/src/signature.h +1 -1
  168. data/ext/rugged/vendor/libgit2-dist/src/status.c +184 -638
  169. data/ext/rugged/vendor/libgit2-dist/src/strmap.h +64 -0
  170. data/ext/rugged/vendor/libgit2-dist/src/submodule.c +387 -0
  171. data/ext/rugged/vendor/libgit2-dist/src/tag.c +162 -137
  172. data/ext/rugged/vendor/libgit2-dist/src/tag.h +2 -1
  173. data/ext/rugged/vendor/libgit2-dist/src/thread-utils.c +1 -1
  174. data/ext/rugged/vendor/libgit2-dist/src/thread-utils.h +8 -8
  175. data/ext/rugged/vendor/libgit2-dist/src/transport.c +31 -19
  176. data/ext/rugged/vendor/libgit2-dist/src/transport.h +31 -11
  177. data/ext/rugged/vendor/libgit2-dist/src/transports/git.c +168 -193
  178. data/ext/rugged/vendor/libgit2-dist/src/transports/http.c +192 -241
  179. data/ext/rugged/vendor/libgit2-dist/src/transports/local.c +92 -86
  180. data/ext/rugged/vendor/libgit2-dist/src/tree-cache.c +32 -49
  181. data/ext/rugged/vendor/libgit2-dist/src/tree-cache.h +1 -1
  182. data/ext/rugged/vendor/libgit2-dist/src/tree.c +172 -145
  183. data/ext/rugged/vendor/libgit2-dist/src/tree.h +16 -2
  184. data/ext/rugged/vendor/libgit2-dist/src/tsort.c +16 -14
  185. data/ext/rugged/vendor/libgit2-dist/src/unix/map.c +8 -24
  186. data/ext/rugged/vendor/libgit2-dist/src/unix/posix.h +9 -3
  187. data/ext/rugged/vendor/libgit2-dist/src/util.c +94 -38
  188. data/ext/rugged/vendor/libgit2-dist/src/util.h +119 -13
  189. data/ext/rugged/vendor/libgit2-dist/src/vector.c +84 -31
  190. data/ext/rugged/vendor/libgit2-dist/src/vector.h +37 -4
  191. data/ext/rugged/vendor/libgit2-dist/src/win32/dir.c +81 -41
  192. data/ext/rugged/vendor/libgit2-dist/src/{dir.h → win32/dir.h} +4 -9
  193. data/ext/rugged/vendor/libgit2-dist/src/win32/map.c +19 -35
  194. data/ext/rugged/vendor/libgit2-dist/src/win32/mingw-compat.h +1 -1
  195. data/ext/rugged/vendor/libgit2-dist/src/win32/msvc-compat.h +5 -1
  196. data/ext/rugged/vendor/libgit2-dist/src/win32/posix.h +10 -8
  197. data/ext/rugged/vendor/libgit2-dist/src/win32/posix_w32.c +262 -118
  198. data/ext/rugged/vendor/libgit2-dist/src/win32/pthread.c +12 -9
  199. data/ext/rugged/vendor/libgit2-dist/src/win32/pthread.h +1 -1
  200. data/ext/rugged/vendor/libgit2-dist/src/win32/utf-conv.c +30 -26
  201. data/ext/rugged/vendor/libgit2-dist/src/win32/utf-conv.h +2 -1
  202. data/ext/rugged/vendor/libgit2-dist/src/xdiff/xdiff.h +135 -0
  203. data/ext/rugged/vendor/libgit2-dist/src/xdiff/xdiffi.c +572 -0
  204. data/ext/rugged/vendor/libgit2-dist/src/xdiff/xdiffi.h +63 -0
  205. data/ext/rugged/vendor/libgit2-dist/src/xdiff/xemit.c +253 -0
  206. data/ext/rugged/vendor/libgit2-dist/src/xdiff/xemit.h +36 -0
  207. data/ext/rugged/vendor/libgit2-dist/src/xdiff/xhistogram.c +371 -0
  208. data/ext/rugged/vendor/libgit2-dist/src/xdiff/xinclude.h +46 -0
  209. data/ext/rugged/vendor/libgit2-dist/src/xdiff/xmacros.h +54 -0
  210. data/ext/rugged/vendor/libgit2-dist/src/xdiff/xmerge.c +619 -0
  211. data/ext/rugged/vendor/libgit2-dist/src/xdiff/xpatience.c +358 -0
  212. data/ext/rugged/vendor/libgit2-dist/src/xdiff/xprepare.c +483 -0
  213. data/ext/rugged/vendor/libgit2-dist/src/xdiff/xprepare.h +34 -0
  214. data/ext/rugged/vendor/libgit2-dist/src/xdiff/xtypes.h +67 -0
  215. data/ext/rugged/vendor/libgit2-dist/src/xdiff/xutils.c +419 -0
  216. data/ext/rugged/vendor/libgit2-dist/src/xdiff/xutils.h +49 -0
  217. data/ext/rugged/vendor/libgit2-dist/tests-clar/attr/attr_expect.h +43 -0
  218. data/ext/rugged/vendor/libgit2-dist/tests-clar/attr/file.c +226 -0
  219. data/ext/rugged/vendor/libgit2-dist/tests-clar/attr/flags.c +108 -0
  220. data/ext/rugged/vendor/libgit2-dist/tests-clar/attr/lookup.c +262 -0
  221. data/ext/rugged/vendor/libgit2-dist/tests-clar/attr/repo.c +273 -0
  222. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/buf/basic.c +5 -5
  223. data/ext/rugged/vendor/libgit2-dist/tests-clar/clar_helpers.c +181 -0
  224. data/ext/rugged/vendor/libgit2-dist/tests-clar/clar_libgit2.h +55 -0
  225. data/ext/rugged/vendor/libgit2-dist/tests-clar/commit/commit.c +44 -0
  226. data/ext/rugged/vendor/libgit2-dist/tests-clar/commit/parse.c +350 -0
  227. data/ext/rugged/vendor/libgit2-dist/tests-clar/commit/signature.c +65 -0
  228. data/ext/rugged/vendor/libgit2-dist/tests-clar/commit/write.c +140 -0
  229. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/config/add.c +3 -3
  230. data/ext/rugged/vendor/libgit2-dist/tests-clar/config/multivar.c +151 -0
  231. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/config/new.c +5 -5
  232. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/config/read.c +44 -32
  233. data/ext/rugged/vendor/libgit2-dist/tests-clar/config/stress.c +61 -0
  234. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/config/write.c +20 -5
  235. data/ext/rugged/vendor/libgit2-dist/tests-clar/core/buffer.c +613 -0
  236. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/core/dirent.c +39 -26
  237. data/ext/rugged/vendor/libgit2-dist/tests-clar/core/env.c +115 -0
  238. data/ext/rugged/vendor/libgit2-dist/tests-clar/core/errors.c +60 -0
  239. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/core/filebuf.c +4 -18
  240. data/ext/rugged/vendor/libgit2-dist/tests-clar/core/hex.c +22 -0
  241. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/core/oid.c +6 -6
  242. data/ext/rugged/vendor/libgit2-dist/tests-clar/core/path.c +420 -0
  243. data/ext/rugged/vendor/libgit2-dist/tests-clar/core/pool.c +85 -0
  244. data/ext/rugged/vendor/libgit2-dist/tests-clar/core/rmdir.c +68 -0
  245. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/core/string.c +1 -1
  246. data/ext/rugged/vendor/libgit2-dist/tests-clar/core/strmap.c +102 -0
  247. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/core/strtol.c +1 -1
  248. data/ext/rugged/vendor/libgit2-dist/tests-clar/core/vector.c +191 -0
  249. data/ext/rugged/vendor/libgit2-dist/tests-clar/date/date.c +15 -0
  250. data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/blob.c +254 -0
  251. data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/diff_helpers.c +104 -0
  252. data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/diff_helpers.h +47 -0
  253. data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/index.c +92 -0
  254. data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/iterator.c +572 -0
  255. data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/patch.c +99 -0
  256. data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/tree.c +210 -0
  257. data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/workdir.c +543 -0
  258. data/ext/rugged/vendor/libgit2-dist/tests-clar/index/read_tree.c +46 -0
  259. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/index/rename.c +2 -12
  260. data/ext/rugged/vendor/libgit2-dist/tests-clar/index/tests.c +246 -0
  261. data/ext/rugged/vendor/libgit2-dist/tests-clar/network/createremotethenload.c +33 -0
  262. data/ext/rugged/vendor/libgit2-dist/tests-clar/network/remotelocal.c +137 -0
  263. data/ext/rugged/vendor/libgit2-dist/tests-clar/network/remotes.c +183 -0
  264. data/ext/rugged/vendor/libgit2-dist/tests-clar/notes/notes.c +133 -0
  265. data/ext/rugged/vendor/libgit2-dist/tests-clar/notes/notesref.c +57 -0
  266. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/blob/filter.c +125 -0
  267. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/blob/fromchunks.c +87 -0
  268. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/blob/write.c +69 -0
  269. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/commit/commitstagedfile.c +126 -0
  270. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/lookup.c +63 -0
  271. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/message.c +171 -0
  272. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/object/raw/chars.c +3 -14
  273. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/object/raw/compare.c +4 -4
  274. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/object/raw/convert.c +10 -10
  275. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/object/raw/data.h +0 -0
  276. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/object/raw/fromstr.c +1 -1
  277. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/object/raw/hash.c +21 -17
  278. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/object/raw/short.c +1 -1
  279. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/object/raw/size.c +1 -1
  280. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/object/raw/type2string.c +14 -14
  281. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/raw/write.c +455 -0
  282. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/tag/peel.c +56 -0
  283. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/tag/read.c +130 -0
  284. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/tag/write.c +192 -0
  285. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/object/tree/frompath.c +22 -16
  286. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/tree/read.c +75 -0
  287. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/tree/write.c +84 -0
  288. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/odb/loose.c +1 -1
  289. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/odb/loose_data.h +0 -0
  290. data/ext/rugged/vendor/libgit2-dist/tests-clar/odb/mixed.c +24 -0
  291. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/odb/pack_data.h +0 -0
  292. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/odb/packed.c +1 -1
  293. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/odb/sorting.c +1 -1
  294. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/branches/create.c +113 -0
  295. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/branches/delete.c +91 -0
  296. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/branches/listall.c +78 -0
  297. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/branches/move.c +72 -0
  298. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/crashes.c +17 -0
  299. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/create.c +149 -0
  300. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/delete.c +85 -0
  301. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/list.c +53 -0
  302. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/listall.c +36 -0
  303. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/lookup.c +42 -0
  304. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/normalize.c +200 -0
  305. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/overwrite.c +136 -0
  306. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/pack.c +67 -0
  307. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/read.c +194 -0
  308. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/reflog.c +123 -0
  309. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/rename.c +339 -0
  310. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/revparse.c +174 -0
  311. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/unicode.c +42 -0
  312. data/ext/rugged/vendor/libgit2-dist/tests-clar/repo/discover.c +142 -0
  313. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/repo/getters.c +19 -1
  314. data/ext/rugged/vendor/libgit2-dist/tests-clar/repo/init.c +235 -0
  315. data/ext/rugged/vendor/libgit2-dist/tests-clar/repo/open.c +282 -0
  316. data/ext/rugged/vendor/libgit2-dist/tests-clar/repo/setters.c +80 -0
  317. data/ext/rugged/vendor/libgit2-dist/tests-clar/reset/mixed.c +47 -0
  318. data/ext/rugged/vendor/libgit2-dist/tests-clar/reset/reset_helpers.c +10 -0
  319. data/ext/rugged/vendor/libgit2-dist/tests-clar/reset/reset_helpers.h +6 -0
  320. data/ext/rugged/vendor/libgit2-dist/tests-clar/reset/soft.c +102 -0
  321. data/ext/rugged/vendor/libgit2-dist/{tests/t05-revwalk.c → tests-clar/revwalk/basic.c} +85 -44
  322. data/ext/rugged/vendor/libgit2-dist/tests-clar/revwalk/mergebase.c +148 -0
  323. data/ext/rugged/vendor/libgit2-dist/tests-clar/status/ignore.c +133 -0
  324. data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/status/single.c +2 -11
  325. data/ext/rugged/vendor/libgit2-dist/tests-clar/status/status_data.h +202 -0
  326. data/ext/rugged/vendor/libgit2-dist/tests-clar/status/status_helpers.c +49 -0
  327. data/ext/rugged/vendor/libgit2-dist/tests-clar/status/status_helpers.h +33 -0
  328. data/ext/rugged/vendor/libgit2-dist/tests-clar/status/submodules.c +112 -0
  329. data/ext/rugged/vendor/libgit2-dist/tests-clar/status/worktree.c +649 -0
  330. data/ext/rugged/vendor/libgit2-dist/tests-clar/threads/basic.c +20 -0
  331. data/ext/rugged/vendor/libgit2-dist.tar.gz +0 -0
  332. data/lib/rugged/commit.rb +35 -0
  333. data/lib/rugged/object.rb +7 -0
  334. data/lib/rugged/reference.rb +9 -0
  335. data/lib/rugged/repository.rb +99 -3
  336. data/lib/rugged/tag.rb +22 -0
  337. data/lib/rugged/tree.rb +8 -0
  338. data/lib/rugged/version.rb +1 -1
  339. data/lib/rugged.rb +4 -1
  340. data/test/blob_test.rb +2 -2
  341. data/test/commit_test.rb +27 -13
  342. data/test/config_test.rb +44 -0
  343. data/test/coverage/HEAD.json +1 -1
  344. data/test/fixtures/testrepo.git/config +2 -0
  345. data/test/fixtures/testrepo.git/objects/7f/043268ea43ce18e3540acaabf9e090c91965b0 +0 -0
  346. data/test/lib_test.rb +7 -0
  347. data/test/object_test.rb +3 -3
  348. data/test/reference_test.rb +46 -8
  349. data/test/remote_test.rb +8 -2
  350. data/test/repo_pack_test.rb +3 -3
  351. data/test/repo_test.rb +79 -11
  352. data/test/tag_test.rb +9 -2
  353. data/test/test_helper.rb +21 -0
  354. data/test/tree_test.rb +18 -6
  355. metadata +205 -81
  356. data/ext/rugged/vendor/libgit2-dist/include/git2/zlib.h +0 -40
  357. data/ext/rugged/vendor/libgit2-dist/src/hashtable.c +0 -243
  358. data/ext/rugged/vendor/libgit2-dist/src/hashtable.h +0 -80
  359. data/ext/rugged/vendor/libgit2-dist/tests/t00-core.c +0 -628
  360. data/ext/rugged/vendor/libgit2-dist/tests/t01-data.h +0 -322
  361. data/ext/rugged/vendor/libgit2-dist/tests/t01-rawobj.c +0 -638
  362. data/ext/rugged/vendor/libgit2-dist/tests/t03-data.h +0 -344
  363. data/ext/rugged/vendor/libgit2-dist/tests/t03-objwrite.c +0 -255
  364. data/ext/rugged/vendor/libgit2-dist/tests/t04-commit.c +0 -788
  365. data/ext/rugged/vendor/libgit2-dist/tests/t06-index.c +0 -219
  366. data/ext/rugged/vendor/libgit2-dist/tests/t07-hashtable.c +0 -192
  367. data/ext/rugged/vendor/libgit2-dist/tests/t08-tag.c +0 -357
  368. data/ext/rugged/vendor/libgit2-dist/tests/t09-tree.c +0 -221
  369. data/ext/rugged/vendor/libgit2-dist/tests/t10-refs.c +0 -1294
  370. data/ext/rugged/vendor/libgit2-dist/tests/t12-repo.c +0 -174
  371. data/ext/rugged/vendor/libgit2-dist/tests/t13-threads.c +0 -41
  372. data/ext/rugged/vendor/libgit2-dist/tests/t17-bufs.c +0 -61
  373. data/ext/rugged/vendor/libgit2-dist/tests/t18-status.c +0 -448
  374. data/ext/rugged/vendor/libgit2-dist/tests/test_helpers.c +0 -310
  375. data/ext/rugged/vendor/libgit2-dist/tests/test_helpers.h +0 -83
  376. data/ext/rugged/vendor/libgit2-dist/tests/test_lib.c +0 -198
  377. data/ext/rugged/vendor/libgit2-dist/tests/test_lib.h +0 -54
  378. data/ext/rugged/vendor/libgit2-dist/tests/test_main.c +0 -89
  379. data/ext/rugged/vendor/libgit2-dist/tests-clay/clay.h +0 -187
  380. data/ext/rugged/vendor/libgit2-dist/tests-clay/clay_libgit2.h +0 -28
  381. data/ext/rugged/vendor/libgit2-dist/tests-clay/clay_main.c +0 -1073
  382. data/ext/rugged/vendor/libgit2-dist/tests-clay/config/stress.c +0 -39
  383. data/ext/rugged/vendor/libgit2-dist/tests-clay/core/path.c +0 -139
  384. data/ext/rugged/vendor/libgit2-dist/tests-clay/core/rmdir.c +0 -50
  385. data/ext/rugged/vendor/libgit2-dist/tests-clay/core/vector.c +0 -66
  386. data/ext/rugged/vendor/libgit2-dist/tests-clay/network/remotes.c +0 -50
  387. data/ext/rugged/vendor/libgit2-dist/tests-clay/repo/init.c +0 -104
  388. data/ext/rugged/vendor/libgit2-dist/tests-clay/repo/open.c +0 -54
  389. data/ext/rugged/vendor/libgit2-dist/tests-clay/status/status_data.h +0 -48
  390. data/ext/rugged/vendor/libgit2-dist/tests-clay/status/worktree.c +0 -124
  391. data/lib/rugged/objects.rb +0 -45
  392. data/test/fixtures/testrepo.git/refs/heads/new_name +0 -1
@@ -2,17 +2,17 @@
2
2
  * The MIT License
3
3
  *
4
4
  * Copyright (c) 2011 GitHub, Inc
5
- *
5
+ *
6
6
  * Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  * of this software and associated documentation files (the "Software"), to deal
8
8
  * in the Software without restriction, including without limitation the rights
9
9
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
10
  * copies of the Software, and to permit persons to whom the Software is
11
11
  * furnished to do so, subject to the following conditions:
12
- *
12
+ *
13
13
  * The above copyright notice and this permission notice shall be included in
14
14
  * all copies or substantial portions of the Software.
15
- *
15
+ *
16
16
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
17
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
18
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -47,6 +47,13 @@ VALUE rugged_ref_new(VALUE klass, VALUE owner, git_reference *ref)
47
47
  return rb_ref;
48
48
  }
49
49
 
50
+ /*
51
+ * call-seq:
52
+ * Reference.pack_all(repository)
53
+ *
54
+ * Pack all the references in +repository+ into the +packed_refs+
55
+ * file.
56
+ */
50
57
  static VALUE rb_git_ref_packall(VALUE klass, VALUE rb_repo)
51
58
  {
52
59
  git_repository *repo;
@@ -63,18 +70,23 @@ static VALUE rb_git_ref_packall(VALUE klass, VALUE rb_repo)
63
70
  return Qnil;
64
71
  }
65
72
 
66
- int ref_foreach__list(const char *ref_name, void *opaque)
67
- {
68
- rb_ary_push((VALUE)opaque, rugged_str_new2(ref_name, NULL));
69
- return GIT_SUCCESS;
70
- }
71
-
72
- int ref_foreach__block(const char *ref_name, void *opaque)
73
+ static int ref_foreach__block(const char *ref_name, void *opaque)
73
74
  {
74
75
  rb_funcall((VALUE)opaque, rb_intern("call"), 1, rugged_str_new2(ref_name, NULL));
75
- return GIT_SUCCESS;
76
+ return GIT_OK;
76
77
  }
77
78
 
79
+ /*
80
+ * call-seq:
81
+ * Reference.each(repository, filter = :all) { |ref_name| block }
82
+ * Reference.each(repository, filter = :all) -> Iterator
83
+ *
84
+ * Iterate through all the references in +repository+. Iteration can be
85
+ * optionally filtered to only +:direct+ or +:symbolic+ references.
86
+ *
87
+ * The given block will be called once with the name of each reference.
88
+ * If no block is given, an iterator will be returned.
89
+ */
78
90
  static VALUE rb_git_ref_each(int argc, VALUE *argv, VALUE self)
79
91
  {
80
92
  git_repository *repo;
@@ -112,6 +124,13 @@ static VALUE rb_git_ref_each(int argc, VALUE *argv, VALUE self)
112
124
  return Qnil;
113
125
  }
114
126
 
127
+ /*
128
+ * call-seq:
129
+ * Reference.lookup(repository, ref_name) -> new_ref
130
+ *
131
+ * Lookup a reference from the +repository+.
132
+ * Returns a new +Rugged::Reference+ object.
133
+ */
115
134
  static VALUE rb_git_ref_lookup(VALUE klass, VALUE rb_repo, VALUE rb_name)
116
135
  {
117
136
  git_repository *repo;
@@ -122,11 +141,52 @@ static VALUE rb_git_ref_lookup(VALUE klass, VALUE rb_repo, VALUE rb_name)
122
141
  Check_Type(rb_name, T_STRING);
123
142
 
124
143
  error = git_reference_lookup(&ref, repo, StringValueCStr(rb_name));
125
- rugged_exception_check(error);
144
+ if (error == GIT_ENOTFOUND)
145
+ return Qnil;
146
+ else
147
+ rugged_exception_check(error);
126
148
 
127
149
  return rugged_ref_new(klass, rb_repo, ref);
128
150
  }
129
151
 
152
+ /*
153
+ * call-seq:
154
+ * Reference.exist?(repository, ref_name) -> true or false
155
+ * Reference.exists?(repository, ref_name) -> true or false
156
+ *
157
+ * Check if a given reference exists on +repository+.
158
+ */
159
+ static VALUE rb_git_ref_exist(VALUE klass, VALUE rb_repo, VALUE rb_name)
160
+ {
161
+ git_repository *repo;
162
+ git_reference *ref;
163
+ int error;
164
+
165
+ Data_Get_Struct(rb_repo, git_repository, repo);
166
+ Check_Type(rb_name, T_STRING);
167
+
168
+ error = git_reference_lookup(&ref, repo, StringValueCStr(rb_name));
169
+ if (error == GIT_ENOTFOUND)
170
+ return Qfalse;
171
+ else
172
+ rugged_exception_check(error);
173
+
174
+ git_reference_free(ref);
175
+ return Qtrue;
176
+ }
177
+
178
+ /*
179
+ * call-seq:
180
+ * Reference.create(repository, name, oid, force = false) -> new_ref
181
+ * Reference.create(repository, name, target, force = false) -> new_ref
182
+ *
183
+ * Create a symbolic or direct reference on +repository+ with the given +name+.
184
+ * If the third argument is a valid OID, the reference will be created as direct.
185
+ * Otherwise, it will be assumed the target is the name of another reference.
186
+ *
187
+ * If a reference with the given +name+ already exists and +force+ is +true+,
188
+ * it will be overwritten. Otherwise, an exception will be raised.
189
+ */
130
190
  static VALUE rb_git_ref_create(int argc, VALUE *argv, VALUE klass)
131
191
  {
132
192
  VALUE rb_repo, rb_name, rb_target, rb_force;
@@ -144,7 +204,7 @@ static VALUE rb_git_ref_create(int argc, VALUE *argv, VALUE klass)
144
204
  if (!NIL_P(rb_force))
145
205
  force = rugged_parse_bool(rb_force);
146
206
 
147
- if (git_oid_fromstr(&oid, StringValueCStr(rb_target)) == GIT_SUCCESS) {
207
+ if (git_oid_fromstr(&oid, StringValueCStr(rb_target)) == GIT_OK) {
148
208
  error = git_reference_create_oid(
149
209
  &ref, repo, StringValueCStr(rb_name), &oid, force);
150
210
  } else {
@@ -157,6 +217,20 @@ static VALUE rb_git_ref_create(int argc, VALUE *argv, VALUE klass)
157
217
  return rugged_ref_new(klass, rb_repo, ref);
158
218
  }
159
219
 
220
+ /*
221
+ * call-seq:
222
+ * reference.target -> oid
223
+ * reference.target -> ref_name
224
+ *
225
+ * Return the target of the reference, which is an OID for +:direct+
226
+ * references, and the name of another reference for +:symbolic+ ones.
227
+ *
228
+ * r1.type #=> :symbolic
229
+ * r1.target #=> "refs/heads/master"
230
+ *
231
+ * r2.type #=> :direct
232
+ * r2.target #=> "de5ba987198bcf2518885f0fc1350e5172cded78"
233
+ */
160
234
  static VALUE rb_git_ref_target(VALUE self)
161
235
  {
162
236
  git_reference *ref;
@@ -170,6 +244,22 @@ static VALUE rb_git_ref_target(VALUE self)
170
244
  }
171
245
  }
172
246
 
247
+ /*
248
+ * call-seq:
249
+ * reference.target = t
250
+ *
251
+ * Set the target of a reference. If +reference+ is a direct reference,
252
+ * the new target must be a +String+ representing a SHA1 OID.
253
+ *
254
+ * If +reference+ is symbolic, the new target must be a +String+ with
255
+ * the name of another reference.
256
+ *
257
+ * r1.type #=> :symbolic
258
+ * r1.target = "refs/heads/master"
259
+ *
260
+ * r2.type #=> :direct
261
+ * r2.target = "de5ba987198bcf2518885f0fc1350e5172cded78"
262
+ */
173
263
  static VALUE rb_git_ref_set_target(VALUE self, VALUE rb_target)
174
264
  {
175
265
  git_reference *ref;
@@ -193,13 +283,32 @@ static VALUE rb_git_ref_set_target(VALUE self, VALUE rb_target)
193
283
  return Qnil;
194
284
  }
195
285
 
286
+ /*
287
+ * call-seq:
288
+ * reference.type -> :symbolic or :direct
289
+ *
290
+ * Return whether the reference is +:symbolic+ or +:direct+
291
+ */
196
292
  static VALUE rb_git_ref_type(VALUE self)
197
293
  {
198
294
  git_reference *ref;
199
295
  UNPACK_REFERENCE(self, ref);
200
- return rugged_str_new2(git_object_type2string(git_reference_type(ref)), NULL);
296
+ switch (git_reference_type(ref)) {
297
+ case GIT_REF_OID:
298
+ return CSTR2SYM("direct");
299
+ case GIT_REF_SYMBOLIC:
300
+ return CSTR2SYM("symbolic");
301
+ default:
302
+ return Qnil;
303
+ }
201
304
  }
202
305
 
306
+ /*
307
+ * call-seq:
308
+ * reference.packed? -> true or false
309
+ *
310
+ * Return whether the reference is packed or not
311
+ */
203
312
  static VALUE rb_git_ref_packed(VALUE self)
204
313
  {
205
314
  git_reference *ref;
@@ -208,6 +317,12 @@ static VALUE rb_git_ref_packed(VALUE self)
208
317
  return git_reference_is_packed(ref) ? Qtrue : Qfalse;
209
318
  }
210
319
 
320
+ /*
321
+ * call-seq:
322
+ * reference.reload!
323
+ *
324
+ * Reload the reference from disk
325
+ */
211
326
  static VALUE rb_git_ref_reload(VALUE self)
212
327
  {
213
328
  int error;
@@ -217,13 +332,21 @@ static VALUE rb_git_ref_reload(VALUE self)
217
332
  error = git_reference_reload(ref);
218
333
 
219
334
  /* If reload fails, the reference is invalidated */
220
- if (error < GIT_SUCCESS)
335
+ if (error < GIT_OK)
221
336
  ref = NULL;
222
337
 
223
338
  rugged_exception_check(error);
224
339
  return Qnil;
225
340
  }
226
341
 
342
+ /*
343
+ * call-seq:
344
+ * reference.name -> name
345
+ *
346
+ * Returns the name of the reference
347
+ *
348
+ * reference.name #=> 'HEAD'
349
+ */
227
350
  static VALUE rb_git_ref_name(VALUE self)
228
351
  {
229
352
  git_reference *ref;
@@ -231,6 +354,19 @@ static VALUE rb_git_ref_name(VALUE self)
231
354
  return rugged_str_new2(git_reference_name(ref), NULL);
232
355
  }
233
356
 
357
+ /*
358
+ * call-seq:
359
+ * reference.resolve -> peeled_ref
360
+ *
361
+ * Peel a symbolic reference to its target reference.
362
+ *
363
+ * r1.type #=> :symbolic
364
+ * r1.name #=> 'HEAD'
365
+ * r1.target #=> 'refs/heads/master'
366
+ *
367
+ * r2 = r1.resolve #=> #<Rugged::Reference:0x401b3948>
368
+ * r2.target #=> '9d09060c850defbc7711d08b57def0d14e742f4e'
369
+ */
234
370
  static VALUE rb_git_ref_resolve(VALUE self)
235
371
  {
236
372
  git_reference *ref;
@@ -245,6 +381,17 @@ static VALUE rb_git_ref_resolve(VALUE self)
245
381
  return rugged_ref_new(rb_cRuggedReference, rugged_owner(self), resolved);
246
382
  }
247
383
 
384
+ /*
385
+ * call-seq:
386
+ * reference.rename(new_name, force = false)
387
+ *
388
+ * Change the name of a reference. If +force+ is +true+, any previously
389
+ * existing references will be overwritten when renaming.
390
+ *
391
+ * reference.name #=> 'refs/heads/master'
392
+ * reference.rename('refs/heads/development') #=> nil
393
+ * reference.name #=> 'refs/heads/development'
394
+ */
248
395
  static VALUE rb_git_ref_rename(int argc, VALUE *argv, VALUE self)
249
396
  {
250
397
  git_reference *ref;
@@ -264,6 +411,17 @@ static VALUE rb_git_ref_rename(int argc, VALUE *argv, VALUE self)
264
411
  return Qnil;
265
412
  }
266
413
 
414
+ /*
415
+ * call-seq:
416
+ * reference.delete!
417
+ *
418
+ * Delete this reference from disk. The +reference+ object will
419
+ * become invalidated.
420
+ *
421
+ * reference.name #=> 'HEAD'
422
+ * reference.delete!
423
+ * reference.name # Exception raised
424
+ */
267
425
  static VALUE rb_git_ref_delete(VALUE self)
268
426
  {
269
427
  git_reference *ref;
@@ -306,6 +464,27 @@ static VALUE reflog_entry_new(const git_reflog_entry *entry)
306
464
  return rb_entry;
307
465
  }
308
466
 
467
+ /*
468
+ * call-seq:
469
+ * reference.log -> [reflog_entry, ...]
470
+ *
471
+ * Return an array with the log of all modifications to this reference
472
+ *
473
+ * Each +reflog_entry+ is a hash with the following keys:
474
+ *
475
+ * - +:oid_old+: previous OID before the change
476
+ * - +:oid_new+: OID after the change
477
+ * - +:committer+: author of the change
478
+ * - +:message+: message for the change
479
+ *
480
+ * reference.log #=> [
481
+ * # {
482
+ * # :oid_old => nil,
483
+ * # :oid_new => '9d09060c850defbc7711d08b57def0d14e742f4e',
484
+ * # :committer => {:name => 'Vicent Marti', :email => {'vicent@github.com'}},
485
+ * # :message => 'created reference'
486
+ * # }, ... ]
487
+ */
309
488
  static VALUE rb_git_reflog(VALUE self)
310
489
  {
311
490
  git_reflog *reflog;
@@ -333,6 +512,13 @@ static VALUE rb_git_reflog(VALUE self)
333
512
  return rb_log;
334
513
  }
335
514
 
515
+ /*
516
+ * call-seq:
517
+ * reference.log!(old_oid, committer, message = nil)
518
+ *
519
+ * Log a modification for this reference to the reflog.
520
+ * +old_oid+ may be +nil+ for newly created references.
521
+ */
336
522
  static VALUE rb_git_reflog_write(
337
523
  VALUE self,
338
524
  VALUE rb_oid_old,
@@ -379,6 +565,8 @@ void Init_rugged_reference()
379
565
  rb_cRuggedReference = rb_define_class_under(rb_mRugged, "Reference", rb_cObject);
380
566
 
381
567
  rb_define_singleton_method(rb_cRuggedReference, "lookup", rb_git_ref_lookup, 2);
568
+ rb_define_singleton_method(rb_cRuggedReference, "exist?", rb_git_ref_exist, 2);
569
+ rb_define_singleton_method(rb_cRuggedReference, "exists?", rb_git_ref_exist, 2);
382
570
  rb_define_singleton_method(rb_cRuggedReference, "create", rb_git_ref_create, -1);
383
571
  rb_define_singleton_method(rb_cRuggedReference, "pack_all", rb_git_ref_packall, 1);
384
572
  rb_define_singleton_method(rb_cRuggedReference, "each", rb_git_ref_each, -1);
@@ -59,8 +59,9 @@ static VALUE rb_git_remote__new(int argc, VALUE *argv, VALUE klass)
59
59
  error = git_remote_new(
60
60
  &remote,
61
61
  repo,
62
+ NIL_P(rb_name) ? NULL : StringValueCStr(rb_name),
62
63
  StringValueCStr(rb_url),
63
- NIL_P(rb_name) ? NULL : StringValueCStr(rb_name)
64
+ NULL
64
65
  );
65
66
  } else {
66
67
  error = git_remote_load(&remote, repo, url);
@@ -125,7 +126,7 @@ static VALUE rugged_rhead_new(git_remote_head *head)
125
126
  static int cb_remote__ls(git_remote_head *head, void *payload)
126
127
  {
127
128
  rb_funcall((VALUE)payload, rb_intern("call"), 1, rugged_rhead_new(head));
128
- return GIT_SUCCESS;
129
+ return GIT_OK;
129
130
  }
130
131
 
131
132
  static VALUE rb_git_remote_ls(VALUE self)
@@ -171,18 +172,15 @@ static VALUE rb_git_remote_download(VALUE self)
171
172
  {
172
173
  int error;
173
174
  git_remote *remote;
174
- char *path;
175
- VALUE rb_path;
175
+ git_off_t bytes = 0;
176
+ git_indexer_stats stats;
176
177
 
177
178
  Data_Get_Struct(self, git_remote, remote);
178
179
 
179
- error = git_remote_download(&path, remote);
180
+ error = git_remote_download(remote, &bytes, &stats);
180
181
  rugged_exception_check(error);
181
182
 
182
- rb_path = rugged_str_new2(path, NULL);
183
- free(path);
184
-
185
- return rb_path;
183
+ return Qnil;
186
184
  }
187
185
 
188
186
  static VALUE rb_git_remote_update_tips(VALUE self)
@@ -192,17 +190,44 @@ static VALUE rb_git_remote_update_tips(VALUE self)
192
190
 
193
191
  Data_Get_Struct(self, git_remote, remote);
194
192
 
195
- error = git_remote_update_tips(remote);
193
+ // TODO: Maybe allow passing down a block?
194
+ error = git_remote_update_tips(remote, NULL);
196
195
  rugged_exception_check(error);
197
196
 
198
197
  return Qnil;
199
198
  }
200
199
 
200
+ static VALUE rb_git_remote_each(VALUE self, VALUE rb_repo)
201
+ {
202
+ git_repository *repo;
203
+ git_strarray remotes;
204
+ size_t i;
205
+ int error;
206
+
207
+ if (!rb_block_given_p())
208
+ return rb_funcall(self, rb_intern("to_enum"), 2, CSTR2SYM("each"), rb_repo);
209
+
210
+ if (!rb_obj_is_kind_of(rb_repo, rb_cRuggedRepo))
211
+ rb_raise(rb_eTypeError, "Expeting a Rugged::Repository instance");
212
+
213
+ Data_Get_Struct(rb_repo, git_repository, repo);
214
+
215
+ error = git_remote_list(&remotes, repo);
216
+ rugged_exception_check(error);
217
+
218
+ for (i = 0; i < remotes.count; ++i)
219
+ rb_yield(rugged_str_new2(remotes.strings[i], NULL));
220
+
221
+ git_strarray_free(&remotes);
222
+ return Qnil;
223
+ }
224
+
201
225
  void Init_rugged_remote()
202
226
  {
203
227
  rb_cRuggedRemote = rb_define_class_under(rb_mRugged, "Remote", rb_cObject);
204
228
 
205
229
  rb_define_singleton_method(rb_cRuggedRemote, "new", rb_git_remote__new, -1);
230
+ rb_define_singleton_method(rb_cRuggedRemote, "each", rb_git_remote_each, 1);
206
231
 
207
232
  rb_define_method(rb_cRuggedRemote, "connect", rb_git_remote_connect, 1);
208
233
  rb_define_method(rb_cRuggedRemote, "disconnect", rb_git_remote_disconnect, 0);