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
@@ -33,6 +33,19 @@ VALUE rb_cRuggedCommit;
33
33
  /*
34
34
  * Commit code
35
35
  */
36
+ /*
37
+ * call-seq:
38
+ * commit.message -> msg
39
+ *
40
+ * Return the message of this commit. This includes the full body of the
41
+ * message, with the short description, detailed descritpion, and any
42
+ * optional footers or signatures after it.
43
+ *
44
+ * In Ruby 1.9.X, the returned string will be encoded with the encoding
45
+ * specified in the +Encoding+ header of the commit, if available.
46
+ *
47
+ * commit.message #=> "add a lot of RDoc docs\n\nthis includes docs for commit and blob"
48
+ */
36
49
  static VALUE rb_git_commit_message_GET(VALUE self)
37
50
  {
38
51
  git_commit *commit;
@@ -53,6 +66,22 @@ static VALUE rb_git_commit_message_GET(VALUE self)
53
66
  return rugged_str_new2(git_commit_message(commit), encoding);
54
67
  }
55
68
 
69
+ /*
70
+ * call-seq:
71
+ * commit.committer -> signature
72
+ *
73
+ * Return the signature for the committer of this +commit+. The signature
74
+ * is returned as a +Hash+ containing +:name+, +:email+ of the author
75
+ * and +:time+ of the change.
76
+ *
77
+ * The committer of a commit is the person who actually applied the changes
78
+ * of the commit; in most cases it's the same as the author.
79
+ *
80
+ * In Ruby 1.9.X, the returned string will be encoded with the encoding
81
+ * specified in the +Encoding+ header of the commit, if available.
82
+ *
83
+ * commit.committer #=> {:email=>"tanoku@gmail.com", :time=>Tue Jan 24 05:42:45 UTC 2012, :name=>"Vicent Mart\303\255"}
84
+ */
56
85
  static VALUE rb_git_commit_committer_GET(VALUE self)
57
86
  {
58
87
  git_commit *commit;
@@ -63,6 +92,21 @@ static VALUE rb_git_commit_committer_GET(VALUE self)
63
92
  git_commit_message_encoding(commit));
64
93
  }
65
94
 
95
+ /*
96
+ * call-seq:
97
+ * commit.author -> signature
98
+ *
99
+ * Return the signature for the author of this +commit+. The signature
100
+ * is returned as a +Hash+ containing +:name+, +:email+ of the author
101
+ * and +:time+ of the change.
102
+ *
103
+ * The author of the commit is the person who intially created the changes.
104
+ *
105
+ * In Ruby 1.9.X, the returned string will be encoded with the encoding
106
+ * specified in the +Encoding+ header of the commit, if available.
107
+ *
108
+ * commit.author #=> {:email=>"tanoku@gmail.com", :time=>Tue Jan 24 05:42:45 UTC 2012, :name=>"Vicent Mart\303\255"}
109
+ */
66
110
  static VALUE rb_git_commit_author_GET(VALUE self)
67
111
  {
68
112
  git_commit *commit;
@@ -73,7 +117,17 @@ static VALUE rb_git_commit_author_GET(VALUE self)
73
117
  git_commit_message_encoding(commit));
74
118
  }
75
119
 
76
- static VALUE rb_git_commit_time_GET(VALUE self)
120
+ /*
121
+ * call-seq:
122
+ * commit.epoch_time -> t
123
+ *
124
+ * Return the time when this commit was made effective. This is the same value
125
+ * as the +:time+ attribute for +commit.committer+, but represented as an +Integer+
126
+ * value in seconds since the Epoch.
127
+ *
128
+ * commit.time #=> 1327383765
129
+ */
130
+ static VALUE rb_git_commit_epoch_time_GET(VALUE self)
77
131
  {
78
132
  git_commit *commit;
79
133
  Data_Get_Struct(self, git_commit, commit);
@@ -81,6 +135,15 @@ static VALUE rb_git_commit_time_GET(VALUE self)
81
135
  return ULONG2NUM(git_commit_time(commit));
82
136
  }
83
137
 
