rugged 0.1.2 → 0.16.0b1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (277) hide show
  1. data/README.md +25 -36
  2. data/Rakefile +20 -98
  3. data/ext/rugged/extconf.rb +44 -4
  4. data/ext/rugged/remote.c +215 -0
  5. data/ext/rugged/rugged.c +171 -0
  6. data/ext/rugged/rugged.h +126 -0
  7. data/ext/rugged/rugged_blob.c +99 -0
  8. data/ext/rugged/rugged_commit.c +224 -0
  9. data/ext/rugged/rugged_config.c +238 -0
  10. data/ext/rugged/rugged_index.c +440 -0
  11. data/ext/rugged/rugged_object.c +203 -0
  12. data/ext/rugged/rugged_reference.c +401 -0
  13. data/ext/rugged/rugged_repo.c +482 -0
  14. data/ext/rugged/rugged_revwalk.c +138 -0
  15. data/ext/rugged/rugged_signature.c +80 -0
  16. data/ext/rugged/rugged_tag.c +216 -0
  17. data/ext/rugged/rugged_tree.c +322 -0
  18. data/ext/rugged/vendor/libgit2-dist.tar.gz +0 -0
  19. data/ext/rugged/vendor/libgit2-dist/deps/http-parser/http_parser.c +1778 -0
  20. data/ext/rugged/vendor/libgit2-dist/deps/http-parser/http_parser.h +267 -0
  21. data/ext/rugged/vendor/libgit2-dist/deps/zlib/adler32.c +169 -0
  22. data/ext/rugged/vendor/libgit2-dist/deps/zlib/crc32.c +442 -0
  23. data/ext/rugged/vendor/libgit2-dist/deps/zlib/crc32.h +441 -0
  24. data/ext/rugged/vendor/libgit2-dist/deps/zlib/deflate.c +1834 -0
  25. data/ext/rugged/vendor/libgit2-dist/deps/zlib/deflate.h +342 -0
  26. data/ext/rugged/vendor/libgit2-dist/deps/zlib/inffast.c +340 -0
  27. data/ext/rugged/vendor/libgit2-dist/deps/zlib/inffast.h +11 -0
  28. data/ext/rugged/vendor/libgit2-dist/deps/zlib/inffixed.h +94 -0
  29. data/ext/rugged/vendor/libgit2-dist/deps/zlib/inflate.c +1480 -0
  30. data/ext/rugged/vendor/libgit2-dist/deps/zlib/inflate.h +122 -0
  31. data/ext/rugged/vendor/libgit2-dist/deps/zlib/inftrees.c +330 -0
  32. data/ext/rugged/vendor/libgit2-dist/deps/zlib/inftrees.h +62 -0
  33. data/ext/rugged/vendor/libgit2-dist/deps/zlib/trees.c +1244 -0
  34. data/ext/rugged/vendor/libgit2-dist/deps/zlib/trees.h +128 -0
  35. data/ext/rugged/vendor/libgit2-dist/deps/zlib/zconf.h +54 -0
  36. data/ext/rugged/vendor/libgit2-dist/deps/zlib/zlib.h +1613 -0
  37. data/ext/rugged/vendor/libgit2-dist/deps/zlib/zutil.c +318 -0
  38. data/ext/rugged/vendor/libgit2-dist/deps/zlib/zutil.h +274 -0
  39. data/ext/rugged/vendor/libgit2-dist/examples/general.c +451 -0
  40. data/ext/rugged/vendor/libgit2-dist/examples/network/common.h +14 -0
  41. data/ext/rugged/vendor/libgit2-dist/examples/network/fetch.c +97 -0
  42. data/ext/rugged/vendor/libgit2-dist/examples/network/git2.c +58 -0
  43. data/ext/rugged/vendor/libgit2-dist/examples/network/index-pack.c +47 -0
  44. data/ext/rugged/vendor/libgit2-dist/examples/network/ls-remote.c +76 -0
  45. data/ext/rugged/vendor/libgit2-dist/examples/showindex.c +43 -0
  46. data/ext/rugged/vendor/libgit2-dist/include/git2.h +44 -0
  47. data/ext/rugged/vendor/libgit2-dist/include/git2/blob.h +120 -0
  48. data/ext/rugged/vendor/libgit2-dist/include/git2/branch.h +15 -0
  49. data/ext/rugged/vendor/libgit2-dist/include/git2/commit.h +263 -0
  50. data/ext/rugged/vendor/libgit2-dist/include/git2/common.h +103 -0
  51. data/ext/rugged/vendor/libgit2-dist/include/git2/config.h +278 -0
  52. data/ext/rugged/vendor/libgit2-dist/include/git2/errors.h +144 -0
  53. data/ext/rugged/vendor/libgit2-dist/include/git2/index.h +306 -0
  54. data/ext/rugged/vendor/libgit2-dist/include/git2/indexer.h +76 -0
  55. data/ext/rugged/vendor/libgit2-dist/include/git2/inttypes.h +305 -0
  56. data/ext/rugged/vendor/libgit2-dist/include/git2/net.h +51 -0
  57. data/ext/rugged/vendor/libgit2-dist/include/git2/object.h +173 -0
  58. data/ext/rugged/vendor/libgit2-dist/include/git2/odb.h +331 -0
  59. data/ext/rugged/vendor/libgit2-dist/include/git2/odb_backend.h +100 -0
  60. data/ext/rugged/vendor/libgit2-dist/include/git2/oid.h +218 -0
  61. data/ext/rugged/vendor/libgit2-dist/include/git2/reflog.h +128 -0
  62. data/ext/rugged/vendor/libgit2-dist/include/git2/refs.h +309 -0
  63. data/ext/rugged/vendor/libgit2-dist/include/git2/refspec.h +60 -0
  64. data/ext/rugged/vendor/libgit2-dist/include/git2/remote.h +176 -0
  65. data/ext/rugged/vendor/libgit2-dist/include/git2/repository.h +290 -0
  66. data/ext/rugged/vendor/libgit2-dist/include/git2/revwalk.h +169 -0
  67. data/ext/rugged/vendor/libgit2-dist/include/git2/signature.h +65 -0
  68. data/ext/rugged/vendor/libgit2-dist/include/git2/status.h +63 -0
  69. data/ext/rugged/vendor/libgit2-dist/include/git2/stdint.h +247 -0
  70. data/ext/rugged/vendor/libgit2-dist/include/git2/tag.h +279 -0
  71. data/ext/rugged/vendor/libgit2-dist/include/git2/threads.h +48 -0
  72. data/ext/rugged/vendor/libgit2-dist/include/git2/tree.h +318 -0
  73. data/ext/rugged/vendor/libgit2-dist/include/git2/types.h +169 -0
  74. data/ext/rugged/vendor/libgit2-dist/include/git2/version.h +15 -0
  75. data/ext/rugged/vendor/libgit2-dist/include/git2/windows.h +59 -0
  76. data/ext/rugged/vendor/libgit2-dist/include/git2/zlib.h +40 -0
  77. data/ext/rugged/vendor/libgit2-dist/src/blob.c +135 -0
  78. data/ext/rugged/vendor/libgit2-dist/src/blob.h +23 -0
  79. data/ext/rugged/vendor/libgit2-dist/src/bswap.h +97 -0
  80. data/ext/rugged/vendor/libgit2-dist/src/buffer.c +113 -0
  81. data/ext/rugged/vendor/libgit2-dist/src/buffer.h +32 -0
  82. data/ext/rugged/vendor/libgit2-dist/src/cache.c +111 -0
  83. data/ext/rugged/vendor/libgit2-dist/src/cache.h +64 -0
  84. data/ext/rugged/vendor/libgit2-dist/src/cc-compat.h +67 -0
  85. data/ext/rugged/vendor/libgit2-dist/src/commit.c +299 -0
  86. data/ext/rugged/vendor/libgit2-dist/src/commit.h +34 -0
  87. data/ext/rugged/vendor/libgit2-dist/src/common.h +64 -0
  88. data/ext/rugged/vendor/libgit2-dist/src/config.c +418 -0
  89. data/ext/rugged/vendor/libgit2-dist/src/config.h +24 -0
  90. data/ext/rugged/vendor/libgit2-dist/src/config_file.c +1210 -0
  91. data/ext/rugged/vendor/libgit2-dist/src/delta-apply.c +115 -0
  92. data/ext/rugged/vendor/libgit2-dist/src/delta-apply.h +33 -0
  93. data/ext/rugged/vendor/libgit2-dist/src/dir.h +47 -0
  94. data/ext/rugged/vendor/libgit2-dist/src/errors.c +104 -0
  95. data/ext/rugged/vendor/libgit2-dist/src/fetch.c +172 -0
  96. data/ext/rugged/vendor/libgit2-dist/src/fetch.h +18 -0
  97. data/ext/rugged/vendor/libgit2-dist/src/filebuf.c +400 -0
  98. data/ext/rugged/vendor/libgit2-dist/src/filebuf.h +72 -0
  99. data/ext/rugged/vendor/libgit2-dist/src/fileops.c +358 -0
  100. data/ext/rugged/vendor/libgit2-dist/src/fileops.h +151 -0
  101. data/ext/rugged/vendor/libgit2-dist/src/global.c +134 -0
  102. data/ext/rugged/vendor/libgit2-dist/src/global.h +24 -0
  103. data/ext/rugged/vendor/libgit2-dist/src/hash.c +74 -0
  104. data/ext/rugged/vendor/libgit2-dist/src/hash.h +29 -0
  105. data/ext/rugged/vendor/libgit2-dist/src/hashtable.c +243 -0
  106. data/ext/rugged/vendor/libgit2-dist/src/hashtable.h +80 -0
  107. data/ext/rugged/vendor/libgit2-dist/src/index.c +918 -0
  108. data/ext/rugged/vendor/libgit2-dist/src/index.h +34 -0
  109. data/ext/rugged/vendor/libgit2-dist/src/indexer.c +401 -0
  110. data/ext/rugged/vendor/libgit2-dist/src/map.h +37 -0
  111. data/ext/rugged/vendor/libgit2-dist/src/mwindow.c +272 -0
  112. data/ext/rugged/vendor/libgit2-dist/src/mwindow.h +45 -0
  113. data/ext/rugged/vendor/libgit2-dist/src/netops.c +198 -0
  114. data/ext/rugged/vendor/libgit2-dist/src/netops.h +36 -0
  115. data/ext/rugged/vendor/libgit2-dist/src/object.c +295 -0
  116. data/ext/rugged/vendor/libgit2-dist/src/odb.c +672 -0
  117. data/ext/rugged/vendor/libgit2-dist/src/odb.h +43 -0
  118. data/ext/rugged/vendor/libgit2-dist/src/odb_loose.c +855 -0
  119. data/ext/rugged/vendor/libgit2-dist/src/odb_pack.c +485 -0
  120. data/ext/rugged/vendor/libgit2-dist/src/oid.c +388 -0
  121. data/ext/rugged/vendor/libgit2-dist/src/pack.c +788 -0
  122. data/ext/rugged/vendor/libgit2-dist/src/pack.h +99 -0
  123. data/ext/rugged/vendor/libgit2-dist/src/path.c +270 -0
  124. data/ext/rugged/vendor/libgit2-dist/src/path.h +84 -0
  125. data/ext/rugged/vendor/libgit2-dist/src/pkt.c +426 -0
  126. data/ext/rugged/vendor/libgit2-dist/src/pkt.h +77 -0
  127. data/ext/rugged/vendor/libgit2-dist/src/posix.c +94 -0
  128. data/ext/rugged/vendor/libgit2-dist/src/posix.h +69 -0
  129. data/ext/rugged/vendor/libgit2-dist/src/ppc/sha1.c +70 -0
  130. data/ext/rugged/vendor/libgit2-dist/src/ppc/sha1.h +26 -0
  131. data/ext/rugged/vendor/libgit2-dist/src/pqueue.c +141 -0
  132. data/ext/rugged/vendor/libgit2-dist/src/pqueue.h +81 -0
  133. data/ext/rugged/vendor/libgit2-dist/src/protocol.c +50 -0
  134. data/ext/rugged/vendor/libgit2-dist/src/protocol.h +23 -0
  135. data/ext/rugged/vendor/libgit2-dist/src/reflog.c +318 -0
  136. data/ext/rugged/vendor/libgit2-dist/src/reflog.h +34 -0
  137. data/ext/rugged/vendor/libgit2-dist/src/refs.c +1693 -0
  138. data/ext/rugged/vendor/libgit2-dist/src/refs.h +58 -0
  139. data/ext/rugged/vendor/libgit2-dist/src/refspec.c +95 -0
  140. data/ext/rugged/vendor/libgit2-dist/src/refspec.h +23 -0
  141. data/ext/rugged/vendor/libgit2-dist/src/remote.c +339 -0
  142. data/ext/rugged/vendor/libgit2-dist/src/remote.h +25 -0
  143. data/ext/rugged/vendor/libgit2-dist/src/repository.c +849 -0
  144. data/ext/rugged/vendor/libgit2-dist/src/repository.h +60 -0
  145. data/ext/rugged/vendor/libgit2-dist/src/revwalk.c +569 -0
  146. data/ext/rugged/vendor/libgit2-dist/src/sha1.c +280 -0
  147. data/ext/rugged/vendor/libgit2-dist/src/sha1.h +21 -0
  148. data/ext/rugged/vendor/libgit2-dist/src/sha1_lookup.c +177 -0
  149. data/ext/rugged/vendor/libgit2-dist/src/sha1_lookup.h +18 -0
  150. data/ext/rugged/vendor/libgit2-dist/src/signature.c +335 -0
  151. data/ext/rugged/vendor/libgit2-dist/src/signature.h +18 -0
  152. data/ext/rugged/vendor/libgit2-dist/src/status.c +696 -0
  153. data/ext/rugged/vendor/libgit2-dist/src/tag.c +446 -0
  154. data/ext/rugged/vendor/libgit2-dist/src/tag.h +28 -0
  155. data/ext/rugged/vendor/libgit2-dist/src/thread-utils.c +55 -0
  156. data/ext/rugged/vendor/libgit2-dist/src/thread-utils.h +108 -0
  157. data/ext/rugged/vendor/libgit2-dist/src/transport.c +85 -0
  158. data/ext/rugged/vendor/libgit2-dist/src/transport.h +110 -0
  159. data/ext/rugged/vendor/libgit2-dist/src/transports/git.c +502 -0
  160. data/ext/rugged/vendor/libgit2-dist/src/transports/http.c +756 -0
  161. data/ext/rugged/vendor/libgit2-dist/src/transports/local.c +235 -0
  162. data/ext/rugged/vendor/libgit2-dist/src/tree-cache.c +201 -0
  163. data/ext/rugged/vendor/libgit2-dist/src/tree-cache.h +31 -0
  164. data/ext/rugged/vendor/libgit2-dist/src/tree.c +758 -0
  165. data/ext/rugged/vendor/libgit2-dist/src/tree.h +37 -0
  166. data/ext/rugged/vendor/libgit2-dist/src/tsort.c +365 -0
  167. data/ext/rugged/vendor/libgit2-dist/src/unix/map.c +70 -0
  168. data/ext/rugged/vendor/libgit2-dist/src/unix/posix.h +25 -0
  169. data/ext/rugged/vendor/libgit2-dist/src/util.c +381 -0
  170. data/ext/rugged/vendor/libgit2-dist/src/util.h +137 -0
  171. data/ext/rugged/vendor/libgit2-dist/src/vector.c +174 -0
  172. data/ext/rugged/vendor/libgit2-dist/src/vector.h +45 -0
  173. data/ext/rugged/vendor/libgit2-dist/src/win32/dir.c +115 -0
  174. data/ext/rugged/vendor/libgit2-dist/src/win32/fnmatch.c +180 -0
  175. data/ext/rugged/vendor/libgit2-dist/src/win32/fnmatch.h +27 -0
  176. data/ext/rugged/vendor/libgit2-dist/src/win32/map.c +131 -0
  177. data/ext/rugged/vendor/libgit2-dist/src/win32/mingw-compat.h +24 -0
  178. data/ext/rugged/vendor/libgit2-dist/src/win32/msvc-compat.h +38 -0
  179. data/ext/rugged/vendor/libgit2-dist/src/win32/posix.h +53 -0
  180. data/ext/rugged/vendor/libgit2-dist/src/win32/posix_w32.c +404 -0
  181. data/ext/rugged/vendor/libgit2-dist/src/win32/pthread.c +65 -0
  182. data/ext/rugged/vendor/libgit2-dist/src/win32/pthread.h +40 -0
  183. data/ext/rugged/vendor/libgit2-dist/src/win32/utf-conv.c +88 -0
  184. data/ext/rugged/vendor/libgit2-dist/src/win32/utf-conv.h +17 -0
  185. data/ext/rugged/vendor/libgit2-dist/tests-clay/buf/basic.c +29 -0
  186. data/ext/rugged/vendor/libgit2-dist/tests-clay/clay.h +187 -0
  187. data/ext/rugged/vendor/libgit2-dist/tests-clay/clay_libgit2.h +28 -0
  188. data/ext/rugged/vendor/libgit2-dist/tests-clay/clay_main.c +1073 -0
  189. data/ext/rugged/vendor/libgit2-dist/tests-clay/config/add.c +37 -0
  190. data/ext/rugged/vendor/libgit2-dist/tests-clay/config/new.c +36 -0
  191. data/ext/rugged/vendor/libgit2-dist/tests-clay/config/read.c +209 -0
  192. data/ext/rugged/vendor/libgit2-dist/tests-clay/config/stress.c +39 -0
  193. data/ext/rugged/vendor/libgit2-dist/tests-clay/config/write.c +77 -0
  194. data/ext/rugged/vendor/libgit2-dist/tests-clay/core/dirent.c +222 -0
  195. data/ext/rugged/vendor/libgit2-dist/tests-clay/core/filebuf.c +106 -0
  196. data/ext/rugged/vendor/libgit2-dist/tests-clay/core/oid.c +18 -0
  197. data/ext/rugged/vendor/libgit2-dist/tests-clay/core/path.c +139 -0
  198. data/ext/rugged/vendor/libgit2-dist/tests-clay/core/rmdir.c +50 -0
  199. data/ext/rugged/vendor/libgit2-dist/tests-clay/core/string.c +28 -0
  200. data/ext/rugged/vendor/libgit2-dist/tests-clay/core/strtol.c +37 -0
  201. data/ext/rugged/vendor/libgit2-dist/tests-clay/core/vector.c +66 -0
  202. data/ext/rugged/vendor/libgit2-dist/tests-clay/index/rename.c +60 -0
  203. data/ext/rugged/vendor/libgit2-dist/tests-clay/network/remotes.c +50 -0
  204. data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/chars.c +52 -0
  205. data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/compare.c +124 -0
  206. data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/convert.c +75 -0
  207. data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/data.h +323 -0
  208. data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/fromstr.c +30 -0
  209. data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/hash.c +162 -0
  210. data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/short.c +94 -0
  211. data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/size.c +13 -0
  212. data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/type2string.c +54 -0
  213. data/ext/rugged/vendor/libgit2-dist/tests-clay/object/tree/frompath.c +75 -0
  214. data/ext/rugged/vendor/libgit2-dist/tests-clay/odb/loose.c +84 -0
  215. data/ext/rugged/vendor/libgit2-dist/tests-clay/odb/loose_data.h +522 -0
  216. data/ext/rugged/vendor/libgit2-dist/tests-clay/odb/pack_data.h +151 -0
  217. data/ext/rugged/vendor/libgit2-dist/tests-clay/odb/packed.c +78 -0
  218. data/ext/rugged/vendor/libgit2-dist/tests-clay/odb/sorting.c +71 -0
  219. data/ext/rugged/vendor/libgit2-dist/tests-clay/repo/getters.c +68 -0
  220. data/ext/rugged/vendor/libgit2-dist/tests-clay/repo/init.c +104 -0
  221. data/ext/rugged/vendor/libgit2-dist/tests-clay/repo/open.c +54 -0
  222. data/ext/rugged/vendor/libgit2-dist/tests-clay/status/single.c +38 -0
  223. data/ext/rugged/vendor/libgit2-dist/tests-clay/status/status_data.h +48 -0
  224. data/ext/rugged/vendor/libgit2-dist/tests-clay/status/worktree.c +124 -0
  225. data/ext/rugged/vendor/libgit2-dist/tests/t00-core.c +628 -0
  226. data/ext/rugged/vendor/libgit2-dist/tests/t01-data.h +322 -0
  227. data/ext/rugged/vendor/libgit2-dist/tests/t01-rawobj.c +638 -0
  228. data/ext/rugged/vendor/libgit2-dist/tests/t03-data.h +344 -0
  229. data/ext/rugged/vendor/libgit2-dist/tests/t03-objwrite.c +255 -0
  230. data/ext/rugged/vendor/libgit2-dist/tests/t04-commit.c +788 -0
  231. data/ext/rugged/vendor/libgit2-dist/tests/t05-revwalk.c +140 -0
  232. data/ext/rugged/vendor/libgit2-dist/tests/t06-index.c +219 -0
  233. data/ext/rugged/vendor/libgit2-dist/tests/t07-hashtable.c +192 -0
  234. data/ext/rugged/vendor/libgit2-dist/tests/t08-tag.c +357 -0
  235. data/ext/rugged/vendor/libgit2-dist/tests/t09-tree.c +221 -0
  236. data/ext/rugged/vendor/libgit2-dist/tests/t10-refs.c +1294 -0
  237. data/ext/rugged/vendor/libgit2-dist/tests/t12-repo.c +174 -0
  238. data/ext/rugged/vendor/libgit2-dist/tests/t13-threads.c +41 -0
  239. data/ext/rugged/vendor/libgit2-dist/tests/t17-bufs.c +61 -0
  240. data/ext/rugged/vendor/libgit2-dist/tests/t18-status.c +448 -0
  241. data/ext/rugged/vendor/libgit2-dist/tests/test_helpers.c +310 -0
  242. data/ext/rugged/vendor/libgit2-dist/tests/test_helpers.h +83 -0
  243. data/ext/rugged/vendor/libgit2-dist/tests/test_lib.c +198 -0
  244. data/ext/rugged/vendor/libgit2-dist/tests/test_lib.h +54 -0
  245. data/ext/rugged/vendor/libgit2-dist/tests/test_main.c +89 -0
  246. data/lib/rugged.rb +4 -3
  247. data/lib/rugged/index.rb +0 -8
  248. data/lib/rugged/objects.rb +45 -0
  249. data/lib/rugged/repository.rb +29 -0
  250. data/lib/rugged/tree.rb +16 -6
  251. data/lib/rugged/version.rb +1 -1
  252. data/lib/rugged/walker.rb +5 -0
  253. data/test/blob_test.rb +18 -14
  254. data/test/commit_test.rb +28 -26
  255. data/test/coverage/HEAD.json +1 -0
  256. data/test/coverage/cover.rb +106 -0
  257. data/test/fixtures/testrepo.git/refs/heads/new_name +1 -0
  258. data/test/index_test.rb +101 -78
  259. data/test/lib_test.rb +4 -4
  260. data/test/object_test.rb +3 -3
  261. data/test/reference_test.rb +75 -0
  262. data/test/remote_test.rb +19 -0
  263. data/test/repo_pack_test.rb +4 -4
  264. data/test/repo_test.rb +44 -15
  265. data/test/tag_test.rb +7 -17
  266. data/test/test_helper.rb +24 -5
  267. data/test/tree_test.rb +30 -12
  268. data/test/walker_test.rb +40 -31
  269. metadata +273 -50
  270. data/lib/rugged/person.rb +0 -20
  271. data/lib/rugged/tree_entry.rb +0 -9
  272. data/test/fixtures/testrepo.git/objects/1d/83f106355e4309a293e42ad2a2c4b8bdbe77ae +0 -0
  273. data/test/fixtures/testrepo.git/objects/2f/3321418db5b2a841375b8b70880a8ab5a4148f +0 -0
  274. data/test/fixtures/testrepo.git/objects/36/9b00a7700cca3a506d79e301d6ad8bf735d9ee +0 -3
  275. data/test/fixtures/testrepo.git/objects/3d/b1b5ceace59ff65279757003763046fd4cbbe6 +0 -0
  276. data/test/fixtures/testrepo.git/objects/4c/d1604907792e2c43e03dcec1216f99d63e68c4 +0 -3
  277. data/test/fixtures/testrepo.git/objects/e0/f46d77041c149296549b01ed4a18b02c4b7400 +0 -0
