rugged 0.27.7 → 0.27.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (409) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rugged/version.rb +1 -1
  3. data/vendor/libgit2/AUTHORS +1 -0
  4. data/vendor/libgit2/CMakeLists.txt +99 -51
  5. data/vendor/libgit2/COPYING +28 -0
  6. data/vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake +15 -1
  7. data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.c.in +29 -0
  8. data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.cmake +96 -0
  9. data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +9 -8
  10. data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +2 -2
  11. data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +1 -1
  12. data/vendor/libgit2/cmake/Modules/FindGSSFramework.cmake +28 -0
  13. data/vendor/libgit2/cmake/Modules/FindIconv.cmake +11 -6
  14. data/vendor/libgit2/cmake/Modules/FindPCRE.cmake +38 -0
  15. data/vendor/libgit2/cmake/Modules/FindPCRE2.cmake +37 -0
  16. data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +2 -2
  17. data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +6 -0
  18. data/vendor/libgit2/cmake/Modules/PkgBuildConfig.cmake +110 -0
  19. data/vendor/libgit2/cmake/Modules/SelectGSSAPI.cmake +53 -0
  20. data/vendor/libgit2/cmake/Modules/SelectHTTPSBackend.cmake +124 -0
  21. data/vendor/libgit2/cmake/Modules/SelectHashes.cmake +66 -0
  22. data/vendor/libgit2/deps/http-parser/http_parser.c +11 -6
  23. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +21 -0
  24. data/vendor/libgit2/deps/ntlmclient/compat.h +33 -0
  25. data/vendor/libgit2/deps/ntlmclient/crypt.h +64 -0
  26. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +120 -0
  27. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +18 -0
  28. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +145 -0
  29. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +18 -0
  30. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +130 -0
  31. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +21 -0
  32. data/vendor/libgit2/deps/ntlmclient/ntlm.c +1420 -0
  33. data/vendor/libgit2/deps/ntlmclient/ntlm.h +174 -0
  34. data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +320 -0
  35. data/vendor/libgit2/deps/ntlmclient/unicode.h +36 -0
  36. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +445 -0
  37. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +201 -0
  38. data/vendor/libgit2/deps/ntlmclient/utf8.h +1257 -0
  39. data/vendor/libgit2/deps/ntlmclient/util.c +21 -0
  40. data/vendor/libgit2/deps/ntlmclient/util.h +14 -0
  41. data/vendor/libgit2/deps/pcre/CMakeLists.txt +140 -0
  42. data/vendor/libgit2/deps/pcre/COPYING +5 -0
  43. data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +22 -0
  44. data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +17 -0
  45. data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +58 -0
  46. data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +29 -0
  47. data/vendor/libgit2/deps/pcre/config.h.in +57 -0
  48. data/vendor/libgit2/deps/pcre/pcre.h +641 -0
  49. data/vendor/libgit2/deps/pcre/pcre_byte_order.c +319 -0
  50. data/vendor/libgit2/deps/pcre/pcre_chartables.c +198 -0
  51. data/vendor/libgit2/deps/pcre/pcre_compile.c +9800 -0
  52. data/vendor/libgit2/deps/pcre/pcre_config.c +190 -0
  53. data/vendor/libgit2/deps/pcre/pcre_dfa_exec.c +3676 -0
  54. data/vendor/libgit2/deps/pcre/pcre_exec.c +7173 -0
  55. data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +245 -0
  56. data/vendor/libgit2/deps/pcre/pcre_get.c +669 -0
  57. data/vendor/libgit2/deps/pcre/pcre_globals.c +86 -0
  58. data/vendor/libgit2/deps/pcre/pcre_internal.h +2787 -0
  59. data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +11913 -0
  60. data/vendor/libgit2/deps/pcre/pcre_maketables.c +156 -0
  61. data/vendor/libgit2/deps/pcre/pcre_newline.c +210 -0
  62. data/vendor/libgit2/deps/pcre/pcre_ord2utf8.c +94 -0
  63. data/vendor/libgit2/deps/pcre/pcre_printint.c +834 -0
  64. data/vendor/libgit2/deps/pcre/pcre_refcount.c +92 -0
  65. data/vendor/libgit2/deps/pcre/pcre_string_utils.c +211 -0
  66. data/vendor/libgit2/deps/pcre/pcre_study.c +1686 -0
  67. data/vendor/libgit2/deps/pcre/pcre_tables.c +727 -0
  68. data/vendor/libgit2/deps/pcre/pcre_ucd.c +3644 -0
  69. data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +301 -0
  70. data/vendor/libgit2/deps/pcre/pcre_version.c +98 -0
  71. data/vendor/libgit2/deps/pcre/pcre_xclass.c +268 -0
  72. data/vendor/libgit2/deps/pcre/pcreposix.c +421 -0
  73. data/vendor/libgit2/deps/pcre/pcreposix.h +117 -0
  74. data/vendor/libgit2/deps/pcre/ucp.h +224 -0
  75. data/vendor/libgit2/deps/winhttp/COPYING.GPL +993 -0
  76. data/vendor/libgit2/deps/winhttp/COPYING.LGPL +502 -0
  77. data/vendor/libgit2/deps/zlib/CMakeLists.txt +1 -0
  78. data/vendor/libgit2/deps/zlib/COPYING +27 -0
  79. data/vendor/libgit2/deps/zlib/adler32.c +0 -7
  80. data/vendor/libgit2/deps/zlib/crc32.c +0 -7
  81. data/vendor/libgit2/include/git2/annotated_commit.h +9 -0
  82. data/vendor/libgit2/include/git2/apply.h +149 -0
  83. data/vendor/libgit2/include/git2/attr.h +20 -13
  84. data/vendor/libgit2/include/git2/blame.h +4 -4
  85. data/vendor/libgit2/include/git2/blob.h +44 -12
  86. data/vendor/libgit2/include/git2/buffer.h +20 -26
  87. data/vendor/libgit2/include/git2/cert.h +135 -0
  88. data/vendor/libgit2/include/git2/checkout.h +53 -21
  89. data/vendor/libgit2/include/git2/cherrypick.h +3 -3
  90. data/vendor/libgit2/include/git2/clone.h +5 -5
  91. data/vendor/libgit2/include/git2/commit.h +25 -3
  92. data/vendor/libgit2/include/git2/common.h +35 -10
  93. data/vendor/libgit2/include/git2/config.h +29 -19
  94. data/vendor/libgit2/include/git2/cred.h +308 -0
  95. data/vendor/libgit2/include/git2/deprecated.h +493 -0
  96. data/vendor/libgit2/include/git2/describe.h +4 -4
  97. data/vendor/libgit2/include/git2/diff.h +177 -135
  98. data/vendor/libgit2/include/git2/errors.h +53 -46
  99. data/vendor/libgit2/include/git2/filter.h +8 -0
  100. data/vendor/libgit2/include/git2/index.h +74 -52
  101. data/vendor/libgit2/include/git2/indexer.h +76 -6
  102. data/vendor/libgit2/include/git2/merge.h +25 -10
  103. data/vendor/libgit2/include/git2/net.h +0 -5
  104. data/vendor/libgit2/include/git2/notes.h +1 -1
  105. data/vendor/libgit2/include/git2/object.h +17 -29
  106. data/vendor/libgit2/include/git2/odb.h +12 -11
  107. data/vendor/libgit2/include/git2/odb_backend.h +10 -9
  108. data/vendor/libgit2/include/git2/oid.h +2 -2
  109. data/vendor/libgit2/include/git2/pack.h +14 -3
  110. data/vendor/libgit2/include/git2/proxy.h +5 -3
  111. data/vendor/libgit2/include/git2/rebase.h +46 -2
  112. data/vendor/libgit2/include/git2/refs.h +34 -16
  113. data/vendor/libgit2/include/git2/remote.h +111 -14
  114. data/vendor/libgit2/include/git2/repository.h +69 -34
  115. data/vendor/libgit2/include/git2/revert.h +1 -1
  116. data/vendor/libgit2/include/git2/revwalk.h +7 -7
  117. data/vendor/libgit2/include/git2/signature.h +2 -2
  118. data/vendor/libgit2/include/git2/stash.h +5 -5
  119. data/vendor/libgit2/include/git2/status.h +26 -17
  120. data/vendor/libgit2/include/git2/submodule.h +23 -6
  121. data/vendor/libgit2/include/git2/sys/alloc.h +18 -18
  122. data/vendor/libgit2/include/git2/sys/commit.h +1 -1
  123. data/vendor/libgit2/include/git2/sys/config.h +13 -13
  124. data/vendor/libgit2/include/git2/sys/cred.h +90 -0
  125. data/vendor/libgit2/include/git2/sys/filter.h +6 -6
  126. data/vendor/libgit2/include/git2/sys/merge.h +3 -3
  127. data/vendor/libgit2/include/git2/sys/odb_backend.h +66 -22
  128. data/vendor/libgit2/include/git2/sys/path.h +14 -5
  129. data/vendor/libgit2/include/git2/sys/refdb_backend.h +76 -40
  130. data/vendor/libgit2/include/git2/sys/repository.h +5 -1
  131. data/vendor/libgit2/include/git2/sys/stream.h +92 -12
  132. data/vendor/libgit2/include/git2/sys/transport.h +129 -83
  133. data/vendor/libgit2/include/git2/tag.h +13 -4
  134. data/vendor/libgit2/include/git2/trace.h +2 -2
  135. data/vendor/libgit2/include/git2/transport.h +11 -311
  136. data/vendor/libgit2/include/git2/tree.h +4 -4
  137. data/vendor/libgit2/include/git2/types.h +25 -106
  138. data/vendor/libgit2/include/git2/version.h +3 -3
  139. data/vendor/libgit2/include/git2/worktree.h +5 -5
  140. data/vendor/libgit2/include/git2.h +4 -0
  141. data/vendor/libgit2/src/CMakeLists.txt +104 -235
  142. data/vendor/libgit2/src/alloc.c +14 -18
  143. data/vendor/libgit2/src/{stdalloc.c → allocators/stdalloc.c} +7 -8
  144. data/vendor/libgit2/src/{stdalloc.h → allocators/stdalloc.h} +4 -4
  145. data/vendor/libgit2/src/allocators/win32_crtdbg.c +118 -0
  146. data/vendor/libgit2/src/{transports/cred.h → allocators/win32_crtdbg.h} +5 -4
  147. data/vendor/libgit2/src/annotated_commit.c +18 -11
  148. data/vendor/libgit2/src/apply.c +535 -28
  149. data/vendor/libgit2/src/apply.h +3 -1
  150. data/vendor/libgit2/src/array.h +2 -2
  151. data/vendor/libgit2/src/attr.c +77 -71
  152. data/vendor/libgit2/src/attr_file.c +203 -117
  153. data/vendor/libgit2/src/attr_file.h +9 -9
  154. data/vendor/libgit2/src/attrcache.c +49 -51
  155. data/vendor/libgit2/src/attrcache.h +2 -1
  156. data/vendor/libgit2/src/blame.c +38 -18
  157. data/vendor/libgit2/src/blame.h +1 -1
  158. data/vendor/libgit2/src/blame_git.c +29 -15
  159. data/vendor/libgit2/src/blob.c +123 -37
  160. data/vendor/libgit2/src/blob.h +19 -2
  161. data/vendor/libgit2/src/branch.c +47 -23
  162. data/vendor/libgit2/src/buf_text.c +7 -6
  163. data/vendor/libgit2/src/buffer.c +60 -53
  164. data/vendor/libgit2/src/cache.c +38 -45
  165. data/vendor/libgit2/src/cache.h +3 -3
  166. data/vendor/libgit2/src/cc-compat.h +20 -3
  167. data/vendor/libgit2/src/checkout.c +77 -67
  168. data/vendor/libgit2/src/cherrypick.c +12 -6
  169. data/vendor/libgit2/src/clone.c +36 -14
  170. data/vendor/libgit2/src/clone.h +4 -0
  171. data/vendor/libgit2/src/commit.c +103 -48
  172. data/vendor/libgit2/src/commit.h +7 -0
  173. data/vendor/libgit2/src/commit_list.c +36 -78
  174. data/vendor/libgit2/src/commit_list.h +2 -2
  175. data/vendor/libgit2/src/common.h +24 -90
  176. data/vendor/libgit2/src/config.c +203 -176
  177. data/vendor/libgit2/src/config.h +8 -20
  178. data/vendor/libgit2/src/config_backend.h +96 -0
  179. data/vendor/libgit2/src/config_cache.c +41 -35
  180. data/vendor/libgit2/src/config_entries.c +229 -0
  181. data/vendor/libgit2/src/config_entries.h +24 -0
  182. data/vendor/libgit2/src/config_file.c +422 -680
  183. data/vendor/libgit2/src/config_mem.c +220 -0
  184. data/vendor/libgit2/src/config_parse.c +96 -68
  185. data/vendor/libgit2/src/config_parse.h +15 -14
  186. data/vendor/libgit2/src/config_snapshot.c +206 -0
  187. data/vendor/libgit2/src/crlf.c +219 -196
  188. data/vendor/libgit2/src/delta.c +25 -18
  189. data/vendor/libgit2/src/describe.c +42 -41
  190. data/vendor/libgit2/src/diff.c +52 -67
  191. data/vendor/libgit2/src/diff.h +2 -1
  192. data/vendor/libgit2/src/diff_driver.c +44 -46
  193. data/vendor/libgit2/src/diff_file.c +16 -14
  194. data/vendor/libgit2/src/diff_file.h +1 -1
  195. data/vendor/libgit2/src/diff_generate.c +158 -103
  196. data/vendor/libgit2/src/diff_generate.h +3 -3
  197. data/vendor/libgit2/src/diff_parse.c +4 -4
  198. data/vendor/libgit2/src/diff_print.c +34 -22
  199. data/vendor/libgit2/src/diff_stats.c +22 -7
  200. data/vendor/libgit2/src/diff_tform.c +18 -16
  201. data/vendor/libgit2/src/diff_xdiff.c +3 -3
  202. data/vendor/libgit2/src/errors.c +51 -39
  203. data/vendor/libgit2/src/errors.h +81 -0
  204. data/vendor/libgit2/src/features.h.in +9 -3
  205. data/vendor/libgit2/src/fetch.c +8 -3
  206. data/vendor/libgit2/src/fetchhead.c +12 -12
  207. data/vendor/libgit2/src/filebuf.c +28 -32
  208. data/vendor/libgit2/src/filebuf.h +2 -2
  209. data/vendor/libgit2/src/filter.c +47 -33
  210. data/vendor/libgit2/src/filter.h +0 -10
  211. data/vendor/libgit2/src/{fileops.c → futils.c} +70 -63
  212. data/vendor/libgit2/src/{fileops.h → futils.h} +6 -6
  213. data/vendor/libgit2/src/global.c +35 -55
  214. data/vendor/libgit2/src/global.h +0 -2
  215. data/vendor/libgit2/src/hash/sha1/collisiondetect.c +48 -0
  216. data/vendor/libgit2/src/hash/sha1/collisiondetect.h +19 -0
  217. data/vendor/libgit2/src/hash/{hash_common_crypto.h → sha1/common_crypto.c} +17 -17
  218. data/vendor/libgit2/src/hash/sha1/common_crypto.h +19 -0
  219. data/vendor/libgit2/src/hash/{hash_generic.c → sha1/generic.c} +22 -10
  220. data/vendor/libgit2/src/hash/{hash_generic.h → sha1/generic.h} +4 -10
  221. data/vendor/libgit2/src/hash/{hash_mbedtls.c → sha1/mbedtls.c} +15 -7
  222. data/vendor/libgit2/src/hash/{hash_mbedtls.h → sha1/mbedtls.h} +6 -7
  223. data/vendor/libgit2/src/hash/sha1/openssl.c +59 -0
  224. data/vendor/libgit2/src/hash/sha1/openssl.h +19 -0
  225. data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/sha1.c +14 -3
  226. data/vendor/libgit2/src/hash/{hash_win32.c → sha1/win32.c} +47 -37
  227. data/vendor/libgit2/src/hash/{hash_win32.h → sha1/win32.h} +6 -19
  228. data/vendor/libgit2/src/hash/sha1.h +38 -0
  229. data/vendor/libgit2/src/hash.c +61 -0
  230. data/vendor/libgit2/src/hash.h +20 -21
  231. data/vendor/libgit2/src/hashsig.c +5 -5
  232. data/vendor/libgit2/src/idxmap.c +107 -61
  233. data/vendor/libgit2/src/idxmap.h +153 -31
  234. data/vendor/libgit2/src/ignore.c +38 -42
  235. data/vendor/libgit2/src/index.c +264 -199
  236. data/vendor/libgit2/src/index.h +7 -1
  237. data/vendor/libgit2/src/indexer.c +338 -167
  238. data/vendor/libgit2/src/integer.h +71 -26
  239. data/vendor/libgit2/src/iterator.c +134 -62
  240. data/vendor/libgit2/src/iterator.h +15 -0
  241. data/vendor/libgit2/src/mailmap.c +8 -8
  242. data/vendor/libgit2/src/map.h +1 -1
  243. data/vendor/libgit2/src/merge.c +137 -93
  244. data/vendor/libgit2/src/merge_driver.c +11 -11
  245. data/vendor/libgit2/src/merge_file.c +2 -2
  246. data/vendor/libgit2/src/mwindow.c +24 -29
  247. data/vendor/libgit2/src/mwindow.h +4 -4
  248. data/vendor/libgit2/src/net.c +184 -0
  249. data/vendor/libgit2/src/net.h +36 -0
  250. data/vendor/libgit2/src/netops.c +55 -156
  251. data/vendor/libgit2/src/netops.h +3 -23
  252. data/vendor/libgit2/src/notes.c +14 -9
  253. data/vendor/libgit2/src/object.c +120 -69
  254. data/vendor/libgit2/src/object.h +22 -9
  255. data/vendor/libgit2/src/object_api.c +8 -8
  256. data/vendor/libgit2/src/odb.c +111 -88
  257. data/vendor/libgit2/src/odb.h +8 -7
  258. data/vendor/libgit2/src/odb_loose.c +58 -47
  259. data/vendor/libgit2/src/odb_mempack.c +21 -34
  260. data/vendor/libgit2/src/odb_pack.c +17 -13
  261. data/vendor/libgit2/src/offmap.c +53 -35
  262. data/vendor/libgit2/src/offmap.h +108 -21
  263. data/vendor/libgit2/src/oid.c +12 -7
  264. data/vendor/libgit2/src/oidmap.c +49 -47
  265. data/vendor/libgit2/src/oidmap.h +101 -24
  266. data/vendor/libgit2/src/pack-objects.c +87 -86
  267. data/vendor/libgit2/src/pack-objects.h +2 -8
  268. data/vendor/libgit2/src/pack.c +94 -96
  269. data/vendor/libgit2/src/pack.h +16 -18
  270. data/vendor/libgit2/src/parse.c +17 -4
  271. data/vendor/libgit2/src/parse.h +3 -3
  272. data/vendor/libgit2/src/patch.c +3 -3
  273. data/vendor/libgit2/src/patch_generate.c +18 -18
  274. data/vendor/libgit2/src/patch_parse.c +147 -79
  275. data/vendor/libgit2/src/path.c +207 -62
  276. data/vendor/libgit2/src/path.h +14 -0
  277. data/vendor/libgit2/src/pathspec.c +18 -18
  278. data/vendor/libgit2/src/pool.c +26 -22
  279. data/vendor/libgit2/src/pool.h +7 -7
  280. data/vendor/libgit2/src/posix.c +10 -10
  281. data/vendor/libgit2/src/posix.h +12 -1
  282. data/vendor/libgit2/src/proxy.c +8 -3
  283. data/vendor/libgit2/src/push.c +35 -29
  284. data/vendor/libgit2/src/push.h +2 -1
  285. data/vendor/libgit2/src/reader.c +265 -0
  286. data/vendor/libgit2/src/reader.h +107 -0
  287. data/vendor/libgit2/src/rebase.c +97 -38
  288. data/vendor/libgit2/src/refdb.c +15 -3
  289. data/vendor/libgit2/src/refdb_fs.c +318 -222
  290. data/vendor/libgit2/src/reflog.c +13 -15
  291. data/vendor/libgit2/src/refs.c +122 -89
  292. data/vendor/libgit2/src/refs.h +5 -3
  293. data/vendor/libgit2/src/refspec.c +27 -33
  294. data/vendor/libgit2/src/regexp.c +221 -0
  295. data/vendor/libgit2/src/regexp.h +97 -0
  296. data/vendor/libgit2/src/remote.c +229 -178
  297. data/vendor/libgit2/src/remote.h +11 -2
  298. data/vendor/libgit2/src/repository.c +227 -172
  299. data/vendor/libgit2/src/repository.h +52 -40
  300. data/vendor/libgit2/src/reset.c +7 -7
  301. data/vendor/libgit2/src/revert.c +11 -6
  302. data/vendor/libgit2/src/revparse.c +46 -46
  303. data/vendor/libgit2/src/revwalk.c +89 -54
  304. data/vendor/libgit2/src/revwalk.h +20 -0
  305. data/vendor/libgit2/src/settings.c +22 -9
  306. data/vendor/libgit2/src/signature.c +15 -13
  307. data/vendor/libgit2/src/sortedcache.c +22 -36
  308. data/vendor/libgit2/src/sortedcache.h +1 -1
  309. data/vendor/libgit2/src/stash.c +56 -76
  310. data/vendor/libgit2/src/status.c +27 -21
  311. data/vendor/libgit2/src/stream.h +17 -2
  312. data/vendor/libgit2/src/streams/mbedtls.c +100 -80
  313. data/vendor/libgit2/src/streams/mbedtls.h +5 -2
  314. data/vendor/libgit2/src/streams/openssl.c +93 -81
  315. data/vendor/libgit2/src/streams/openssl.h +5 -2
  316. data/vendor/libgit2/src/streams/registry.c +118 -0
  317. data/vendor/libgit2/src/streams/registry.h +19 -0
  318. data/vendor/libgit2/src/streams/socket.c +55 -30
  319. data/vendor/libgit2/src/streams/stransport.c +57 -32
  320. data/vendor/libgit2/src/streams/stransport.h +5 -0
  321. data/vendor/libgit2/src/streams/tls.c +48 -20
  322. data/vendor/libgit2/src/streams/tls.h +12 -4
  323. data/vendor/libgit2/src/strmap.c +47 -74
  324. data/vendor/libgit2/src/strmap.h +108 -33
  325. data/vendor/libgit2/src/submodule.c +190 -169
  326. data/vendor/libgit2/src/submodule.h +1 -1
  327. data/vendor/libgit2/src/sysdir.c +25 -15
  328. data/vendor/libgit2/src/tag.c +39 -26
  329. data/vendor/libgit2/src/tag.h +2 -1
  330. data/vendor/libgit2/src/trace.c +2 -2
  331. data/vendor/libgit2/src/trace.h +2 -2
  332. data/vendor/libgit2/src/trailer.c +46 -32
  333. data/vendor/libgit2/src/transaction.c +30 -29
  334. data/vendor/libgit2/src/transport.c +3 -3
  335. data/vendor/libgit2/src/transports/auth.c +14 -10
  336. data/vendor/libgit2/src/transports/auth.h +10 -3
  337. data/vendor/libgit2/src/transports/auth_negotiate.c +31 -16
  338. data/vendor/libgit2/src/transports/auth_negotiate.h +2 -2
  339. data/vendor/libgit2/src/transports/auth_ntlm.c +223 -0
  340. data/vendor/libgit2/src/transports/auth_ntlm.h +35 -0
  341. data/vendor/libgit2/src/transports/cred.c +24 -24
  342. data/vendor/libgit2/src/transports/git.c +25 -30
  343. data/vendor/libgit2/src/transports/http.c +871 -335
  344. data/vendor/libgit2/src/transports/http.h +2 -0
  345. data/vendor/libgit2/src/transports/local.c +28 -28
  346. data/vendor/libgit2/src/transports/smart.c +64 -46
  347. data/vendor/libgit2/src/transports/smart.h +5 -6
  348. data/vendor/libgit2/src/transports/smart_pkt.c +162 -151
  349. data/vendor/libgit2/src/transports/smart_protocol.c +64 -94
  350. data/vendor/libgit2/src/transports/ssh.c +76 -65
  351. data/vendor/libgit2/src/transports/winhttp.c +328 -319
  352. data/vendor/libgit2/src/tree-cache.c +21 -14
  353. data/vendor/libgit2/src/tree.c +119 -112
  354. data/vendor/libgit2/src/tree.h +1 -0
  355. data/vendor/libgit2/src/unix/map.c +3 -3
  356. data/vendor/libgit2/src/unix/posix.h +1 -11
  357. data/vendor/libgit2/src/userdiff.h +3 -1
  358. data/vendor/libgit2/src/util.c +154 -93
  359. data/vendor/libgit2/src/util.h +19 -23
  360. data/vendor/libgit2/src/vector.c +15 -10
  361. data/vendor/libgit2/src/wildmatch.c +320 -0
  362. data/vendor/libgit2/src/wildmatch.h +23 -0
  363. data/vendor/libgit2/src/win32/dir.c +3 -3
  364. data/vendor/libgit2/src/win32/findfile.c +1 -1
  365. data/vendor/libgit2/src/win32/map.c +9 -11
  366. data/vendor/libgit2/src/win32/msvc-compat.h +6 -0
  367. data/vendor/libgit2/src/win32/path_w32.c +113 -9
  368. data/vendor/libgit2/src/win32/path_w32.h +18 -29
  369. data/vendor/libgit2/src/win32/posix.h +1 -4
  370. data/vendor/libgit2/src/win32/posix_w32.c +69 -44
  371. data/vendor/libgit2/src/win32/precompiled.h +0 -2
  372. data/vendor/libgit2/src/win32/thread.c +5 -10
  373. data/vendor/libgit2/src/win32/w32_buffer.c +9 -5
  374. data/vendor/libgit2/src/win32/w32_common.h +39 -0
  375. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +2 -95
  376. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +0 -2
  377. data/vendor/libgit2/src/win32/w32_stack.c +6 -11
  378. data/vendor/libgit2/src/win32/w32_stack.h +3 -3
  379. data/vendor/libgit2/src/win32/w32_util.c +27 -64
  380. data/vendor/libgit2/src/win32/w32_util.h +5 -49
  381. data/vendor/libgit2/src/worktree.c +44 -30
  382. data/vendor/libgit2/src/xdiff/xdiffi.c +5 -5
  383. data/vendor/libgit2/src/xdiff/xhistogram.c +1 -1
  384. data/vendor/libgit2/src/xdiff/xmerge.c +27 -15
  385. data/vendor/libgit2/src/xdiff/xpatience.c +3 -0
  386. data/vendor/libgit2/src/zstream.c +4 -4
  387. metadata +115 -38
  388. data/vendor/libgit2/deps/regex/CMakeLists.txt +0 -2
  389. data/vendor/libgit2/deps/regex/config.h +0 -7
  390. data/vendor/libgit2/deps/regex/regcomp.c +0 -3857
  391. data/vendor/libgit2/deps/regex/regex.c +0 -92
  392. data/vendor/libgit2/deps/regex/regex.h +0 -582
  393. data/vendor/libgit2/deps/regex/regex_internal.c +0 -1744
  394. data/vendor/libgit2/deps/regex/regex_internal.h +0 -819
  395. data/vendor/libgit2/deps/regex/regexec.c +0 -4369
  396. data/vendor/libgit2/include/git2/inttypes.h +0 -309
  397. data/vendor/libgit2/include/git2/sys/time.h +0 -31
  398. data/vendor/libgit2/libgit2.pc.in +0 -13
  399. data/vendor/libgit2/src/config_file.h +0 -73
  400. data/vendor/libgit2/src/fnmatch.c +0 -248
  401. data/vendor/libgit2/src/fnmatch.h +0 -48
  402. data/vendor/libgit2/src/hash/hash_collisiondetect.h +0 -47
  403. data/vendor/libgit2/src/hash/hash_openssl.h +0 -59
  404. data/vendor/libgit2/src/streams/curl.c +0 -385
  405. data/vendor/libgit2/src/streams/curl.h +0 -17
  406. /data/vendor/libgit2/deps/http-parser/{LICENSE-MIT → COPYING} +0 -0
  407. /data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/sha1.h +0 -0
  408. /data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/ubc_check.c +0 -0
  409. /data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/ubc_check.h +0 -0
