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,60 @@
1
+ #include "clay_libgit2.h"
2
+ #include "posix.h"
3
+
4
+ static void file_create(const char *filename, const char *content)
5
+ {
6
+ int fd;
7
+
8
+ fd = p_creat(filename, 0666);
9
+ cl_assert(fd != 0);
10
+ cl_git_pass(p_write(fd, content, strlen(content)));
11
+ cl_git_pass(p_close(fd));
12
+ }
13
+
14
+ void test_index_rename__single_file(void)
15
+ {
16
+ git_repository *repo;
17
+ git_index *index;
18
+ int position;
19
+ git_oid expected;
20
+ git_index_entry *entry;
21
+
22
+ p_mkdir("rename", 0700);
23
+
24
+ cl_git_pass(git_repository_init(&repo, "./rename", 0));
25
+ cl_git_pass(git_repository_index(&index, repo));
26
+
27
+ cl_assert(git_index_entrycount(index) == 0);
28
+
29
+ file_create("./rename/lame.name.txt", "new_file\n");
30
+
31
+ /* This should add a new blob to the object database in 'd4/fa8600b4f37d7516bef4816ae2c64dbf029e3a' */
32
+ cl_git_pass(git_index_add(index, "lame.name.txt", 0));
33
+ cl_assert(git_index_entrycount(index) == 1);
34
+
35
+ cl_git_pass(git_oid_fromstr(&expected, "d4fa8600b4f37d7516bef4816ae2c64dbf029e3a"));
36
+
37
+ position = git_index_find(index, "lame.name.txt");
38
+
39
+ entry = git_index_get(index, position);
40
+ cl_assert(git_oid_cmp(&expected, &entry->oid) == 0);
41
+
42
+ /* This removes the entry from the index, but not from the object database */
43
+ cl_git_pass(git_index_remove(index, position));
44
+ cl_assert(git_index_entrycount(index) == 0);
45
+
46
+ p_rename("./rename/lame.name.txt", "./rename/fancy.name.txt");
47
+
48
+ cl_git_pass(git_index_add(index, "fancy.name.txt", 0));
49
+ cl_assert(git_index_entrycount(index) == 1);
50
+
51
+ position = git_index_find(index, "fancy.name.txt");
52
+
53
+ entry = git_index_get(index, position);
54
+ cl_assert(git_oid_cmp(&expected, &entry->oid) == 0);
55
+
56
+ git_index_free(index);
57
+ git_repository_free(repo);
58
+
59
+ cl_fixture_cleanup("rename");
60
+ }
@@ -0,0 +1,50 @@
1
+ #include "clay_libgit2.h"
2
+
3
+ static git_remote *_remote;
4
+ static git_repository *_repo;
5
+ static const git_refspec *_refspec;
6
+
7
+ void test_network_remotes__initialize(void)
8
+ {
9
+ cl_fixture_sandbox("testrepo.git");
10
+
11
+ cl_git_pass(git_repository_open(&_repo, "testrepo.git"));
12
+ cl_git_pass(git_remote_load(&_remote, _repo, "test"));
13
+
14
+ _refspec = git_remote_fetchspec(_remote);
15
+ cl_assert(_refspec != NULL);
16
+ }
17
+
18
+ void test_network_remotes__cleanup(void)
19
+ {
20
+ git_remote_free(_remote);
21
+ git_repository_free(_repo);
22
+ cl_fixture_cleanup("testrepo.git");
23
+ }
24
+
25
+ void test_network_remotes__parsing(void)
26
+ {
27
+ cl_assert(!strcmp(git_remote_name(_remote), "test"));
28
+ cl_assert(!strcmp(git_remote_url(_remote), "git://github.com/libgit2/libgit2"));
29
+ }
30
+
31
+ void test_network_remotes__refspec_parsing(void)
32
+ {
33
+ cl_assert(!strcmp(git_refspec_src(_refspec), "refs/heads/*"));
34
+ cl_assert(!strcmp(git_refspec_dst(_refspec), "refs/remotes/test/*"));
35
+ }
36
+
37
+ void test_network_remotes__fnmatch(void)
38
+ {
39
+ cl_git_pass(git_refspec_src_match(_refspec, "refs/heads/master"));
40
+ cl_git_pass(git_refspec_src_match(_refspec, "refs/heads/multi/level/branch"));
41
+ }
42
+
43
+ void test_network_remotes__transform(void)
44
+ {
45
+ char ref[1024];
46
+
47
+ memset(ref, 0x0, sizeof(ref));
48
+ cl_git_pass(git_refspec_transform(ref, sizeof(ref), _refspec, "refs/heads/master"));
49
+ cl_assert(!strcmp(ref, "refs/remotes/test/master"));
50
+ }
@@ -0,0 +1,52 @@
1
+
2
+ #include "clay_libgit2.h"
3
+
4
+ #include "odb.h"
5
+
6
+ static int from_hex(unsigned int i)
7
+ {
8
+ if (i >= '0' && i <= '9')
9
+ return i - '0';
10
+ if (i >= 'a' && i <= 'f')
11
+ return 10 + (i - 'a');
12
+ if (i >= 'A' && i <= 'F')
13
+ return 10 + (i - 'A');
14
+ return -1;
15
+ }
16
+
17
+ void test_object_raw_chars__find_invalid_chars_in_oid(void)
18
+ {
19
+ git_oid out;
20
+ unsigned char exp[] = {
21
+ 0x16, 0xa6, 0x77, 0x70, 0xb7,
22
+ 0xd8, 0xd7, 0x23, 0x17, 0xc4,
23
+ 0xb7, 0x75, 0x21, 0x3c, 0x23,
24
+ 0xa8, 0xbd, 0x74, 0xf5, 0xe0,
25
+ };
26
+ char in[41] = "16a67770b7d8d72317c4b775213c23a8bd74f5e0";
27
+ unsigned int i;
28
+
29
+ for (i = 0; i < 256; i++) {
30
+ in[38] = (char)i;
31
+ if (from_hex(i) >= 0) {
32
+ exp[19] = (unsigned char)(from_hex(i) << 4);
33
+ cl_git_pass(git_oid_fromstr(&out, in));
34
+ cl_assert(memcmp(out.id, exp, sizeof(out.id)) == 0);
35
+ } else {
36
+ cl_git_fail(git_oid_fromstr(&out, in));
37
+ }
38
+ }
39
+ }
40
+
41
+ void test_object_raw_chars__build_valid_oid_from_raw_bytes(void)
42
+ {
43
+ git_oid out;
44
+ unsigned char exp[] = {
45
+ 0x16, 0xa6, 0x77, 0x70, 0xb7,
46
+ 0xd8, 0xd7, 0x23, 0x17, 0xc4,
47
+ 0xb7, 0x75, 0x21, 0x3c, 0x23,
48
+ 0xa8, 0xbd, 0x74, 0xf5, 0xe0,
49
+ };
50
+ git_oid_fromraw(&out, exp);
51
+ cl_git_pass(memcmp(out.id, exp, sizeof(out.id)));
52
+ }
@@ -0,0 +1,124 @@
1
+
2
+ #include "clay_libgit2.h"
3
+
4
+ #include "odb.h"
5
+
6
+ void test_object_raw_compare__succeed_on_copy_oid(void)
7
+ {
8
+ git_oid a, b;
9
+ unsigned char exp[] = {
10
+ 0x16, 0xa6, 0x77, 0x70, 0xb7,
11
+ 0xd8, 0xd7, 0x23, 0x17, 0xc4,
12
+ 0xb7, 0x75, 0x21, 0x3c, 0x23,
13
+ 0xa8, 0xbd, 0x74, 0xf5, 0xe0,
14
+ };
15
+ memset(&b, 0, sizeof(b));
16
+ git_oid_fromraw(&a, exp);
17
+ git_oid_cpy(&b, &a);
18
+ cl_git_pass(memcmp(a.id, exp, sizeof(a.id)));
19
+ }
20
+
21
+ void test_object_raw_compare__succeed_on_oid_comparison_lesser(void)
22
+ {
23
+ git_oid a, b;
24
+ unsigned char a_in[] = {
25
+ 0x16, 0xa6, 0x77, 0x70, 0xb7,
26
+ 0xd8, 0xd7, 0x23, 0x17, 0xc4,
27
+ 0xb7, 0x75, 0x21, 0x3c, 0x23,
28
+ 0xa8, 0xbd, 0x74, 0xf5, 0xe0,
29
+ };
30
+ unsigned char b_in[] = {
31
+ 0x16, 0xa6, 0x77, 0x70, 0xb7,
32
+ 0xd8, 0xd7, 0x23, 0x17, 0xc4,
33
+ 0xb7, 0x75, 0x21, 0x3c, 0x23,
34
+ 0xa8, 0xbd, 0x74, 0xf5, 0xf0,
35
+ };
36
+ git_oid_fromraw(&a, a_in);
37
+ git_oid_fromraw(&b, b_in);
38
+ cl_assert(git_oid_cmp(&a, &b) < 0);
39
+ }
40
+
41
+ void test_object_raw_compare__succeed_on_oid_comparison_equal(void)
42
+ {
43
+ git_oid a, b;
44
+ unsigned char a_in[] = {
45
+ 0x16, 0xa6, 0x77, 0x70, 0xb7,
46
+ 0xd8, 0xd7, 0x23, 0x17, 0xc4,
47
+ 0xb7, 0x75, 0x21, 0x3c, 0x23,
48
+ 0xa8, 0xbd, 0x74, 0xf5, 0xe0,
49
+ };
50
+ git_oid_fromraw(&a, a_in);
51
+ git_oid_fromraw(&b, a_in);
52
+ cl_assert(git_oid_cmp(&a, &b) == 0);
53
+ }
54
+
55
+ void test_object_raw_compare__succeed_on_oid_comparison_greater(void)
56
+ {
57
+ git_oid a, b;
58
+ unsigned char a_in[] = {
59
+ 0x16, 0xa6, 0x77, 0x70, 0xb7,
60
+ 0xd8, 0xd7, 0x23, 0x17, 0xc4,
61
+ 0xb7, 0x75, 0x21, 0x3c, 0x23,
62
+ 0xa8, 0xbd, 0x74, 0xf5, 0xe0,
63
+ };
64
+ unsigned char b_in[] = {
65
+ 0x16, 0xa6, 0x77, 0x70, 0xb7,
66
+ 0xd8, 0xd7, 0x23, 0x17, 0xc4,
67
+ 0xb7, 0x75, 0x21, 0x3c, 0x23,
68
+ 0xa8, 0xbd, 0x74, 0xf5, 0xd0,
69
+ };
70
+ git_oid_fromraw(&a, a_in);
71
+ git_oid_fromraw(&b, b_in);
72
+ cl_assert(git_oid_cmp(&a, &b) > 0);
73
+ }
74
+
75
+ void test_object_raw_compare__compare_fmt_oids(void)
76
+ {
77
+ const char *exp = "16a0123456789abcdef4b775213c23a8bd74f5e0";
78
+ git_oid in;
79
+ char out[GIT_OID_HEXSZ + 1];
80
+
81
+ cl_git_pass(git_oid_fromstr(&in, exp));
82
+
83
+ /* Format doesn't touch the last byte */
84
+ out[GIT_OID_HEXSZ] = 'Z';
85
+ git_oid_fmt(out, &in);
86
+ cl_assert(out[GIT_OID_HEXSZ] == 'Z');
87
+
88
+ /* Format produced the right result */
89
+ out[GIT_OID_HEXSZ] = '\0';
90
+ cl_assert(strcmp(exp, out) == 0);
91
+ }
92
+
93
+ void test_object_raw_compare__compare_allocfmt_oids(void)
94
+ {
95
+ const char *exp = "16a0123456789abcdef4b775213c23a8bd74f5e0";
96
+ git_oid in;
97
+ char *out;
98
+
99
+ cl_git_pass(git_oid_fromstr(&in, exp));
100
+
101
+ out = git_oid_allocfmt(&in);
102
+ cl_assert(out);
103
+ cl_assert(strcmp(exp, out) == 0);
104
+ git__free(out);
105
+ }
106
+
107
+ void test_object_raw_compare__compare_pathfmt_oids(void)
108
+ {
109
+ const char *exp1 = "16a0123456789abcdef4b775213c23a8bd74f5e0";
110
+ const char *exp2 = "16/a0123456789abcdef4b775213c23a8bd74f5e0";
111
+ git_oid in;
112
+ char out[GIT_OID_HEXSZ + 2];
113
+
114
+ cl_git_pass(git_oid_fromstr(&in, exp1));
115
+
116
+ /* Format doesn't touch the last byte */
117
+ out[GIT_OID_HEXSZ + 1] = 'Z';
118
+ git_oid_pathfmt(out, &in);
119
+ cl_assert(out[GIT_OID_HEXSZ + 1] == 'Z');
120
+
121
+ /* Format produced the right result */
122
+ out[GIT_OID_HEXSZ + 1] = '\0';
123
+ cl_assert(strcmp(exp2, out) == 0);
124
+ }
@@ -0,0 +1,75 @@
1
+
2
+ #include "clay_libgit2.h"
3
+
4
+ #include "odb.h"
5
+
6
+ void test_object_raw_convert__succeed_on_oid_to_string_conversion(void)
7
+ {
8
+ const char *exp = "16a0123456789abcdef4b775213c23a8bd74f5e0";
9
+ git_oid in;
10
+ char out[GIT_OID_HEXSZ + 1];
11
+ char *str;
12
+ int i;
13
+
14
+ cl_git_pass(git_oid_fromstr(&in, exp));
15
+
16
+ /* NULL buffer pointer, returns static empty string */
17
+ str = git_oid_to_string(NULL, sizeof(out), &in);
18
+ cl_assert(str && *str == '\0' && str != out);
19
+
20
+ /* zero buffer size, returns static empty string */
21
+ str = git_oid_to_string(out, 0, &in);
22
+ cl_assert(str && *str == '\0' && str != out);
23
+
24
+ /* NULL oid pointer, returns static empty string */
25
+ str = git_oid_to_string(out, sizeof(out), NULL);
26
+ cl_assert(str && *str == '\0' && str != out);
27
+
28
+ /* n == 1, returns out as an empty string */
29
+ str = git_oid_to_string(out, 1, &in);
30
+ cl_assert(str && *str == '\0' && str == out);
31
+
32
+ for (i = 1; i < GIT_OID_HEXSZ; i++) {
33
+ out[i+1] = 'Z';
34
+ str = git_oid_to_string(out, i+1, &in);
35
+ /* returns out containing c-string */
36
+ cl_assert(str && str == out);
37
+ /* must be '\0' terminated */
38
+ cl_assert(*(str+i) == '\0');
39
+ /* must not touch bytes past end of string */
40
+ cl_assert(*(str+(i+1)) == 'Z');
41
+ /* i == n-1 charaters of string */
42
+ cl_git_pass(strncmp(exp, out, i));
43
+ }
44
+
45
+ /* returns out as hex formatted c-string */
46
+ str = git_oid_to_string(out, sizeof(out), &in);
47
+ cl_assert(str && str == out && *(str+GIT_OID_HEXSZ) == '\0');
48
+ cl_assert(strcmp(exp, out) == 0);
49
+ }
50
+
51
+ void test_object_raw_convert__succeed_on_oid_to_string_conversion_big(void)
52
+ {
53
+ const char *exp = "16a0123456789abcdef4b775213c23a8bd74f5e0";
54
+ git_oid in;
55
+ char big[GIT_OID_HEXSZ + 1 + 3]; /* note + 4 => big buffer */
56
+ char *str;
57
+
58
+ cl_git_pass(git_oid_fromstr(&in, exp));
59
+
60
+ /* place some tail material */
61
+ big[GIT_OID_HEXSZ+0] = 'W'; /* should be '\0' afterwards */
62
+ big[GIT_OID_HEXSZ+1] = 'X'; /* should remain untouched */
63
+ big[GIT_OID_HEXSZ+2] = 'Y'; /* ditto */
64
+ big[GIT_OID_HEXSZ+3] = 'Z'; /* ditto */
65
+
66
+ /* returns big as hex formatted c-string */
67
+ str = git_oid_to_string(big, sizeof(big), &in);
68
+ cl_assert(str && str == big && *(str+GIT_OID_HEXSZ) == '\0');
69
+ cl_assert(strcmp(exp, big) == 0);
70
+
71
+ /* check tail material is untouched */
72
+ cl_assert(str && str == big && *(str+GIT_OID_HEXSZ+1) == 'X');
73
+ cl_assert(str && str == big && *(str+GIT_OID_HEXSZ+2) == 'Y');
74
+ cl_assert(str && str == big && *(str+GIT_OID_HEXSZ+3) == 'Z');
75
+ }
@@ -0,0 +1,323 @@
1
+
2
+ /*
3
+ * Raw data
4
+ */
5
+ static unsigned char commit_data[] = {
6
+ 0x74, 0x72, 0x65, 0x65, 0x20, 0x64, 0x66, 0x66,
7
+ 0x32, 0x64, 0x61, 0x39, 0x30, 0x62, 0x32, 0x35,
8
+ 0x34, 0x65, 0x31, 0x62, 0x65, 0x62, 0x38, 0x38,
9
+ 0x39, 0x64, 0x31, 0x66, 0x31, 0x66, 0x31, 0x32,
10
+ 0x38, 0x38, 0x62, 0x65, 0x31, 0x38, 0x30, 0x33,
11
+ 0x37, 0x38, 0x32, 0x64, 0x66, 0x0a, 0x61, 0x75,
12
+ 0x74, 0x68, 0x6f, 0x72, 0x20, 0x41, 0x20, 0x55,
13
+ 0x20, 0x54, 0x68, 0x6f, 0x72, 0x20, 0x3c, 0x61,
14
+ 0x75, 0x74, 0x68, 0x6f, 0x72, 0x40, 0x65, 0x78,
15
+ 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f,
16
+ 0x6d, 0x3e, 0x20, 0x31, 0x32, 0x32, 0x37, 0x38,
17
+ 0x31, 0x34, 0x32, 0x39, 0x37, 0x20, 0x2b, 0x30,
18
+ 0x30, 0x30, 0x30, 0x0a, 0x63, 0x6f, 0x6d, 0x6d,
19
+ 0x69, 0x74, 0x74, 0x65, 0x72, 0x20, 0x43, 0x20,
20
+ 0x4f, 0x20, 0x4d, 0x69, 0x74, 0x74, 0x65, 0x72,
21
+ 0x20, 0x3c, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
22
+ 0x74, 0x65, 0x72, 0x40, 0x65, 0x78, 0x61, 0x6d,
23
+ 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x3e,
24
+ 0x20, 0x31, 0x32, 0x32, 0x37, 0x38, 0x31, 0x34,
25
+ 0x32, 0x39, 0x37, 0x20, 0x2b, 0x30, 0x30, 0x30,
26
+ 0x30, 0x0a, 0x0a, 0x41, 0x20, 0x6f, 0x6e, 0x65,
27
+ 0x2d, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x63, 0x6f,
28
+ 0x6d, 0x6d, 0x69, 0x74, 0x20, 0x73, 0x75, 0x6d,
29
+ 0x6d, 0x61, 0x72, 0x79, 0x0a, 0x0a, 0x54, 0x68,
30
+ 0x65, 0x20, 0x62, 0x6f, 0x64, 0x79, 0x20, 0x6f,
31
+ 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f,
32
+ 0x6d, 0x6d, 0x69, 0x74, 0x20, 0x6d, 0x65, 0x73,
33
+ 0x73, 0x61, 0x67, 0x65, 0x2c, 0x20, 0x63, 0x6f,
34
+ 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67,
35
+ 0x20, 0x66, 0x75, 0x72, 0x74, 0x68, 0x65, 0x72,
36
+ 0x20, 0x65, 0x78, 0x70, 0x6c, 0x61, 0x6e, 0x61,
37
+ 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x6f, 0x66, 0x20,
38
+ 0x74, 0x68, 0x65, 0x20, 0x70, 0x75, 0x72, 0x70,
39
+ 0x6f, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74,
40
+ 0x68, 0x65, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x67,
41
+ 0x65, 0x73, 0x20, 0x69, 0x6e, 0x74, 0x72, 0x6f,
42
+ 0x64, 0x75, 0x63, 0x65, 0x64, 0x20, 0x62, 0x79,
43
+ 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x6d,
44
+ 0x6d, 0x69, 0x74, 0x2e, 0x0a, 0x0a, 0x53, 0x69,
45
+ 0x67, 0x6e, 0x65, 0x64, 0x2d, 0x6f, 0x66, 0x2d,
46
+ 0x62, 0x79, 0x3a, 0x20, 0x41, 0x20, 0x55, 0x20,
47
+ 0x54, 0x68, 0x6f, 0x72, 0x20, 0x3c, 0x61, 0x75,
48
+ 0x74, 0x68, 0x6f, 0x72, 0x40, 0x65, 0x78, 0x61,
49
+ 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d,
50
+ 0x3e, 0x0a,
51
+ };
52
+
53
+
54
+ static unsigned char tree_data[] = {
55
+ 0x31, 0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x6f,
56
+ 0x6e, 0x65, 0x00, 0x8b, 0x13, 0x78, 0x91, 0x79,
57
+ 0x1f, 0xe9, 0x69, 0x27, 0xad, 0x78, 0xe6, 0x4b,
58
+ 0x0a, 0xad, 0x7b, 0xde, 0xd0, 0x8b, 0xdc, 0x31,
59
+ 0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x73, 0x6f,
60
+ 0x6d, 0x65, 0x00, 0xfd, 0x84, 0x30, 0xbc, 0x86,
61
+ 0x4c, 0xfc, 0xd5, 0xf1, 0x0e, 0x55, 0x90, 0xf8,
62
+ 0xa4, 0x47, 0xe0, 0x1b, 0x94, 0x2b, 0xfe, 0x31,
63
+ 0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x74, 0x77,
64
+ 0x6f, 0x00, 0x78, 0x98, 0x19, 0x22, 0x61, 0x3b,
65
+ 0x2a, 0xfb, 0x60, 0x25, 0x04, 0x2f, 0xf6, 0xbd,
66
+ 0x87, 0x8a, 0xc1, 0x99, 0x4e, 0x85, 0x31, 0x30,
67
+ 0x30, 0x36, 0x34, 0x34, 0x20, 0x7a, 0x65, 0x72,
68
+ 0x6f, 0x00, 0xe6, 0x9d, 0xe2, 0x9b, 0xb2, 0xd1,
69
+ 0xd6, 0x43, 0x4b, 0x8b, 0x29, 0xae, 0x77, 0x5a,
70
+ 0xd8, 0xc2, 0xe4, 0x8c, 0x53, 0x91,
71
+ };
72
+
73
+ static unsigned char tag_data[] = {
74
+ 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x33,
75
+ 0x64, 0x37, 0x66, 0x38, 0x61, 0x36, 0x61, 0x66,
76
+ 0x30, 0x37, 0x36, 0x63, 0x38, 0x63, 0x33, 0x66,
77
+ 0x32, 0x30, 0x30, 0x37, 0x31, 0x61, 0x38, 0x39,
78
+ 0x33, 0x35, 0x63, 0x64, 0x62, 0x65, 0x38, 0x32,
79
+ 0x32, 0x38, 0x35, 0x39, 0x34, 0x64, 0x31, 0x0a,
80
+ 0x74, 0x79, 0x70, 0x65, 0x20, 0x63, 0x6f, 0x6d,
81
+ 0x6d, 0x69, 0x74, 0x0a, 0x74, 0x61, 0x67, 0x20,
82
+ 0x76, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x0a, 0x74,
83
+ 0x61, 0x67, 0x67, 0x65, 0x72, 0x20, 0x43, 0x20,
84
+ 0x4f, 0x20, 0x4d, 0x69, 0x74, 0x74, 0x65, 0x72,
85
+ 0x20, 0x3c, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
86
+ 0x74, 0x65, 0x72, 0x40, 0x65, 0x78, 0x61, 0x6d,
87
+ 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x3e,
88
+ 0x20, 0x31, 0x32, 0x32, 0x37, 0x38, 0x31, 0x34,
89
+ 0x32, 0x39, 0x37, 0x20, 0x2b, 0x30, 0x30, 0x30,
90
+ 0x30, 0x0a, 0x0a, 0x54, 0x68, 0x69, 0x73, 0x20,
91
+ 0x69, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74,
92
+ 0x61, 0x67, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63,
93
+ 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x72, 0x65,
94
+ 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x76, 0x30,
95
+ 0x2e, 0x30, 0x2e, 0x31, 0x0a,
96
+ };
97
+
98
+ /*
99
+ * Dummy data
100
+ */
101
+ static unsigned char zero_data[] = {
102
+ 0x00,
103
+ };
104
+
105
+ static unsigned char one_data[] = {
106
+ 0x0a,
107
+ };
108
+
109
+ static unsigned char two_data[] = {
110
+ 0x61, 0x0a,
111
+ };
112
+
113
+ static unsigned char some_data[] = {
114
+ 0x2f, 0x2a, 0x0a, 0x20, 0x2a, 0x20, 0x54, 0x68,
115
+ 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20,
116
+ 0x69, 0x73, 0x20, 0x66, 0x72, 0x65, 0x65, 0x20,
117
+ 0x73, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
118
+ 0x3b, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x63, 0x61,
119
+ 0x6e, 0x20, 0x72, 0x65, 0x64, 0x69, 0x73, 0x74,
120
+ 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x69,
121
+ 0x74, 0x20, 0x61, 0x6e, 0x64, 0x2f, 0x6f, 0x72,
122
+ 0x20, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x0a,
123
+ 0x20, 0x2a, 0x20, 0x69, 0x74, 0x20, 0x75, 0x6e,
124
+ 0x64, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20,
125
+ 0x74, 0x65, 0x72, 0x6d, 0x73, 0x20, 0x6f, 0x66,
126
+ 0x20, 0x74, 0x68, 0x65, 0x20, 0x47, 0x4e, 0x55,
127
+ 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
128
+ 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
129
+ 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x2c,
130
+ 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
131
+ 0x20, 0x32, 0x2c, 0x0a, 0x20, 0x2a, 0x20, 0x61,
132
+ 0x73, 0x20, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73,
133
+ 0x68, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74,
134
+ 0x68, 0x65, 0x20, 0x46, 0x72, 0x65, 0x65, 0x20,
135
+ 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
136
+ 0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x74,
137
+ 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x20, 0x2a, 0x0a,
138
+ 0x20, 0x2a, 0x20, 0x49, 0x6e, 0x20, 0x61, 0x64,
139
+ 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74,
140
+ 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x65,
141
+ 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e,
142
+ 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65,
143
+ 0x20, 0x47, 0x4e, 0x55, 0x20, 0x47, 0x65, 0x6e,
144
+ 0x65, 0x72, 0x61, 0x6c, 0x20, 0x50, 0x75, 0x62,
145
+ 0x6c, 0x69, 0x63, 0x20, 0x4c, 0x69, 0x63, 0x65,
146
+ 0x6e, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x2a, 0x20,
147
+ 0x74, 0x68, 0x65, 0x20, 0x61, 0x75, 0x74, 0x68,
148
+ 0x6f, 0x72, 0x73, 0x20, 0x67, 0x69, 0x76, 0x65,
149
+ 0x20, 0x79, 0x6f, 0x75, 0x20, 0x75, 0x6e, 0x6c,
150
+ 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x20, 0x70,
151
+ 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f,
152
+ 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x6c, 0x69, 0x6e,
153
+ 0x6b, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f,
154
+ 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x64, 0x0a, 0x20,
155
+ 0x2a, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
156
+ 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69,
157
+ 0x73, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x69,
158
+ 0x6e, 0x74, 0x6f, 0x20, 0x63, 0x6f, 0x6d, 0x62,
159
+ 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73,
160
+ 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6f, 0x74,
161
+ 0x68, 0x65, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x67,
162
+ 0x72, 0x61, 0x6d, 0x73, 0x2c, 0x0a, 0x20, 0x2a,
163
+ 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x6f, 0x20,
164
+ 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75,
165
+ 0x74, 0x65, 0x20, 0x74, 0x68, 0x6f, 0x73, 0x65,
166
+ 0x20, 0x63, 0x6f, 0x6d, 0x62, 0x69, 0x6e, 0x61,
167
+ 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x77, 0x69,
168
+ 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x61, 0x6e,
169
+ 0x79, 0x20, 0x72, 0x65, 0x73, 0x74, 0x72, 0x69,
170
+ 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x20, 0x2a,
171
+ 0x20, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x20,
172
+ 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65,
173
+ 0x20, 0x75, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20,
174
+ 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c,
175
+ 0x65, 0x2e, 0x20, 0x20, 0x28, 0x54, 0x68, 0x65,
176
+ 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
177
+ 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
178
+ 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x0a,
179
+ 0x20, 0x2a, 0x20, 0x72, 0x65, 0x73, 0x74, 0x72,
180
+ 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20,
181
+ 0x64, 0x6f, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x79,
182
+ 0x20, 0x69, 0x6e, 0x20, 0x6f, 0x74, 0x68, 0x65,
183
+ 0x72, 0x20, 0x72, 0x65, 0x73, 0x70, 0x65, 0x63,
184
+ 0x74, 0x73, 0x3b, 0x20, 0x66, 0x6f, 0x72, 0x20,
185
+ 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2c,
186
+ 0x20, 0x74, 0x68, 0x65, 0x79, 0x20, 0x63, 0x6f,
187
+ 0x76, 0x65, 0x72, 0x0a, 0x20, 0x2a, 0x20, 0x6d,
188
+ 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
189
+ 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74,
190
+ 0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2c,
191
+ 0x20, 0x61, 0x6e, 0x64, 0x20, 0x64, 0x69, 0x73,
192
+ 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f,
193
+ 0x6e, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x6e,
194
+ 0x6f, 0x74, 0x20, 0x6c, 0x69, 0x6e, 0x6b, 0x65,
195
+ 0x64, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x0a, 0x20,
196
+ 0x2a, 0x20, 0x61, 0x20, 0x63, 0x6f, 0x6d, 0x62,
197
+ 0x69, 0x6e, 0x65, 0x64, 0x20, 0x65, 0x78, 0x65,
198
+ 0x63, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x2e,
199
+ 0x29, 0x0a, 0x20, 0x2a, 0x0a, 0x20, 0x2a, 0x20,
200
+ 0x54, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c,
201
+ 0x65, 0x20, 0x69, 0x73, 0x20, 0x64, 0x69, 0x73,
202
+ 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x64,
203
+ 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20,
204
+ 0x68, 0x6f, 0x70, 0x65, 0x20, 0x74, 0x68, 0x61,
205
+ 0x74, 0x20, 0x69, 0x74, 0x20, 0x77, 0x69, 0x6c,
206
+ 0x6c, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65,
207
+ 0x66, 0x75, 0x6c, 0x2c, 0x20, 0x62, 0x75, 0x74,
208
+ 0x0a, 0x20, 0x2a, 0x20, 0x57, 0x49, 0x54, 0x48,
209
+ 0x4f, 0x55, 0x54, 0x20, 0x41, 0x4e, 0x59, 0x20,
210
+ 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x59,
211
+ 0x3b, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75,
212
+ 0x74, 0x20, 0x65, 0x76, 0x65, 0x6e, 0x20, 0x74,
213
+ 0x68, 0x65, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x69,
214
+ 0x65, 0x64, 0x20, 0x77, 0x61, 0x72, 0x72, 0x61,
215
+ 0x6e, 0x74, 0x79, 0x20, 0x6f, 0x66, 0x0a, 0x20,
216
+ 0x2a, 0x20, 0x4d, 0x45, 0x52, 0x43, 0x48, 0x41,
217
+ 0x4e, 0x54, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54,
218
+ 0x59, 0x20, 0x6f, 0x72, 0x20, 0x46, 0x49, 0x54,
219
+ 0x4e, 0x45, 0x53, 0x53, 0x20, 0x46, 0x4f, 0x52,
220
+ 0x20, 0x41, 0x20, 0x50, 0x41, 0x52, 0x54, 0x49,
221
+ 0x43, 0x55, 0x4c, 0x41, 0x52, 0x20, 0x50, 0x55,
222
+ 0x52, 0x50, 0x4f, 0x53, 0x45, 0x2e, 0x20, 0x20,
223
+ 0x53, 0x65, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20,
224
+ 0x47, 0x4e, 0x55, 0x0a, 0x20, 0x2a, 0x20, 0x47,
225
+ 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x20, 0x50,
226
+ 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20, 0x4c, 0x69,
227
+ 0x63, 0x65, 0x6e, 0x73, 0x65, 0x20, 0x66, 0x6f,
228
+ 0x72, 0x20, 0x6d, 0x6f, 0x72, 0x65, 0x20, 0x64,
229
+ 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x2e, 0x0a,
230
+ 0x20, 0x2a, 0x0a, 0x20, 0x2a, 0x20, 0x59, 0x6f,
231
+ 0x75, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64,
232
+ 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x72, 0x65,
233
+ 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x20, 0x61,
234
+ 0x20, 0x63, 0x6f, 0x70, 0x79, 0x20, 0x6f, 0x66,
235
+ 0x20, 0x74, 0x68, 0x65, 0x20, 0x47, 0x4e, 0x55,
236
+ 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
237
+ 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
238
+ 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x0a,
239
+ 0x20, 0x2a, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67,
240
+ 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68,
241
+ 0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x67, 0x72,
242
+ 0x61, 0x6d, 0x3b, 0x20, 0x73, 0x65, 0x65, 0x20,
243
+ 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65,
244
+ 0x20, 0x43, 0x4f, 0x50, 0x59, 0x49, 0x4e, 0x47,
245
+ 0x2e, 0x20, 0x20, 0x49, 0x66, 0x20, 0x6e, 0x6f,
246
+ 0x74, 0x2c, 0x20, 0x77, 0x72, 0x69, 0x74, 0x65,
247
+ 0x20, 0x74, 0x6f, 0x0a, 0x20, 0x2a, 0x20, 0x74,
248
+ 0x68, 0x65, 0x20, 0x46, 0x72, 0x65, 0x65, 0x20,
249
+ 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
250
+ 0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x74,
251
+ 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x35, 0x31, 0x20,
252
+ 0x46, 0x72, 0x61, 0x6e, 0x6b, 0x6c, 0x69, 0x6e,
253
+ 0x20, 0x53, 0x74, 0x72, 0x65, 0x65, 0x74, 0x2c,
254
+ 0x20, 0x46, 0x69, 0x66, 0x74, 0x68, 0x20, 0x46,
255
+ 0x6c, 0x6f, 0x6f, 0x72, 0x2c, 0x0a, 0x20, 0x2a,
256
+ 0x20, 0x42, 0x6f, 0x73, 0x74, 0x6f, 0x6e, 0x2c,
257
+ 0x20, 0x4d, 0x41, 0x20, 0x30, 0x32, 0x31, 0x31,
258
+ 0x30, 0x2d, 0x31, 0x33, 0x30, 0x31, 0x2c, 0x20,
259
+ 0x55, 0x53, 0x41, 0x2e, 0x0a, 0x20, 0x2a, 0x2f,
260
+ 0x0a,
261
+ };
262
+
263
+ /*
264
+ * SHA1 Hashes
265
+ */
266
+ static char *commit_id = "3d7f8a6af076c8c3f20071a8935cdbe8228594d1";
267
+ static char *tree_id = "dff2da90b254e1beb889d1f1f1288be1803782df";
268
+ static char *tag_id = "09d373e1dfdc16b129ceec6dd649739911541e05";
269
+ static char *zero_id = "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";
270
+ static char *one_id = "8b137891791fe96927ad78e64b0aad7bded08bdc";
271
+ static char *two_id = "78981922613b2afb6025042ff6bd878ac1994e85";
272
+ static char *some_id = "fd8430bc864cfcd5f10e5590f8a447e01b942bfe";
273
+
274
+ /*
275
+ * In-memory objects
276
+ */
277
+ static git_rawobj tree_obj = {
278
+ tree_data,
279
+ sizeof(tree_data),
280
+ GIT_OBJ_TREE
281
+ };
282
+
283
+ static git_rawobj tag_obj = {
284
+ tag_data,
285
+ sizeof(tag_data),
286
+ GIT_OBJ_TAG
287
+ };
288
+
289
+ static git_rawobj zero_obj = {
290
+ zero_data,
291
+ 0,
292
+ GIT_OBJ_BLOB
293
+ };
294
+
295
+ static git_rawobj one_obj = {
296
+ one_data,
297
+ sizeof(one_data),
298
+ GIT_OBJ_BLOB
299
+ };
300
+
301
+ static git_rawobj two_obj = {
302
+ two_data,
303
+ sizeof(two_data),
304
+ GIT_OBJ_BLOB
305
+ };
306
+
307
+ static git_rawobj commit_obj = {
308
+ commit_data,
309
+ sizeof(commit_data),
310
+ GIT_OBJ_COMMIT
311
+ };
312
+
313
+ static git_rawobj some_obj = {
314
+ some_data,
315
+ sizeof(some_data),
316
+ GIT_OBJ_BLOB
317
+ };
318
+
319
+ static git_rawobj junk_obj = {
320
+ NULL,
321
+ 0,
322
+ GIT_OBJ_BAD
323
+ };