data/README.md CHANGED
@@ -11,6 +11,8 @@ First you need to install libgit2:
11
11
 
12
12
  $ git clone git://github.com/libgit2/libgit2.git
13
13
  $ cd libgit2
14
+ $ mdkir build && cd build
15
+ $ cmake ..
14
16
  $ make
15
17
  $ make install
16
18
 
@@ -32,8 +34,8 @@ API
32
34
  There is a general library for some basic Gitty methods. So far, just converting
33
35
  a raw sha (20 bytes) into a readable hex sha (40 char).
34
36
 
35
- raw = Rugged::Lib.hex_to_raw(hex_sha)
36
- hex = Rugged::Lib.raw_to_hex(20_byte_raw_sha)
37
+ raw = Rugged.hex_to_raw(hex_sha)
38
+ hex = Rugged.raw_to_hex(20_byte_raw_sha)
37
39
 
38
40
 
39
41
  Repository Access
@@ -74,22 +76,20 @@ but all of these methods should be useful in it's derived classes
74
76
  # the repository and instantiated
75
77
  # If the 'sha' ID of the object is missing, the object will be
76
78
  # created in memory and can be written later on to the repository
77
- Rugged::Object(repo, sha)
78
- obj.sha
79
+ Rugged::Object.new(repo, sha)
80
+ obj.oid
79
81
  obj.type