@@ -19,38 +19,58 @@
19
19
  const void *git_blob_rawcontent(const git_blob *blob)
20
20
  {
21
21
  assert(blob);
22
- return git_odb_object_data(blob->odb_object);
22
+ if (blob->raw)
23
+ return blob->data.raw.data;
24
+ else
25
+ return git_odb_object_data(blob->data.odb);
23
26
  }
24
27
 
25
- git_off_t git_blob_rawsize(const git_blob *blob)
28
+ git_object_size_t git_blob_rawsize(const git_blob *blob)
26
29
  {
27
30
  assert(blob);
28
- return (git_off_t)git_odb_object_size(blob->odb_object);
31
+ if (blob->raw)
32
+ return blob->data.raw.size;
33
+ else
34
+ return (git_object_size_t)git_odb_object_size(blob->data.odb);
29
35
  }
30
36
 
31
37
  int git_blob__getbuf(git_buf *buffer, git_blob *blob)
32
38
  {
33
- return git_buf_set(
34
- buffer,
35
- git_odb_object_data(blob->odb_object),
36
- git_odb_object_size(blob->odb_object));
39
+ git_object_size_t size = git_blob_rawsize(blob);
40
+
41
+ GIT_ERROR_CHECK_BLOBSIZE(size);
42
+ return git_buf_set(buffer, git_blob_rawcontent(blob), (size_t)size);
37
43
  }