138
+ /*
139
+ * call-seq:
140
+ * commit.tree -> tree
141
+ *
142
+ * Return the tree pointed at by this +commit+. The tree is
143
+ * returned as a +Rugged::Tree+ object.
144
+ *
145
+ * commit.tree #=> #<Rugged::Tree:0x10882c680>
146
+ */
84
147
  static VALUE rb_git_commit_tree_GET(VALUE self)
85
148
  {
86
149
  git_commit *commit;
@@ -97,6 +160,39 @@ static VALUE rb_git_commit_tree_GET(VALUE self)
97
160
  return rugged_object_new(owner, (git_object *)tree);
98
161
  }
99
162
 
163
+ /*
164
+ * call-seq:
165
+ * commit.tree_oid -> oid
166
+ *
167
+ * Return the tree oid pointed at by this +commit+. The tree is
168
+ * returned as a String object.
169
+ *
170
+ * commit.tree #=> "f148106ca58764adc93ad4e2d6b1d168422b9796"
171
+ */
172
+ static VALUE rb_git_commit_tree_oid_GET(VALUE self)
173
+ {
174
+ git_commit *commit;
175
+ const git_oid *tree_oid;
176
+ int error;
177
+
178
+ Data_Get_Struct(self, git_commit, commit);
179
+
180
+ tree_oid = git_commit_tree_oid(commit);
181
+
182
+ return rugged_create_oid(tree_oid);
183
+ }
184
+
185
+ /*
186
+ * call-seq:
187
+ * commit.parents -> [commit, ...]
188
+ *
189
+ * Return the parent(s) of this commit as an array of +Rugged::Commit+
190
+ * objects. An array is always returned even when the commit has only
191
+ * one or zero parents.
192
+ *
193
+ * commit.parents #=> => [#<Rugged::Commit:0x108828918>]
194
+ * root.parents #=> []
195
+ */
100
196
  static VALUE rb_git_commit_parents_GET(VALUE self)
101
197
  {
102
198
  git_commit *commit;
@@ -120,15 +216,80 @@ static VALUE rb_git_commit_parents_GET(VALUE self)
120
216
  return ret_arr;
121
217
  }
122
218
 
219
+ /*
220
+ * call-seq:
221
+ * commit.parent_oids -> [oid, ...]
222
+ *
223
+ * Return the parent oid(s) of this commit as an array of oid String
224
+ * objects. An array is always returned even when the commit has only
225
+ * one or zero parents.
226
+ *
227
+ * commit.parent_oids #=> => ["2cb831a8aea28b2c1b9c63385585b864e4d3bad1", ...]
228
+ * root.parent_oids #=> []
229
+ */
230
+ static VALUE rb_git_commit_parent_oids_GET(VALUE self)
231
+ {
232
+ git_commit *commit;
233
+ const git_oid *parent_oid;
234
+ unsigned int n, parent_count;
235
+ VALUE ret_arr;
236
+ int error;
237
+
238
+ Data_Get_Struct(self, git_commit, commit);
239
+
240
+ parent_count = git_commit_parentcount(commit);
241
+ ret_arr = rb_ary_new2((long)parent_count);
242
+
243
+ for (n = 0; n < parent_count; n++) {
244
+ parent_oid = git_commit_parent_oid(commit, n);
245
+ if (parent_oid) {
246
+ rb_ary_push(ret_arr, rugged_create_oid(parent_oid));
247
+ }
248
+ }
249
+
250
+ return ret_arr;
251
+ }
252
+
253
+ /*
254
+ * call-seq:
255
+ * Commit.create(repository, data = {}) -> oid
256
+ *
257
+ * Write a new +Commit+ object to +repository+, with the given +data+
258
+ * arguments, passed as a +Hash+:
259
+ *
260
+ * - +:message+: a string with the full text for the commit's message
261
+ * - +:committer+: a hash with the signature for the committer
262
+ * - +:author+: a hash with the signature for the author
263
+ * - +:parents+: an +Array+ with zero or more parents for this commit,
264
+ * represented as <tt>Rugged::Commit</tt> instances, or OID +String+.
265
+ * - +:tree+: the tree for this commit, represented as a <tt>Rugged::Tree</tt>
266
+ * instance or an OID +String+.
267
+ * - +:update_ref+ (optional): a +String+ with the name of a reference in the
268
+ * repository which should be updated to point to this commit (e.g. "HEAD")
269
+ *
270
+ * When the commit is successfully written to disk, its +oid+ will be
271
+ * returned as a hex +String+.
272
+ *
273
+ * author = {:email=>"tanoku@gmail.com", :time=>Time.now, :name=>"Vicent Mart\303\255"}
274
+ *
275
+ * Rugged::Commit.create(r,
276
+ * :author => author,
277
+ * :message => "Hello world\n\n",
278
+ * :committer => author,
279
+ * :parents => ["2cb831a8aea28b2c1b9c63385585b864e4d3bad1"],
280
+ * :tree => some_tree) #=> "f148106ca58764adc93ad4e2d6b1d168422b9796"
281
+ */
123
282
  static VALUE rb_git_commit_create(VALUE self, VALUE rb_repo, VALUE rb_data)