80
82
 
81
83
  str = obj.read_raw # read the raw data of the object
82
- sha = obj.write # write the object to a repository
83
-
84
84
 
85
85
  The next classes are for consuming and creating the 4 base
86
- git object types. just about every method should be able to take
87
- of each should be able to take a parameter to change the value
88
- so the object can be re-written slightly differently or no parameter
89
- to simply read the current value out
86
+ git object types. Just about every method should be able to take
87
+ a parameter to change the value so the object can be re-written
88
+ slightly different or no parameter to simply read the current
89
+ value out.
90
90
 
91
- gobjc =
92
- Rugged::Commit.new < Rugged::Object
91
+ gobjc = Rugged::Commit.new
92
+ # Rugged::Commit.new < Rugged::Object
93
93
  str = gobjc.message
94
94
  str = gobjc.message_short
95
95
  str = gobjc.message_body # TODO
@@ -97,18 +97,18 @@ to simply read the current value out
97
97
  prsn = gobjc.committer
98
98
  gobjr = gobjc.tree
99
99
  sha = gobjc.tree_sha
100
- arr = gobjc.parents [*] # TODO
100
+ arr = gobjc.parents [*] # TODO: write
101
101
 
102
- gobtg =
103
- Rugged::Tag.new < Rugged::Object
102
+ gobtg = Rugged::Tag.new
103
+ # Rugged::Tag.new < Rugged::Object
104
104
  gobj = gobtg.target
