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
@@ -0,0 +1,151 @@
1
+
2
+ static const char *packed_objects[] = {
3
+ "0266163a49e280c4f5ed1e08facd36a2bd716bcf",
4
+ "53fc32d17276939fc79ed05badaef2db09990016",
5
+ "6336846bd5c88d32f93ae57d846683e61ab5c530",
6
+ "6dcf9bf7541ee10456529833502442f385010c3d",
7
+ "bed08a0b30b72a9d4aed7f1af8c8ca124e8d64b9",
8
+ "e90810b8df3e80c413d903f631643c716887138d",
9
+ "fc3c3a2083e9f6f89e6bd53e9420e70d1e357c9b",
10
+ "fc58168adf502d0c0ef614c3111a7038fc8c09c8",
11
+ "fd0ec0333948dfe23265ac46be0205a436a8c3a5",
12
+ "fd8430bc864cfcd5f10e5590f8a447e01b942bfe",
13
+ "fd899f45951c15c1c5f7c34b1c864e91bd6556c6",
14
+ "fda23b974899e7e1f938619099280bfda13bdca9",
15
+ "fdbec189efb657c8325962b494875987881a356b",
16
+ "fe1ca6bd22b5d8353ce6c2f3aba80805c438a7a5",
17
+ "fe3a6a42c87ff1239370c741a265f3997add87c1",
18
+ "deb106bfd2d36ecf9f0079224c12022201a39ad1",
19
+ "dec93efc79e60f2680de3e666755d335967eec30",
20
+ "def425bf8568b9c1e20879bf5be6f9c52b7361c4",
21
+ "df48000ac4f48570054e3a71a81916357997b680",
22
+ "dfae6ed8f6dd8acc3b40a31811ea316239223559",
23
+ "dff79e27d3d2cdc09790ded80fe2ea8ff5d61034",
24
+ "e00e46abe4c542e17c8bc83d72cf5be8018d7b0e",
25
+ "e01b107b4f77f8f98645adac0206a504f2d29d7c",
26
+ "e032d863f512c47b479bd984f8b6c8061f66b7d4",
27
+ "e044baa468a1c74f9f9da36805445f6888358b49",
28
+ "e04529998989ba8ae3419538dd57969af819b241",
29
+ "e0637ddfbea67c8d7f557c709e095af8906e9176",
30
+ "e0743ad4031231e71700abdc6fdbe94f189d20e5",
31
+ "cf33ac7a3d8b2b8f6bb266518aadbf59de397608",
32
+ "cf5f7235b9c9689b133f6ea12015720b411329bd",
33
+ "cf6cccf1297284833a9a03138a1f5738fa1c6c94",
34
+ "cf7992bde17ce7a79cab5f0c1fcbe8a0108721ed",
35
+ "cfe3a027ab12506d4144ee8a35669ae8fc4b7ab1",
36
+ "cfe96f31dfad7bab49977aa1df7302f7fafcb025",
37
+ "cff54d138945ef4de384e9d2759291d0c13ea90a",
38
+ "d01f7573ac34c2f502bd1cf18cde73480c741151",
39
+ "d03f567593f346a1ca96a57f8191def098d126e3",
40
+ "d047b47aadf88501238f36f5c17dd0a50dc62087",
41
+ "d0a0d63086fae3b0682af7261df21f7d0f7f066d",
42
+ "d0a44bd6ed0be21b725a96c0891bbc79bc1a540c",
43
+ "d0d7e736e536a41bcb885005f8bf258c61cad682",
44
+ "d0e7959d4b95ffec6198df6f5a7ae259b23a5f50",
45
+ "bf2fe2acca17d13356ce802ba9dc8343f710dfb7",
46
+ "bf55f407d6d9418e51f42ea7a3a6aadf17388349",
47
+ "bf92206f8b633b88a66dca4a911777630b06fbac",
48
+ "bfaf8c42eb8842abe206179fee864cfba87e3ca9",
49
+ "bfe05675d4e8f6b59d50932add8790f1a06b10ee",
50
+ "bff8618112330763327cfa6ce6e914db84f51ddf",
51
+ "bff873e9853ed99fed52c25f7ad29f78b27dcec2",
52
+ "c01c3fae7251098d7af1b459bcd0786e81d4616d",
53
+ "c0220fca67f48b8a5d4163d53b1486224be3a198",
54
+ "c02d0b160b82ee72469c269f13de4c26a7ea09cb",
55
+ "c059510ad1b45ab58390e042d7dee1ac46703854",
56
+ "c07204a1897aeeaa3c248d29dbfa9b033baf9755",
57
+ "c073337a4dd7276931b4b3fdbc3f0040e9441793",
58
+ "0fd7e4bfba5b3a82be88d1057757ca8b2c5e6d26",
59
+ "100746511cc45c9f1ad6721c4ef5be49222fee4d",
60
+ "1088490171d9b984d68b8b9be9ca003f4eafff59",
61
+ "1093c8ff4cb78fcf5f79dbbeedcb6e824bd4e253",
62
+ "10aa3fa72afab7ee31e116ae06442fe0f7b79df2",
63
+ "10b759e734e8299aa0dca08be935d95d886127b6",
64
+ "111d5ccf0bb010c4e8d7af3eedfa12ef4c5e265b",
65
+ "11261fbff21758444d426356ff6327ee01e90752",
66
+ "112998d425717bb922ce74e8f6f0f831d8dc4510",
67
+ "2ef4e5d838b6507bd61d457cf6466662b791c5c0",
68
+ "2ef4faa0f82efa00eeac6cae9e8b2abccc8566ee",
69
+ "2f06098183b0d7be350acbe39cdbaccff2df0c4a",
70
+ "2f1c5d509ac5bffb3c62f710a1c2c542e126dfd1",
71
+ "2f205b20fc16423c42b3ba51b2ea78d7b9ff3578",
72
+ "2f9b6b6e3d9250ba09360734aa47973a993b59d1",
73
+ "30c62a2d5a8d644f1311d4f7fe3f6a788e4c8188",
74
+ "31438e245492d85fd6da4d1406eba0fbde8332a4",
75
+ "3184a3abdfea231992254929ff4e275898e5bbf6",
76
+ "3188ffdbb3a3d52e0f78f30c484533899224436e",
77
+ "32581d0093429770d044a60eb0e9cc0462bedb13",
78
+ "32679a9544d83e5403202c4d5efb61ad02492847",
79
+ "4e7e9f60b7e2049b7f5697daf133161a18ef688f",
80
+ "4e8cda27ddc8be7db875ceb0f360c37734724c6d",
81
+ "4ea481c61c59ab55169b7cbaae536ad50b49d6f0",
82
+ "4f0adcd0e61eabe06fe32be66b16559537124b7a",
83
+ "4f1355c91100d12f9e7202f91b245df0c110867c",
84
+ "4f6eadeb08b9d0d1e8b1b3eac8a34940adf29a2d",
85
+ "4f9339df943c53117a5fc8e86e2f38716ff3a668",
86
+ "4fc3874b118752e40de556b1c3e7b4a9f1737d00",
87
+ "4ff1dd0992dd6baafdb5e166be6f9f23b59bdf87",
88
+ "5018a35e0b7e2eec7ce5050baf9c7343f3f74164",
89
+ "50298f44a45eda3a29dae82dbe911b5aa176ac07",
90
+ "502acd164fb115768d723144da2e7bb5a24891bb",
91
+ "50330c02bd4fd95c9db1fcf2f97f4218e42b7226",
92
+ "5052bf355d9f8c52446561a39733a8767bf31e37",
93
+ "6f2cd729ae42988c1dd43588d3a6661ba48ad7a0",
94
+ "6f4e2c42d9138bfbf3e0f908f1308828cc6f2178",
95
+ "6f6a17db05a83620cef4572761831c20a70ba9b9",
96
+ "6faad60901e36538634f0d8b8ff3f21f83503c71",
97
+ "6fc72e46de3df0c3842dab302bbacf697a63abab",
98
+ "6fdccd49f442a7204399ca9b418f017322dbded8",
99
+ "6fe7568fc3861c334cb008fd85d57d9647249ef5",
100
+ "700f55d91d7b55665594676a4bada1f1457a0598",
101
+ "702bd70595a7b19afc48a1f784a6505be68469d4",
102
+ "7033f9ee0e52b08cb5679cd49b7b7999eaf9eaf8",
103
+ "70957110ce446c4e250f865760fb3da513cdcc92",
104
+ "8ec696a4734f16479d091bc70574d23dd9fe7443",
105
+ "8ed341c55ed4d6f4cdc8bf4f0ca18a08c93f6962",
106
+ "8edc2805f1f11b63e44bf81f4557f8b473612b69",
107
+ "8ef9060a954118a698fc10e20acdc430566a100f",
108
+ "8f0c4b543f4bb6eb1518ecfc3d4699e43108d393",
109
+ "8fac94df3035405c2e60b3799153ce7c428af6b9",
110
+ "904c0ac12b23548de524adae712241b423d765a3",
111
+ "90bbaa9a809c3a768d873a9cc7d52b4f3bf3d1b9",
112
+ "90d4d2f0fc362beabbbf76b4ffda0828229c198d",
113
+ "90f9ff6755330b685feff6c3d81782ee3592ab04",
114
+ "91822c50ebe4f9bf5bbb8308ecf9f6557062775c",
115
+ "91d973263a55708fa8255867b3202d81ef9c2868",
116
+ "af292c99c6148d772af3315a1c74e83330e7ead7",
117
+ "af3b99d5be330dbbce0b9250c3a5fb05911908cc",
118
+ "af55d0cdeb280af2db8697e5afa506e081012719",
119
+ "af795e498d411142ddb073e8ca2c5447c3295a4c",
120
+ "afadc73a392f8cc8e2cc77dd62a7433dd3bafa8c",
121
+ "affd84ed8ec7ce67612fe3c12a80f8164b101f6a",
122
+ "b0941f9c70ffe67f0387a827b338e64ecf3190f0",
123
+ "b0a3077f9ef6e093f8d9869bdb0c07095bd722cb",
124
+ "b0a8568a7614806378a54db5706ee3b06ae58693",
125
+ "b0fb7372f242233d1d35ce7d8e74d3990cbc5841",
126
+ "b10489944b9ead17427551759d180d10203e06ba",
127
+ "b196a807b323f2748ffc6b1d42cd0812d04c9a40",
128
+ "b1bb1d888f0c5e19278536d49fa77db035fac7ae"
129
+ };
130
+
131
+ static const char *loose_objects[] = {
132
+ "45b983be36b73c0788dc9cbcb76cbb80fc7bb057",
133
+ "a8233120f6ad708f843d861ce2b7228ec4e3dec6",
134
+ "fd093bff70906175335656e6ce6ae05783708765",
135
+ "c47800c7266a2be04c571c04d5a6614691ea99bd",
136
+ "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd",
137
+ "8496071c1b46c854b31185ea97743be6a8774479",
138
+ "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
139
+ "814889a078c031f61ed08ab5fa863aea9314344d",
140
+ "5b5b025afb0b4c913b4c338a42934a3863bf3644",
141
+ "1385f264afb75a56a5bec74243be9b367ba4ca08",
142
+ "f60079018b664e4e79329a7ef9559c8d9e0378d1",
143
+ "be3563ae3f795b2b4353bcce3a527ad0a4f7f644",
144
+ "75057dd4114e74cca1d750d0aee1647c903cb60a",
145
+ "fa49b077972391ad58037050f2a75f74e3671e92",
146
+ "9fd738e8f7967c078dceed8190330fc8648ee56a",
147
+ "1810dff58d8a660512d4832e740f692884338ccd",
148
+ "181037049a54a1eb5fab404658a3a250b44335d7",
149
+ "a4a7dce85cf63874e984719f4fdd239f5145052f",
150
+ "4a202b346bb0fb0db7eff3cffeb3c70babbd2045"
151
+ };
@@ -0,0 +1,78 @@
1
+ #include "clay_libgit2.h"
2
+ #include "odb.h"
3
+ #include "pack_data.h"
4
+
5
+ static git_odb *_odb;
6
+
7
+ void test_odb_packed__initialize(void)
8
+ {
9
+ cl_git_pass(git_odb_open(&_odb, cl_fixture("testrepo.git/objects")));
10
+ }
11
+
12
+ void test_odb_packed__cleanup(void)
13
+ {
14
+ git_odb_free(_odb);
15
+ }
16
+
17
+ void test_odb_packed__mass_read(void)
18
+ {
19
+ unsigned int i;
20
+
21
+ for (i = 0; i < ARRAY_SIZE(packed_objects); ++i) {
22
+ git_oid id;
23
+ git_odb_object *obj;
24
+
25
+ cl_git_pass(git_oid_fromstr(&id, packed_objects[i]));
26
+ cl_assert(git_odb_exists(_odb, &id) == 1);
27
+ cl_git_pass(git_odb_read(&obj, _odb, &id));
28
+
29
+ git_odb_object_free(obj);
30
+ }
31
+ }
32
+
33
+ void test_odb_packed__read_header_0(void)
34
+ {
35
+ unsigned int i;
36
+
37
+ for (i = 0; i < ARRAY_SIZE(packed_objects); ++i) {
38
+ git_oid id;
39
+ git_odb_object *obj;
40
+ size_t len;
41
+ git_otype type;
42
+
43
+ cl_git_pass(git_oid_fromstr(&id, packed_objects[i]));
44
+
45
+ cl_git_pass(git_odb_read(&obj, _odb, &id));
46
+ cl_git_pass(git_odb_read_header(&len, &type, _odb, &id));
47
+
48
+ cl_assert(obj->raw.len == len);
49
+ cl_assert(obj->raw.type == type);
50
+
51
+ git_odb_object_free(obj);
52
+ }
53
+ }
54
+
55
+ void test_odb_packed__read_header_1(void)
56
+ {
57
+ unsigned int i;
58
+
59
+ for (i = 0; i < ARRAY_SIZE(loose_objects); ++i) {
60
+ git_oid id;
61
+ git_odb_object *obj;
62
+ size_t len;
63
+ git_otype type;
64
+
65
+ cl_git_pass(git_oid_fromstr(&id, loose_objects[i]));
66
+
67
+ cl_assert(git_odb_exists(_odb, &id) == 1);
68
+
69
+ cl_git_pass(git_odb_read(&obj, _odb, &id));
70
+ cl_git_pass(git_odb_read_header(&len, &type, _odb, &id));
71
+
72
+ cl_assert(obj->raw.len == len);
73
+ cl_assert(obj->raw.type == type);
74
+
75
+ git_odb_object_free(obj);
76
+ }
77
+ }
78
+
@@ -0,0 +1,71 @@
1
+ #include "clay_libgit2.h"
2
+ #include "git2/odb_backend.h"
3
+ #include "odb.h"
4
+
5
+ typedef struct {
6
+ git_odb_backend base;
7
+ int position;
8
+ } fake_backend;
9
+
10
+ static git_odb_backend *new_backend(int position)
11
+ {
12
+ fake_backend *b;
13
+
14
+ b = git__malloc(sizeof(fake_backend));
15
+ if (b == NULL)
16
+ return NULL;
17
+
18
+ memset(b, 0x0, sizeof(fake_backend));
19
+ b->position = position;
20
+ return (git_odb_backend *)b;
21
+ }
22
+
23
+ static void check_backend_sorting(git_odb *odb)
24
+ {
25
+ unsigned int i;
26
+
27
+ for (i = 0; i < odb->backends.length; ++i) {
28
+ fake_backend *internal =
29
+ *((fake_backend **)git_vector_get(&odb->backends, i));
30
+
31
+ cl_assert(internal != NULL);
32
+ cl_assert(internal->position == (int)i);
33
+ }
34
+ }
35
+
36
+ static git_odb *_odb;
37
+
38
+ void test_odb_sorting__initialize(void)
39
+ {
40
+ cl_git_pass(git_odb_new(&_odb));
41
+ }
42
+
43
+ void test_odb_sorting__cleanup(void)
44
+ {
45
+ git_odb_free(_odb);
46
+ _odb = NULL;
47
+ }
48
+
49
+ void test_odb_sorting__basic_backends_sorting(void)
50
+ {
51
+ cl_git_pass(git_odb_add_backend(_odb, new_backend(0), 5));
52
+ cl_git_pass(git_odb_add_backend(_odb, new_backend(2), 3));
53
+ cl_git_pass(git_odb_add_backend(_odb, new_backend(1), 4));
54
+ cl_git_pass(git_odb_add_backend(_odb, new_backend(3), 1));
55
+
56
+ check_backend_sorting(_odb);
57
+ }
58
+
59
+ void test_odb_sorting__alternate_backends_sorting(void)
60
+ {
61
+ cl_git_pass(git_odb_add_backend(_odb, new_backend(0), 5));
62
+ cl_git_pass(git_odb_add_backend(_odb, new_backend(2), 3));
63
+ cl_git_pass(git_odb_add_backend(_odb, new_backend(1), 4));
64
+ cl_git_pass(git_odb_add_backend(_odb, new_backend(3), 1));
65
+ cl_git_pass(git_odb_add_alternate(_odb, new_backend(4), 5));
66
+ cl_git_pass(git_odb_add_alternate(_odb, new_backend(6), 3));
67
+ cl_git_pass(git_odb_add_alternate(_odb, new_backend(5), 4));
68
+ cl_git_pass(git_odb_add_alternate(_odb, new_backend(7), 1));
69
+
70
+ check_backend_sorting(_odb);
71
+ }
@@ -0,0 +1,68 @@
1
+ #include "clay_libgit2.h"
2
+
3
+ void test_repo_getters__initialize(void)
4
+ {
5
+ cl_fixture_sandbox("testrepo.git");
6
+ }
7
+
8
+ void test_repo_getters__cleanup(void)
9
+ {
10
+ cl_fixture_cleanup("testrepo.git");
11
+ }
12
+
13
+ void test_repo_getters__empty(void)
14
+ {
15
+ git_repository *repo_empty, *repo_normal;
16
+
17
+ cl_git_pass(git_repository_open(&repo_normal, cl_fixture("testrepo.git")));
18
+ cl_assert(git_repository_is_empty(repo_normal) == 0);
19
+ git_repository_free(repo_normal);
20
+
21
+ cl_git_pass(git_repository_open(&repo_empty, cl_fixture("empty_bare.git")));
22
+ cl_assert(git_repository_is_empty(repo_empty) == 1);
23
+ git_repository_free(repo_empty);
24
+ }
25
+
26
+ void test_repo_getters__head_detached(void)
27
+ {
28
+ git_repository *repo;
29
+ git_reference *ref;
30
+ git_oid oid;
31
+
32
+ cl_git_pass(git_repository_open(&repo, "testrepo.git"));
33
+
34
+ cl_assert(git_repository_head_detached(repo) == 0);
35
+
36
+ /* detach the HEAD */
37
+ git_oid_fromstr(&oid, "c47800c7266a2be04c571c04d5a6614691ea99bd");
38
+ cl_git_pass(git_reference_create_oid(&ref, repo, "HEAD", &oid, 1));
39
+ cl_assert(git_repository_head_detached(repo) == 1);
40
+
41
+ /* take the reop back to it's original state */
42
+ cl_git_pass(git_reference_create_symbolic(&ref, repo, "HEAD", "refs/heads/master", 1));
43
+ cl_assert(git_repository_head_detached(repo) == 0);
44
+
45
+ git_reference_free(ref);
46
+ git_repository_free(repo);
47
+ }
48
+
49
+ void test_repo_getters__head_orphan(void)
50
+ {
51
+ git_repository *repo;
52
+ git_reference *ref;
53
+
54
+ cl_git_pass(git_repository_open(&repo, "testrepo.git"));
55
+
56
+ cl_assert(git_repository_head_orphan(repo) == 0);
57
+
58
+ /* orphan HEAD */
59
+ cl_git_pass(git_reference_create_symbolic(&ref, repo, "HEAD", "refs/heads/orphan", 1));
60
+ cl_assert(git_repository_head_orphan(repo) == 1);
61
+
62
+ /* take the reop back to it's original state */
63
+ cl_git_pass(git_reference_create_symbolic(&ref, repo, "HEAD", "refs/heads/master", 1));
64
+ cl_assert(git_repository_head_orphan(repo) == 0);
65
+
66
+ git_reference_free(ref);
67
+ git_repository_free(repo);
68
+ }
@@ -0,0 +1,104 @@
1
+ #include "clay_libgit2.h"
2
+ #include "fileops.h"
3
+
4
+ enum repo_mode {
5
+ STANDARD_REPOSITORY = 0,
6
+ BARE_REPOSITORY = 1
7
+ };
8
+
9
+ static git_repository *_repo;
10
+
11
+ void test_repo_init__initialize(void)
12
+ {
13
+ _repo = NULL;
14
+ }
15
+
16
+ static void cleanup_repository(void *path)
17
+ {
18
+ git_repository_free(_repo);
19
+ cl_fixture_cleanup((const char *)path);
20
+ }
21
+
22
+ static void ensure_repository_init(
23
+ const char *working_directory,
24
+ int is_bare,
25
+ const char *expected_path_repository,
26
+ const char *expected_working_directory)
27
+ {
28
+ const char *workdir;
29
+
30
+ cl_git_pass(git_repository_init(&_repo, working_directory, is_bare));
31
+
32
+ workdir = git_repository_workdir(_repo);
33
+ if (workdir != NULL || expected_working_directory != NULL) {
34
+ cl_assert(
35
+ git__suffixcmp(workdir, expected_working_directory) == 0
36
+ );
37
+ }
38
+
39
+ cl_assert(
40
+ git__suffixcmp(git_repository_path(_repo), expected_path_repository) == 0
41
+ );
42
+
43
+ cl_assert(git_repository_is_bare(_repo) == is_bare);
44
+
45
+ #ifdef GIT_WIN32
46
+ if (!is_bare) {
47
+ cl_assert((GetFileAttributes(_repo->path_repository) & FILE_ATTRIBUTE_HIDDEN) != 0);
48
+ }
49
+ #endif
50
+
51
+ cl_assert(git_repository_is_empty(_repo));
52
+ }
53
+
54
+ void test_repo_init__standard_repo(void)
55
+ {
56
+ cl_set_cleanup(&cleanup_repository, "testrepo");
57
+ ensure_repository_init("testrepo/", 0, "testrepo/.git/", "testrepo/");
58
+ }
59
+
60
+ void test_repo_init__standard_repo_noslash(void)
61
+ {
62
+ cl_set_cleanup(&cleanup_repository, "testrepo");
63
+ ensure_repository_init("testrepo", 0, "testrepo/.git/", "testrepo/");
64
+ }
65
+
66
+ void test_repo_init__bare_repo(void)
67
+ {
68
+ cl_set_cleanup(&cleanup_repository, "testrepo.git");
69
+ ensure_repository_init("testrepo.git/", 1, "testrepo.git/", NULL);
70
+ }
71
+
72
+ void test_repo_init__bare_repo_noslash(void)
73
+ {
74
+ cl_set_cleanup(&cleanup_repository, "testrepo.git");
75
+ ensure_repository_init("testrepo.git", 1, "testrepo.git/", NULL);
76
+ }
77
+
78
+ #if 0
79
+ BEGIN_TEST(init2, "Initialize and open a bare repo with a relative path escaping out of the current working directory")
80
+ char path_repository[GIT_PATH_MAX];
81
+ char current_workdir[GIT_PATH_MAX];
82
+ const mode_t mode = 0777;
83
+ git_repository* repo;
84
+
85
+ must_pass(p_getcwd(current_workdir, sizeof(current_workdir)));
86
+
87
+ git_path_join(path_repository, TEMP_REPO_FOLDER, "a/b/c/");
88
+ must_pass(git_futils_mkdir_r(path_repository, mode));
89
+
90
+ must_pass(chdir(path_repository));
91
+
92
+ must_pass(git_repository_init(&repo, "../d/e.git", 1));
93
+ must_pass(git__suffixcmp(repo->path_repository, "/a/b/d/e.git/"));
94
+
95
+ git_repository_free(repo);
96
+
97
+ must_pass(git_repository_open(&repo, "../d/e.git"));
98
+
99
+ git_repository_free(repo);
100
+
101
+ must_pass(chdir(current_workdir));
102
+ must_pass(git_futils_rmdir_r(TEMP_REPO_FOLDER, 1));
103
+ END_TEST
104
+ #endif