rugged 0.17.0b2 → 0.17.0.b6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (374) hide show
  1. data/Rakefile +10 -11
  2. data/ext/rugged/extconf.rb +5 -13
  3. data/ext/rugged/rugged_commit.c +2 -5
  4. data/ext/rugged/rugged_reference.c +29 -28
  5. data/ext/rugged/rugged_remote.c +1 -1
  6. data/ext/rugged/rugged_repo.c +4 -1
  7. data/ext/rugged/rugged_tree.c +20 -19
  8. data/lib/rugged/commit.rb +5 -1
  9. data/lib/rugged/repository.rb +6 -4
  10. data/lib/rugged/version.rb +1 -1
  11. data/test/config_test.rb +1 -1
  12. data/test/index_test.rb +4 -2
  13. data/test/object_test.rb +3 -3
  14. data/test/reference_test.rb +66 -1
  15. data/test/repo_test.rb +4 -4
  16. data/test/tree_test.rb +1 -1
  17. data/test/walker_test.rb +1 -1
  18. data/vendor/libgit2/Makefile.embed +42 -0
  19. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/http-parser/http_parser.c +0 -0
  20. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/http-parser/http_parser.h +0 -0
  21. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/regex/config.h +0 -0
  22. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/regex/regcomp.c +0 -0
  23. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/regex/regex.c +0 -0
  24. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/regex/regex.h +0 -0
  25. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/regex/regex_internal.c +0 -0
  26. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/regex/regex_internal.h +0 -0
  27. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/regex/regexec.c +0 -0
  28. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/adler32.c +0 -0
  29. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/crc32.c +0 -0
  30. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/crc32.h +0 -0
  31. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/deflate.c +0 -0
  32. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/deflate.h +0 -0
  33. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/inffast.c +0 -0
  34. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/inffast.h +0 -0
  35. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/inffixed.h +0 -0
  36. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/inflate.c +0 -0
  37. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/inflate.h +0 -0
  38. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/inftrees.c +0 -0
  39. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/inftrees.h +0 -0
  40. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/trees.c +0 -0
  41. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/trees.h +0 -0
  42. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/zconf.h +0 -0
  43. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/zlib.h +0 -0
  44. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/zutil.c +0 -0
  45. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/zutil.h +0 -0
  46. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2.h +6 -0
  47. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/attr.h +35 -20
  48. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/blob.h +1 -1
  49. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/branch.h +62 -24
  50. data/vendor/libgit2/include/git2/checkout.h +66 -0
  51. data/vendor/libgit2/include/git2/clone.h +59 -0
  52. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/commit.h +22 -3
  53. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/common.h +27 -0
  54. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/config.h +22 -4
  55. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/diff.h +20 -1
  56. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/errors.h +2 -37
  57. data/vendor/libgit2/include/git2/ignore.h +74 -0
  58. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/index.h +37 -5
  59. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/indexer.h +2 -2
  60. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/inttypes.h +0 -0
  61. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/merge.h +10 -0
  62. data/vendor/libgit2/include/git2/message.h +43 -0
  63. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/net.h +0 -0
  64. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/notes.h +24 -20
  65. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/object.h +18 -1
  66. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/odb.h +16 -1
  67. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/odb_backend.h +8 -1
  68. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/oid.h +26 -2
  69. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/reflog.h +39 -9
  70. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/refs.h +55 -3
  71. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/refspec.h +0 -0
  72. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/remote.h +68 -2
  73. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/repository.h +39 -1
  74. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/reset.h +0 -0
  75. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/revparse.h +0 -0
  76. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/revwalk.h +2 -2
  77. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/signature.h +3 -0
  78. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/status.h +5 -2
  79. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/stdint.h +0 -0
  80. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/submodule.h +0 -0
  81. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/tag.h +3 -3
  82. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/threads.h +0 -0
  83. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/tree.h +77 -20
  84. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/types.h +14 -0
  85. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/version.h +0 -0
  86. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/windows.h +0 -0
  87. data/vendor/libgit2/src/amiga/map.c +51 -0
  88. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/attr.c +39 -6
  89. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/attr.h +1 -0
  90. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/attr_file.c +2 -16
  91. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/attr_file.h +4 -0
  92. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/blob.c +0 -0
  93. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/blob.h +0 -0
  94. data/vendor/libgit2/src/branch.c +294 -0
  95. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/bswap.h +0 -0
  96. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/buffer.c +40 -0
  97. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/buffer.h +22 -0
  98. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/cache.c +1 -0
  99. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/cache.h +0 -0
  100. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/cc-compat.h +0 -0
  101. data/vendor/libgit2/src/checkout.c +230 -0
  102. data/vendor/libgit2/src/clone.c +254 -0
  103. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/commit.c +42 -16
  104. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/commit.h +0 -0
  105. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/common.h +3 -9
  106. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/compat/fnmatch.c +0 -0
  107. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/compat/fnmatch.h +0 -0
  108. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/config.c +15 -5
  109. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/config.h +0 -0
  110. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/config_cache.c +0 -0
  111. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/config_file.c +86 -19
  112. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/config_file.h +16 -1
  113. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/crlf.c +92 -4
  114. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/date.c +20 -20
  115. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/delta-apply.c +0 -0
  116. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/delta-apply.h +0 -0
  117. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/diff.c +45 -18
  118. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/diff.h +0 -0
  119. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/diff_output.c +63 -46
  120. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/errors.c +0 -0
  121. data/vendor/libgit2/src/fetch.c +380 -0
  122. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/fetch.h +1 -2
  123. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/filebuf.c +7 -2
  124. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/filebuf.h +0 -0
  125. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/fileops.c +16 -1
  126. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/fileops.h +10 -0
  127. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/filter.c +38 -2
  128. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/filter.h +15 -0
  129. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/global.c +5 -0
  130. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/global.h +2 -6
  131. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/hash.c +0 -0
  132. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/hash.h +0 -0
  133. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/ignore.c +50 -1
  134. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/ignore.h +0 -0
  135. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/index.c +95 -28
  136. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/index.h +5 -0
  137. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/indexer.c +27 -25
  138. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/iterator.c +0 -0
  139. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/iterator.h +0 -0
  140. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/khash.h +6 -4
  141. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/map.h +4 -0
  142. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/message.c +27 -2
  143. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/message.h +2 -1
  144. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/mwindow.c +54 -10
  145. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/mwindow.h +1 -1
  146. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/netops.c +48 -38
  147. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/netops.h +7 -4
  148. data/vendor/libgit2/src/notes.c +610 -0
  149. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/notes.h +0 -0
  150. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/object.c +73 -2
  151. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/odb.c +20 -1
  152. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/odb.h +0 -0
  153. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/odb_loose.c +89 -3
  154. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/odb_pack.c +61 -3
  155. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/oid.c +1 -6
  156. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/oidmap.h +1 -6
  157. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/pack.c +49 -4
  158. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/pack.h +5 -1
  159. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/path.c +144 -21
  160. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/path.h +46 -0
  161. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/pkt.c +30 -8
  162. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/pkt.h +0 -0
  163. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/pool.c +7 -0
  164. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/pool.h +7 -0
  165. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/posix.c +92 -1
  166. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/posix.h +36 -1
  167. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/ppc/sha1.c +0 -0
  168. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/ppc/sha1.h +0 -0
  169. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/pqueue.c +0 -0
  170. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/pqueue.h +0 -0
  171. data/vendor/libgit2/src/protocol.c +88 -0
  172. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/protocol.h +3 -9
  173. data/vendor/libgit2/src/reflog.c +489 -0
  174. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/reflog.h +3 -0
  175. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/refs.c +95 -52
  176. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/refs.h +0 -0
  177. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/refspec.c +0 -0
  178. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/refspec.h +0 -0
  179. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/remote.c +130 -8
  180. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/remote.h +6 -0
  181. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/repository.c +167 -42
  182. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/repository.h +7 -0
  183. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/reset.c +1 -1
  184. data/vendor/libgit2/src/revparse.c +830 -0
  185. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/revwalk.c +83 -15
  186. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/sha1.c +0 -0
  187. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/sha1.h +5 -0
  188. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/sha1_lookup.c +0 -0
  189. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/sha1_lookup.h +0 -0
  190. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/signature.c +19 -5
  191. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/signature.h +0 -0
  192. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/status.c +24 -18
  193. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/strmap.h +1 -1
  194. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/submodule.c +3 -3
  195. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/tag.c +2 -9
  196. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/tag.h +0 -0
  197. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/thread-utils.c +0 -0
  198. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/thread-utils.h +0 -0
  199. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/transport.c +0 -0
  200. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/transport.h +13 -9
  201. data/vendor/libgit2/src/transports/git.c +245 -0
  202. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/transports/http.c +93 -336
  203. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/transports/local.c +35 -32
  204. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/tree-cache.c +0 -0
  205. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/tree-cache.h +0 -0
  206. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/tree.c +214 -124
  207. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/tree.h +7 -3
  208. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/tsort.c +0 -0
  209. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/unix/map.c +2 -0
  210. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/unix/posix.h +2 -1
  211. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/util.c +30 -0
  212. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/util.h +13 -6
  213. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/vector.c +1 -1
  214. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/vector.h +5 -5
  215. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/win32/dir.c +0 -0
  216. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/win32/dir.h +0 -0
  217. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/win32/map.c +0 -0
  218. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/win32/mingw-compat.h +0 -0
  219. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/win32/msvc-compat.h +0 -0
  220. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/win32/posix.h +1 -0
  221. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/win32/posix_w32.c +17 -1
  222. data/vendor/libgit2/src/win32/precompiled.c +1 -0
  223. data/vendor/libgit2/src/win32/precompiled.h +19 -0
  224. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/win32/pthread.c +0 -0
  225. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/win32/pthread.h +0 -0
  226. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/win32/utf-conv.c +0 -0
  227. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/win32/utf-conv.h +0 -0
  228. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xdiff.h +0 -0
  229. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xdiffi.c +0 -0
  230. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xdiffi.h +0 -0
  231. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xemit.c +0 -0
  232. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xemit.h +0 -0
  233. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xhistogram.c +0 -0
  234. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xinclude.h +0 -0
  235. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xmacros.h +0 -0
  236. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xmerge.c +0 -0
  237. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xpatience.c +0 -0
  238. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xprepare.c +0 -0
  239. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xprepare.h +0 -0
  240. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xtypes.h +0 -0
  241. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xutils.c +0 -0
  242. data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xutils.h +0 -0
  243. metadata +265 -348
  244. data/ext/rugged/vendor/libgit2-dist.tar.gz +0 -0
  245. data/ext/rugged/vendor/libgit2-dist/examples/diff.c +0 -238
  246. data/ext/rugged/vendor/libgit2-dist/examples/general.c +0 -451
  247. data/ext/rugged/vendor/libgit2-dist/examples/network/common.h +0 -14
  248. data/ext/rugged/vendor/libgit2-dist/examples/network/fetch.c +0 -113
  249. data/ext/rugged/vendor/libgit2-dist/examples/network/git2.c +0 -62
  250. data/ext/rugged/vendor/libgit2-dist/examples/network/index-pack.c +0 -102
  251. data/ext/rugged/vendor/libgit2-dist/examples/network/ls-remote.c +0 -76
  252. data/ext/rugged/vendor/libgit2-dist/examples/showindex.c +0 -43
  253. data/ext/rugged/vendor/libgit2-dist/src/branch.c +0 -208
  254. data/ext/rugged/vendor/libgit2-dist/src/branch.h +0 -17
  255. data/ext/rugged/vendor/libgit2-dist/src/fetch.c +0 -200
  256. data/ext/rugged/vendor/libgit2-dist/src/notes.c +0 -548
  257. data/ext/rugged/vendor/libgit2-dist/src/protocol.c +0 -58
  258. data/ext/rugged/vendor/libgit2-dist/src/reflog.c +0 -340
  259. data/ext/rugged/vendor/libgit2-dist/src/revparse.c +0 -748
  260. data/ext/rugged/vendor/libgit2-dist/src/transports/git.c +0 -477
  261. data/ext/rugged/vendor/libgit2-dist/tests-clar/attr/attr_expect.h +0 -43
  262. data/ext/rugged/vendor/libgit2-dist/tests-clar/attr/file.c +0 -226
  263. data/ext/rugged/vendor/libgit2-dist/tests-clar/attr/flags.c +0 -108
  264. data/ext/rugged/vendor/libgit2-dist/tests-clar/attr/lookup.c +0 -262
  265. data/ext/rugged/vendor/libgit2-dist/tests-clar/attr/repo.c +0 -273
  266. data/ext/rugged/vendor/libgit2-dist/tests-clar/buf/basic.c +0 -29
  267. data/ext/rugged/vendor/libgit2-dist/tests-clar/clar_helpers.c +0 -181
  268. data/ext/rugged/vendor/libgit2-dist/tests-clar/clar_libgit2.h +0 -55
  269. data/ext/rugged/vendor/libgit2-dist/tests-clar/commit/commit.c +0 -44
  270. data/ext/rugged/vendor/libgit2-dist/tests-clar/commit/parse.c +0 -350
  271. data/ext/rugged/vendor/libgit2-dist/tests-clar/commit/signature.c +0 -65
  272. data/ext/rugged/vendor/libgit2-dist/tests-clar/commit/write.c +0 -140
  273. data/ext/rugged/vendor/libgit2-dist/tests-clar/config/add.c +0 -37
  274. data/ext/rugged/vendor/libgit2-dist/tests-clar/config/multivar.c +0 -151
  275. data/ext/rugged/vendor/libgit2-dist/tests-clar/config/new.c +0 -36
  276. data/ext/rugged/vendor/libgit2-dist/tests-clar/config/read.c +0 -221
  277. data/ext/rugged/vendor/libgit2-dist/tests-clar/config/stress.c +0 -61
  278. data/ext/rugged/vendor/libgit2-dist/tests-clar/config/write.c +0 -92
  279. data/ext/rugged/vendor/libgit2-dist/tests-clar/core/buffer.c +0 -613
  280. data/ext/rugged/vendor/libgit2-dist/tests-clar/core/dirent.c +0 -235
  281. data/ext/rugged/vendor/libgit2-dist/tests-clar/core/env.c +0 -115
  282. data/ext/rugged/vendor/libgit2-dist/tests-clar/core/errors.c +0 -60
  283. data/ext/rugged/vendor/libgit2-dist/tests-clar/core/filebuf.c +0 -92
  284. data/ext/rugged/vendor/libgit2-dist/tests-clar/core/hex.c +0 -22
  285. data/ext/rugged/vendor/libgit2-dist/tests-clar/core/oid.c +0 -18
  286. data/ext/rugged/vendor/libgit2-dist/tests-clar/core/path.c +0 -420
  287. data/ext/rugged/vendor/libgit2-dist/tests-clar/core/pool.c +0 -85
  288. data/ext/rugged/vendor/libgit2-dist/tests-clar/core/rmdir.c +0 -68
  289. data/ext/rugged/vendor/libgit2-dist/tests-clar/core/string.c +0 -28
  290. data/ext/rugged/vendor/libgit2-dist/tests-clar/core/strmap.c +0 -102
  291. data/ext/rugged/vendor/libgit2-dist/tests-clar/core/strtol.c +0 -37
  292. data/ext/rugged/vendor/libgit2-dist/tests-clar/core/vector.c +0 -191
  293. data/ext/rugged/vendor/libgit2-dist/tests-clar/date/date.c +0 -15
  294. data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/blob.c +0 -254
  295. data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/diff_helpers.c +0 -104
  296. data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/diff_helpers.h +0 -47
  297. data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/index.c +0 -92
  298. data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/iterator.c +0 -572
  299. data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/patch.c +0 -99
  300. data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/tree.c +0 -210
  301. data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/workdir.c +0 -543
  302. data/ext/rugged/vendor/libgit2-dist/tests-clar/index/read_tree.c +0 -46
  303. data/ext/rugged/vendor/libgit2-dist/tests-clar/index/rename.c +0 -50
  304. data/ext/rugged/vendor/libgit2-dist/tests-clar/index/tests.c +0 -246
  305. data/ext/rugged/vendor/libgit2-dist/tests-clar/network/createremotethenload.c +0 -33
  306. data/ext/rugged/vendor/libgit2-dist/tests-clar/network/remotelocal.c +0 -137
  307. data/ext/rugged/vendor/libgit2-dist/tests-clar/network/remotes.c +0 -183
  308. data/ext/rugged/vendor/libgit2-dist/tests-clar/notes/notes.c +0 -133
  309. data/ext/rugged/vendor/libgit2-dist/tests-clar/notes/notesref.c +0 -57
  310. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/blob/filter.c +0 -125
  311. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/blob/fromchunks.c +0 -87
  312. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/blob/write.c +0 -69
  313. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/commit/commitstagedfile.c +0 -126
  314. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/lookup.c +0 -63
  315. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/message.c +0 -171
  316. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/raw/chars.c +0 -41
  317. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/raw/compare.c +0 -124
  318. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/raw/convert.c +0 -75
  319. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/raw/data.h +0 -323
  320. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/raw/fromstr.c +0 -30
  321. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/raw/hash.c +0 -166
  322. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/raw/short.c +0 -94
  323. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/raw/size.c +0 -13
  324. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/raw/type2string.c +0 -54
  325. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/raw/write.c +0 -455
  326. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/tag/peel.c +0 -56
  327. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/tag/read.c +0 -130
  328. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/tag/write.c +0 -192
  329. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/tree/frompath.c +0 -81
  330. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/tree/read.c +0 -75
  331. data/ext/rugged/vendor/libgit2-dist/tests-clar/object/tree/write.c +0 -84
  332. data/ext/rugged/vendor/libgit2-dist/tests-clar/odb/loose.c +0 -84
  333. data/ext/rugged/vendor/libgit2-dist/tests-clar/odb/loose_data.h +0 -522
  334. data/ext/rugged/vendor/libgit2-dist/tests-clar/odb/mixed.c +0 -24
  335. data/ext/rugged/vendor/libgit2-dist/tests-clar/odb/pack_data.h +0 -151
  336. data/ext/rugged/vendor/libgit2-dist/tests-clar/odb/packed.c +0 -78
  337. data/ext/rugged/vendor/libgit2-dist/tests-clar/odb/sorting.c +0 -71
  338. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/branches/create.c +0 -113
  339. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/branches/delete.c +0 -91
  340. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/branches/listall.c +0 -78
  341. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/branches/move.c +0 -72
  342. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/crashes.c +0 -17
  343. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/create.c +0 -149
  344. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/delete.c +0 -85
  345. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/list.c +0 -53
  346. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/listall.c +0 -36
  347. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/lookup.c +0 -42
  348. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/normalize.c +0 -200
  349. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/overwrite.c +0 -136
  350. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/pack.c +0 -67
  351. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/read.c +0 -194
  352. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/reflog.c +0 -123
  353. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/rename.c +0 -339
  354. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/revparse.c +0 -174
  355. data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/unicode.c +0 -42
  356. data/ext/rugged/vendor/libgit2-dist/tests-clar/repo/discover.c +0 -142
  357. data/ext/rugged/vendor/libgit2-dist/tests-clar/repo/getters.c +0 -86
  358. data/ext/rugged/vendor/libgit2-dist/tests-clar/repo/init.c +0 -249
  359. data/ext/rugged/vendor/libgit2-dist/tests-clar/repo/open.c +0 -282
  360. data/ext/rugged/vendor/libgit2-dist/tests-clar/repo/setters.c +0 -80
  361. data/ext/rugged/vendor/libgit2-dist/tests-clar/reset/mixed.c +0 -47
  362. data/ext/rugged/vendor/libgit2-dist/tests-clar/reset/reset_helpers.c +0 -10
  363. data/ext/rugged/vendor/libgit2-dist/tests-clar/reset/reset_helpers.h +0 -6
  364. data/ext/rugged/vendor/libgit2-dist/tests-clar/reset/soft.c +0 -102
  365. data/ext/rugged/vendor/libgit2-dist/tests-clar/revwalk/basic.c +0 -181
  366. data/ext/rugged/vendor/libgit2-dist/tests-clar/revwalk/mergebase.c +0 -148
  367. data/ext/rugged/vendor/libgit2-dist/tests-clar/status/ignore.c +0 -147
  368. data/ext/rugged/vendor/libgit2-dist/tests-clar/status/single.c +0 -29
  369. data/ext/rugged/vendor/libgit2-dist/tests-clar/status/status_data.h +0 -202
  370. data/ext/rugged/vendor/libgit2-dist/tests-clar/status/status_helpers.c +0 -49
  371. data/ext/rugged/vendor/libgit2-dist/tests-clar/status/status_helpers.h +0 -33
  372. data/ext/rugged/vendor/libgit2-dist/tests-clar/status/submodules.c +0 -112
  373. data/ext/rugged/vendor/libgit2-dist/tests-clar/status/worktree.c +0 -649
  374. data/ext/rugged/vendor/libgit2-dist/tests-clar/threads/basic.c +0 -20