124
283
  {
125
- VALUE rb_message, rb_tree, rb_parents;
284
+ VALUE rb_message, rb_tree, rb_parents, rb_ref;
126
285
  int parent_count, i, error;
127
- const git_commit **parents;
286
+ const git_commit **parents = NULL;
287
+ git_commit **free_list = NULL;
128
288
  git_tree *tree;
129
289
  git_signature *author, *committer;
130
290
  git_oid commit_oid;
131
291
  git_repository *repo;
292
+ const char *update_ref = NULL;
132
293
 
133
294
  Check_Type(rb_data, T_HASH);
134
295
 
@@ -136,6 +297,12 @@ static VALUE rb_git_commit_create(VALUE self, VALUE rb_repo, VALUE rb_data)
136
297
  rb_raise(rb_eTypeError, "Expeting a Rugged::Repository instance");
137
298
  Data_Get_Struct(rb_repo, git_repository, repo);
138
299
 
300
+ rb_ref = rb_hash_aref(rb_data, CSTR2SYM("update_ref"));
301
+ if (!NIL_P(rb_ref)) {
302
+ Check_Type(rb_ref, T_STRING);
303
+ update_ref = StringValueCStr(rb_ref);
304
+ }
305
+
139
306
  rb_message = rb_hash_aref(rb_data, CSTR2SYM("message"));
140
307
  Check_Type(rb_message, T_STRING);
141
308
 
@@ -153,38 +320,46 @@ static VALUE rb_git_commit_create(VALUE self, VALUE rb_repo, VALUE rb_data)
153
320
  rb_tree = rb_hash_aref(rb_data, CSTR2SYM("tree"));
154
321
  tree = (git_tree *)rugged_object_load(repo, rb_tree, GIT_OBJ_TREE);
155
322
 
156
- parent_count = (int)RARRAY_LEN(rb_parents);
157
- parents = malloc(parent_count * sizeof(void*));
323
+ parents = xmalloc(RARRAY_LEN(rb_parents) * sizeof(void *));
324
+ free_list = xmalloc(RARRAY_LEN(rb_parents) * sizeof(void *));
325
+ parent_count = 0;
158
326
 
159
- for (i = 0; i < parent_count; ++i) {
327
+ for (i = 0; i < (int)RARRAY_LEN(rb_parents); ++i) {
160
328
  VALUE p = rb_ary_entry(rb_parents, i);
161
329
  git_commit *parent = NULL;
330
+ git_commit *free_ptr = NULL;
331
+
332
+ if (NIL_P(p))
333
+ continue;
162
334
 
163
335
  if (TYPE(p) == T_STRING) {
164
336
  git_oid oid;
165
337
 
166
338
  error = git_oid_fromstr(&oid, StringValueCStr(p));
167
- if (error < GIT_SUCCESS)
339
+ if (error < GIT_OK)
168
340
  goto cleanup;
169
341
 
170
342
  error = git_commit_lookup(&parent, repo, &oid);
171
- if (error < GIT_SUCCESS)
343
+ if (error < GIT_OK)
172
344
  goto cleanup;
173
345
 
346
+ free_ptr = parent;
347
+
174
348
  } else if (rb_obj_is_kind_of(p, rb_cRuggedCommit)) {
175
349
  Data_Get_Struct(p, git_commit, parent);
176
350
  } else {
177
- error = GIT_EINVALIDTYPE;
178
- goto cleanup;
351
+ rb_raise(rb_eTypeError, "Invalid type for parent object");
179
352
  }
180
353
 
181
- parents[i] = parent;
354
+ parents[parent_count] = parent;
355
+ free_list[parent_count] = free_ptr;
356
+ parent_count++;
182
357
  }
183
358
 
184
359
  error = git_commit_create(
185
360
  &commit_oid,
186
361
  repo,
187
- NULL,
362
+ update_ref,
188
363
  author,
189
364
  committer,
190
365
  NULL,
@@ -200,9 +375,10 @@ cleanup:
200
375
  git_object_free((git_object *)tree);
201
376
 
202
377
  for (i = 0; i < parent_count; ++i)
203
- git_object_free((git_object *)parents[i]);
378
+ git_object_free((git_object *)free_list[i]);
204
379
 
205
- free(parents);
380
+ xfree(parents);
381
+ xfree(free_list);
206
382
  rugged_exception_check(error);
207
383
 
208
384
  return rugged_create_oid(&commit_oid);
@@ -215,10 +391,12 @@ void Init_rugged_commit()
215
391
  rb_define_singleton_method(rb_cRuggedCommit, "create", rb_git_commit_create, 2);
216
392
 
217
393
  rb_define_method(rb_cRuggedCommit, "message", rb_git_commit_message_GET, 0);
218
- rb_define_method(rb_cRuggedCommit, "time", rb_git_commit_time_GET, 0);
394
+ rb_define_method(rb_cRuggedCommit, "epoch_time", rb_git_commit_epoch_time_GET, 0);
219
395
  rb_define_method(rb_cRuggedCommit, "committer", rb_git_commit_committer_GET, 0);
220
396
  rb_define_method(rb_cRuggedCommit, "author", rb_git_commit_author_GET, 0);
221
397
  rb_define_method(rb_cRuggedCommit, "tree", rb_git_commit_tree_GET, 0);
398
+ rb_define_method(rb_cRuggedCommit, "tree_oid", rb_git_commit_tree_oid_GET, 0);
222
399
  rb_define_method(rb_cRuggedCommit, "parents", rb_git_commit_parents_GET, 0);
400
+ rb_define_method(rb_cRuggedCommit, "parent_oids", rb_git_commit_parent_oids_GET, 0);
223
401
  }
224
402
 
@@ -36,9 +36,17 @@ VALUE rugged_config_new(VALUE klass, VALUE owner, git_config *cfg)
36
36
  {
37
37
  VALUE rb_config = Data_Wrap_Struct(klass, NULL, &rb_git_config__free, cfg);
38
38
  rugged_set_owner(rb_config, owner);
39
- return owner;
39
+ return rb_config;
40
40
  }
41
41
 
42
+ /*
43
+ * call-seq:
44
+ * Config.new(path) -> new_config
45
+ *
46
+ * Open the file specified in +path+ as a +Rugged::Config+ file.
47
+ * If +path+ cannot be found, or the file is an invalid Git config,
48
+ * an exception will be raised.
49
+ */
42
50
  static VALUE rb_git_config_new(VALUE klass, VALUE rb_path)
43
51
  {
44
52
  git_config *config = NULL;
@@ -64,6 +72,18 @@ static VALUE rb_git_config_new(VALUE klass, VALUE rb_path)
64
72
  return rugged_config_new(klass, Qnil, config);
65
73
  }
66
74
 
75
+ /*
76
+ * call-seq:
77
+ * cfg.get(key) -> value
78
+ * cfg[key] -> value
79
+ *
80
+ * Get the value for the given config +key+. Values are always
81
+ * returned as +String+, or +nil+ if the given key doesn't exist
82
+ * in the Config file.
83
+ *
84
+ * cfg['apply.whitespace'] #=> 'fix'
85
+ * cfg['diff.renames'] #=> 'true'
86
+ */
67
87
  static VALUE rb_git_config_get(VALUE self, VALUE rb_key)
68
88
  {
69
89
  git_config *config;
@@ -73,7 +93,7 @@ static VALUE rb_git_config_get(VALUE self, VALUE rb_key)
73
93
  Data_Get_Struct(self, git_config, config);
74
94
  Check_Type(rb_key, T_STRING);
75
95
 
76
- error = git_config_get_string(config, StringValueCStr(rb_key), &value);
96
+ error = git_config_get_string(&value, config, StringValueCStr(rb_key));
77
97
  if (error == GIT_ENOTFOUND)
78
98
  return Qnil;
79
99
 
@@ -83,6 +103,21 @@ static VALUE rb_git_config_get(VALUE self, VALUE rb_key)
83
103
  return rugged_str_new2(value, NULL);
84
104
  }
85
105
 
106
+ /*
107
+ * call-seq:
108
+ * cfg.store(key, value)
109
+ * cfg[key] = value
110
+ *
111
+ * Store the given +value+ in the Config file, under the section
112
+ * and name specified by +key+. Value can be any of the following
113
+ * Ruby types: +String+, +true+, +false+ and +Fixnum+.
114
+ *
115
+ * The config file will be automatically stored to disk.
116
+ *
117
+ * cfg['apply.whitespace'] = 'fix'
118
+ * cfg['diff.renames'] = true
119
+ * cfg['gc.reflogexpre'] = 90
120
+ */
86
121
  static VALUE rb_git_config_store(VALUE self, VALUE rb_key, VALUE rb_val)
87
122
  {
88
123
  git_config *config;
@@ -117,6 +152,16 @@ static VALUE rb_git_config_store(VALUE self, VALUE rb_key, VALUE rb_val)
117
152
  return Qnil;
118
153
  }
119
154
 
155
+ /*
156
+ * call-seq:
157
+ * cfg.delete(key) -> true or false
158
+ *
159
+ * Delete the given +key+ from the config file. Return +true+ if
160
+ * the deletion was successful, or +false+ if the key was not
161
+ * found in the Config file.
162
+ *
163
+ * The config file is immediately updated on disk.
164
+ */
120
165
  static VALUE rb_git_config_delete(VALUE self, VALUE rb_key)
121
166
  {
122
167
  git_config *config;
@@ -137,7 +182,7 @@ static VALUE rb_git_config_delete(VALUE self, VALUE rb_key)
137
182
  static int cb_config__each_key(const char *key, const char *value, void *opaque)
138
183
  {
139
184
  rb_funcall((VALUE)opaque, rb_intern("call"), 1, rugged_str_new2(key, NULL));
140
- return GIT_SUCCESS;
185
+ return GIT_OK;
141
186
  }
142
187
 
143
188
  static int cb_config__each_pair(const char *key, const char *value, void *opaque)
@@ -146,7 +191,7 @@ static int cb_config__each_pair(const char *key, const char *value, void *opaque
146
191
  rugged_str_new2(key, NULL),
147
192
  rugged_str_new2(value, NULL));
148
193
 
149
- return GIT_SUCCESS;
194
+ return GIT_OK;
150
195
  }
151
196
 
152
197
  static int cb_config__to_hash(const char *key, const char *value, void *opaque)
@@ -155,9 +200,21 @@ static int cb_config__to_hash(const char *key, const char *value, void *opaque)
155
200
  rugged_str_new2(key, NULL),
156
201
  rugged_str_new2(value, NULL));
157
202
 
158
- return GIT_SUCCESS;
203
+ return GIT_OK;
159
204
  }