105
105
  int = gobtg.target_type
106
106
  str = gobtg.name
107
107
  prsn = gobtg.tagger
108
108
  str = gobtg.message
109
109
 
110
- gobtr =
111
- Rugged::Tree.new < Rugged::Object
110
+ gobtr = Rugged::Tree.new
111
+ # Rugged::Tree.new < Rugged::Object
112
112
  gobtr.add(ent) # TODO
113
113
  gobtr.remove(name) # TODO
114
114
  int = gobtr.entry_count
@@ -133,10 +133,11 @@ objects, one at a time. You can also hide() commits if you are not interested in
133
133
  anything beneath them (useful for a `git log master ^origin/master` type deal).
134
134
 
135
135
  walker =
136
- Rugged::Walker.new(repo)
136
+ Rugged::Walker.new(repo)
137
+ walker.walk { |c| puts c.inspect } # walk is just an alias of each
138
+ walker.each { |c| puts c.inspect }
137
139
  walker.push(hex_sha_interesting)
138
140
  walker.hide(hex_sha_uninteresting)
139
- cmt = walker.next # false if none left
140
141
  walker.reset
141
142
 
142
143
 
@@ -151,29 +152,17 @@ of manually opening the Index by its path.
151
152
  # TODO: the remove and add functions immediately flush to the index file on disk