38
44
 
39
- void git_blob__free(void *blob)
45
+ void git_blob__free(void *_blob)
40
46
  {
41
- git_odb_object_free(((git_blob *)blob)->odb_object);
47
+ git_blob *blob = (git_blob *) _blob;
48
+ if (!blob->raw)
49
+ git_odb_object_free(blob->data.odb);
42
50
  git__free(blob);
43
51
  }
44
52
 
45
- int git_blob__parse(void *blob, git_odb_object *odb_obj)
53
+ int git_blob__parse_raw(void *_blob, const char *data, size_t size)
54
+ {
55
+ git_blob *blob = (git_blob *) _blob;
56
+ assert(blob);
57
+ blob->raw = 1;
58
+ blob->data.raw.data = data;
59
+ blob->data.raw.size = size;
60
+ return 0;
61
+ }
62
+
63
+ int git_blob__parse(void *_blob, git_odb_object *odb_obj)
46
64
  {
65
+ git_blob *blob = (git_blob *) _blob;
47
66
  assert(blob);
48
67
  git_cached_obj_incref((git_cached_obj *)odb_obj);
49
- ((git_blob *)blob)->odb_object = odb_obj;
68
+ blob->raw = 0;
69
+ blob->data.odb = odb_obj;
50
70
  return 0;
51
71
  }
