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
@@ -101,6 +101,10 @@ int git_pack_entry_find(
101
101
  struct git_pack_entry *e,
102
102
  struct git_pack_file *p,
103
103
  const git_oid *short_oid,
104
- unsigned int len);
104
+ size_t len);
105
+ int git_pack_foreach_entry(
106
+ struct git_pack_file *p,
107
+ int (*cb)(git_oid *oid, void *data),
108
+ void *data);
105
109
 
106
110
  #endif
@@ -17,9 +17,7 @@
17
17
  #include <stdio.h>
18
18
  #include <ctype.h>
19
19
 
20
- #ifdef GIT_WIN32
21
20
  #define LOOKS_LIKE_DRIVE_PREFIX(S) (git__isalpha((S)[0]) && (S)[1] == ':')
22
- #endif
23
21
 
24
22
  /*
25
23
  * Based on the Android implementation, BSD licensed.
@@ -172,11 +170,11 @@ int git_path_root(const char *path)
172
170
  {
173
171
  int offset = 0;
174
172
 
175
- #ifdef GIT_WIN32
176
173
  /* Does the root of the path look like a windows drive ? */
177
174
  if (LOOKS_LIKE_DRIVE_PREFIX(path))
178
175
  offset += 2;
179
176
 
177
+ #ifdef GIT_WIN32
180
178
  /* Are we dealing with a windows network path? */
181
179
  else if ((path[0] == '/' && path[1] == '/') ||
182
180
  (path[0] == '\\' && path[1] == '\\'))
@@ -389,6 +387,69 @@ bool git_path_isfile(const char *path)
389
387
  return S_ISREG(st.st_mode) != 0;
390
388
  }
391
389
 
390
+ #ifdef GIT_WIN32
391
+
392
+ bool git_path_is_empty_dir(const char *path)
393
+ {
394
+ git_buf pathbuf = GIT_BUF_INIT;
395
+ HANDLE hFind = INVALID_HANDLE_VALUE;
396
+ wchar_t *wbuf;
397
+ WIN32_FIND_DATAW ffd;
398
+ bool retval = true;
399
+
400
+ if (!git_path_isdir(path)) return false;
401
+
402
+ git_buf_printf(&pathbuf, "%s\\*", path);
403
+ wbuf = gitwin_to_utf16(git_buf_cstr(&pathbuf));
404
+
405
+ hFind = FindFirstFileW(wbuf, &ffd);
406
+ if (INVALID_HANDLE_VALUE == hFind) {
407
+ giterr_set(GITERR_OS, "Couldn't open '%s'", path);
408
+ return false;
409
+ }
410
+
411
+ do {
412
+ if (!git_path_is_dot_or_dotdotW(ffd.cFileName)) {
413
+ retval = false;
414
+ }
415
+ } while (FindNextFileW(hFind, &ffd) != 0);
416
+
417
+ FindClose(hFind);
418
+ git_buf_free(&pathbuf);
419
+ git__free(wbuf);
420
+ return retval;
421
+ }
422
+
423
+ #else
424
+
425
+ bool git_path_is_empty_dir(const char *path)
426
+ {
427
+ DIR *dir = NULL;
428
+ struct dirent *e;
429
+ bool retval = true;
430
+
431
+ if (!git_path_isdir(path)) return false;
432
+
433
+ dir = opendir(path);
434
+ if (!dir) {
435
+ giterr_set(GITERR_OS, "Couldn't open '%s'", path);
436
+ return false;
437
+ }
438
+
439
+ while ((e = readdir(dir)) != NULL) {
440
+ if (!git_path_is_dot_or_dotdot(e->d_name)) {
441
+ giterr_set(GITERR_INVALID,
442
+ "'%s' exists and is not an empty directory", path);
443
+ retval = false;
444
+ break;
445
+ }
446
+ }
447
+ closedir(dir);
448
+
449
+ return retval;
450
+ }
451
+ #endif
452
+
392
453
  int git_path_lstat(const char *path, struct stat *st)
393
454
  {
394
455
  int err = 0;
@@ -464,31 +525,93 @@ int git_path_find_dir(git_buf *dir, const char *path, const char *base)
464
525
  return error;
465
526
  }
466
527
 