152
153
  index =
153
154
  Rugged::Index.new(path)
154
- index.refresh # re-read the index file from disk
155
- int = index.entry_count # count of index entries
155
+ index.reload # re-read the index file from disk
156
+ int = index.count # count of index entries
157
+ index.entries # collection of index entries
158
+ index.each { |i| puts i.inspect }
156
159
  ent = index.get_entry(i/path)
157
160
  index.remove(i/path)
158
161
  index.add(ientry) # also updates existing entry if there is one
159
162
  index.add(path) # create ientry from file in path, update index
160
163
  #TODO index.read_tree(gobtr, path='/')
161
164
  #TODO index.write_tree
162
-
163
- ientry =
164
- Rugged::IndexEntry.new(index, offset)
165
- str = ientry.path
166
- time = ientry.ctime
167
- time = ientry.mtime
168
- str = ientry.sha
169
- int = ientry.dev
170
- int = ientry.ino
171
- int = ientry.mode
172
- int = ientry.uid
173
- int = ientry.gid
174
- int = ientry.file_size
175
- int = ientry.flags # (what flags are available?)
176
- int = ientry.flags_extended # (what flags are available?)
165
+
177
166
 
178
167
  Index Status # TODO
179
168
  -------------------
data/Rakefile CHANGED
@@ -1,31 +1,34 @@
1
- # stolen largely from defunkt/mustache
2
1
  require 'rake/testtask'