160
205
 
206
+ /*
207
+ * call-seq:
208
+ * cfg.each_key { |key| block }
209
+ * cfg.each_key -> Iterator
210
+ *
211
+ * Call the given block once for each key in the config file. If no block
212
+ * is given, an +Iterator+ is returned.
213
+ *
214
+ * cfg.each_key do |key|
215
+ * puts key
216
+ * end
217
+ */
161
218
  static VALUE rb_git_config_each_key(VALUE self)
162
219
  {
163
220
  git_config *config;
@@ -173,6 +230,20 @@ static VALUE rb_git_config_each_key(VALUE self)
173
230
  return Qnil;
174
231
  }
175
232
 
233
+ /*
234
+ * call-seq:
235
+ * cfg.each_pair { |key, value| block }
236
+ * cfg.each_pair -> Iterator
237
+ * cfg.each { |key, value| block }
238
+ * cfg.each -> Iterator
239
+ *
240
+ * Call the given block once for each key/value pair in the config file.
241
+ * If no block is given, an +Iterator+ is returned.
242
+ *
243
+ * cfg.each do |key, value|
244
+ * puts "#{key} => #{value}"
245
+ * end
246
+ */
176
247
  static VALUE rb_git_config_each_pair(VALUE self)
177
248
  {
178
249
  git_config *config;
@@ -188,6 +259,16 @@ static VALUE rb_git_config_each_pair(VALUE self)
188
259
  return Qnil;
189
260
  }