528
+ int git_path_resolve_relative(git_buf *path, size_t ceiling)
529
+ {
530
+ char *base, *to, *from, *next;
531
+ size_t len;
532
+
533
+ if (!path || git_buf_oom(path))
534
+ return -1;
535
+
536
+ if (ceiling > path->size)
537
+ ceiling = path->size;
538
+
539
+ /* recognize drive prefixes, etc. that should not be backed over */
540
+ if (ceiling == 0)
541
+ ceiling = git_path_root(path->ptr) + 1;
542
+
543
+ /* recognize URL prefixes that should not be backed over */
544
+ if (ceiling == 0) {
545
+ for (next = path->ptr; *next && git__isalpha(*next); ++next);
546
+ if (next[0] == ':' && next[1] == '/' && next[2] == '/')
547
+ ceiling = (next + 3) - path->ptr;
548
+ }
549
+
550
+ base = to = from = path->ptr + ceiling;
551
+
552
+ while (*from) {
553
+ for (next = from; *next && *next != '/'; ++next);
554
+
555
+ len = next - from;
556
+
557
+ if (len == 1 && from[0] == '.')
558
+ /* do nothing with singleton dot */;
559
+
560
+ else if (len == 2 && from[0] == '.' && from[1] == '.') {
561
+ while (to > base && to[-1] == '/') to--;
562
+ while (to > base && to[-1] != '/') to--;
563
+ }
564
+
565
+ else {
566
+ if (*next == '/')
567
+ len++;
568
+
569
+ if (to != from)
570
+ memmove(to, from, len);
571
+
572
+ to += len;
573
+ }
574
+
575
+ from += len;
576
+
577
+ while (*from == '/') from++;
578
+ }
579
+
580
+ *to = '\0';
581
+
582
+ path->size = to - path->ptr;
583
+
584
+ return 0;
585
+ }
586
+
587
+ int git_path_apply_relative(git_buf *target, const char *relpath)
588
+ {
589
+ git_buf_joinpath(target, git_buf_cstr(target), relpath);
590
+ return git_path_resolve_relative(target, 0);
591
+ }
592
+
467
593
  int git_path_cmp(
468
594
  const char *name1, size_t len1, int isdir1,
469
595
  const char *name2, size_t len2, int isdir2)
470
596
  {
597
+ unsigned char c1, c2;
471
598
  size_t len = len1 < len2 ? len1 : len2;
472
599
  int cmp;
473
600
 
474
601
  cmp = memcmp(name1, name2, len);
475
602
  if (cmp)
476
603
  return cmp;
477
- if (len1 < len2)
478
- return (!isdir1 && !isdir2) ? -1 :
479
- (isdir1 ? '/' - name2[len1] : name2[len1] - '/');
480
- if (len1 > len2)
481
- return (!isdir1 && !isdir2) ? 1 :
482
- (isdir2 ? name1[len2] - '/' : '/' - name1[len2]);
483
- return 0;
484
- }
485
604
 
486
- /* Taken from git.git */
487
- GIT_INLINE(int) is_dot_or_dotdot(const char *name)
488
- {
489
- return (name[0] == '.' &&
490
- (name[1] == '\0' ||
491
- (name[1] == '.' && name[2] == '\0')));
605
+ c1 = name1[len];
606
+ c2 = name2[len];
607
+
608
+ if (c1 == '\0' && isdir1)
609
+ c1 = '/';
610
+
611
+ if (c2 == '\0' && isdir2)
612
+ c2 = '/';
613
+
614
+ return (c1 < c2) ? -1 : (c1 > c2) ? 1 : 0;
492
615
  }
493
616
 