3
- require 'rake/rdoctask'
4
- require 'rake/extensiontask'
5
2
 
6
- Rake::ExtensionTask.new('rugged') do |r|
7
- r.lib_dir = 'lib/rugged'
8
- end
9
-
10
- #
11
- # Helpers
12
- #
3
+ begin
4
+ require 'rake/extensiontask'
5
+ rescue LoadError
6
+ abort <<-error
7
+ rake-compile is missing; Rugged depends on rake-compiler to build the C wrapping code.
13
8
 
14
- def command?(command)
15
- system("type #{command} > /dev/null")
9
+ Install it by running `gem i rake-compiler`
10
+ error
16
11
  end
17
12
 
13
+ Rake::ExtensionTask.new('rugged') do |r|
14
+ r.lib_dir = 'lib/rugged'
15
+ end
18
16
 
19
17
  #
20
18
  # Tests
21
19
  #
20
+ task :default => [:compile, :test]
22
21
 
23
- task :default => :test
22
+ task :pack_dist do
23
+ dir = File.dirname(File.expand_path(__FILE__))
24
+ output = File.join(dir, 'ext', 'rugged', 'vendor', 'libgit2-dist.tar.gz')
25
+ Dir.chdir(ENV['LIBGIT2_PATH']) do
26
+ `git archive --format=tar --prefix=libgit2-dist/ HEAD | gzip > #{output}`
27
+ end
28
+ end
24
29
 
25
- desc "Run tests"
26
- task :turn do
27
- suffix = "-n #{ENV['TEST']}" if ENV['TEST']
28
- sh "turn test/*_test.rb #{suffix}"
30
+ task :cover do
31
+ ruby 'test/coverage/cover.rb'
29
32
  end
30
33
 
31
34
  Rake::TestTask.new do |t|
@@ -33,84 +36,3 @@ Rake::TestTask.new do |t|
33
36
  t.pattern = 'test/**/*_test.rb'
34
37
  t.verbose = false
35
38
  end
36
-
37
- if command? :kicker
38
- desc "Launch Kicker (like autotest)"
39
- task :kicker do
40
- puts "Kicking... (ctrl+c to cancel)"
41
- exec "kicker -e rake test lib"
42
- end
43
- end
44
-
45
- desc "Update the libgit2 SHA"
46
- task :libgit do
47
- sha = `git --git-dir=../libgit2/.git rev-parse HEAD`
48
- File.open("LIBGIT2_VERSION", 'w') do |f|
49
- f.puts "# git --git-dir=../libgit2/.git rev-parse HEAD"
50
- f.puts sha
51
- end
52
- end
53
-
54
-
55
- #
56
- # Ron
57
- #
58
-
59
- if command? :ronn
60
- desc "Show the manual"
61
- task :man => "man:build" do
62
- exec "man man/mustache.1"
63
- end
64
-
65
- desc "Build the manual"
66
- task "man:build" do
67
- sh "ronn -br5 --organization=SCHACON --manual='Rugged Manual' man/*.ron"
68
- end
69
- end
70
-
71
-
72
- #
73
- # Gems
74
- #
75
-
76
- begin
77
- require 'mg'
78
- MG.new("rugged.gemspec")
79
-
80
- desc "Push a new version to Gemcutter and publish docs."
81
- task :publish => "gem:publish" do
82
- require File.dirname(__FILE__) + '/lib/mustache/version'
83
-
84
- system "git tag v#{Rugged::Version}"
85
- sh "git push origin master --tags"
86
- sh "git clean -fd"
87
- exec "rake pages"
88
- end
89
- rescue LoadError
90
- warn "mg not available."
91
- warn "Install it with: gem i mg"
92
- end
93
-
94
- #
95
- # Documentation
96
- #
97
-
98
- desc "Publish to GitHub Pages"
99
- task :pages => [ "man:build" ] do
100
- Dir['man/*.html'].each do |f|
101
- cp f, File.basename(f).sub('.html', '.newhtml')
102
- end
103
-
104
- `git commit -am 'generated manual'`
105
- `git checkout site`
106
-
107
- Dir['*.newhtml'].each do |f|
108
- mv f, f.sub('.newhtml', '.html')
109
- end
110
-
111
- `git add .`
112
- `git commit -m updated`
113
- `git push site site:master`
114
- `git checkout master`
115
- puts :done
116
- end
@@ -1,9 +1,49 @@
1
1
  require 'mkmf'
