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
@@ -121,9 +121,9 @@ static const struct {
121
121
  { "IDLE", +12, 0, }, /* International Date Line East */
122
122
  };
123
123
 
124
- static int match_string(const char *date, const char *str)
124
+ static size_t match_string(const char *date, const char *str)
125
125
  {
126
- int i = 0;
126
+ size_t i = 0;
127
127
 
128
128
  for (i = 0; *date; date++, str++, i++) {
129
129
  if (*date == *str)
@@ -149,12 +149,12 @@ static int skip_alpha(const char *date)
149
149
  /*
150
150
  * Parse month, weekday, or timezone name
151
151
  */
152
- static int match_alpha(const char *date, struct tm *tm, int *offset)
152
+ static size_t match_alpha(const char *date, struct tm *tm, int *offset)
153
153
  {
154
154
  unsigned int i;
155
155
 
156
156
  for (i = 0; i < 12; i++) {
157
- int match = match_string(date, month_names[i]);
157
+ size_t match = match_string(date, month_names[i]);
158
158
  if (match >= 3) {
159
159
  tm->tm_mon = i;
160
160
  return match;
@@ -162,7 +162,7 @@ static int match_alpha(const char *date, struct tm *tm, int *offset)
162
162
  }
163
163
 
164
164
  for (i = 0; i < 7; i++) {
165
- int match = match_string(date, weekday_names[i]);
165
+ size_t match = match_string(date, weekday_names[i]);
166
166
  if (match >= 3) {
167
167
  tm->tm_wday = i;
168
168
  return match;
@@ -170,8 +170,8 @@ static int match_alpha(const char *date, struct tm *tm, int *offset)
170
170
  }
171
171
 
172
172
  for (i = 0; i < ARRAY_SIZE(timezone_names); i++) {
173
- int match = match_string(date, timezone_names[i].name);
174
- if (match >= 3 || match == (int)strlen(timezone_names[i].name)) {
173
+ size_t match = match_string(date, timezone_names[i].name);
174
+ if (match >= 3 || match == strlen(timezone_names[i].name)) {
175
175
  int off = timezone_names[i].offset;
176
176
 
177
177
  /* This is bogus, but we like summer */
@@ -241,7 +241,7 @@ static int is_date(int year, int month, int day, struct tm *now_tm, time_t now,
241
241
  return 0;
242
242
  }
243
243
 
244
- static int match_multi_number(unsigned long num, char c, const char *date, char *end, struct tm *tm)
244
+ static size_t match_multi_number(unsigned long num, char c, const char *date, char *end, struct tm *tm)
245
245
  {
246
246
  time_t now;
247
247
  struct tm now_tm;
@@ -319,9 +319,9 @@ static int nodate(struct tm *tm)
319
319
  /*
320
320
  * We've seen a digit. Time? Year? Date?
321
321
  */
322
- static int match_digit(const char *date, struct tm *tm, int *offset, int *tm_gmt)
322
+ static size_t match_digit(const char *date, struct tm *tm, int *offset, int *tm_gmt)
323
323
  {
324
- int n;
324
+ size_t n;
325
325
  char *end;
326
326
  unsigned long num;
327
327
 
@@ -349,7 +349,7 @@ static int match_digit(const char *date, struct tm *tm, int *offset, int *tm_gmt
349
349
  case '/':
350
350
  case '-':
351
351
  if (isdigit(end[1])) {
352
- int match = match_multi_number(num, *end, date, end, tm);
352
+ size_t match = match_multi_number(num, *end, date, end, tm);
353
353
  if (match)
354
354
  return match;
355
355
  }
@@ -413,11 +413,11 @@ static int match_digit(const char *date, struct tm *tm, int *offset, int *tm_gmt
413
413
  return n;
414
414
  }
415
415
 
416
- static int match_tz(const char *date, int *offp)
416
+ static size_t match_tz(const char *date, int *offp)
417
417
  {
418
418
  char *end;
419
419
  int hour = strtoul(date + 1, &end, 10);
420
- int n = end - (date + 1);
420
+ size_t n = end - (date + 1);
421
421
  int min = 0;
422
422
 
423
423
  if (n == 4) {
@@ -506,7 +506,7 @@ static int parse_date_basic(const char *date, git_time_t *timestamp, int *offset
506
506
  !match_object_header_date(date + 1, timestamp, offset))
507
507
  return 0; /* success */
508
508
  for (;;) {
509
- int match = 0;
509
+ size_t match = 0;
510
510
  unsigned char c = *date;
511
511
 
512
512
  /* Stop at end of string or newline */
@@ -685,7 +685,7 @@ static const char *approxidate_alpha(const char *date, struct tm *tm, struct tm
685
685
  ;
686
686
 
687
687
  for (i = 0; i < 12; i++) {
688
- int match = match_string(date, month_names[i]);
688
+ size_t match = match_string(date, month_names[i]);
689
689
  if (match >= 3) {
690
690
  tm->tm_mon = i;
691
691
  *touched = 1;
@@ -694,7 +694,7 @@ static const char *approxidate_alpha(const char *date, struct tm *tm, struct tm
694
694
  }
695
695
 
696
696
  for (s = special; s->name; s++) {
697
- int len = strlen(s->name);
697
+ size_t len = strlen(s->name);
698
698
  if (match_string(date, s->name) == len) {
699
699
  s->fn(tm, now, num);
700
700
  *touched = 1;
@@ -704,7 +704,7 @@ static const char *approxidate_alpha(const char *date, struct tm *tm, struct tm
704
704
 
705
705
  if (!*num) {
706
706
  for (i = 1; i < 11; i++) {
707
- int len = strlen(number_name[i]);
707
+ size_t len = strlen(number_name[i]);
708
708
  if (match_string(date, number_name[i]) == len) {
709
709
  *num = i;
710
710
  *touched = 1;
@@ -720,7 +720,7 @@ static const char *approxidate_alpha(const char *date, struct tm *tm, struct tm
720
720
 
721
721
  tl = typelen;
722
722
  while (tl->type) {
723
- int len = strlen(tl->type);
723
+ size_t len = strlen(tl->type);
724
724
  if (match_string(date, tl->type) >= len-1) {
725
725
  update_tm(tm, now, tl->length * *num);
726
726
  *num = 0;
@@ -731,7 +731,7 @@ static const char *approxidate_alpha(const char *date, struct tm *tm, struct tm
731
731
  }
732
732
 
733
733
  for (i = 0; i < 7; i++) {
734
- int match = match_string(date, weekday_names[i]);
734
+ size_t match = match_string(date, weekday_names[i]);
735
735
  if (match >= 3) {
736
736
  int diff, n = *num -1;
737
737
  *num = 0;
@@ -783,7 +783,7 @@ static const char *approxidate_digit(const char *date, struct tm *tm, int *num)
783
783
  case '/':
784
784
  case '-':
785
785
  if (isdigit(end[1])) {
786
- int match = match_multi_number(number, *end, date, end, tm);
786
+ size_t match = match_multi_number(number, *end, date, end, tm);
787
787
  if (match)
788
788
  return date + match;
789
789
  }
@@ -6,6 +6,7 @@
6
6
  */
7
7
  #include "common.h"
8
8
  #include "git2/diff.h"
9
+ #include "git2/oid.h"
9
10
  #include "diff.h"
10
11
  #include "fileops.h"
11
12
  #include "config.h"
@@ -20,14 +21,21 @@ static char *diff_prefix_from_pathspec(const git_strarray *pathspec)
20
21
  return NULL;
21
22
 
22
23
  /* diff prefix will only be leading non-wildcards */
23
- for (scan = prefix.ptr; *scan && !git__iswildcard(*scan); ++scan);
24
+ for (scan = prefix.ptr; *scan; ++scan) {
25
+ if (git__iswildcard(*scan) &&
26
+ (scan == prefix.ptr || (*(scan - 1) != '\\')))
27
+ break;
28
+ }
24
29
  git_buf_truncate(&prefix, scan - prefix.ptr);
25
30
 
26
- if (prefix.size > 0)
27
- return git_buf_detach(&prefix);
31
+ if (prefix.size <= 0) {
32
+ git_buf_free(&prefix);
33
+ return NULL;
34
+ }
28
35
 
29
- git_buf_free(&prefix);
30
- return NULL;
36
+ git_buf_unescape(&prefix);
37
+
38
+ return git_buf_detach(&prefix);
31
39
  }
32
40
 
33
41
  static bool diff_pathspec_is_interesting(const git_strarray *pathspec)
@@ -54,7 +62,11 @@ static bool diff_path_matches_pathspec(git_diff_list *diff, const char *path)
54
62
  return true;
55
63
 
56
64
  git_vector_foreach(&diff->pathspec, i, match) {
57
- int result = p_fnmatch(match->pattern, path, 0);
65
+ int result = strcmp(match->pattern, path) ? FNM_NOMATCH : 0;
66
+
67
+ if (((diff->opts.flags & GIT_DIFF_DISABLE_PATHSPEC_MATCH) == 0) &&
68
+ result == FNM_NOMATCH)
69
+ result = p_fnmatch(match->pattern, path, 0);
58
70
 
59
71
  /* if we didn't match, look for exact dirname prefix match */
60
72
  if (result == FNM_NOMATCH &&
@@ -456,10 +468,11 @@ static int maybe_modified(
456
468
  if (!diff_path_matches_pathspec(diff, oitem->path))
457
469
  return 0;
458
470
 
459
- /* on platforms with no symlinks, promote plain files to symlinks */
471
+ /* on platforms with no symlinks, preserve mode of existing symlinks */
460
472
  if (S_ISLNK(omode) && S_ISREG(nmode) &&
461
- !(diff->diffcaps & GIT_DIFFCAPS_HAS_SYMLINKS))
462
- nmode = GIT_MODE_TYPE(omode) | (nmode & GIT_MODE_PERMS_MASK);
473
+ !(diff->diffcaps & GIT_DIFFCAPS_HAS_SYMLINKS) &&
474
+ new_iter->type == GIT_ITERATOR_WORKDIR)
475
+ nmode = omode;
463
476
 
464
477
  /* on platforms with no execmode, just preserve old mode */
465
478
  if (!(diff->diffcaps & GIT_DIFFCAPS_TRUST_MODE_BITS) &&
@@ -704,12 +717,17 @@ int git_diff_index_to_tree(
704
717
  assert(repo && diff);
705
718
 
706
719
  if (git_iterator_for_tree_range(&a, repo, old_tree, prefix, prefix) < 0 ||
707
- git_iterator_for_index_range(&b, repo, prefix, prefix) < 0)
708
- return -1;
720
+ git_iterator_for_index_range(&b, repo, prefix, prefix) < 0)
721
+ goto on_error;
709
722
 
710
723
  git__free(prefix);
711
724
 
712
725
  return diff_from_iterators(repo, opts, a, b, diff);
726
+
727
+ on_error:
728
+ git__free(prefix);
729
+ git_iterator_free(a);
730
+ return -1;
713
731
  }
714
732
 
715
733
  int git_diff_workdir_to_index(
@@ -723,12 +741,17 @@ int git_diff_workdir_to_index(
723
741
  assert(repo && diff);
724
742
 
725
743
  if (git_iterator_for_index_range(&a, repo, prefix, prefix) < 0 ||
726
- git_iterator_for_workdir_range(&b, repo, prefix, prefix) < 0)
727
- return -1;
744
+ git_iterator_for_workdir_range(&b, repo, prefix, prefix) < 0)
745
+ goto on_error;
728
746
 
729
747
  git__free(prefix);
730
748
 
731
749
  return diff_from_iterators(repo, opts, a, b, diff);
750
+
751
+ on_error:
752
+ git__free(prefix);
753
+ git_iterator_free(a);
754
+ return -1;
732
755
  }
733
756
 
734
757
 
@@ -744,12 +767,17 @@ int git_diff_workdir_to_tree(
744
767
  assert(repo && old_tree && diff);
745
768
 
746
769
  if (git_iterator_for_tree_range(&a, repo, old_tree, prefix, prefix) < 0 ||
747
- git_iterator_for_workdir_range(&b, repo, prefix, prefix) < 0)
748
- return -1;
770
+ git_iterator_for_workdir_range(&b, repo, prefix, prefix) < 0)
771
+ goto on_error;
749
772
 
750
773
  git__free(prefix);
751
774
 
752
775
  return diff_from_iterators(repo, opts, a, b, diff);
776
+
777
+ on_error:
778
+ git__free(prefix);
779
+ git_iterator_free(a);
780
+ return -1;
753
781
  }
754
782
 
755
783
  int git_diff_merge(
@@ -799,9 +827,9 @@ int git_diff_merge(
799
827
 
800
828
  /* prefix strings also come from old pool, so recreate those.*/
801
829
  onto->opts.old_prefix =
802
- git_pool_strdup(&onto->pool, onto->opts.old_prefix);
830
+ git_pool_strdup_safe(&onto->pool, onto->opts.old_prefix);
803
831
  onto->opts.new_prefix =
804
- git_pool_strdup(&onto->pool, onto->opts.new_prefix);
832
+ git_pool_strdup_safe(&onto->pool, onto->opts.new_prefix);
805
833
  }
806
834
 
807
835
  git_vector_foreach(&onto_new, i, delta)
@@ -811,4 +839,3 @@ int git_diff_merge(
811
839
 
812
840
  return error;
813
841
  }
814
-
@@ -8,6 +8,7 @@
8
8
  #include "git2/diff.h"
9
9
  #include "git2/attr.h"
10
10
  #include "git2/blob.h"
11
+ #include "git2/oid.h"
11
12
  #include "xdiff/xdiff.h"
12
13
  #include <ctype.h>
13
14
  #include "diff.h"
@@ -23,6 +24,7 @@ typedef struct {
23
24
  unsigned int index;
24
25
  git_diff_delta *delta;
25
26
  git_diff_range range;
27
+ int error;
26
28
  } diff_output_info;
27
29
 
28
30
  static int read_next_int(const char **str, int *value)
@@ -49,25 +51,24 @@ static int diff_output_cb(void *priv, mmbuffer_t *bufs, int len)
49
51
 
50
52
  /* expect something of the form "@@ -%d[,%d] +%d[,%d] @@" */
51
53
  if (*scan != '@')
52
- return -1;
53
-
54
- if (read_next_int(&scan, &range.old_start) < 0)
55
- return -1;
56
- if (*scan == ',' && read_next_int(&scan, &range.old_lines) < 0)
57
- return -1;
58
-
59
- if (read_next_int(&scan, &range.new_start) < 0)
60
- return -1;
61
- if (*scan == ',' && read_next_int(&scan, &range.new_lines) < 0)
62
- return -1;
63
-
64
- if (range.old_start < 0 || range.new_start < 0)
65
- return -1;
66
-
67
- memcpy(&info->range, &range, sizeof(git_diff_range));
68
-
69
- return info->hunk_cb(
70
- info->cb_data, info->delta, &range, bufs[0].ptr, bufs[0].size);
54
+ info->error = -1;
55
+ else if (read_next_int(&scan, &range.old_start) < 0)
56
+ info->error = -1;
57
+ else if (*scan == ',' && read_next_int(&scan, &range.old_lines) < 0)
58
+ info->error = -1;
59
+ else if (read_next_int(&scan, &range.new_start) < 0)
60
+ info->error = -1;
61
+ else if (*scan == ',' && read_next_int(&scan, &range.new_lines) < 0)
62
+ info->error = -1;
63
+ else if (range.old_start < 0 || range.new_start < 0)
64
+ info->error = -1;
65
+ else {
66
+ memcpy(&info->range, &range, sizeof(git_diff_range));
67
+
68
+ if (info->hunk_cb(
69
+ info->cb_data, info->delta, &range, bufs[0].ptr, bufs[0].size))
70
+ info->error = GIT_EUSER;
71
+ }
71
72
  }
72
73
 
73
74
  if ((len == 2 || len == 3) && info->line_cb) {
@@ -80,23 +81,24 @@ static int diff_output_cb(void *priv, mmbuffer_t *bufs, int len)
80
81
  GIT_DIFF_LINE_CONTEXT;
81
82
 
82
83
  if (info->line_cb(
83
- info->cb_data, info->delta, &info->range, origin, bufs[1].ptr, bufs[1].size) < 0)
84
- return -1;
84
+ info->cb_data, info->delta, &info->range, origin, bufs[1].ptr, bufs[1].size))
85
+ info->error = GIT_EUSER;
85
86
 
86
87
  /* This should only happen if we are adding a line that does not
87
88
  * have a newline at the end and the old code did. In that case,
88
89
  * we have a ADD with a DEL_EOFNL as a pair.
89
90
  */
90
- if (len == 3) {
91
+ else if (len == 3) {
91
92
  origin = (origin == GIT_DIFF_LINE_ADDITION) ?
92
93
  GIT_DIFF_LINE_DEL_EOFNL : GIT_DIFF_LINE_ADD_EOFNL;
93
94
 
94
- return info->line_cb(
95
- info->cb_data, info->delta, &info->range, origin, bufs[2].ptr, bufs[2].size);
95
+ if (info->line_cb(
96
+ info->cb_data, info->delta, &info->range, origin, bufs[2].ptr, bufs[2].size))
97
+ info->error = GIT_EUSER;
96
98
  }
97
99
  }
98
100
 
99
- return 0;
101
+ return info->error;
100
102
  }
101
103
 
102
104
  #define BINARY_DIFF_FLAGS (GIT_DIFF_FILE_BINARY|GIT_DIFF_FILE_NOT_BINARY)
@@ -160,7 +162,7 @@ static int file_is_binary_by_attr(
160
162
  mirror_new = (delta->new_file.path == delta->old_file.path ||
161
163
  strcmp(delta->new_file.path, delta->old_file.path) == 0);
162
164
  if (mirror_new)
163
- delta->new_file.flags &= (delta->old_file.flags & BINARY_DIFF_FLAGS);
165
+ delta->new_file.flags |= (delta->old_file.flags & BINARY_DIFF_FLAGS);
164
166
  else
165
167
  error = update_file_is_binary_by_attr(diff->repo, &delta->new_file);
166
168
 
@@ -212,7 +214,7 @@ static void setup_xdiff_options(
212
214
  cfg->ctxlen =
213
215
  (!opts || !opts->context_lines) ? 3 : opts->context_lines;
214
216
  cfg->interhunkctxlen =
215
- (!opts || !opts->interhunk_lines) ? 3 : opts->interhunk_lines;
217
+ (!opts) ? 0 : opts->interhunk_lines;
216
218
 
217
219
  if (!opts)
218
220
  return;
@@ -318,6 +320,7 @@ int git_diff_foreach(
318
320
  xdemitconf_t xdiff_config;
319
321
  xdemitcb_t xdiff_callback;
320
322
 
323
+ memset(&info, 0, sizeof(info));
321
324
  info.diff = diff;
322
325
  info.cb_data = data;
323
326
  info.hunk_cb = hunk_cb;
@@ -394,6 +397,7 @@ int git_diff_foreach(
394
397
 
395
398
  if (error < 0)
396
399
  goto cleanup;
400
+ delta->new_file.flags |= GIT_DIFF_FILE_VALID_OID;
397
401
 
398
402
  /* since we did not have the definitive oid, we may have
399
403
  * incorrect status and need to skip this item.
@@ -422,11 +426,11 @@ int git_diff_foreach(
422
426
  * diffs to tell if a file has really been changed.
423
427
  */
424
428
 
425
- if (file_cb != NULL) {
426
- error = file_cb(
427
- data, delta, (float)info.index / diff->deltas.length);
428
- if (error < 0)
429
- goto cleanup;
429
+ if (file_cb != NULL &&
430
+ file_cb(data, delta, (float)info.index / diff->deltas.length))
431
+ {
432
+ error = GIT_EUSER;
433
+ goto cleanup;
430
434
  }
431
435
 
432
436
  /* don't do hunk and line diffs if file is binary */
@@ -451,6 +455,7 @@ int git_diff_foreach(
451
455
 
452
456
  xdl_diff(&old_xdiff_data, &new_xdiff_data,
453
457
  &xdiff_params, &xdiff_config, &xdiff_callback);
458
+ error = info.error;
454
459
 
455
460
  cleanup:
456
461
  release_content(&delta->old_file, &old_data, old_blob);
@@ -524,7 +529,11 @@ static int print_compact(void *data, git_diff_delta *delta, float progress)
524
529
  if (git_buf_oom(pi->buf))
525
530
  return -1;
526
531
 
527
- return pi->print_cb(pi->cb_data, delta, NULL, GIT_DIFF_LINE_FILE_HDR, git_buf_cstr(pi->buf), git_buf_len(pi->buf));
532
+ if (pi->print_cb(pi->cb_data, delta, NULL, GIT_DIFF_LINE_FILE_HDR,
533
+ git_buf_cstr(pi->buf), git_buf_len(pi->buf)))
534
+ return GIT_EUSER;
535
+
536
+ return 0;
528
537
  }
529
538
 
530
539
  int git_diff_print_compact(
@@ -586,7 +595,6 @@ static int print_patch_file(void *data, git_diff_delta *delta, float progress)
586
595
  const char *oldpath = delta->old_file.path;
587
596
  const char *newpfx = pi->diff->opts.new_prefix;
588
597
  const char *newpath = delta->new_file.path;
589
- int result;
590
598
 
591
599
  GIT_UNUSED(progress);
592
600
 
@@ -619,9 +627,8 @@ static int print_patch_file(void *data, git_diff_delta *delta, float progress)
619
627
  if (git_buf_oom(pi->buf))
620
628
  return -1;
621
629
 
622
- result = pi->print_cb(pi->cb_data, delta, NULL, GIT_DIFF_LINE_FILE_HDR, git_buf_cstr(pi->buf), git_buf_len(pi->buf));
623
- if (result < 0)
624
- return result;
630
+ if (pi->print_cb(pi->cb_data, delta, NULL, GIT_DIFF_LINE_FILE_HDR, git_buf_cstr(pi->buf), git_buf_len(pi->buf)))
631
+ return GIT_EUSER;
625
632
 
626
633
  if (delta->binary != 1)
627
634
  return 0;
@@ -633,7 +640,11 @@ static int print_patch_file(void *data, git_diff_delta *delta, float progress)
633
640
  if (git_buf_oom(pi->buf))
634
641
  return -1;
635
642
 
636
- return pi->print_cb(pi->cb_data, delta, NULL, GIT_DIFF_LINE_BINARY, git_buf_cstr(pi->buf), git_buf_len(pi->buf));
643
+ if (pi->print_cb(pi->cb_data, delta, NULL, GIT_DIFF_LINE_BINARY,
644
+ git_buf_cstr(pi->buf), git_buf_len(pi->buf)))
645
+ return GIT_EUSER;
646
+
647
+ return 0;
637
648
  }
638
649
 
639
650
  static int print_patch_hunk(
@@ -649,7 +660,11 @@ static int print_patch_hunk(
649
660
  if (git_buf_printf(pi->buf, "%.*s", (int)header_len, header) < 0)
650
661
  return -1;
651
662
 
652
- return pi->print_cb(pi->cb_data, d, r, GIT_DIFF_LINE_HUNK_HDR, git_buf_cstr(pi->buf), git_buf_len(pi->buf));
663
+ if (pi->print_cb(pi->cb_data, d, r, GIT_DIFF_LINE_HUNK_HDR,
664
+ git_buf_cstr(pi->buf), git_buf_len(pi->buf)))
665
+ return GIT_EUSER;
666
+
667
+ return 0;
653
668
  }
654
669
 
655
670
  static int print_patch_line(
@@ -674,7 +689,11 @@ static int print_patch_line(
674
689
  if (git_buf_oom(pi->buf))
675
690
  return -1;
676
691
 
677
- return pi->print_cb(pi->cb_data, delta, range, line_origin, git_buf_cstr(pi->buf), git_buf_len(pi->buf));
692
+ if (pi->print_cb(pi->cb_data, delta, range, line_origin,
693
+ git_buf_cstr(pi->buf), git_buf_len(pi->buf)))
694
+ return GIT_EUSER;
695
+
696
+ return 0;
678
697
  }
679
698
 
680
699
  int git_diff_print_patch(
@@ -763,11 +782,8 @@ int git_diff_blobs(
763
782
  if (file_is_binary_by_content(&delta, &old_map, &new_map) < 0)
764
783
  return -1;
765
784
 
766
- if (file_cb != NULL) {
767
- int error = file_cb(cb_data, &delta, 1);
768
- if (error < 0)
769
- return error;
770
- }
785
+ if (file_cb != NULL && file_cb(cb_data, &delta, 1))
786
+ return GIT_EUSER;
771
787
 
772
788
  /* don't do hunk and line diffs if the two blobs are identical */
773
789
  if (delta.status == GIT_DELTA_UNMODIFIED)
@@ -777,6 +793,7 @@ int git_diff_blobs(
777
793
  if (delta.binary == 1)
778
794
  return 0;
779
795
 
796
+ memset(&info, 0, sizeof(info));
780
797
  info.diff = NULL;
781
798
  info.delta = &delta;
782
799
  info.cb_data = cb_data;
@@ -790,5 +807,5 @@ int git_diff_blobs(
790
807
 
791
808
  xdl_diff(&old_data, &new_data, &xdiff_params, &xdiff_config, &xdiff_callback);
792
809
 
793
- return 0;
810
+ return info.error;
794
811
  }