190
261
 
262
+ /*
263
+ * call-seq:
264
+ * cfg.to_hash -> hash
265
+ *
266
+ * Returns the config file represented as a Ruby hash, where
267
+ * each configuration entry appears as a key with its
268
+ * corresponding value.
269
+ *
270
+ * cfg.to_hash #=> {"core.autolf" => "true", "core.bare" => "true"}
271
+ */
191
272
  static VALUE rb_git_config_to_hash(VALUE self)
192
273
  {
193
274
  git_config *config;
@@ -202,6 +283,14 @@ static VALUE rb_git_config_to_hash(VALUE self)
202
283
  return hash;
203
284
  }
204
285
 
286
+ /*
287
+ * call-seq:
288
+ * Config.open_global() -> new_config
289
+ *
290
+ * Open the global config file as a new +Rugged::Config+ object.
291
+ * An exception will be raised if the global config file doesn't
292
+ * exist.
293
+ */
205
294
  static VALUE rb_git_config_open_global(VALUE klass)
206
295
  {
207
296
  git_config *cfg;
@@ -33,6 +33,59 @@ extern VALUE rb_cRuggedRepo;
33
33
 
34
34
  VALUE rb_cRuggedObject;
35
35
 
36
+ git_otype rugged_otype_get(VALUE self)
37
+ {
38
+ git_otype type = GIT_OBJ_BAD;
39
+
40
+ if (NIL_P(self))
41
+ return GIT_OBJ_ANY;
42
+
43
+ switch (TYPE(self)) {
44
+ case T_STRING:
45
+ type = git_object_string2type(StringValueCStr(self));
46
+ break;
47
+
48
+ case T_FIXNUM:
49
+ type = FIX2INT(self);
50
+ break;
51
+
52
+ case T_SYMBOL: {
53
+ ID t = SYM2ID(self);
54
+
55
+ if (t == rb_intern("commit"))
56
+ type = GIT_OBJ_COMMIT;
57
+ else if (t == rb_intern("tree"))
58
+ type = GIT_OBJ_TREE;
59
+ else if (t == rb_intern("tag"))
60
+ type = GIT_OBJ_TAG;
61
+ else if (t == rb_intern("blob"))
62
+ type = GIT_OBJ_BLOB;
63
+ }
64
+ }
65
+
66
+ if (!git_object_typeisloose(type))
67
+ rb_raise(rb_eTypeError, "Invalid Git object type specifier");
68
+
69
+ return type;
70
+ }
71
+
72
+ VALUE rugged_otype_new(git_otype t)
73
+ {
74
+ switch (t) {
75
+ case GIT_OBJ_COMMIT:
76
+ return CSTR2SYM("commit");
77
+ case GIT_OBJ_TAG:
78
+ return CSTR2SYM("tag");
79
+ case GIT_OBJ_TREE:
80
+ return CSTR2SYM("tree");
81
+ case GIT_OBJ_BLOB:
82
+ return CSTR2SYM("blob");
83
+ default:
84
+ return Qnil;
85
+ }
86
+ }
87
+
88
+
36
89
  git_object *rugged_object_load(git_repository *repo, VALUE object_value, git_otype type)
37
90
  {
38
91
  git_object *object = NULL;
@@ -179,7 +232,7 @@ static VALUE rb_git_object_type_GET(VALUE self)
179
232
  git_object *object;
180
233
  Data_Get_Struct(self, git_object, object);
181
234
 
182
- return rugged_str_new2(git_object_type2string(git_object_type(object)), NULL);
235
+ return rugged_otype_new(git_object_type(object));
183
236
  }
184
237
 
185
238
  static VALUE rb_git_object_read_raw(VALUE self)