2
2
 
3
- dir_config("rugged")
3
+ def sys(cmd)
4
+ puts " -- #{cmd}"
5
+ unless ret = xsystem(cmd)
6
+ raise "ERROR: '#{cmd}' failed"
7
+ end
8
+ ret
9
+ end
4
10
 
5
- have_library("git2")
6
- have_library('z')
11
+ if `which make`.strip.empty?
12
+ STDERR.puts "ERROR: GNU make is required to build Rugged"
13
+ exit(1)
14
+ end
7
15
 
8
- create_makefile("rugged/rugged")
16
+ if p = ENV['LIBGIT2_PATH']
17
+ $INCFLAGS[0,0] = " -I#{File.join(p, 'include')} "
18
+ $LDFLAGS << " -L#{p} "
19
+
20
+ unless have_library 'git2' and have_header 'git2.h'
21
+ STDERR.puts "ERROR: Invalid `LIBGIT2_PATH` environment"
22
+ exit(1)
23
+ end
24
+ else
25
+ CWD = File.expand_path(File.dirname(__FILE__))
26
+
27
+ LIBGIT2_DIST = 'libgit2-dist.tar.gz'
28
+ LIBGIT2_DIR = File.basename(LIBGIT2_DIST, '.tar.gz')
29
+
30
+ Dir.chdir("#{CWD}/vendor") do
31
+ FileUtils.rm_rf(LIBGIT2_DIR) if File.exists?(LIBGIT2_DIR)
9
32
 