52
72
 
53
- int git_blob_create_frombuffer(
73
+ int git_blob_create_from_buffer(
54
74
  git_oid *id, git_repository *repo, const void *buffer, size_t len)
55
75
  {
56
76
  int error;
@@ -60,7 +80,7 @@ int git_blob_create_frombuffer(
60
80
  assert(id && repo);
61
81
 
62
82
  if ((error = git_repository_odb__weakptr(&odb, repo)) < 0 ||
63
- (error = git_odb_open_wstream(&stream, odb, len, GIT_OBJ_BLOB)) < 0)
83
+ (error = git_odb_open_wstream(&stream, odb, len, GIT_OBJECT_BLOB)) < 0)
64
84
  return error;
65
85
 
66
86
  if ((error = git_odb_stream_write(stream, buffer, len)) == 0)
@@ -71,16 +91,16 @@ int git_blob_create_frombuffer(
71
91
  }
72
92
 
73
93
  static int write_file_stream(
74
- git_oid *id, git_odb *odb, const char *path, git_off_t file_size)
94
+ git_oid *id, git_odb *odb, const char *path, git_object_size_t file_size)
75
95
  {
76
96
  int fd, error;
77
97
  char buffer[FILEIO_BUFSIZE];
78
98
  git_odb_stream *stream = NULL;
79
99
  ssize_t read_len = -1;
80
- git_off_t written = 0;
100
+ git_object_size_t written = 0;
81
101
 
82
102
  if ((error = git_odb_open_wstream(
83
- &stream, odb, file_size, GIT_OBJ_BLOB)) < 0)
103
+ &stream, odb, file_size, GIT_OBJECT_BLOB)) < 0)
84
104
  return error;