@@ -1,29 +0,0 @@
1
- #include "clar_libgit2.h"
2
- #include "posix.h"
3
-
4
- static void
5
- cleanup__remove_file(void *_file)
6
- {
7
- cl_must_pass(p_unlink((char *)_file));
8
- }
9
-
10
- /* test retrieving OID from a file apart from the ODB */
11
- void test_status_single__hash_single_file(void)
12
- {
13
- static const char file_name[] = "new_file";
14
- static const char file_contents[] = "new_file\n";
15
- static const char file_hash[] = "d4fa8600b4f37d7516bef4816ae2c64dbf029e3a";
16
-
17
- git_oid expected_id, actual_id;
18
-
19
- /* initialization */
20
- git_oid_fromstr(&expected_id, file_hash);
21
- cl_git_mkfile(file_name, file_contents);
22
- cl_set_cleanup(&cleanup__remove_file, (void *)file_name);
23
-
24
- cl_git_pass(git_odb_hashfile(&actual_id, file_name, GIT_OBJ_BLOB));
25
- cl_assert(git_oid_cmp(&expected_id, &actual_id) == 0);
26
- }
27
-
28
-
29
-
@@ -1,202 +0,0 @@
1
- #include "status_helpers.h"
2
-
3
- /* entries for a plain copy of tests/resources/status */
4
-
5
- static const char *entry_paths0[] = {
6
- "file_deleted",
7
- "ignored_file",
8
- "modified_file",
9
- "new_file",
10
- "staged_changes",
11
- "staged_changes_file_deleted",
12
- "staged_changes_modified_file",
13
- "staged_delete_file_deleted",
14
- "staged_delete_modified_file",
15
- "staged_new_file",
16
- "staged_new_file_deleted_file",
17
- "staged_new_file_modified_file",
18
-
19
- "subdir/deleted_file",
20
- "subdir/modified_file",
21
- "subdir/new_file",
22
-
23
- "\xe8\xbf\x99",
24
- };
25
-
26
- static const unsigned int entry_statuses0[] = {
27
- GIT_STATUS_WT_DELETED,
28
- GIT_STATUS_IGNORED,
29
- GIT_STATUS_WT_MODIFIED,
30
- GIT_STATUS_WT_NEW,
31
- GIT_STATUS_INDEX_MODIFIED,
32
- GIT_STATUS_INDEX_MODIFIED | GIT_STATUS_WT_DELETED,
33
- GIT_STATUS_INDEX_MODIFIED | GIT_STATUS_WT_MODIFIED,
34
- GIT_STATUS_INDEX_DELETED,
35
- GIT_STATUS_INDEX_DELETED | GIT_STATUS_WT_NEW,
36
- GIT_STATUS_INDEX_NEW,
37
- GIT_STATUS_INDEX_NEW | GIT_STATUS_WT_DELETED,
38
- GIT_STATUS_INDEX_NEW | GIT_STATUS_WT_MODIFIED,
39
-
40
- GIT_STATUS_WT_DELETED,
41
- GIT_STATUS_WT_MODIFIED,
42
- GIT_STATUS_WT_NEW,
43
-
44
- GIT_STATUS_WT_NEW,
45
- };
46
-
47
- static const size_t entry_count0 = 16;
48
-
49
- /* entries for a copy of tests/resources/status with all content
50
- * deleted from the working directory
51
- */
52
-
53
- static const char *entry_paths2[] = {
54
- "current_file",
55
- "file_deleted",
56
- "modified_file",
57
- "staged_changes",
58
- "staged_changes_file_deleted",
59
- "staged_changes_modified_file",
60
- "staged_delete_file_deleted",
61
- "staged_delete_modified_file",
62
- "staged_new_file",
63
- "staged_new_file_deleted_file",
64
- "staged_new_file_modified_file",
65
- "subdir.txt",
66
- "subdir/current_file",
67
- "subdir/deleted_file",
68
- "subdir/modified_file",
69
- };
70
-
71
- static const unsigned int entry_statuses2[] = {
72
- GIT_STATUS_WT_DELETED,
73
- GIT_STATUS_WT_DELETED,
74
- GIT_STATUS_WT_DELETED,
75
- GIT_STATUS_WT_DELETED | GIT_STATUS_INDEX_MODIFIED,
76
- GIT_STATUS_WT_DELETED | GIT_STATUS_INDEX_MODIFIED,
77
- GIT_STATUS_WT_DELETED | GIT_STATUS_INDEX_MODIFIED,
78
- GIT_STATUS_INDEX_DELETED,
79
- GIT_STATUS_INDEX_DELETED,
80
- GIT_STATUS_WT_DELETED | GIT_STATUS_INDEX_NEW,
81
- GIT_STATUS_WT_DELETED | GIT_STATUS_INDEX_NEW,
82
- GIT_STATUS_WT_DELETED | GIT_STATUS_INDEX_NEW,
83
- GIT_STATUS_WT_DELETED,
84
- GIT_STATUS_WT_DELETED,
85
- GIT_STATUS_WT_DELETED,
86
- GIT_STATUS_WT_DELETED,
87
- };
88
-
89
- static const size_t entry_count2 = 15;
90
-
91
- /* entries for a copy of tests/resources/status with some mods */
92
-
93
- static const char *entry_paths3[] = {
94
- ".HEADER",
95
- "42-is-not-prime.sigh",
96
- "README.md",
97
- "current_file",
98
- "current_file/",
99
- "file_deleted",
100
- "ignored_file",
101
- "modified_file",
102
- "new_file",
103
- "staged_changes",
104
- "staged_changes_file_deleted",
105
- "staged_changes_modified_file",
106
- "staged_delete_file_deleted",
107
- "staged_delete_modified_file",
108
- "staged_new_file",
109
- "staged_new_file_deleted_file",
110
- "staged_new_file_modified_file",
111
- "subdir",
112
- "subdir/current_file",
113
- "subdir/deleted_file",
114
- "subdir/modified_file",
115
- "\xe8\xbf\x99",
116
- };
117
-
118
- static const unsigned int entry_statuses3[] = {
119
- GIT_STATUS_WT_NEW,
120
- GIT_STATUS_WT_NEW,
121
- GIT_STATUS_WT_NEW,
122
- GIT_STATUS_WT_DELETED,
123
- GIT_STATUS_WT_NEW,
124
- GIT_STATUS_WT_DELETED,
125
- GIT_STATUS_IGNORED,
126
- GIT_STATUS_WT_MODIFIED,
127
- GIT_STATUS_WT_NEW,
128
- GIT_STATUS_INDEX_MODIFIED,
129
- GIT_STATUS_WT_DELETED | GIT_STATUS_INDEX_MODIFIED,
130
- GIT_STATUS_WT_MODIFIED | GIT_STATUS_INDEX_MODIFIED,
131
- GIT_STATUS_INDEX_DELETED,
132
- GIT_STATUS_WT_NEW | GIT_STATUS_INDEX_DELETED,
133
- GIT_STATUS_INDEX_NEW,
134
- GIT_STATUS_WT_DELETED | GIT_STATUS_INDEX_NEW,
135
- GIT_STATUS_WT_MODIFIED | GIT_STATUS_INDEX_NEW,
136
- GIT_STATUS_WT_NEW,
137
- GIT_STATUS_WT_DELETED,
138
- GIT_STATUS_WT_DELETED,
139
- GIT_STATUS_WT_DELETED,
140
- GIT_STATUS_WT_NEW,
141
- };
142
-
143
- static const size_t entry_count3 = 22;
144
-
145
-
146
- /* entries for a copy of tests/resources/status with some mods
147
- * and different options to the status call
148
- */
149
-
150
- static const char *entry_paths4[] = {
151
- ".new_file",
152
- "current_file",
153
- "current_file/current_file",
154
- "current_file/modified_file",
155
- "current_file/new_file",
156
- "file_deleted",
157
- "modified_file",
158
- "new_file",
159
- "staged_changes",
160
- "staged_changes_file_deleted",
161
- "staged_changes_modified_file",
162
- "staged_delete_file_deleted",
163
- "staged_delete_modified_file",
164
- "staged_new_file",
165
- "staged_new_file_deleted_file",
166
- "staged_new_file_modified_file",
167
- "subdir",
168
- "subdir/current_file",
169
- "subdir/deleted_file",
170
- "subdir/modified_file",
171
- "zzz_new_dir/new_file",
172
- "zzz_new_file",
173
- "\xe8\xbf\x99",
174
- };
175
-
176
- static const unsigned int entry_statuses4[] = {
177
- GIT_STATUS_WT_NEW,
178
- GIT_STATUS_WT_DELETED,
179
- GIT_STATUS_WT_NEW,
180
- GIT_STATUS_WT_NEW,
181
- GIT_STATUS_WT_NEW,
182
- GIT_STATUS_WT_DELETED,
183
- GIT_STATUS_WT_MODIFIED,
184
- GIT_STATUS_WT_NEW,
185
- GIT_STATUS_INDEX_MODIFIED,
186
- GIT_STATUS_WT_DELETED | GIT_STATUS_INDEX_MODIFIED,
187
- GIT_STATUS_WT_MODIFIED | GIT_STATUS_INDEX_MODIFIED,
188
- GIT_STATUS_INDEX_DELETED,
189
- GIT_STATUS_WT_NEW | GIT_STATUS_INDEX_DELETED,
190
- GIT_STATUS_INDEX_NEW,
191
- GIT_STATUS_WT_DELETED | GIT_STATUS_INDEX_NEW,
192
- GIT_STATUS_WT_MODIFIED | GIT_STATUS_INDEX_NEW,
193
- GIT_STATUS_WT_NEW,
194
- GIT_STATUS_WT_DELETED,
195
- GIT_STATUS_WT_DELETED,
196
- GIT_STATUS_WT_DELETED,
197
- GIT_STATUS_WT_NEW,
198
- GIT_STATUS_WT_NEW,
199
- GIT_STATUS_WT_NEW,
200
- };
201
-
202
- static const size_t entry_count4 = 23;
@@ -1,49 +0,0 @@
1
- #include "clar_libgit2.h"
2
- #include "status_helpers.h"
3
-
4
- int cb_status__normal(
5
- const char *path, unsigned int status_flags, void *payload)
6
- {
7
- status_entry_counts *counts = payload;
8
-
9
- if (counts->entry_count >= counts->expected_entry_count) {
10
- counts->wrong_status_flags_count++;
11
- goto exit;
12
- }
13
-
14
- if (strcmp(path, counts->expected_paths[counts->entry_count])) {
15
- counts->wrong_sorted_path++;
16
- goto exit;
17
- }
18
-
19
- if (status_flags != counts->expected_statuses[counts->entry_count])
20
- counts->wrong_status_flags_count++;
21
-
22
- exit:
23
- counts->entry_count++;
24
- return 0;
25
- }
26
-
27
- int cb_status__count(const char *p, unsigned int s, void *payload)
28
- {
29
- volatile int *count = (int *)payload;
30
-
31
- GIT_UNUSED(p);
32
- GIT_UNUSED(s);
33
-
34
- (*count)++;
35
-
36
- return 0;
37
- }
38
-
39
- int cb_status__single(const char *p, unsigned int s, void *payload)
40
- {
41
- status_entry_single *data = (status_entry_single *)payload;
42
-
43
- GIT_UNUSED(p);
44
-
45
- data->count++;
46
- data->status = s;
47
-
48
- return 0;
49
- }
@@ -1,33 +0,0 @@
1
- #ifndef INCLUDE_cl_status_helpers_h__
2
- #define INCLUDE_cl_status_helpers_h__
3
-
4
- typedef struct {
5
- size_t wrong_status_flags_count;
6
- size_t wrong_sorted_path;
7
- size_t entry_count;
8
- const unsigned int* expected_statuses;
9
- const char** expected_paths;
10
- size_t expected_entry_count;
11
- } status_entry_counts;
12
-
13
- /* cb_status__normal takes payload of "status_entry_counts *" */
14
-
15
- extern int cb_status__normal(
16
- const char *path, unsigned int status_flags, void *payload);
17
-
18
-
19
- /* cb_status__count takes payload of "int *" */
20
-
21
- extern int cb_status__count(const char *p, unsigned int s, void *payload);
22
-
23
-
24
- typedef struct {
25
- int count;
26
- unsigned int status;
27
- } status_entry_single;
28
-
29
- /* cb_status__single takes payload of "status_entry_single *" */
30
-
31
- extern int cb_status__single(const char *p, unsigned int s, void *payload);
32
-
33
- #endif
@@ -1,112 +0,0 @@
1
- #include "clar_libgit2.h"
2
- #include "buffer.h"
3
- #include "path.h"
4
- #include "posix.h"
5
- #include "status_helpers.h"
6
-
7
- static git_repository *g_repo = NULL;
8
-
9
- void test_status_submodules__initialize(void)
10
- {
11
- git_buf modpath = GIT_BUF_INIT;
12
-
13
- g_repo = cl_git_sandbox_init("submodules");
14
-
15
- cl_fixture_sandbox("testrepo.git");
16
-
17
- cl_git_pass(git_buf_sets(&modpath, git_repository_workdir(g_repo)));
18
- cl_assert(git_path_dirname_r(&modpath, modpath.ptr) >= 0);
19
- cl_git_pass(git_buf_joinpath(&modpath, modpath.ptr, "testrepo.git\n"));
20
-
21
- p_rename("submodules/gitmodules", "submodules/.gitmodules");
22
- cl_git_append2file("submodules/.gitmodules", modpath.ptr);
23
- git_buf_free(&modpath);
24
-
25
- p_rename("submodules/testrepo/.gitted", "submodules/testrepo/.git");
26
- }
27
-
28
- void test_status_submodules__cleanup(void)
29
- {
30
- cl_git_sandbox_cleanup();
31
- }
32
-
33
- void test_status_submodules__api(void)
34
- {
35
- git_submodule *sm;
36
-
37
- cl_assert(git_submodule_lookup(NULL, g_repo, "nonexistent") == GIT_ENOTFOUND);
38
-
39
- cl_assert(git_submodule_lookup(NULL, g_repo, "modified") == GIT_ENOTFOUND);
40
-
41
- cl_git_pass(git_submodule_lookup(&sm, g_repo, "testrepo"));
42
- cl_assert(sm != NULL);
43
- cl_assert_equal_s("testrepo", sm->name);
44
- cl_assert_equal_s("testrepo", sm->path);
45
- }
46
-
47
- void test_status_submodules__0(void)
48
- {
49
- int counts = 0;
50
-
51
- cl_assert(git_path_isdir("submodules/.git"));
52
- cl_assert(git_path_isdir("submodules/testrepo/.git"));
53
- cl_assert(git_path_isfile("submodules/.gitmodules"));
54
-
55
- cl_git_pass(
56
- git_status_foreach(g_repo, cb_status__count, &counts)
57
- );
58
-
59
- cl_assert(counts == 6);
60
- }
61
-
62
- static const char *expected_files[] = {
63
- ".gitmodules",
64
- "added",
65
- "deleted",
66
- "ignored",
67
- "modified",
68
- "untracked"
69
- };
70
-
71
- static unsigned int expected_status[] = {
72
- GIT_STATUS_WT_MODIFIED,
73
- GIT_STATUS_INDEX_NEW,
74
- GIT_STATUS_INDEX_DELETED,
75
- GIT_STATUS_IGNORED,
76
- GIT_STATUS_WT_MODIFIED,
77
- GIT_STATUS_WT_NEW
78
- };
79
-
80
- static int
81
- cb_status__match(const char *p, unsigned int s, void *payload)
82
- {
83
- volatile int *index = (int *)payload;
84
-
85
- cl_assert_equal_s(expected_files[*index], p);
86
- cl_assert(expected_status[*index] == s);
87
- (*index)++;
88
-
89
- return 0;
90
- }
91
-
92
- void test_status_submodules__1(void)
93
- {
94
- int index = 0;
95
-
96
- cl_assert(git_path_isdir("submodules/.git"));
97
- cl_assert(git_path_isdir("submodules/testrepo/.git"));
98
- cl_assert(git_path_isfile("submodules/.gitmodules"));
99
-
100
- cl_git_pass(
101
- git_status_foreach(g_repo, cb_status__match, &index)
102
- );
103
-
104
- cl_assert(index == 6);
105
- }
106
-
107
- void test_status_submodules__single_file(void)
108
- {
109
- unsigned int status;
110
- cl_git_pass( git_status_file(&status, g_repo, "testrepo") );
111
- cl_assert(status == 0);
112
- }
@@ -1,649 +0,0 @@
1
- #include "clar_libgit2.h"
2
- #include "fileops.h"
3
- #include "ignore.h"
4
- #include "status_data.h"
5
- #include "posix.h"
6
- #include "util.h"
7
- #include "path.h"
8
-
9
- /**
10
- * Initializer
11
- *
12
- * Not all of the tests in this file use the same fixtures, so we allow each
13
- * test to load their fixture at the top of the test function.
14
- */
15
- void test_status_worktree__initialize(void)
16
- {
17
- }
18
-
19
- /**
20
- * Cleanup
21
- *
22
- * This will be called once after each test finishes, even
23
- * if the test failed
24
- */
25
- void test_status_worktree__cleanup(void)
26
- {
27
- cl_git_sandbox_cleanup();
28
- }
29
-
30
- /**
31
- * Tests - Status determination on a working tree
32
- */
33
- /* this test is equivalent to t18-status.c:statuscb0 */
34
- void test_status_worktree__whole_repository(void)
35
- {
36
- status_entry_counts counts;
37
- git_repository *repo = cl_git_sandbox_init("status");
38
-
39
- memset(&counts, 0x0, sizeof(status_entry_counts));
40
- counts.expected_entry_count = entry_count0;
41
- counts.expected_paths = entry_paths0;
42
- counts.expected_statuses = entry_statuses0;
43
-
44
- cl_git_pass(
45
- git_status_foreach(repo, cb_status__normal, &counts)
46
- );
47
-
48
- cl_assert_equal_i(counts.expected_entry_count, counts.entry_count);
49
- cl_assert_equal_i(0, counts.wrong_status_flags_count);
50
- cl_assert_equal_i(0, counts.wrong_sorted_path);
51
- }
52
-
53
- /* this test is equivalent to t18-status.c:statuscb1 */
54
- void test_status_worktree__empty_repository(void)
55
- {
56
- int count = 0;
57
- git_repository *repo = cl_git_sandbox_init("empty_standard_repo");
58
-
59
- cl_git_pass(git_status_foreach(repo, cb_status__count, &count));
60
-
61
- cl_assert_equal_i(0, count);
62
- }
63
-
64
- static int remove_file_cb(void *data, git_buf *file)
65
- {
66
- const char *filename = git_buf_cstr(file);
67
-
68
- GIT_UNUSED(data);
69
-
70
- if (git__suffixcmp(filename, ".git") == 0)
71
- return 0;
72
-
73
- if (git_path_isdir(filename))
74
- cl_git_pass(git_futils_rmdir_r(filename, GIT_DIRREMOVAL_FILES_AND_DIRS));
75
- else
76
- cl_git_pass(p_unlink(git_buf_cstr(file)));
77
-
78
- return 0;
79
- }
80
-
81
- /* this test is equivalent to t18-status.c:statuscb2 */
82
- void test_status_worktree__purged_worktree(void)
83
- {
84
- status_entry_counts counts;
85
- git_repository *repo = cl_git_sandbox_init("status");
86
- git_buf workdir = GIT_BUF_INIT;
87
-
88
- /* first purge the contents of the worktree */
89
- cl_git_pass(git_buf_sets(&workdir, git_repository_workdir(repo)));
90
- cl_git_pass(git_path_direach(&workdir, remove_file_cb, NULL));
91
- git_buf_free(&workdir);
92
-
93
- /* now get status */
94
- memset(&counts, 0x0, sizeof(status_entry_counts));
95
- counts.expected_entry_count = entry_count2;
96
- counts.expected_paths = entry_paths2;
97
- counts.expected_statuses = entry_statuses2;
98
-
99
- cl_git_pass(
100
- git_status_foreach(repo, cb_status__normal, &counts)
101
- );
102
-
103
- cl_assert_equal_i(counts.expected_entry_count, counts.entry_count);
104
- cl_assert_equal_i(0, counts.wrong_status_flags_count);
105
- cl_assert_equal_i(0, counts.wrong_sorted_path);
106
- }
107
-
108
- /* this test is similar to t18-status.c:statuscb3 */
109
- void test_status_worktree__swap_subdir_and_file(void)
110
- {
111
- status_entry_counts counts;
112
- git_repository *repo = cl_git_sandbox_init("status");
113
- git_status_options opts;
114
-
115
- /* first alter the contents of the worktree */
116
- cl_git_pass(p_rename("status/current_file", "status/swap"));
117
- cl_git_pass(p_rename("status/subdir", "status/current_file"));
118
- cl_git_pass(p_rename("status/swap", "status/subdir"));
119
-
120
- cl_git_mkfile("status/.HEADER", "dummy");
121
- cl_git_mkfile("status/42-is-not-prime.sigh", "dummy");
122
- cl_git_mkfile("status/README.md", "dummy");
123
-
124
- /* now get status */
125
- memset(&counts, 0x0, sizeof(status_entry_counts));
126
- counts.expected_entry_count = entry_count3;
127
- counts.expected_paths = entry_paths3;
128
- counts.expected_statuses = entry_statuses3;
129
-
130
- memset(&opts, 0, sizeof(opts));
131
- opts.flags = GIT_STATUS_OPT_INCLUDE_UNTRACKED |
132
- GIT_STATUS_OPT_INCLUDE_IGNORED;
133
-
134
- cl_git_pass(
135
- git_status_foreach_ext(repo, &opts, cb_status__normal, &counts)
136
- );
137
-
138
- cl_assert_equal_i(counts.expected_entry_count, counts.entry_count);
139
- cl_assert_equal_i(0, counts.wrong_status_flags_count);
140
- cl_assert_equal_i(0, counts.wrong_sorted_path);
141
- }
142
-
143
- void test_status_worktree__swap_subdir_with_recurse_and_pathspec(void)
144
- {
145
- status_entry_counts counts;
146
- git_repository *repo = cl_git_sandbox_init("status");
147
- git_status_options opts;
148
-
149
- /* first alter the contents of the worktree */
150
- cl_git_pass(p_rename("status/current_file", "status/swap"));
151
- cl_git_pass(p_rename("status/subdir", "status/current_file"));
152
- cl_git_pass(p_rename("status/swap", "status/subdir"));
153
- cl_git_mkfile("status/.new_file", "dummy");
154
- cl_git_pass(git_futils_mkdir_r("status/zzz_new_dir", NULL, 0777));
155
- cl_git_mkfile("status/zzz_new_dir/new_file", "dummy");
156
- cl_git_mkfile("status/zzz_new_file", "dummy");
157
-
158
- /* now get status */
159
- memset(&counts, 0x0, sizeof(status_entry_counts));
160
- counts.expected_entry_count = entry_count4;
161
- counts.expected_paths = entry_paths4;
162
- counts.expected_statuses = entry_statuses4;
163
-
164
- memset(&opts, 0, sizeof(opts));
165
- opts.flags = GIT_STATUS_OPT_INCLUDE_UNTRACKED |
166
- GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS;
167
- /* TODO: set pathspec to "current_file" eventually */
168
-
169
- cl_git_pass(
170
- git_status_foreach_ext(repo, &opts, cb_status__normal, &counts)
171
- );
172
-
173
- cl_assert_equal_i(counts.expected_entry_count, counts.entry_count);
174
- cl_assert_equal_i(0, counts.wrong_status_flags_count);
175
- cl_assert_equal_i(0, counts.wrong_sorted_path);
176
- }
177
-
178
- /* this test is equivalent to t18-status.c:singlestatus0 */
179
- void test_status_worktree__single_file(void)
180
- {
181
- int i;
182
- unsigned int status_flags;
183
- git_repository *repo = cl_git_sandbox_init("status");
184
-
185
- for (i = 0; i < (int)entry_count0; i++) {
186
- cl_git_pass(
187
- git_status_file(&status_flags, repo, entry_paths0[i])
188
- );
189
- cl_assert(entry_statuses0[i] == status_flags);
190
- }
191
- }
192
-
193
- /* this test is equivalent to t18-status.c:singlestatus1 */
194
- void test_status_worktree__single_nonexistent_file(void)
195
- {
196
- int error;
197
- unsigned int status_flags;
198
- git_repository *repo = cl_git_sandbox_init("status");
199
-
200
- error = git_status_file(&status_flags, repo, "nonexistent");
201
- cl_git_fail(error);
202
- cl_assert(error == GIT_ENOTFOUND);
203
- }
204
-
205
- /* this test is equivalent to t18-status.c:singlestatus2 */
206
- void test_status_worktree__single_nonexistent_file_empty_repo(void)
207
- {
208
- int error;
209
- unsigned int status_flags;
210
- git_repository *repo = cl_git_sandbox_init("empty_standard_repo");
211
-
212
- error = git_status_file(&status_flags, repo, "nonexistent");
213
- cl_git_fail(error);
214
- cl_assert(error == GIT_ENOTFOUND);
215
- }
216
-
217
- /* this test is equivalent to t18-status.c:singlestatus3 */
218
- void test_status_worktree__single_file_empty_repo(void)
219
- {
220
- unsigned int status_flags;
221
- git_repository *repo = cl_git_sandbox_init("empty_standard_repo");
222
-
223
- cl_git_mkfile("empty_standard_repo/new_file", "new_file\n");
224
-
225
- cl_git_pass(git_status_file(&status_flags, repo, "new_file"));
226
- cl_assert(status_flags == GIT_STATUS_WT_NEW);
227
- }
228
-
229
- /* this test is equivalent to t18-status.c:singlestatus4 */
230
- void test_status_worktree__single_folder(void)
231
- {
232
- int error;
233
- unsigned int status_flags;
234
- git_repository *repo = cl_git_sandbox_init("status");
235
-
236
- error = git_status_file(&status_flags, repo, "subdir");
237
- cl_git_fail(error);
238
- cl_assert(error != GIT_ENOTFOUND);
239
- }
240
-
241
-
242
- void test_status_worktree__ignores(void)
243
- {
244
- int i, ignored;
245
- git_repository *repo = cl_git_sandbox_init("status");
246
-
247
- for (i = 0; i < (int)entry_count0; i++) {
248
- cl_git_pass(
249
- git_status_should_ignore(&ignored, repo, entry_paths0[i])
250
- );
251
- cl_assert(ignored == (entry_statuses0[i] == GIT_STATUS_IGNORED));
252
- }
253
-
254
- cl_git_pass(
255
- git_status_should_ignore(&ignored, repo, "nonexistent_file")
256
- );
257
- cl_assert(!ignored);
258
-
259
- cl_git_pass(
260
- git_status_should_ignore(&ignored, repo, "ignored_nonexistent_file")
261
- );
262
- cl_assert(ignored);
263
- }
264
-
265
- static int cb_status__check_592(const char *p, unsigned int s, void *payload)
266
- {
267
- GIT_UNUSED(payload);
268
-
269
- if (s != GIT_STATUS_WT_DELETED || (payload != NULL && strcmp(p, (const char *)payload) != 0))
270
- return -1;
271
-
272
- return 0;
273
- }
274
-
275
- void test_status_worktree__issue_592(void)
276
- {
277
- git_repository *repo;
278
- git_buf path = GIT_BUF_INIT;
279
-
280
- repo = cl_git_sandbox_init("issue_592");
281
- cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(repo), "l.txt"));
282
- cl_git_pass(p_unlink(git_buf_cstr(&path)));
283
-
284
- cl_git_pass(git_status_foreach(repo, cb_status__check_592, "l.txt"));
285
-
286
- git_buf_free(&path);
287
- }
288
-
289
- void test_status_worktree__issue_592_2(void)
290
- {
291
- git_repository *repo;
292
- git_buf path = GIT_BUF_INIT;
293
-
294
- repo = cl_git_sandbox_init("issue_592");
295
- cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(repo), "c/a.txt"));
296
- cl_git_pass(p_unlink(git_buf_cstr(&path)));
297
-
298
- cl_git_pass(git_status_foreach(repo, cb_status__check_592, "c/a.txt"));
299
-
300
- git_buf_free(&path);
301
- }
302
-
303
- void test_status_worktree__issue_592_3(void)
304
- {
305
- git_repository *repo;
306
- git_buf path = GIT_BUF_INIT;
307
-
308
- repo = cl_git_sandbox_init("issue_592");
309
-
310
- cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(repo), "c"));
311
- cl_git_pass(git_futils_rmdir_r(git_buf_cstr(&path), GIT_DIRREMOVAL_FILES_AND_DIRS));
312
-
313
- cl_git_pass(git_status_foreach(repo, cb_status__check_592, "c/a.txt"));
314
-
315
- git_buf_free(&path);
316
- }
317
-
318
- void test_status_worktree__issue_592_4(void)
319
- {
320
- git_repository *repo;
321
- git_buf path = GIT_BUF_INIT;
322
-
323
- repo = cl_git_sandbox_init("issue_592");
324
-
325
- cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(repo), "t/b.txt"));
326
- cl_git_pass(p_unlink(git_buf_cstr(&path)));
327
-
328
- cl_git_pass(git_status_foreach(repo, cb_status__check_592, "t/b.txt"));
329
-
330
- git_buf_free(&path);
331
- }
332
-
333
- void test_status_worktree__issue_592_5(void)
334
- {
335
- git_repository *repo;
336
- git_buf path = GIT_BUF_INIT;
337
-
338
- repo = cl_git_sandbox_init("issue_592");
339
-
340
- cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(repo), "t"));
341
- cl_git_pass(git_futils_rmdir_r(git_buf_cstr(&path), GIT_DIRREMOVAL_FILES_AND_DIRS));
342
- cl_git_pass(p_mkdir(git_buf_cstr(&path), 0777));
343
-
344
- cl_git_pass(git_status_foreach(repo, cb_status__check_592, NULL));
345
-
346
- git_buf_free(&path);
347
- }
348
-
349
- void test_status_worktree__issue_592_ignores_0(void)
350
- {
351
- int count = 0;
352
- status_entry_single st;
353
- git_repository *repo = cl_git_sandbox_init("issue_592");
354
-
355
- cl_git_pass(git_status_foreach(repo, cb_status__count, &count));
356
- cl_assert_equal_i(0, count);
357
-
358
- cl_git_rewritefile("issue_592/.gitignore",
359
- ".gitignore\n*.txt\nc/\n[tT]*/\n");
360
-
361
- cl_git_pass(git_status_foreach(repo, cb_status__count, &count));
362
- cl_assert_equal_i(1, count);
363
-
364
- /* This is a situation where the behavior of libgit2 is
365
- * different from core git. Core git will show ignored.txt
366
- * in the list of ignored files, even though the directory
367
- * "t" is ignored and the file is untracked because we have
368
- * the explicit "*.txt" ignore rule. Libgit2 just excludes
369
- * all untracked files that are contained within ignored
370
- * directories without explicitly listing them.
371
- */
372
- cl_git_rewritefile("issue_592/t/ignored.txt", "ping");
373
-
374
- memset(&st, 0, sizeof(st));
375
- cl_git_pass(git_status_foreach(repo, cb_status__single, &st));
376
- cl_assert_equal_i(1, st.count);
377
- cl_assert(st.status == GIT_STATUS_IGNORED);
378
-
379
- cl_git_rewritefile("issue_592/c/ignored_by_dir", "ping");
380
-
381
- memset(&st, 0, sizeof(st));
382
- cl_git_pass(git_status_foreach(repo, cb_status__single, &st));
383
- cl_assert_equal_i(1, st.count);
384
- cl_assert(st.status == GIT_STATUS_IGNORED);
385
-
386
- cl_git_rewritefile("issue_592/t/ignored_by_dir_pattern", "ping");
387
-
388
- memset(&st, 0, sizeof(st));
389
- cl_git_pass(git_status_foreach(repo, cb_status__single, &st));
390
- cl_assert_equal_i(1, st.count);
391
- cl_assert(st.status == GIT_STATUS_IGNORED);
392
- }
393
-
394
- void test_status_worktree__issue_592_ignored_dirs_with_tracked_content(void)
395
- {
396
- int count = 0;
397
- git_repository *repo = cl_git_sandbox_init("issue_592b");
398
-
399
- cl_git_pass(git_status_foreach(repo, cb_status__count, &count));
400
- cl_assert_equal_i(1, count);
401
-
402
- /* if we are really mimicking core git, then only ignored1.txt
403
- * at the top level will show up in the ignores list here.
404
- * everything else will be unmodified or skipped completely.
405
- */
406
- }
407
-
408
- void test_status_worktree__cannot_retrieve_the_status_of_a_bare_repository(void)
409
- {
410
- git_repository *repo;
411
- int error;
412
- unsigned int status = 0;
413
-
414
- cl_git_pass(git_repository_open(&repo, cl_fixture("testrepo.git")));
415
-
416
- error = git_status_file(&status, repo, "dummy");
417
-
418
- cl_git_fail(error);
419
- cl_assert(error != GIT_ENOTFOUND);
420
-
421
- git_repository_free(repo);
422
- }
423
-
424
- void test_status_worktree__first_commit_in_progress(void)
425
- {
426
- git_repository *repo;
427
- git_index *index;
428
- status_entry_single result;
429
-
430
- cl_git_pass(git_repository_init(&repo, "getting_started", 0));
431
- cl_git_mkfile("getting_started/testfile.txt", "content\n");
432
-
433
- memset(&result, 0, sizeof(result));
434
- cl_git_pass(git_status_foreach(repo, cb_status__single, &result));
435
- cl_assert_equal_i(1, result.count);
436
- cl_assert(result.status == GIT_STATUS_WT_NEW);
437
-
438
- cl_git_pass(git_repository_index(&index, repo));
439
- cl_git_pass(git_index_add(index, "testfile.txt", 0));
440
- cl_git_pass(git_index_write(index));
441
-
442
- memset(&result, 0, sizeof(result));
443
- cl_git_pass(git_status_foreach(repo, cb_status__single, &result));
444
- cl_assert_equal_i(1, result.count);
445
- cl_assert(result.status == GIT_STATUS_INDEX_NEW);
446
-
447
- git_index_free(index);
448
- git_repository_free(repo);
449
- }
450
-
451
-
452
-
453
- void test_status_worktree__status_file_without_index_or_workdir(void)
454
- {
455
- git_repository *repo;
456
- unsigned int status = 0;
457
- git_index *index;
458
-
459
- cl_git_pass(p_mkdir("wd", 0777));
460
-
461
- cl_git_pass(git_repository_open(&repo, cl_fixture("testrepo.git")));
462
- cl_git_pass(git_repository_set_workdir(repo, "wd"));
463
-
464
- cl_git_pass(git_index_open(&index, "empty-index"));
465
- cl_assert_equal_i(0, git_index_entrycount(index));
466
- git_repository_set_index(repo, index);
467
-
468
- cl_git_pass(git_status_file(&status, repo, "branch_file.txt"));
469
-
470
- cl_assert_equal_i(GIT_STATUS_INDEX_DELETED, status);
471
-
472
- git_repository_free(repo);
473
- git_index_free(index);
474
- cl_git_pass(p_rmdir("wd"));
475
- }
476
-
477
- static void fill_index_wth_head_entries(git_repository *repo, git_index *index)
478
- {
479
- git_oid oid;
480
- git_commit *commit;
481
- git_tree *tree;
482
-
483
- cl_git_pass(git_reference_name_to_oid(&oid, repo, "HEAD"));
484
- cl_git_pass(git_commit_lookup(&commit, repo, &oid));
485
- cl_git_pass(git_commit_tree(&tree, commit));
486
-
487
- cl_git_pass(git_index_read_tree(index, tree));
488
- cl_git_pass(git_index_write(index));
489
-
490
- git_tree_free(tree);
491
- git_commit_free(commit);
492
- }
493
-
494
- void test_status_worktree__status_file_with_clean_index_and_empty_workdir(void)
495
- {
496
- git_repository *repo;
497
- unsigned int status = 0;
498
- git_index *index;
499
-
500
- cl_git_pass(p_mkdir("wd", 0777));
501
-
502
- cl_git_pass(git_repository_open(&repo, cl_fixture("testrepo.git")));
503
- cl_git_pass(git_repository_set_workdir(repo, "wd"));
504
-
505
- cl_git_pass(git_index_open(&index, "my-index"));
506
- fill_index_wth_head_entries(repo, index);
507
-
508
- git_repository_set_index(repo, index);
509
-
510
- cl_git_pass(git_status_file(&status, repo, "branch_file.txt"));
511
-
512
- cl_assert_equal_i(GIT_STATUS_WT_DELETED, status);
513
-
514
- git_repository_free(repo);
515
- git_index_free(index);
516
- cl_git_pass(p_rmdir("wd"));
517
- cl_git_pass(p_unlink("my-index"));
518
- }
519
-
520
-
521
- void test_status_worktree__space_in_filename(void)
522
- {
523
- git_repository *repo;
524
- git_index *index;
525
- status_entry_single result;
526
- unsigned int status_flags;
527
-
528
- #define FILE_WITH_SPACE "LICENSE - copy.md"
529
-
530
- cl_git_pass(git_repository_init(&repo, "with_space", 0));
531
- cl_git_mkfile("with_space/" FILE_WITH_SPACE, "I have a space in my name\n");
532
-
533
- /* file is new to working directory */
534
-
535
- memset(&result, 0, sizeof(result));
536
- cl_git_pass(git_status_foreach(repo, cb_status__single, &result));
537
- cl_assert_equal_i(1, result.count);
538
- cl_assert(result.status == GIT_STATUS_WT_NEW);
539
-
540
- cl_git_pass(git_status_file(&status_flags, repo, FILE_WITH_SPACE));
541
- cl_assert(status_flags == GIT_STATUS_WT_NEW);
542
-
543
- /* ignore the file */
544
-
545
- cl_git_rewritefile("with_space/.gitignore", "*.md\n.gitignore\n");
546
-
547
- memset(&result, 0, sizeof(result));
548
- cl_git_pass(git_status_foreach(repo, cb_status__single, &result));
549
- cl_assert_equal_i(2, result.count);
550
- cl_assert(result.status == GIT_STATUS_IGNORED);
551
-
552
- cl_git_pass(git_status_file(&status_flags, repo, FILE_WITH_SPACE));
553
- cl_assert(status_flags == GIT_STATUS_IGNORED);
554
-
555
- /* don't ignore the file */
556
-
557
- cl_git_rewritefile("with_space/.gitignore", ".gitignore\n");
558
-
559
- memset(&result, 0, sizeof(result));
560
- cl_git_pass(git_status_foreach(repo, cb_status__single, &result));
561
- cl_assert_equal_i(2, result.count);
562
- cl_assert(result.status == GIT_STATUS_WT_NEW);
563
-
564
- cl_git_pass(git_status_file(&status_flags, repo, FILE_WITH_SPACE));
565
- cl_assert(status_flags == GIT_STATUS_WT_NEW);
566
-
567
- /* add the file to the index */
568
-
569
- cl_git_pass(git_repository_index(&index, repo));
570
- cl_git_pass(git_index_add(index, FILE_WITH_SPACE, 0));
571
- cl_git_pass(git_index_write(index));
572
-
573
- memset(&result, 0, sizeof(result));
574
- cl_git_pass(git_status_foreach(repo, cb_status__single, &result));
575
- cl_assert_equal_i(2, result.count);
576
- cl_assert(result.status == GIT_STATUS_INDEX_NEW);
577
-
578
- cl_git_pass(git_status_file(&status_flags, repo, FILE_WITH_SPACE));
579
- cl_assert(status_flags == GIT_STATUS_INDEX_NEW);
580
-
581
- git_index_free(index);
582
- git_repository_free(repo);
583
- }
584
-
585
- static const char *filemode_paths[] = {
586
- "exec_off",
587
- "exec_off2on_staged",
588
- "exec_off2on_workdir",
589
- "exec_off_untracked",
590
- "exec_on",
591
- "exec_on2off_staged",
592
- "exec_on2off_workdir",
593
- "exec_on_untracked",
594
- };
595
-
596
- static unsigned int filemode_statuses[] = {
597
- GIT_STATUS_CURRENT,
598
- GIT_STATUS_INDEX_MODIFIED,
599
- GIT_STATUS_WT_MODIFIED,
600
- GIT_STATUS_WT_NEW,
601
- GIT_STATUS_CURRENT,
602
- GIT_STATUS_INDEX_MODIFIED,
603
- GIT_STATUS_WT_MODIFIED,
604
- GIT_STATUS_WT_NEW
605
- };
606
-
607
- static const size_t filemode_count = 8;
608
-
609
- void test_status_worktree__filemode_changes(void)
610
- {
611
- git_repository *repo = cl_git_sandbox_init("filemodes");
612
- status_entry_counts counts;
613
- git_status_options opts;
614
- git_config *cfg;
615
-
616
- /* overwrite stored filemode with platform appropriate value */
617
- cl_git_pass(git_repository_config(&cfg, repo));
618
- if (cl_is_chmod_supported())
619
- cl_git_pass(git_config_set_bool(cfg, "core.filemode", true));
620
- else {
621
- unsigned int i;
622
- cl_git_pass(git_config_set_bool(cfg, "core.filemode", false));
623
-
624
- /* won't trust filesystem mode diffs, so these will appear unchanged */
625
- for (i = 0; i < filemode_count; ++i)
626
- if (filemode_statuses[i] == GIT_STATUS_WT_MODIFIED)
627
- filemode_statuses[i] = GIT_STATUS_CURRENT;
628
- }
629
-
630
- memset(&opts, 0, sizeof(opts));
631
- opts.flags = GIT_STATUS_OPT_INCLUDE_UNTRACKED |
632
- GIT_STATUS_OPT_INCLUDE_IGNORED |
633
- GIT_STATUS_OPT_INCLUDE_UNMODIFIED;
634
-
635
- memset(&counts, 0, sizeof(counts));
636
- counts.expected_entry_count = filemode_count;
637
- counts.expected_paths = filemode_paths;
638
- counts.expected_statuses = filemode_statuses;
639
-
640
- cl_git_pass(
641
- git_status_foreach_ext(repo, &opts, cb_status__normal, &counts)
642
- );
643
-
644
- cl_assert_equal_i(counts.expected_entry_count, counts.entry_count);
645
- cl_assert_equal_i(0, counts.wrong_status_flags_count);
646
- cl_assert_equal_i(0, counts.wrong_sorted_path);
647
-
648
- git_config_free(cfg);
649
- }