33
+ sys("tar zxvf #{LIBGIT2_DIST}")
34
+ Dir.chdir(LIBGIT2_DIR) do
35
+ sys("make -f Makefile.embed")
36
+ FileUtils.cp "libgit2.a", "#{CWD}/libgit2_embed.a"
37
+ end
38
+ end
39
+
40
+ $INCFLAGS[0,0] = " -I#{CWD}/vendor/#{LIBGIT2_DIR}/include "
41
+ $LDFLAGS << " -L#{CWD} "
42
+
43
+ unless have_library 'git2_embed' and have_header 'git2.h'
44
+ STDERR.puts "ERROR: Failed to build libgit2"
45
+ exit(1)
46
+ end
47
+ end
48
+
49
+ create_makefile("rugged/rugged")
@@ -0,0 +1,215 @@
1
+ /*
2
+ * The MIT License
3
+ *
4
+ * Copyright (c) 2011 GitHub, Inc
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in
14
+ * all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ * THE SOFTWARE.
23
+ */
24
+
25
+ #include "rugged.h"
26
+
27
+ extern VALUE rb_mRugged;
28
+ extern VALUE rb_cRuggedRepo;
29
+ VALUE rb_cRuggedRemote;
30
+
31
+ static void rb_git_remote__free(git_remote *remote)
32
+ {
33
+ git_remote_free(remote);
34
+ }
35
+
36
+ static VALUE rb_git_remote__new(int argc, VALUE *argv, VALUE klass)
37
+ {
38
+ VALUE rb_remote, rb_repo, rb_url, rb_name;
39
+ git_remote *remote;
40
+ git_repository *repo;
41
+ const char *url;
42
+ int error;
43
+
44
+ rb_scan_args(argc, argv, "21", &rb_repo, &rb_url, &rb_name);
45
+
46
+ Check_Type(rb_url, T_STRING);
47
+
48
+ if (!rb_obj_is_instance_of(rb_repo, rb_cRuggedRepo))
49
+ rb_raise(rb_eTypeError, "Expecting a Rugged Repository");
50
+
51
+ Data_Get_Struct(rb_repo, git_repository, repo);
52
+
53
+ url = StringValueCStr(rb_url);
54
+
55
+ if (git_remote_valid_url(url)) {
56
+ if (!NIL_P(rb_name))
57
+ Check_Type(rb_name, T_STRING);
58
+
59
+ error = git_remote_new(
60
+ &remote,
61
+ repo,
62
+ StringValueCStr(rb_url),
63
+ NIL_P(rb_name) ? NULL : StringValueCStr(rb_name)
64
+ );
65
+ } else {
66
+ error = git_remote_load(&remote, repo, url);
67
+ }
68
+
69
+ rugged_exception_check(error);
70
+
71
+ rb_remote = Data_Wrap_Struct(klass, NULL, &rb_git_remote__free, remote);
72
+ rugged_set_owner(rb_remote, rb_repo);
73
+ return rb_remote;
74
+ }
75
+
76
+ static VALUE rb_git_remote_disconnect(VALUE self)
77
+ {
78
+ git_remote *remote;
79
+ Data_Get_Struct(self, git_remote, remote);
80
+
81
+ git_remote_disconnect(remote);
82
+ return Qnil;
83
+ }
84
+
85
+ static VALUE rb_git_remote_connect(VALUE self, VALUE rb_direction)
86
+ {
87
+ int error, direction = 0;
88
+ git_remote *remote;
89
+ ID id_direction;
90
+
91
+ Data_Get_Struct(self, git_remote, remote);
92
+
93
+ Check_Type(rb_direction, T_SYMBOL);
94
+ id_direction = SYM2ID(rb_direction);
95
+
96
+ if (id_direction == rb_intern("fetch"))
97
+ direction = GIT_DIR_FETCH;
98
+ else if (id_direction == rb_intern("push"))
99
+ direction = GIT_DIR_PUSH;
100
+ else
101
+ rb_raise(rb_eTypeError,
102
+ "Invalid remote direction. Expected `:fetch` or `:push`");
103
+
104
+ error = git_remote_connect(remote, direction);
105
+ rugged_exception_check(error);
106
+
107
+ if (rb_block_given_p())
108
+ rb_ensure(rb_yield, self, rb_git_remote_disconnect, self);
109
+
110
+ return Qnil;
111
+ }
112
+
113
+ static VALUE rugged_rhead_new(git_remote_head *head)
114
+ {
115
+ VALUE rb_head = rb_hash_new();
116
+
117
+ rb_hash_aset(rb_head, CSTR2SYM("local?"), head->local ? Qtrue : Qfalse);
118
+ rb_hash_aset(rb_head, CSTR2SYM("oid"), rugged_create_oid(&head->oid));
119
+ rb_hash_aset(rb_head, CSTR2SYM("loid"), rugged_create_oid(&head->loid));
120
+ rb_hash_aset(rb_head, CSTR2SYM("name"), rugged_str_new2(head->name, NULL));
121
+
122
+ return rb_head;
123
+ }
124
+
125
+ static int cb_remote__ls(git_remote_head *head, void *payload)
126
+ {
127
+ rb_funcall((VALUE)payload, rb_intern("call"), 1, rugged_rhead_new(head));
128
+ return GIT_SUCCESS;
129
+ }
130
+
131
+ static VALUE rb_git_remote_ls(VALUE self)
132
+ {
133
+ int error;
134
+ git_remote *remote;
135
+ Data_Get_Struct(self, git_remote, remote);
136
+
137
+ if (!rb_block_given_p())
138
+ return rb_funcall(self, rb_intern("to_enum"), 1, CSTR2SYM("ls"));
139
+
140
+ error = git_remote_ls(remote, &cb_remote__ls, (void *)rb_block_proc());
141
+ rugged_exception_check(error);
142
+
143
+ return Qnil;
144
+ }
145
+
146
+ static VALUE rb_git_remote_name(VALUE self)
147
+ {
148
+ git_remote *remote;
149
+ Data_Get_Struct(self, git_remote, remote);
150
+
151
+ return rugged_str_new2(git_remote_name(remote), NULL);
152
+ }
153
+
154
+ static VALUE rb_git_remote_url(VALUE self)
155
+ {
156
+ git_remote *remote;
157
+ Data_Get_Struct(self, git_remote, remote);
158
+
159
+ return rugged_str_new2(git_remote_url(remote), NULL);
160
+ }
161
+
162
+ static VALUE rb_git_remote_connected(VALUE self)
163
+ {
164
+ git_remote *remote;
165
+ Data_Get_Struct(self, git_remote, remote);
166
+
167
+ return git_remote_connected(remote) ? Qtrue : Qfalse;
168
+ }
169
+
170
+ static VALUE rb_git_remote_download(VALUE self)
171
+ {
172
+ int error;
173
+ git_remote *remote;
174
+ char *path;
175
+ VALUE rb_path;
176
+
177
+ Data_Get_Struct(self, git_remote, remote);
178
+
179
+ error = git_remote_download(&path, remote);
180
+ rugged_exception_check(error);
181
+
182
+ rb_path = rugged_str_new2(path, NULL);
183
+ free(path);
184
+
185
+ return rb_path;
186
+ }
187
+
188
+ static VALUE rb_git_remote_update_tips(VALUE self)
189
+ {
190
+ int error;
191
+ git_remote *remote;
192
+
193
+ Data_Get_Struct(self, git_remote, remote);
194
+
195
+ error = git_remote_update_tips(remote);
196
+ rugged_exception_check(error);
197
+
198
+ return Qnil;
199
+ }
200
+
201
+ void Init_rugged_remote()
202
+ {
203
+ rb_cRuggedRemote = rb_define_class_under(rb_mRugged, "Remote", rb_cObject);
204
+
205
+ rb_define_singleton_method(rb_cRuggedRemote, "new", rb_git_remote__new, -1);
206
+
207
+ rb_define_method(rb_cRuggedRemote, "connect", rb_git_remote_connect, 1);
208
+ rb_define_method(rb_cRuggedRemote, "disconnect", rb_git_remote_disconnect, 0);
209
+ rb_define_method(rb_cRuggedRemote, "name", rb_git_remote_name, 0);
210
+ rb_define_method(rb_cRuggedRemote, "url", rb_git_remote_url, 0);
211
+ rb_define_method(rb_cRuggedRemote, "connected?", rb_git_remote_connected, 0);
212
+ rb_define_method(rb_cRuggedRemote, "ls", rb_git_remote_ls, 0);
213
+ rb_define_method(rb_cRuggedRemote, "download", rb_git_remote_download, 0);
214
+ rb_define_method(rb_cRuggedRemote, "update_tips!", rb_git_remote_update_tips, 0);
215
+ }