494
617
  int git_path_direach(
@@ -510,7 +633,7 @@ int git_path_direach(
510
633
  return -1;
511
634
  }
512
635
 
513
- #ifdef __sun
636
+ #if defined(__sun) || defined(__GNU__)
514
637
  de_buf = git__malloc(sizeof(struct dirent) + FILENAME_MAX + 1);
515
638
  #else
516
639
  de_buf = git__malloc(sizeof(struct dirent));
@@ -519,7 +642,7 @@ int git_path_direach(
519
642
  while (p_readdir_r(dir, de_buf, &de) == 0 && de != NULL) {
520
643
  int result;
521
644
 
522
- if (is_dot_or_dotdot(de->d_name))
645
+ if (git_path_is_dot_or_dotdot(de->d_name))
523
646
  continue;
524
647
 
525
648
  if (git_buf_puts(path, de->d_name) < 0) {
@@ -564,7 +687,7 @@ int git_path_dirload(
564
687
  return -1;
565
688
  }
566
689
 
567
- #ifdef __sun
690
+ #if defined(__sun) || defined(__GNU__)
568
691
  de_buf = git__malloc(sizeof(struct dirent) + FILENAME_MAX + 1);
569
692
  #else
570
693
  de_buf = git__malloc(sizeof(struct dirent));
@@ -578,7 +701,7 @@ int git_path_dirload(
578
701
  char *entry_path;
579
702
  size_t entry_len;
580
703
 
581
- if (is_dot_or_dotdot(de->d_name))
704
+ if (git_path_is_dot_or_dotdot(de->d_name))
582
705
  continue;
583
706
 
584
707
  entry_len = strlen(de->d_name);
@@ -80,7 +80,24 @@ extern int git_path_to_dir(git_buf *path);
80
80
  */
81
81
  extern void git_path_string_to_dir(char* path, size_t size);
82
82
 
83
+ /**
84
+ * Taken from git.git; returns nonzero if the given path is "." or "..".
85
+ */
86
+ GIT_INLINE(int) git_path_is_dot_or_dotdot(const char *name)
87
+ {
88
+ return (name[0] == '.' &&
89
+ (name[1] == '\0' ||
90
+ (name[1] == '.' && name[2] == '\0')));
91
+ }
92
+
83
93
  #ifdef GIT_WIN32
94
+ GIT_INLINE(int) git_path_is_dot_or_dotdotW(const wchar_t *name)
95
+ {
96
+ return (name[0] == L'.' &&
97
+ (name[1] == L'\0' ||
98
+ (name[1] == L'.' && name[2] == L'\0')));
99
+ }
100
+
84
101
  /**
85
102
  * Convert backslashes in path to forward slashes.
86
103
  */
@@ -129,6 +146,11 @@ extern bool git_path_isdir(const char *path);
129
146
  */
130
147
  extern bool git_path_isfile(const char *path);
131
148
 
149
+ /**
150
+ * Check if the given path is a directory, and is empty.
151
+ */
152
+ extern bool git_path_is_empty_dir(const char *path);
153
+
132
154
  /**
133
155
  * Stat a file and/or link and set error if needed.
134
156
  */
@@ -185,6 +207,29 @@ extern int git_path_prettify_dir(git_buf *path_out, const char *path, const char
185
207
  */
186
208
  extern int git_path_find_dir(git_buf *dir, const char *path, const char *base);
187
209
 
210
+ /**
211
+ * Resolve relative references within a path.
212
+ *
213
+ * This eliminates "./" and "../" relative references inside a path,
214
+ * as well as condensing multiple slashes into single ones. It will
215
+ * not touch the path before the "ceiling" length.
216
+ *
217
+ * Additionally, this will recognize an "c:/" drive prefix or a "xyz://" URL
218
+ * prefix and not touch that part of the path.
219
+ */
220
+ extern int git_path_resolve_relative(git_buf *path, size_t ceiling);
221
+
222
+ /**
223
+ * Apply a relative path to base path.
224
+ *
225
+ * Note that the base path could be a filename or a URL and this
226
+ * should still work. The relative path is walked segment by segment
227
+ * with three rules: series of slashes will be condensed to a single
228
+ * slash, "." will be eaten with no change, and ".." will remove a
229
+ * segment from the base path.
230
+ */
231
+ extern int git_path_apply_relative(git_buf *target, const char *relpath);
232
+
188
233
  /**
189
234
  * Walk each directory entry, except '.' and '..', calling fn(state).
190
235
  *
@@ -194,6 +239,7 @@ extern int git_path_find_dir(git_buf *dir, const char *path, const char *base);
194
239
  * the input state and the second arg is pathbuf. The function
195
240
  * may modify the pathbuf, but only by appending new text.
196
241
  * @param state to pass to fn as the first arg.
242
+ * @return 0 on success, GIT_EUSER on non-zero callback, or error code
197
243
  */
198
244
  extern int git_path_direach(
199
245
  git_buf *pathbuf,
@@ -42,15 +42,29 @@ static int flush_pkt(git_pkt **out)
42
42
  /* the rest of the line will be useful for multi_ack */
43
43
  static int ack_pkt(git_pkt **out, const char *line, size_t len)
44
44
  {
45
- git_pkt *pkt;
45
+ git_pkt_ack *pkt;
46
46
  GIT_UNUSED(line);
47
47
  GIT_UNUSED(len);
48
48
 
49
- pkt = git__malloc(sizeof(git_pkt));
49
+ pkt = git__calloc(1, sizeof(git_pkt_ack));
50
50
  GITERR_CHECK_ALLOC(pkt);
51
51
 
52
52
  pkt->type = GIT_PKT_ACK;
53
- *out = pkt;
53
+ line += 3;
54
+ len -= 3;
55
+
56
+ if (len >= GIT_OID_HEXSZ) {
57
+ git_oid_fromstr(&pkt->oid, line + 1);
58
+ line += GIT_OID_HEXSZ + 1;
59
+ len -= GIT_OID_HEXSZ + 1;
60
+ }
61
+
62
+ if (len >= 7) {
63
+ if (!git__prefixcmp(line + 1, "continue"))
64
+ pkt->status = GIT_ACK_CONTINUE;
65
+ }
66
+
67
+ *out = (git_pkt *) pkt;
54
68
 
55
69
  return 0;
56
70
  }
@@ -283,20 +297,28 @@ int git_pkt_buffer_flush(git_buf *buf)
283
297
 
284
298
  static int buffer_want_with_caps(git_remote_head *head, git_transport_caps *caps, git_buf *buf)
285
299
  {
286
- char capstr[20];
300
+ git_buf str = GIT_BUF_INIT;
287
301
  char oid[GIT_OID_HEXSZ +1] = {0};
288
302
  unsigned int len;
289
303
 
290
304
  if (caps->ofs_delta)
291
- strncpy(capstr, GIT_CAP_OFS_DELTA, sizeof(capstr));
305
+ git_buf_puts(&str, GIT_CAP_OFS_DELTA " ");
306
+
307
+ if (caps->multi_ack)
308
+ git_buf_puts(&str, GIT_CAP_MULTI_ACK " ");
309
+
310
+ if (git_buf_oom(&str))
311
+ return -1;
292
312
 
293
313
  len = (unsigned int)
294
314
  (strlen("XXXXwant ") + GIT_OID_HEXSZ + 1 /* NUL */ +
295
- strlen(capstr) + 1 /* LF */);
315
+ git_buf_len(&str) + 1 /* LF */);
296
316
  git_buf_grow(buf, git_buf_len(buf) + len);
297
-
298
317
  git_oid_fmt(oid, &head->oid);
299
- return git_buf_printf(buf, "%04xwant %s%c%s\n", len, oid, 0, capstr);
318
+ git_buf_printf(buf, "%04xwant %s %s\n", len, oid, git_buf_cstr(&str));
319
+ git_buf_free(&str);
320
+
321
+ return git_buf_oom(buf);
300
322
  }
301
323
 
302
324
  /*
@@ -206,6 +206,11 @@ char *git_pool_strdup(git_pool *pool, const char *str)
206
206
  return git_pool_strndup(pool, str, strlen(str));
207
207
  }
208
208
 
209
+ char *git_pool_strdup_safe(git_pool *pool, const char *str)
210
+ {
211
+ return str ? git_pool_strdup(pool, str) : NULL;
212
+ }
213
+
209
214
  char *git_pool_strcat(git_pool *pool, const char *a, const char *b)
210
215
  {
211
216
  void *ptr;
@@ -275,6 +280,8 @@ uint32_t git_pool__system_page_size(void)
275
280
  SYSTEM_INFO info;
276
281
  GetSystemInfo(&info);
277
282
  size = (uint32_t)info.dwPageSize;
283
+ #elif defined(__amigaos4__)
284
+ size = (uint32_t)4096; /* 4K as there is no global value we can query */
278
285
  #else
279
286
  size = (uint32_t)sysconf(_SC_PAGE_SIZE);
280
287
  #endif
@@ -89,6 +89,13 @@ extern char *git_pool_strndup(git_pool *pool, const char *str, size_t n);
89
89
  */
90
90
  extern char *git_pool_strdup(git_pool *pool, const char *str);
91
91
 
92
+ /**
93
+ * Allocate space and duplicate a string into it, NULL is no error.
94
+ *
95
+ * This is allowed only for pools with item_size == sizeof(char)
96
+ */
97
+ extern char *git_pool_strdup_safe(git_pool *pool, const char *str);
98
+
92
99
  /**
93
100
  * Allocate space for the concatenation of two strings.
94
101
  *
@@ -12,6 +12,97 @@
12
12
 
13
13
  #ifndef GIT_WIN32
14
14
 
15
+ #ifdef NO_ADDRINFO
16
+ int p_getaddrinfo(
17
+ const char *host,
18
+ const char *port,
19
+ struct addrinfo *hints,
20
+ struct addrinfo **info)
21
+ {
22
+ GIT_UNUSED(hints);
23
+
24
+ struct addrinfo *ainfo, *ai;
25
+ int p = 0;
26
+
27
+ if ((ainfo = malloc(sizeof(struct addrinfo))) == NULL)
28
+ return -1;
29
+
30
+ if ((ainfo->ai_hostent = gethostbyname(host)) == NULL)
31
+ return -2;
32
+
33
+ ainfo->ai_servent = getservbyname(port, 0);
34
+
35
+ if (ainfo->ai_servent)
36
+ ainfo->ai_port = ainfo->ai_servent->s_port;
37
+ else
38
+ ainfo->ai_port = atol(port);
39
+
40
+ memcpy(&ainfo->ai_addr_in.sin_addr,
41
+ ainfo->ai_hostent->h_addr_list[0],
42
+ ainfo->ai_hostent->h_length);
43
+
44
+ ainfo->ai_protocol = 0;
45
+ ainfo->ai_socktype = hints->ai_socktype;
46
+ ainfo->ai_family = ainfo->ai_hostent->h_addrtype;
47
+ ainfo->ai_addr_in.sin_family = ainfo->ai_family;
48
+ ainfo->ai_addr_in.sin_port = ainfo->ai_port;
49
+ ainfo->ai_addr = (struct addrinfo *)&ainfo->ai_addr_in;
50
+ ainfo->ai_addrlen = sizeof(struct sockaddr_in);
51
+
52
+ *info = ainfo;
53
+
54
+ if (ainfo->ai_hostent->h_addr_list[1] == NULL) {
55
+ ainfo->ai_next = NULL;
56
+ return 0;
57
+ }
58
+
59
+ ai = ainfo;
60
+
61
+ for (p = 1; ainfo->ai_hostent->h_addr_list[p] != NULL; p++) {
62
+ ai->ai_next = malloc(sizeof(struct addrinfo));
63
+ memcpy(&ai->ai_next, ainfo, sizeof(struct addrinfo));
64
+ memcpy(&ai->ai_next->ai_addr_in.sin_addr,
65
+ ainfo->ai_hostent->h_addr_list[p],
66
+ ainfo->ai_hostent->h_length);
67
+ ai->ai_next->ai_addr = (struct addrinfo *)&ai->ai_next->ai_addr_in;
68
+ ai = ai->ai_next;
69
+ }
70
+
71
+ ai->ai_next = NULL;
72
+ return 0;
73
+ }
74
+
75
+ void p_freeaddrinfo(struct addrinfo *info)
76
+ {
77
+ struct addrinfo *p, *next;
78
+
79
+ p = info;
80
+
81
+ while(p != NULL) {
82
+ next = p->ai_next;
83
+ free(p);
84
+ p = next;
85
+ }
86
+ }
87
+
88
+ const char *p_gai_strerror(int ret)
89
+ {
90
+ switch(ret) {
91
+ case -1:
92
+ return "Out of memory";
93
+ break;
94
+
95
+ case -2:
96
+ return "Address lookup failed";
97
+ break;
98
+
99
+ default:
100
+ return "Unknown error";
101
+ break;
102
+ }
103
+ }
104
+ #endif /* NO_ADDRINFO */
105
+
15
106
  int p_open(const char *path, int flags, ...)
16
107
  {
17
108
  mode_t mode = 0;
@@ -63,7 +154,7 @@ int p_rename(const char *from, const char *to)
63
154
  return -1;
64
155
  }
65
156
 
66
- #endif
157
+ #endif /* GIT_WIN32 */
67
158
 
68
159
  int p_read(git_file fd, void *buf, size_t cnt)
69
160
  {