85
105
 
86
106
  if ((fd = git_futils_open_ro(path)) < 0) {
@@ -96,7 +116,7 @@ static int write_file_stream(
96
116
  p_close(fd);
97
117
 
98
118
  if (written != file_size || read_len < 0) {
99
- giterr_set(GITERR_OS, "failed to read file into stream");
119
+ git_error_set(GIT_ERROR_OS, "failed to read file into stream");
100
120
  error = -1;
101
121
  }
102
122
 
@@ -109,7 +129,7 @@ static int write_file_stream(
109
129
 
110
130
  static int write_file_filtered(
111
131
  git_oid *id,
112
- git_off_t *size,
132
+ git_object_size_t *size,
113
133
  git_odb *odb,
114
134
  const char *full_path,
115
135
  git_filter_list *fl)
@@ -123,7 +143,7 @@ static int write_file_filtered(
123
143
  if (!error) {
124
144
  *size = tgt.size;
125
145
 
126
- error = git_odb_write(id, odb, tgt.ptr, tgt.size, GIT_OBJ_BLOB);
146
+ error = git_odb_write(id, odb, tgt.ptr, tgt.size, GIT_OBJECT_BLOB);
127
147
  }
128
148
 
129
149
  git_buf_dispose(&tgt);
@@ -138,16 +158,16 @@ static int write_symlink(
138
158
  int error;
139
159
 
140
160
  link_data = git__malloc(link_size);
141
- GITERR_CHECK_ALLOC(link_data);
161
+ GIT_ERROR_CHECK_ALLOC(link_data);
142
162
 
143
163
  read_len = p_readlink(path, link_data, link_size);
144
164
  if (read_len != (ssize_t)link_size) {
145
- giterr_set(GITERR_OS, "failed to create blob: cannot read symlink '%s'", path);
165
+ git_error_set(GIT_ERROR_OS, "failed to create blob: cannot read symlink '%s'", path);
146
166
  git__free(link_data);
147
167
  return -1;
148
168
  }
149
169
 
150
- error = git_odb_write(id, odb, (void *)link_data, link_size, GIT_OBJ_BLOB);
170
+ error = git_odb_write(id, odb, (void *)link_data, link_size, GIT_OBJECT_BLOB);
151
171
  git__free(link_data);
152
172
  return error;
153
173
  }
@@ -164,7 +184,7 @@ int git_blob__create_from_paths(
164
184
  int error;
165
185
  struct stat st;
166
186
  git_odb *odb = NULL;
167
- git_off_t size;
187
+ git_object_size_t size;
168
188
  mode_t mode;
169
189
  git_buf path = GIT_BUF_INIT;
170
190
 
@@ -186,7 +206,7 @@ int git_blob__create_from_paths(
186
206
  goto done;
187
207
 
188
208
  if (S_ISDIR(st.st_mode)) {
189
- giterr_set(GITERR_ODB, "cannot create blob from '%s': it is a directory", content_path);
209
+ git_error_set(GIT_ERROR_ODB, "cannot create blob from '%s': it is a directory", content_path);
190
210
  error = GIT_EDIRECTORY;
191
211
  goto done;
192
212
  }
@@ -243,13 +263,13 @@ done:
243
263
  return error;
244
264
  }
245
265
 
246
- int git_blob_create_fromworkdir(
266
+ int git_blob_create_from_workdir(
247
267
  git_oid *id, git_repository *repo, const char *path)
248
268
  {
249
269
  return git_blob__create_from_paths(id, NULL, repo, NULL, path, 0, true);
250
270
  }
251
271
 
252
- int git_blob_create_fromdisk(
272
+ int git_blob_create_from_disk(
253
273
  git_oid *id, git_repository *repo, const char *path)
254
274
  {
255
275
  int error;
@@ -305,7 +325,7 @@ static int blob_writestream_write(git_writestream *_stream, const char *buffer,
305
325
  return git_filebuf_write(&stream->fbuf, buffer, len);
306
326
  }
307
327
 
308
- int git_blob_create_fromstream(git_writestream **out, git_repository *repo, const char *hintpath)
328
+ int git_blob_create_from_stream(git_writestream **out, git_repository *repo, const char *hintpath)
309
329
  {
310
330
  int error;
311
331
  git_buf path = GIT_BUF_INIT;
@@ -314,11 +334,11 @@ int git_blob_create_fromstream(git_writestream **out, git_repository *repo, cons
314
334
  assert(out && repo);
315
335
 
316
336
  stream = git__calloc(1, sizeof(blob_writestream));
317
- GITERR_CHECK_ALLOC(stream);
337
+ GIT_ERROR_CHECK_ALLOC(stream);
318
338
 
319
339
  if (hintpath) {
320
340
  stream->hintpath = git__strdup(hintpath);
321
- GITERR_CHECK_ALLOC(stream->hintpath);
341
+ GIT_ERROR_CHECK_ALLOC(stream->hintpath);
322
342
  }
323
343
 
324
344
  stream->repo = repo;
@@ -344,7 +364,7 @@ cleanup:
344
364
  return error;
345
365
  }
346
366
 
347
- int git_blob_create_fromstream_commit(git_oid *out, git_writestream *_stream)
367
+ int git_blob_create_from_stream_commit(git_oid *out, git_writestream *_stream)
348
368
  {
349
369
  int error;
350
370
  blob_writestream *stream = (blob_writestream *) _stream;
@@ -369,34 +389,51 @@ cleanup:
369
389
  int git_blob_is_binary(const git_blob *blob)
370
390
  {
371
391
  git_buf content = GIT_BUF_INIT;
392
+ git_object_size_t size;
372
393
 
373
394
  assert(blob);
374
395
 
375
- git_buf_attach_notowned(&content, blob->odb_object->buffer,
376
- min(blob->odb_object->cached.size,
377
- GIT_FILTER_BYTES_TO_CHECK_NUL));
396
+ size = git_blob_rawsize(blob);
397
+
398
+ git_buf_attach_notowned(&content, git_blob_rawcontent(blob),
399
+ (size_t)min(size, GIT_FILTER_BYTES_TO_CHECK_NUL));
378
400
  return git_buf_text_is_binary(&content);
379
401
  }
380
402
 
381
- int git_blob_filtered_content(
403
+ int git_blob_filter(
382
404
  git_buf *out,
383
405
  git_blob *blob,
384
406
  const char *path,
385
- int check_for_binary_data)
407
+ git_blob_filter_options *given_opts)
386
408
  {
387
409
  int error = 0;
388
410
  git_filter_list *fl = NULL;
411
+ git_blob_filter_options opts = GIT_BLOB_FILTER_OPTIONS_INIT;
412
+ git_filter_flag_t flags = GIT_FILTER_DEFAULT;
389
413
 
390
414
  assert(blob && path && out);
391
415
 
392
416
  git_buf_sanitize(out);
393
417
 
394
- if (check_for_binary_data && git_blob_is_binary(blob))
418
+ GIT_ERROR_CHECK_VERSION(
419
+ given_opts, GIT_BLOB_FILTER_OPTIONS_VERSION, "git_blob_filter_options");
420
+
421
+ if (given_opts != NULL)
422
+ memcpy(&opts, given_opts, sizeof(git_blob_filter_options));
423
+
424
+ if ((opts.flags & GIT_BLOB_FILTER_CHECK_FOR_BINARY) != 0 &&
425
+ git_blob_is_binary(blob))
395
426
  return 0;
396
427
 
428
+ if ((opts.flags & GIT_BLOB_FILTER_NO_SYSTEM_ATTRIBUTES) != 0)
429
+ flags |= GIT_FILTER_NO_SYSTEM_ATTRIBUTES;
430
+
431
+ if ((opts.flags & GIT_BLOB_FILTER_ATTTRIBUTES_FROM_HEAD) != 0)
432
+ flags |= GIT_FILTER_ATTRIBUTES_FROM_HEAD;
433
+
397
434
  if (!(error = git_filter_list_load(
398
435
  &fl, git_blob_owner(blob), blob, path,
399
- GIT_FILTER_TO_WORKTREE, GIT_FILTER_DEFAULT))) {
436
+ GIT_FILTER_TO_WORKTREE, flags))) {
400
437
 
401
438
  error = git_filter_list_apply_to_blob(out, fl, blob);
402
439
 
@@ -405,3 +442,52 @@ int git_blob_filtered_content(
405
442
 
406
443
  return error;
407
444
  }
445
+
446
+ /* Deprecated functions */
447
+
448
+ int git_blob_create_frombuffer(
449
+ git_oid *id, git_repository *repo, const void *buffer, size_t len)
450
+ {
451
+ return git_blob_create_from_buffer(id, repo, buffer, len);
452
+ }
453
+
454
+ int git_blob_create_fromworkdir(git_oid *id, git_repository *repo, const char *relative_path)
455
+ {
456
+ return git_blob_create_from_workdir(id, repo, relative_path);
457
+ }
458
+
459
+ int git_blob_create_fromdisk(git_oid *id, git_repository *repo, const char *path)
460
+ {
461
+ return git_blob_create_from_disk(id, repo, path);
462
+ }
463
+
464
+ int git_blob_create_fromstream(
465
+ git_writestream **out,
466
+ git_repository *repo,
467
+ const char *hintpath)
468
+ {
469
+ return git_blob_create_from_stream(out, repo, hintpath);
470
+ }
471
+
472
+ int git_blob_create_fromstream_commit(
473
+ git_oid *out,
474
+ git_writestream *stream)
475
+ {
476
+ return git_blob_create_from_stream_commit(out, stream);
477
+ }
478
+
479
+ int git_blob_filtered_content(
480
+ git_buf *out,
481
+ git_blob *blob,
482
+ const char *path,
483
+ int check_for_binary_data)
484
+ {
485
+ git_blob_filter_options opts = GIT_BLOB_FILTER_OPTIONS_INIT;
486
+
487
+ if (check_for_binary_data)
488
+ opts.flags |= GIT_BLOB_FILTER_CHECK_FOR_BINARY;
489
+ else
490
+ opts.flags &= ~GIT_BLOB_FILTER_CHECK_FOR_BINARY;
491
+
492
+ return git_blob_filter(out, blob, path, &opts);
493
+ }
@@ -12,15 +12,32 @@
12
12
  #include "git2/blob.h"
13
13
  #include "repository.h"
14
14
  #include "odb.h"
15
- #include "fileops.h"
15
+ #include "futils.h"
16
16
 
17
17
  struct git_blob {
18
18
  git_object object;
19
- git_odb_object *odb_object;
19
+
20
+ union {
21
+ git_odb_object *odb;
22
+ struct {
23
+ const char *data;
24
+ git_object_size_t size;
25
+ } raw;
26
+ } data;
27
+ unsigned int raw:1;
20
28
  };
21
29
 
30
+ #define GIT_ERROR_CHECK_BLOBSIZE(n) \
31
+ do { \
32
+ if (!git__is_sizet(n)) { \
33
+ git_error_set(GIT_ERROR_NOMEMORY, "blob contents too large to fit in memory"); \
34
+ return -1; \
35
+ } \
36
+ } while(0)
37
+
22
38
  void git_blob__free(void *blob);
23
39
  int git_blob__parse(void *blob, git_odb_object *obj);
40
+ int git_blob__parse_raw(void *blob, const char *data, size_t size);
24
41
  int git_blob__getbuf(git_buf *buffer, git_blob *blob);
25
42
 
26
43
  extern int git_blob__create_from_paths(
@@ -22,7 +22,7 @@ static int retrieve_branch_reference(
22
22
  git_reference **branch_reference_out,
23
23
  git_repository *repo,
24
24
  const char *branch_name,
25
- int is_remote)
25
+ bool is_remote)
26
26
  {
27
27
  git_reference *branch = NULL;
28
28
  int error = 0;
@@ -34,8 +34,8 @@ static int retrieve_branch_reference(
34
34
  if ((error = git_buf_joinpath(&ref_name, prefix, branch_name)) < 0)
35
35
  /* OOM */;
36
36
  else if ((error = git_reference_lookup(&branch, repo, ref_name.ptr)) < 0)
37
- giterr_set(
38
- GITERR_REFERENCE, "cannot locate %s branch '%s'",
37
+ git_error_set(
38
+ GIT_ERROR_REFERENCE, "cannot locate %s branch '%s'",
39
39
  is_remote ? "remote-tracking" : "local", branch_name);
40
40
 
41
41
  *branch_reference_out = branch; /* will be NULL on error */
@@ -46,8 +46,8 @@ static int retrieve_branch_reference(
46
46
 
47
47
  static int not_a_local_branch(const char *reference_name)
48
48
  {
49
- giterr_set(
50
- GITERR_INVALID,
49
+ git_error_set(
50
+ GIT_ERROR_INVALID,
51
51
  "reference '%s' is not a local branch.", reference_name);
52
52
  return -1;
53
53
  }
@@ -71,7 +71,7 @@ static int create_branch(
71
71
  assert(git_object_owner((const git_object *)commit) == repository);
72
72
 
73
73
  if (!git__strcmp(branch_name, "HEAD")) {
74
- giterr_set(GITERR_REFERENCE, "'HEAD' is not a valid branch name");
74
+ git_error_set(GIT_ERROR_REFERENCE, "'HEAD' is not a valid branch name");
75
75
  error = -1;
76
76
  goto cleanup;
77
77
  }
@@ -88,7 +88,7 @@ static int create_branch(
88
88
  }
89
89
 
90
90
  if (is_unmovable_head && force) {
91
- giterr_set(GITERR_REFERENCE, "cannot force update branch '%s' as it is "
91
+ git_error_set(GIT_ERROR_REFERENCE, "cannot force update branch '%s' as it is "
92
92
  "the current HEAD of the repository.", branch_name);
93
93
  error = -1;
94
94
  goto cleanup;
@@ -141,7 +141,7 @@ static int branch_equals(git_repository *repo, const char *path, void *payload)
141
141
  int equal = 0;
142
142
 
143
143
  if (git_reference__read_head(&head, repo, path) < 0 ||
144
- git_reference_type(head) != GIT_REF_SYMBOLIC)
144
+ git_reference_type(head) != GIT_REFERENCE_SYMBOLIC)
145
145
  goto done;
146
146
 
147
147
  equal = !git__strcmp(head->target.symbolic, branch->name);
@@ -153,10 +153,20 @@ done:
153
153
 
154
154
  int git_branch_is_checked_out(const git_reference *branch)
155
155
  {
156
- assert(branch && git_reference_is_branch(branch));
156
+ git_repository *repo;
157
+ int flags = 0;
158
+
159
+ assert(branch);
157
160
 
158
- return git_repository_foreach_head(git_reference_owner(branch),
159
- branch_equals, (void *) branch) == 1;
161
+ if (!git_reference_is_branch(branch))
162
+ return 0;
163
+
164
+ repo = git_reference_owner(branch);
165
+
166
+ if (git_repository_is_bare(repo))
167
+ flags |= GIT_REPOSITORY_FOREACH_HEAD_SKIP_REPO;
168
+
169
+ return git_repository_foreach_head(repo, branch_equals, flags, (void *) branch) == 1;
160
170
  }
161
171
 
162
172
  int git_branch_delete(git_reference *branch)
@@ -168,7 +178,7 @@ int git_branch_delete(git_reference *branch)
168
178
  assert(branch);
169
179
 
170
180
  if (!git_reference_is_branch(branch) && !git_reference_is_remote(branch)) {
171
- giterr_set(GITERR_INVALID, "reference '%s' is not a valid branch.",
181
+ git_error_set(GIT_ERROR_INVALID, "reference '%s' is not a valid branch.",
172
182
  git_reference_name(branch));
173
183
  return GIT_ENOTFOUND;
174
184
  }
@@ -177,13 +187,13 @@ int git_branch_delete(git_reference *branch)
177
187
  return is_head;
178
188
 
179
189
  if (is_head) {
180
- giterr_set(GITERR_REFERENCE, "cannot delete branch '%s' as it is "
190
+ git_error_set(GIT_ERROR_REFERENCE, "cannot delete branch '%s' as it is "
181
191
  "the current HEAD of the repository.", git_reference_name(branch));
182
192
  return -1;
183
193
  }
184
194
 
185
195
  if (git_reference_is_branch(branch) && git_branch_is_checked_out(branch)) {
186
- giterr_set(GITERR_REFERENCE, "Cannot delete branch '%s' as it is "
196
+ git_error_set(GIT_ERROR_REFERENCE, "Cannot delete branch '%s' as it is "
187
197
  "the current HEAD of a linked repository.", git_reference_name(branch));
188
198
  return -1;
189
199
  }
@@ -243,7 +253,7 @@ int git_branch_iterator_new(
243
253
  branch_iter *iter;
244
254
 
245
255
  iter = git__calloc(1, sizeof(branch_iter));
246
- GITERR_CHECK_ALLOC(iter);
256
+ GIT_ERROR_CHECK_ALLOC(iter);
247
257
 
248
258
  iter->flags = list_flags;
249
259
 
@@ -324,9 +334,23 @@ int git_branch_lookup(
324
334
  const char *branch_name,
325
335
  git_branch_t branch_type)
326
336
  {
337
+ int error = -1;
327
338
  assert(ref_out && repo && branch_name);
328
339
 
329
- return retrieve_branch_reference(ref_out, repo, branch_name, branch_type == GIT_BRANCH_REMOTE);
340
+ switch (branch_type) {
341
+ case GIT_BRANCH_LOCAL:
342
+ case GIT_BRANCH_REMOTE:
343
+ error = retrieve_branch_reference(ref_out, repo, branch_name, branch_type == GIT_BRANCH_REMOTE);
344
+ break;
345
+ case GIT_BRANCH_ALL:
346
+ error = retrieve_branch_reference(ref_out, repo, branch_name, false);
347
+ if (error == GIT_ENOTFOUND)
348
+ error = retrieve_branch_reference(ref_out, repo, branch_name, true);
349
+ break;
350
+ default:
351
+ assert(false);
352
+ }
353
+ return error;
330
354
  }
331
355
 
332
356
  int git_branch_name(
@@ -344,7 +368,7 @@ int git_branch_name(
344
368
  } else if (git_reference_is_remote(ref)) {
345
369
  branch_name += strlen(GIT_REFS_REMOTES_DIR);
346
370
  } else {
347
- giterr_set(GITERR_INVALID,
371
+ git_error_set(GIT_ERROR_INVALID,
348
372
  "reference '%s' is neither a local nor a remote branch.", ref->name);
349
373
  return -1;
350
374
  }
@@ -402,7 +426,7 @@ int git_branch_upstream_name(
402
426
  goto cleanup;
403
427
 
404
428
  if (git_buf_len(&remote_name) == 0 || git_buf_len(&merge_name) == 0) {
405
- giterr_set(GITERR_REFERENCE,
429
+ git_error_set(GIT_ERROR_REFERENCE,
406
430
  "branch '%s' does not have an upstream", refname);
407
431
  error = GIT_ENOTFOUND;
408
432
  goto cleanup;
@@ -452,7 +476,7 @@ int git_branch_upstream_remote(git_buf *buf, git_repository *repo, const char *r
452
476
  return error;
453
477
 
454
478
  if (git_buf_len(buf) == 0) {
455
- giterr_set(GITERR_REFERENCE, "branch '%s' does not have an upstream remote", refname);
479
+ git_error_set(GIT_ERROR_REFERENCE, "branch '%s' does not have an upstream remote", refname);
456
480
  error = GIT_ENOTFOUND;
457
481
  git_buf_clear(buf);
458
482
  }
@@ -475,7 +499,7 @@ int git_branch_remote_name(git_buf *buf, git_repository *repo, const char *refna
475
499
 
476
500
  /* Verify that this is a remote branch */
477
501
  if (!git_reference__is_remote(refname)) {
478
- giterr_set(GITERR_INVALID, "reference '%s' is not a remote branch.",
502
+ git_error_set(GIT_ERROR_INVALID, "reference '%s' is not a remote branch.",
479
503
  refname);
480
504
  error = GIT_ERROR;
481
505
  goto cleanup;
@@ -501,7 +525,7 @@ int git_branch_remote_name(git_buf *buf, git_repository *repo, const char *refna
501
525
  } else {
502
526
  git_remote_free(remote);
503
527
 
504
- giterr_set(GITERR_REFERENCE,
528
+ git_error_set(GIT_ERROR_REFERENCE,
505
529
  "reference '%s' is ambiguous", refname);
506
530
  error = GIT_EAMBIGUOUS;
507
531
  goto cleanup;
@@ -515,7 +539,7 @@ int git_branch_remote_name(git_buf *buf, git_repository *repo, const char *refna
515
539
  git_buf_clear(buf);
516
540
  error = git_buf_puts(buf, remote_name);
517
541
  } else {
518
- giterr_set(GITERR_REFERENCE,
542
+ git_error_set(GIT_ERROR_REFERENCE,
519
543
  "could not determine remote for '%s'", refname);
520
544
  error = GIT_ENOTFOUND;
521
545
  }
@@ -604,7 +628,7 @@ int git_branch_set_upstream(git_reference *branch, const char *upstream_name)
604
628
  else if (git_branch_lookup(&upstream, repo, upstream_name, GIT_BRANCH_REMOTE) == 0)
605
629
  local = 0;
606
630
  else {
607
- giterr_set(GITERR_REFERENCE,
631
+ git_error_set(GIT_ERROR_REFERENCE,
608
632
  "cannot set upstream for branch '%s'", shortname);
609
633
  return GIT_ENOTFOUND;
610
634
  }
@@ -29,7 +29,7 @@ int git_buf_text_puts_escaped(
29
29
  scan += count;
30
30
  }
31
31
 
32
- GITERR_CHECK_ALLOC_ADD(&alloclen, total, 1);
32
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, total, 1);
33
33
  if (git_buf_grow_by(buf, alloclen) < 0)
34
34
  return -1;
35
35
 
@@ -75,7 +75,7 @@ int git_buf_text_crlf_to_lf(git_buf *tgt, const git_buf *src)
75
75
  return git_buf_set(tgt, src->ptr, src->size);
76
76
 
77
77
  /* reduce reallocs while in the loop */
78
- GITERR_CHECK_ALLOC_ADD(&new_size, src->size, 1);
78
+ GIT_ERROR_CHECK_ALLOC_ADD(&new_size, src->size, 1);
79
79
  if (git_buf_grow(tgt, new_size) < 0)
80
80
  return -1;
81
81
 
@@ -122,8 +122,8 @@ int git_buf_text_lf_to_crlf(git_buf *tgt, const git_buf *src)
122
122
  return git_buf_set(tgt, src->ptr, src->size);
123
123
 
124
124
  /* attempt to reduce reallocs while in the loop */
125
- GITERR_CHECK_ALLOC_ADD(&alloclen, src->size, src->size >> 4);
126
- GITERR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
125
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, src->size, src->size >> 4);
126
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
127
127
  if (git_buf_grow(tgt, alloclen) < 0)
128
128
  return -1;
129
129
  tgt->size = 0;
@@ -135,7 +135,7 @@ int git_buf_text_lf_to_crlf(git_buf *tgt, const git_buf *src)
135
135
  if (copylen && next[-1] == '\r')
136
136
  copylen--;
137
137
 
138
- GITERR_CHECK_ALLOC_ADD(&alloclen, copylen, 3);
138
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, copylen, 3);
139
139
  if (git_buf_grow_by(tgt, alloclen) < 0)
140
140
  return -1;
141
141
 
@@ -310,6 +310,7 @@ bool git_buf_text_gather_stats(
310
310
  }
311
311
  }
312
312
 
313
- return (stats->nul > 0 ||
313
+ /* Treat files with a bare CR as binary */
314
+ return (stats->cr != stats->crlf || stats->nul > 0 ||
314
315
  ((stats->printable >> 7) < stats->nonprintable));
315
316
  }