rugged 0.26.7 → 0.27.0

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 (341) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/ext/rugged/rugged_blame.c +6 -3
  4. data/ext/rugged/rugged_branch_collection.c +3 -6
  5. data/ext/rugged/rugged_commit.c +56 -0
  6. data/ext/rugged/rugged_config.c +44 -9
  7. data/ext/rugged/rugged_diff.c +3 -14
  8. data/ext/rugged/rugged_diff_hunk.c +1 -3
  9. data/ext/rugged/rugged_index.c +1 -5
  10. data/ext/rugged/rugged_note.c +1 -4
  11. data/ext/rugged/rugged_patch.c +1 -4
  12. data/ext/rugged/rugged_reference_collection.c +1 -7
  13. data/ext/rugged/rugged_remote.c +5 -8
  14. data/ext/rugged/rugged_remote_collection.c +1 -6
  15. data/ext/rugged/rugged_repo.c +16 -48
  16. data/ext/rugged/rugged_revwalk.c +7 -16
  17. data/ext/rugged/rugged_settings.c +28 -0
  18. data/ext/rugged/rugged_submodule_collection.c +3 -4
  19. data/ext/rugged/rugged_tag_collection.c +1 -5
  20. data/ext/rugged/rugged_tree.c +2 -3
  21. data/lib/rugged/repository.rb +43 -0
  22. data/lib/rugged/version.rb +1 -1
  23. data/vendor/libgit2/AUTHORS +1 -0
  24. data/vendor/libgit2/CMakeLists.txt +61 -510
  25. data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +14 -0
  26. data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +25 -8
  27. data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +27 -8
  28. data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +20 -0
  29. data/vendor/libgit2/cmake/Modules/IdeSplitSources.cmake +22 -0
  30. data/vendor/libgit2/deps/http-parser/CMakeLists.txt +3 -0
  31. data/vendor/libgit2/deps/regex/CMakeLists.txt +2 -0
  32. data/vendor/libgit2/deps/winhttp/CMakeLists.txt +26 -0
  33. data/vendor/libgit2/deps/zlib/CMakeLists.txt +4 -0
  34. data/vendor/libgit2/include/git2/config.h +29 -2
  35. data/vendor/libgit2/include/git2/describe.h +1 -1
  36. data/vendor/libgit2/include/git2/diff.h +59 -8
  37. data/vendor/libgit2/include/git2/graph.h +3 -0
  38. data/vendor/libgit2/include/git2/merge.h +6 -0
  39. data/vendor/libgit2/include/git2/message.h +43 -3
  40. data/vendor/libgit2/include/git2/notes.h +89 -0
  41. data/vendor/libgit2/include/git2/odb.h +8 -1
  42. data/vendor/libgit2/include/git2/patch.h +2 -2
  43. data/vendor/libgit2/include/git2/pathspec.h +35 -18
  44. data/vendor/libgit2/include/git2/refs.h +3 -0
  45. data/vendor/libgit2/include/git2/remote.h +34 -4
  46. data/vendor/libgit2/include/git2/repository.h +6 -6
  47. data/vendor/libgit2/include/git2/reset.h +4 -4
  48. data/vendor/libgit2/include/git2/status.h +4 -0
  49. data/vendor/libgit2/include/git2/sys/config.h +4 -1
  50. data/vendor/libgit2/include/git2/sys/odb_backend.h +2 -1
  51. data/vendor/libgit2/include/git2/tree.h +4 -3
  52. data/vendor/libgit2/include/git2/types.h +1 -0
  53. data/vendor/libgit2/include/git2/version.h +4 -4
  54. data/vendor/libgit2/include/git2/worktree.h +1 -1
  55. data/vendor/libgit2/src/CMakeLists.txt +463 -0
  56. data/vendor/libgit2/src/annotated_commit.c +1 -1
  57. data/vendor/libgit2/src/annotated_commit.h +2 -0
  58. data/vendor/libgit2/src/apply.c +2 -1
  59. data/vendor/libgit2/src/apply.h +2 -0
  60. data/vendor/libgit2/src/attr.c +24 -4
  61. data/vendor/libgit2/src/attr.h +2 -0
  62. data/vendor/libgit2/src/attr_file.c +9 -2
  63. data/vendor/libgit2/src/attr_file.h +2 -0
  64. data/vendor/libgit2/src/attrcache.c +9 -1
  65. data/vendor/libgit2/src/attrcache.h +2 -0
  66. data/vendor/libgit2/src/blame.c +1 -0
  67. data/vendor/libgit2/src/blame.h +2 -1
  68. data/vendor/libgit2/src/blame_git.c +1 -0
  69. data/vendor/libgit2/src/blame_git.h +2 -0
  70. data/vendor/libgit2/src/blob.c +2 -2
  71. data/vendor/libgit2/src/blob.h +2 -0
  72. data/vendor/libgit2/src/branch.c +8 -1
  73. data/vendor/libgit2/src/branch.h +2 -0
  74. data/vendor/libgit2/src/buf_text.c +7 -7
  75. data/vendor/libgit2/src/buf_text.h +3 -3
  76. data/vendor/libgit2/src/buffer.c +31 -1
  77. data/vendor/libgit2/src/buffer.h +3 -0
  78. data/vendor/libgit2/src/cache.c +2 -2
  79. data/vendor/libgit2/src/cache.h +2 -0
  80. data/vendor/libgit2/src/cc-compat.h +3 -3
  81. data/vendor/libgit2/src/checkout.c +30 -19
  82. data/vendor/libgit2/src/checkout.h +2 -0
  83. data/vendor/libgit2/src/cherrypick.c +1 -0
  84. data/vendor/libgit2/src/clone.c +2 -1
  85. data/vendor/libgit2/src/clone.h +4 -0
  86. data/vendor/libgit2/src/commit.c +2 -1
  87. data/vendor/libgit2/src/commit.h +2 -0
  88. data/vendor/libgit2/src/commit_list.c +1 -1
  89. data/vendor/libgit2/src/commit_list.h +2 -0
  90. data/vendor/libgit2/src/common.h +11 -5
  91. data/vendor/libgit2/src/config.c +12 -10
  92. data/vendor/libgit2/src/config.h +2 -0
  93. data/vendor/libgit2/src/config_cache.c +1 -0
  94. data/vendor/libgit2/src/config_file.c +287 -786
  95. data/vendor/libgit2/src/config_file.h +4 -3
  96. data/vendor/libgit2/src/config_parse.c +525 -0
  97. data/vendor/libgit2/src/config_parse.h +64 -0
  98. data/vendor/libgit2/src/crlf.c +2 -1
  99. data/vendor/libgit2/src/delta.c +28 -30
  100. data/vendor/libgit2/src/delta.h +1 -0
  101. data/vendor/libgit2/src/describe.c +3 -1
  102. data/vendor/libgit2/src/diff.c +148 -2
  103. data/vendor/libgit2/src/diff.h +3 -1
  104. data/vendor/libgit2/src/diff_driver.c +12 -9
  105. data/vendor/libgit2/src/diff_driver.h +4 -1
  106. data/vendor/libgit2/src/diff_file.c +7 -4
  107. data/vendor/libgit2/src/diff_file.h +1 -0
  108. data/vendor/libgit2/src/diff_generate.c +6 -3
  109. data/vendor/libgit2/src/diff_generate.h +6 -1
  110. data/vendor/libgit2/src/diff_parse.c +5 -4
  111. data/vendor/libgit2/src/diff_parse.h +2 -0
  112. data/vendor/libgit2/src/diff_print.c +2 -0
  113. data/vendor/libgit2/src/diff_stats.c +2 -0
  114. data/vendor/libgit2/src/diff_tform.c +2 -1
  115. data/vendor/libgit2/src/diff_tform.h +4 -1
  116. data/vendor/libgit2/src/diff_xdiff.c +5 -2
  117. data/vendor/libgit2/src/diff_xdiff.h +2 -0
  118. data/vendor/libgit2/src/errors.c +2 -0
  119. data/vendor/libgit2/src/features.h.in +36 -0
  120. data/vendor/libgit2/src/fetch.c +2 -2
  121. data/vendor/libgit2/src/fetch.h +4 -0
  122. data/vendor/libgit2/src/fetchhead.c +3 -3
  123. data/vendor/libgit2/src/fetchhead.h +3 -0
  124. data/vendor/libgit2/src/filebuf.c +2 -1
  125. data/vendor/libgit2/src/filebuf.h +2 -0
  126. data/vendor/libgit2/src/fileops.c +12 -1
  127. data/vendor/libgit2/src/fileops.h +7 -1
  128. data/vendor/libgit2/src/filter.c +2 -1
  129. data/vendor/libgit2/src/filter.h +1 -0
  130. data/vendor/libgit2/src/fnmatch.c +2 -2
  131. data/vendor/libgit2/src/fnmatch.h +3 -4
  132. data/vendor/libgit2/src/global.c +4 -3
  133. data/vendor/libgit2/src/global.h +1 -5
  134. data/vendor/libgit2/src/graph.c +2 -0
  135. data/vendor/libgit2/src/hash.c +0 -1
  136. data/vendor/libgit2/src/hash.h +3 -1
  137. data/vendor/libgit2/src/hash/hash_collisiondetect.h +3 -3
  138. data/vendor/libgit2/src/hash/hash_common_crypto.h +18 -5
  139. data/vendor/libgit2/src/hash/hash_generic.c +2 -2
  140. data/vendor/libgit2/src/hash/hash_generic.h +5 -3
  141. data/vendor/libgit2/src/hash/hash_openssl.h +3 -3
  142. data/vendor/libgit2/src/hash/hash_win32.c +57 -14
  143. data/vendor/libgit2/src/hash/hash_win32.h +4 -3
  144. data/vendor/libgit2/src/hashsig.c +3 -0
  145. data/vendor/libgit2/src/ident.c +2 -0
  146. data/vendor/libgit2/src/idxmap.h +2 -1
  147. data/vendor/libgit2/src/ignore.c +14 -2
  148. data/vendor/libgit2/src/ignore.h +2 -0
  149. data/vendor/libgit2/src/index.c +20 -40
  150. data/vendor/libgit2/src/index.h +2 -0
  151. data/vendor/libgit2/src/indexer.c +13 -5
  152. data/vendor/libgit2/src/indexer.h +5 -1
  153. data/vendor/libgit2/src/integer.h +1 -1
  154. data/vendor/libgit2/src/iterator.c +44 -3
  155. data/vendor/libgit2/src/iterator.h +3 -0
  156. data/vendor/libgit2/src/map.h +1 -1
  157. data/vendor/libgit2/src/merge.c +155 -33
  158. data/vendor/libgit2/src/merge.h +2 -0
  159. data/vendor/libgit2/src/merge_driver.c +2 -2
  160. data/vendor/libgit2/src/merge_driver.h +2 -0
  161. data/vendor/libgit2/src/merge_file.c +3 -0
  162. data/vendor/libgit2/src/message.h +3 -1
  163. data/vendor/libgit2/src/mwindow.c +1 -1
  164. data/vendor/libgit2/src/mwindow.h +2 -0
  165. data/vendor/libgit2/src/netops.c +75 -62
  166. data/vendor/libgit2/src/netops.h +2 -1
  167. data/vendor/libgit2/src/notes.c +164 -48
  168. data/vendor/libgit2/src/notes.h +1 -1
  169. data/vendor/libgit2/src/object.c +14 -3
  170. data/vendor/libgit2/src/object.h +4 -0
  171. data/vendor/libgit2/src/object_api.c +3 -2
  172. data/vendor/libgit2/src/odb.c +104 -38
  173. data/vendor/libgit2/src/odb.h +3 -1
  174. data/vendor/libgit2/src/odb_loose.c +414 -267
  175. data/vendor/libgit2/src/odb_mempack.c +1 -0
  176. data/vendor/libgit2/src/odb_pack.c +2 -1
  177. data/vendor/libgit2/src/offmap.h +1 -0
  178. data/vendor/libgit2/src/oid.c +2 -1
  179. data/vendor/libgit2/src/oid.h +3 -8
  180. data/vendor/libgit2/src/oidarray.c +2 -1
  181. data/vendor/libgit2/src/oidarray.h +1 -0
  182. data/vendor/libgit2/src/oidmap.h +1 -0
  183. data/vendor/libgit2/src/pack-objects.c +5 -1
  184. data/vendor/libgit2/src/pack-objects.h +1 -1
  185. data/vendor/libgit2/src/pack.c +2 -6
  186. data/vendor/libgit2/src/pack.h +2 -1
  187. data/vendor/libgit2/src/parse.c +121 -0
  188. data/vendor/libgit2/src/parse.h +61 -0
  189. data/vendor/libgit2/src/patch.c +9 -2
  190. data/vendor/libgit2/src/patch.h +2 -0
  191. data/vendor/libgit2/src/patch_generate.c +6 -5
  192. data/vendor/libgit2/src/patch_generate.h +1 -0
  193. data/vendor/libgit2/src/patch_parse.c +265 -276
  194. data/vendor/libgit2/src/patch_parse.h +6 -11
  195. data/vendor/libgit2/src/path.c +24 -181
  196. data/vendor/libgit2/src/path.h +14 -73
  197. data/vendor/libgit2/src/pathspec.c +2 -1
  198. data/vendor/libgit2/src/pathspec.h +2 -1
  199. data/vendor/libgit2/src/pool.c +8 -0
  200. data/vendor/libgit2/src/pool.h +1 -0
  201. data/vendor/libgit2/src/posix.c +2 -1
  202. data/vendor/libgit2/src/posix.h +1 -0
  203. data/vendor/libgit2/src/pqueue.c +1 -0
  204. data/vendor/libgit2/src/pqueue.h +2 -0
  205. data/vendor/libgit2/src/proxy.c +2 -1
  206. data/vendor/libgit2/src/proxy.h +3 -1
  207. data/vendor/libgit2/src/push.c +4 -171
  208. data/vendor/libgit2/src/push.h +2 -0
  209. data/vendor/libgit2/src/rebase.c +1 -0
  210. data/vendor/libgit2/src/refdb.c +2 -3
  211. data/vendor/libgit2/src/refdb.h +2 -0
  212. data/vendor/libgit2/src/refdb_fs.c +5 -3
  213. data/vendor/libgit2/src/refdb_fs.h +4 -0
  214. data/vendor/libgit2/src/reflog.c +1 -0
  215. data/vendor/libgit2/src/reflog.h +2 -1
  216. data/vendor/libgit2/src/refs.c +1 -0
  217. data/vendor/libgit2/src/refs.h +2 -1
  218. data/vendor/libgit2/src/refspec.c +2 -2
  219. data/vendor/libgit2/src/refspec.h +2 -0
  220. data/vendor/libgit2/src/remote.c +56 -10
  221. data/vendor/libgit2/src/remote.h +2 -0
  222. data/vendor/libgit2/src/repository.c +16 -14
  223. data/vendor/libgit2/src/repository.h +2 -0
  224. data/vendor/libgit2/src/reset.c +6 -5
  225. data/vendor/libgit2/src/revert.c +1 -0
  226. data/vendor/libgit2/src/revparse.c +3 -5
  227. data/vendor/libgit2/src/revwalk.c +2 -2
  228. data/vendor/libgit2/src/revwalk.h +2 -0
  229. data/vendor/libgit2/src/settings.c +6 -8
  230. data/vendor/libgit2/src/sha1_lookup.c +2 -216
  231. data/vendor/libgit2/src/sha1_lookup.h +2 -6
  232. data/vendor/libgit2/src/signature.c +8 -3
  233. data/vendor/libgit2/src/signature.h +2 -0
  234. data/vendor/libgit2/src/sortedcache.c +7 -0
  235. data/vendor/libgit2/src/sortedcache.h +2 -0
  236. data/vendor/libgit2/src/stash.c +1 -0
  237. data/vendor/libgit2/src/status.c +14 -9
  238. data/vendor/libgit2/src/status.h +2 -0
  239. data/vendor/libgit2/src/{curl_stream.c → streams/curl.c} +2 -0
  240. data/vendor/libgit2/src/{curl_stream.h → streams/curl.h} +4 -2
  241. data/vendor/libgit2/src/{openssl_stream.c → streams/openssl.c} +47 -18
  242. data/vendor/libgit2/src/{openssl_stream.h → streams/openssl.h} +6 -2
  243. data/vendor/libgit2/src/{socket_stream.c → streams/socket.c} +2 -2
  244. data/vendor/libgit2/src/{socket_stream.h → streams/socket.h} +4 -2
  245. data/vendor/libgit2/src/{stransport_stream.c → streams/stransport.c} +4 -2
  246. data/vendor/libgit2/src/{stransport_stream.h → streams/stransport.h} +4 -2
  247. data/vendor/libgit2/src/{tls_stream.c → streams/tls.c} +4 -3
  248. data/vendor/libgit2/src/{tls_stream.h → streams/tls.h} +4 -2
  249. data/vendor/libgit2/src/submodule.c +28 -80
  250. data/vendor/libgit2/src/submodule.h +2 -13
  251. data/vendor/libgit2/src/sysdir.c +75 -8
  252. data/vendor/libgit2/src/sysdir.h +2 -1
  253. data/vendor/libgit2/src/tag.c +2 -2
  254. data/vendor/libgit2/src/tag.h +2 -0
  255. data/vendor/libgit2/src/thread-utils.c +1 -0
  256. data/vendor/libgit2/src/thread-utils.h +1 -1
  257. data/vendor/libgit2/src/trace.c +2 -2
  258. data/vendor/libgit2/src/trace.h +2 -0
  259. data/vendor/libgit2/src/trailer.c +416 -0
  260. data/vendor/libgit2/src/transaction.c +2 -1
  261. data/vendor/libgit2/src/transport.c +2 -0
  262. data/vendor/libgit2/src/transports/auth.c +2 -1
  263. data/vendor/libgit2/src/transports/auth.h +4 -3
  264. data/vendor/libgit2/src/transports/auth_negotiate.c +2 -1
  265. data/vendor/libgit2/src/transports/auth_negotiate.h +3 -3
  266. data/vendor/libgit2/src/transports/cred.c +2 -0
  267. data/vendor/libgit2/src/transports/cred.h +4 -2
  268. data/vendor/libgit2/src/transports/cred_helpers.c +1 -0
  269. data/vendor/libgit2/src/transports/git.c +3 -1
  270. data/vendor/libgit2/src/transports/http.c +10 -14
  271. data/vendor/libgit2/src/transports/http.h +23 -0
  272. data/vendor/libgit2/src/transports/local.c +23 -5
  273. data/vendor/libgit2/src/transports/smart.c +3 -1
  274. data/vendor/libgit2/src/transports/smart.h +23 -16
  275. data/vendor/libgit2/src/transports/smart_pkt.c +114 -130
  276. data/vendor/libgit2/src/transports/smart_protocol.c +26 -22
  277. data/vendor/libgit2/src/transports/ssh.c +12 -7
  278. data/vendor/libgit2/src/transports/ssh.h +4 -2
  279. data/vendor/libgit2/src/transports/winhttp.c +19 -21
  280. data/vendor/libgit2/src/tree-cache.c +1 -0
  281. data/vendor/libgit2/src/tree-cache.h +1 -0
  282. data/vendor/libgit2/src/tree.c +20 -14
  283. data/vendor/libgit2/src/tree.h +2 -0
  284. data/vendor/libgit2/src/tsort.c +0 -1
  285. data/vendor/libgit2/src/unix/map.c +4 -1
  286. data/vendor/libgit2/src/unix/posix.h +8 -4
  287. data/vendor/libgit2/src/unix/pthread.h +1 -1
  288. data/vendor/libgit2/src/unix/realpath.c +4 -1
  289. data/vendor/libgit2/src/util.c +6 -5
  290. data/vendor/libgit2/src/util.h +39 -111
  291. data/vendor/libgit2/src/varint.c +0 -1
  292. data/vendor/libgit2/src/varint.h +2 -0
  293. data/vendor/libgit2/src/vector.c +1 -1
  294. data/vendor/libgit2/src/win32/dir.c +3 -0
  295. data/vendor/libgit2/src/win32/dir.h +4 -3
  296. data/vendor/libgit2/src/win32/error.c +1 -1
  297. data/vendor/libgit2/src/win32/error.h +4 -2
  298. data/vendor/libgit2/src/win32/findfile.c +2 -1
  299. data/vendor/libgit2/src/win32/findfile.h +4 -2
  300. data/vendor/libgit2/src/win32/map.c +2 -0
  301. data/vendor/libgit2/src/win32/mingw-compat.h +3 -3
  302. data/vendor/libgit2/src/win32/msvc-compat.h +3 -3
  303. data/vendor/libgit2/src/win32/path_w32.c +7 -12
  304. data/vendor/libgit2/src/win32/path_w32.h +3 -2
  305. data/vendor/libgit2/src/win32/posix.h +2 -2
  306. data/vendor/libgit2/src/win32/posix_w32.c +11 -5
  307. data/vendor/libgit2/src/win32/precompiled.h +2 -1
  308. data/vendor/libgit2/src/win32/reparse.h +2 -2
  309. data/vendor/libgit2/src/win32/thread.c +1 -0
  310. data/vendor/libgit2/src/win32/thread.h +2 -2
  311. data/vendor/libgit2/src/win32/utf-conv.c +0 -1
  312. data/vendor/libgit2/src/win32/utf-conv.h +4 -3
  313. data/vendor/libgit2/src/win32/w32_buffer.c +1 -1
  314. data/vendor/libgit2/src/win32/w32_buffer.h +4 -2
  315. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +2 -1
  316. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +85 -2
  317. data/vendor/libgit2/src/win32/w32_stack.c +2 -1
  318. data/vendor/libgit2/src/win32/w32_stack.h +5 -3
  319. data/vendor/libgit2/src/win32/w32_util.h +4 -2
  320. data/vendor/libgit2/src/win32/win32-compat.h +3 -3
  321. data/vendor/libgit2/src/worktree.c +4 -5
  322. data/vendor/libgit2/src/worktree.h +2 -0
  323. data/vendor/libgit2/src/xdiff/xdiff.h +22 -13
  324. data/vendor/libgit2/src/xdiff/xdiffi.c +523 -81
  325. data/vendor/libgit2/src/xdiff/xdiffi.h +2 -2
  326. data/vendor/libgit2/src/xdiff/xemit.c +63 -39
  327. data/vendor/libgit2/src/xdiff/xemit.h +2 -2
  328. data/vendor/libgit2/src/xdiff/xhistogram.c +0 -1
  329. data/vendor/libgit2/src/xdiff/xinclude.h +3 -2
  330. data/vendor/libgit2/src/xdiff/xmacros.h +2 -2
  331. data/vendor/libgit2/src/xdiff/xmerge.c +80 -20
  332. data/vendor/libgit2/src/xdiff/xpatience.c +41 -9
  333. data/vendor/libgit2/src/xdiff/xprepare.c +2 -2
  334. data/vendor/libgit2/src/xdiff/xprepare.h +2 -2
  335. data/vendor/libgit2/src/xdiff/xtypes.h +2 -2
  336. data/vendor/libgit2/src/xdiff/xutils.c +47 -27
  337. data/vendor/libgit2/src/xdiff/xutils.h +2 -5
  338. data/vendor/libgit2/src/zstream.c +65 -45
  339. data/vendor/libgit2/src/zstream.h +9 -2
  340. metadata +27 -13
  341. data/vendor/libgit2/include/git2/sys/remote.h +0 -16
@@ -5,8 +5,8 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
- #include "common.h"
9
8
  #include "annotated_commit.h"
9
+
10
10
  #include "refs.h"
11
11
  #include "cache.h"
12
12
 
@@ -7,6 +7,8 @@
7
7
  #ifndef INCLUDE_annotated_commit_h__
8
8
  #define INCLUDE_annotated_commit_h__
9
9
 
10
+ #include "common.h"
11
+
10
12
  #include "oidarray.h"
11
13
 
12
14
  #include "git2/oid.h"
@@ -5,6 +5,8 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
+ #include "apply.h"
9
+
8
10
  #include <assert.h>
9
11
 
10
12
  #include "git2/patch.h"
@@ -12,7 +14,6 @@
12
14
  #include "array.h"
13
15
  #include "patch.h"
14
16
  #include "fileops.h"
15
- #include "apply.h"
16
17
  #include "delta.h"
17
18
  #include "zstream.h"
18
19
 
@@ -7,6 +7,8 @@
7
7
  #ifndef INCLUDE_apply_h__
8
8
  #define INCLUDE_apply_h__
9
9
 
10
+ #include "common.h"
11
+
10
12
  #include "git2/patch.h"
11
13
  #include "buffer.h"
12
14
 
@@ -1,4 +1,12 @@
1
- #include "common.h"
1
+ /*
2
+ * Copyright (C) the libgit2 contributors. All rights reserved.
3
+ *
4
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
5
+ * a Linking Exception. For full terms see the included COPYING file.
6
+ */
7
+
8
+ #include "attr.h"
9
+
2
10
  #include "repository.h"
3
11
  #include "sysdir.h"
4
12
  #include "config.h"
@@ -48,12 +56,16 @@ int git_attr_get(
48
56
  git_attr_file *file;
49
57
  git_attr_name attr;
50
58
  git_attr_rule *rule;
59
+ git_dir_flag dir_flag = GIT_DIR_FLAG_UNKNOWN;
51
60
 
52
61
  assert(value && repo && name);
53
62
 
54
63
  *value = NULL;
55
64
 
56
- if (git_attr_path__init(&path, pathname, git_repository_workdir(repo), GIT_DIR_FLAG_UNKNOWN) < 0)
65
+ if (git_repository_is_bare(repo))
66
+ dir_flag = GIT_DIR_FLAG_FALSE;
67
+
68
+ if (git_attr_path__init(&path, pathname, git_repository_workdir(repo), dir_flag) < 0)
57
69
  return -1;
58
70
 
59
71
  if ((error = collect_attr_files(repo, NULL, flags, pathname, &files)) < 0)
@@ -106,13 +118,17 @@ int git_attr_get_many_with_session(
106
118
  git_attr_rule *rule;
107
119
  attr_get_many_info *info = NULL;
108
120
  size_t num_found = 0;
121
+ git_dir_flag dir_flag = GIT_DIR_FLAG_UNKNOWN;
109
122
 
110
123
  if (!num_attr)
111
124
  return 0;
112
125
 
113
126
  assert(values && repo && names);
114
127
 
115
- if (git_attr_path__init(&path, pathname, git_repository_workdir(repo), GIT_DIR_FLAG_UNKNOWN) < 0)
128
+ if (git_repository_is_bare(repo))
129
+ dir_flag = GIT_DIR_FLAG_FALSE;
130
+
131
+ if (git_attr_path__init(&path, pathname, git_repository_workdir(repo), dir_flag) < 0)
116
132
  return -1;
117
133
 
118
134
  if ((error = collect_attr_files(repo, attr_session, flags, pathname, &files)) < 0)
@@ -188,10 +204,14 @@ int git_attr_foreach(
188
204
  git_attr_rule *rule;
189
205
  git_attr_assignment *assign;
190
206
  git_strmap *seen = NULL;
207
+ git_dir_flag dir_flag = GIT_DIR_FLAG_UNKNOWN;
191
208
 
192
209
  assert(repo && callback);
193
210
 
194
- if (git_attr_path__init(&path, pathname, git_repository_workdir(repo), GIT_DIR_FLAG_UNKNOWN) < 0)
211
+ if (git_repository_is_bare(repo))
212
+ dir_flag = GIT_DIR_FLAG_FALSE;
213
+
214
+ if (git_attr_path__init(&path, pathname, git_repository_workdir(repo), dir_flag) < 0)
195
215
  return -1;
196
216
 
197
217
  if ((error = collect_attr_files(repo, NULL, flags, pathname, &files)) < 0 ||
@@ -7,6 +7,8 @@
7
7
  #ifndef INCLUDE_attr_h__
8
8
  #define INCLUDE_attr_h__
9
9
 
10
+ #include "common.h"
11
+
10
12
  #include "attr_file.h"
11
13
  #include "attrcache.h"
12
14
 
@@ -1,7 +1,14 @@
1
- #include "common.h"
1
+ /*
2
+ * Copyright (C) the libgit2 contributors. All rights reserved.
3
+ *
4
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
5
+ * a Linking Exception. For full terms see the included COPYING file.
6
+ */
7
+
8
+ #include "attr_file.h"
9
+
2
10
  #include "repository.h"
3
11
  #include "filebuf.h"
4
- #include "attr_file.h"
5
12
  #include "attrcache.h"
6
13
  #include "git2/blob.h"
7
14
  #include "git2/tree.h"
@@ -7,6 +7,8 @@
7
7
  #ifndef INCLUDE_attr_file_h__
8
8
  #define INCLUDE_attr_file_h__
9
9
 
10
+ #include "common.h"
11
+
10
12
  #include "git2/oid.h"
11
13
  #include "git2/attr.h"
12
14
  #include "vector.h"
@@ -1,4 +1,12 @@
1
- #include "common.h"
1
+ /*
2
+ * Copyright (C) the libgit2 contributors. All rights reserved.
3
+ *
4
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
5
+ * a Linking Exception. For full terms see the included COPYING file.
6
+ */
7
+
8
+ #include "attrcache.h"
9
+
2
10
  #include "repository.h"
3
11
  #include "attr_file.h"
4
12
  #include "config.h"
@@ -7,6 +7,8 @@
7
7
  #ifndef INCLUDE_attrcache_h__
8
8
  #define INCLUDE_attrcache_h__
9
9
 
10
+ #include "common.h"
11
+
10
12
  #include "attr_file.h"
11
13
  #include "strmap.h"
12
14
 
@@ -6,6 +6,7 @@
6
6
  */
7
7
 
8
8
  #include "blame.h"
9
+
9
10
  #include "git2/commit.h"
10
11
  #include "git2/revparse.h"
11
12
  #include "git2/revwalk.h"
@@ -1,8 +1,9 @@
1
1
  #ifndef INCLUDE_blame_h__
2
2
  #define INCLUDE_blame_h__
3
3
 
4
- #include "git2/blame.h"
5
4
  #include "common.h"
5
+
6
+ #include "git2/blame.h"
6
7
  #include "vector.h"
7
8
  #include "diff.h"
8
9
  #include "array.h"
@@ -6,6 +6,7 @@
6
6
  */
7
7
 
8
8
  #include "blame_git.h"
9
+
9
10
  #include "commit.h"
10
11
  #include "blob.h"
11
12
  #include "xdiff/xinclude.h"
@@ -7,6 +7,8 @@
7
7
  #ifndef INCLUDE_blame_git__
8
8
  #define INCLUDE_blame_git__
9
9
 
10
+ #include "common.h"
11
+
10
12
  #include "blame.h"
11
13
 
12
14
  int git_blame__get_origin(
@@ -5,14 +5,14 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
+ #include "blob.h"
9
+
8
10
  #include "git2/common.h"
9
11
  #include "git2/object.h"
10
12
  #include "git2/repository.h"
11
13
  #include "git2/odb_backend.h"
12
14
 
13
- #include "common.h"
14
15
  #include "filebuf.h"
15
- #include "blob.h"
16
16
  #include "filter.h"
17
17
  #include "buf_text.h"
18
18
 
@@ -7,6 +7,8 @@
7
7
  #ifndef INCLUDE_blob_h__
8
8
  #define INCLUDE_blob_h__
9
9
 
10
+ #include "common.h"
11
+
10
12
  #include "git2/blob.h"
11
13
  #include "repository.h"
12
14
  #include "odb.h"
@@ -5,7 +5,8 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
- #include "common.h"
8
+ #include "branch.h"
9
+
9
10
  #include "commit.h"
10
11
  #include "tag.h"
11
12
  #include "config.h"
@@ -69,6 +70,12 @@ static int create_branch(
69
70
  assert(branch_name && commit && ref_out);
70
71
  assert(git_object_owner((const git_object *)commit) == repository);
71
72
 
73
+ if (!git__strcmp(branch_name, "HEAD")) {
74
+ giterr_set(GITERR_REFERENCE, "'HEAD' is not a valid branch name");
75
+ error = -1;
76
+ goto cleanup;
77
+ }
78
+
72
79
  if (force && !bare && git_branch_lookup(&branch, repository, branch_name, GIT_BRANCH_LOCAL) == 0) {
73
80
  error = git_branch_is_head(branch);
74
81
  git_reference_free(branch);
@@ -7,6 +7,8 @@
7
7
  #ifndef INCLUDE_branch_h__
8
8
  #define INCLUDE_branch_h__
9
9
 
10
+ #include "common.h"
11
+
10
12
  #include "buffer.h"
11
13
 
12
14
  int git_branch_upstream__name(
@@ -188,7 +188,7 @@ bool git_buf_text_is_binary(const git_buf *buf)
188
188
  git_bom_t bom;
189
189
  int printable = 0, nonprintable = 0;
190
190
 
191
- scan += git_buf_text_detect_bom(&bom, buf, 0);
191
+ scan += git_buf_text_detect_bom(&bom, buf);
192
192
 
193
193
  if (bom > GIT_BOM_UTF8)
194
194
  return 1;
@@ -215,18 +215,18 @@ bool git_buf_text_contains_nul(const git_buf *buf)
215
215
  return (memchr(buf->ptr, '\0', buf->size) != NULL);
216
216
  }
217
217
 
218
- int git_buf_text_detect_bom(git_bom_t *bom, const git_buf *buf, size_t offset)
218
+ int git_buf_text_detect_bom(git_bom_t *bom, const git_buf *buf)
219
219
  {
220
220
  const char *ptr;
221
221
  size_t len;
222
222
 
223
223
  *bom = GIT_BOM_NONE;
224
- /* need at least 2 bytes after offset to look for any BOM */
225
- if (buf->size < offset + 2)
224
+ /* need at least 2 bytes to look for any BOM */
225
+ if (buf->size < 2)
226
226
  return 0;
227
227
 
228
- ptr = buf->ptr + offset;
229
- len = buf->size - offset;
228
+ ptr = buf->ptr;
229
+ len = buf->size;
230
230
 
231
231
  switch (*ptr++) {
232
232
  case 0:
@@ -274,7 +274,7 @@ bool git_buf_text_gather_stats(
274
274
  memset(stats, 0, sizeof(*stats));
275
275
 
276
276
  /* BOM detection */
277
- skip = git_buf_text_detect_bom(&stats->bom, buf, 0);
277
+ skip = git_buf_text_detect_bom(&stats->bom, buf);
278
278
  if (skip_bom)
279
279
  scan += skip;
280
280
 
@@ -7,6 +7,8 @@
7
7
  #ifndef INCLUDE_buf_text_h__
8
8
  #define INCLUDE_buf_text_h__
9
9
 
10
+ #include "common.h"
11
+
10
12
  #include "buffer.h"
11
13
 
12
14
  typedef enum {
@@ -97,11 +99,9 @@ extern bool git_buf_text_contains_nul(const git_buf *buf);
97
99
  *
98
100
  * @param bom Set to the type of BOM detected or GIT_BOM_NONE
99
101
  * @param buf Buffer in which to check the first bytes for a BOM
100
- * @param offset Offset into buffer to look for BOM
101
102
  * @return Number of bytes of BOM data (or 0 if no BOM found)
102
103
  */
103
- extern int git_buf_text_detect_bom(
104
- git_bom_t *bom, const git_buf *buf, size_t offset);
104
+ extern int git_buf_text_detect_bom(git_bom_t *bom, const git_buf *buf);
105
105
 
106
106
  /**
107
107
  * Gather stats for a piece of text
@@ -212,7 +212,7 @@ int git_buf_put(git_buf *buf, const char *data, size_t len)
212
212
  size_t new_size;
213
213
 
214
214
  assert(data);
215
-
215
+
216
216
  GITERR_CHECK_ALLOC_ADD(&new_size, buf->size, len);
217
217
  GITERR_CHECK_ALLOC_ADD(&new_size, new_size, 1);
218
218
  ENSURE_SIZE(buf, new_size);
@@ -455,6 +455,36 @@ on_error:
455
455
  return -1;
456
456
  }
457
457
 
458
+ #define HEX_DECODE(c) ((c | 32) % 39 - 9)
459
+
460
+ int git_buf_decode_percent(
461
+ git_buf *buf,
462
+ const char *str,
463
+ size_t str_len)
464
+ {
465
+ size_t str_pos, new_size;
466
+
467
+ GITERR_CHECK_ALLOC_ADD(&new_size, buf->size, str_len);
468
+ GITERR_CHECK_ALLOC_ADD(&new_size, new_size, 1);
469
+ ENSURE_SIZE(buf, new_size);
470
+
471
+ for (str_pos = 0; str_pos < str_len; buf->size++, str_pos++) {
472
+ if (str[str_pos] == '%' &&
473
+ str_len > str_pos + 2 &&
474
+ isxdigit(str[str_pos + 1]) &&
475
+ isxdigit(str[str_pos + 2])) {
476
+ buf->ptr[buf->size] = (HEX_DECODE(str[str_pos + 1]) << 4) +
477
+ HEX_DECODE(str[str_pos + 2]);
478
+ str_pos += 2;
479
+ } else {
480
+ buf->ptr[buf->size] = str[str_pos];
481
+ }
482
+ }
483
+
484
+ buf->ptr[buf->size] = '\0';
485
+ return 0;
486
+ }
487
+
458
488
  int git_buf_vprintf(git_buf *buf, const char *format, va_list ap)
459
489
  {
460
490
  size_t expected_size, new_size;
@@ -190,6 +190,9 @@ int git_buf_encode_base85(git_buf *buf, const char *data, size_t len);
190
190
  /* Decode the given "base85" and write the result to the buffer */
191
191
  int git_buf_decode_base85(git_buf *buf, const char *base64, size_t len, size_t output_len);
192
192
 
193
+ /* Decode the given percent-encoded string and write the result to the buffer */
194
+ int git_buf_decode_percent(git_buf *buf, const char *str, size_t len);
195
+
193
196
  /*
194
197
  * Insert, remove or replace a portion of the buffer.
195
198
  *
@@ -5,12 +5,12 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
- #include "common.h"
8
+ #include "cache.h"
9
+
9
10
  #include "repository.h"
10
11
  #include "commit.h"
11
12
  #include "thread-utils.h"
12
13
  #include "util.h"
13
- #include "cache.h"
14
14
  #include "odb.h"
15
15
  #include "object.h"
16
16
  #include "git2/oid.h"
@@ -7,6 +7,8 @@
7
7
  #ifndef INCLUDE_cache_h__
8
8
  #define INCLUDE_cache_h__
9
9
 
10
+ #include "common.h"
11
+
10
12
  #include "git2/common.h"
11
13
  #include "git2/oid.h"
12
14
  #include "git2/odb.h"
@@ -4,8 +4,8 @@
4
4
  * This file is part of libgit2, distributed under the GNU GPL v2 with
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
- #ifndef INCLUDE_compat_h__
8
- #define INCLUDE_compat_h__
7
+ #ifndef INCLUDE_cc_compat_h__
8
+ #define INCLUDE_cc_compat_h__
9
9
 
10
10
  #include <stdarg.h>
11
11
 
@@ -84,4 +84,4 @@
84
84
  # endif
85
85
  #endif
86
86
 
87
- #endif /* INCLUDE_compat_h__ */
87
+ #endif
@@ -5,10 +5,10 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
- #include <assert.h>
9
-
10
8
  #include "checkout.h"
11
9
 
10
+ #include <assert.h>
11
+
12
12
  #include "git2/repository.h"
13
13
  #include "git2/refs.h"
14
14
  #include "git2/tree.h"
@@ -70,6 +70,7 @@ typedef struct {
70
70
  git_buf tmp;
71
71
  unsigned int strategy;
72
72
  int can_symlink;
73
+ int respect_filemode;
73
74
  bool reload_submodules;
74
75
  size_t total_steps;
75
76
  size_t completed_steps;
@@ -159,17 +160,20 @@ GIT_INLINE(bool) is_workdir_base_or_new(
159
160
  git_oid__cmp(&newitem->id, workdir_id) == 0);
160
161
  }
161
162
 
162
- GIT_INLINE(bool) is_file_mode_changed(git_filemode_t a, git_filemode_t b)
163
+ GIT_INLINE(bool) is_filemode_changed(git_filemode_t a, git_filemode_t b, int respect_filemode)
163
164
  {
164
- #ifdef GIT_WIN32
165
- /*
166
- * On Win32 we do not support the executable bit; the file will
167
- * always be 0100644 on disk, don't bother doing a test.
168
- */
169
- return false;
170
- #else
171
- return (S_ISREG(a) && S_ISREG(b) && a != b);
172
- #endif
165
+ /* If core.filemode = false, ignore links in the repository and executable bit changes */
166
+ if (!respect_filemode) {
167
+ if (a == S_IFLNK)
168
+ a = GIT_FILEMODE_BLOB;
169
+ if (b == S_IFLNK)
170
+ b = GIT_FILEMODE_BLOB;
171
+
172
+ a &= ~0111;
173
+ b &= ~0111;
174
+ }
175
+
176
+ return (a != b);
173
177
  }
174
178
 
175
179
  static bool checkout_is_workdir_modified(
@@ -217,11 +221,11 @@ static bool checkout_is_workdir_modified(
217
221
  if (ie != NULL &&
218
222
  git_index_time_eq(&wditem->mtime, &ie->mtime) &&
219
223
  wditem->file_size == ie->file_size &&
220
- !is_file_mode_changed(wditem->mode, ie->mode)) {
224
+ !is_filemode_changed(wditem->mode, ie->mode, data->respect_filemode)) {
221
225
 
222
226
  /* The workdir is modified iff the index entry is modified */
223
227
  return !is_workdir_base_or_new(&ie->id, baseitem, newitem) ||
224
- is_file_mode_changed(baseitem->mode, ie->mode);
228
+ is_filemode_changed(baseitem->mode, ie->mode, data->respect_filemode);
225
229
  }
226
230
 
227
231
  /* depending on where base is coming from, we may or may not know
@@ -234,7 +238,7 @@ static bool checkout_is_workdir_modified(
234
238
  if (S_ISDIR(wditem->mode))
235
239
  return false;
236
240
 
237
- if (is_file_mode_changed(baseitem->mode, wditem->mode))
241
+ if (is_filemode_changed(baseitem->mode, wditem->mode, data->respect_filemode))
238
242
  return true;
239
243
 
240
244
  if (git_diff__oid_for_entry(&oid, data->diff, wditem, wditem->mode, NULL) < 0)
@@ -1272,14 +1276,14 @@ static int checkout_verify_paths(
1272
1276
  unsigned int flags = GIT_PATH_REJECT_WORKDIR_DEFAULTS;
1273
1277
 
1274
1278
  if (action & CHECKOUT_ACTION__REMOVE) {
1275
- if (!git_path_isvalid(repo, delta->old_file.path, delta->old_file.mode, flags)) {
1279
+ if (!git_path_isvalid(repo, delta->old_file.path, flags)) {
1276
1280
  giterr_set(GITERR_CHECKOUT, "cannot remove invalid path '%s'", delta->old_file.path);
1277
1281
  return -1;
1278
1282
  }
1279
1283
  }
1280
1284
 
1281
1285
  if (action & ~CHECKOUT_ACTION__REMOVE) {
1282
- if (!git_path_isvalid(repo, delta->new_file.path, delta->new_file.mode, flags)) {
1286
+ if (!git_path_isvalid(repo, delta->new_file.path, flags)) {
1283
1287
  giterr_set(GITERR_CHECKOUT, "cannot checkout to invalid path '%s'", delta->new_file.path);
1284
1288
  return -1;
1285
1289
  }
@@ -2028,8 +2032,11 @@ static int checkout_write_entry(
2028
2032
  (error = checkout_safe_for_update_only(data, fullpath->ptr, side->mode)) <= 0)
2029
2033
  return error;
2030
2034
 
2031
- return checkout_write_content(data,
2032
- &side->id, fullpath->ptr, hint_path, side->mode, &st);
2035
+ if (!S_ISGITLINK(side->mode))
2036
+ return checkout_write_content(data,
2037
+ &side->id, fullpath->ptr, hint_path, side->mode, &st);
2038
+
2039
+ return 0;
2033
2040
  }
2034
2041
 
2035
2042
  static int checkout_write_entries(
@@ -2451,6 +2458,10 @@ static int checkout_data_init(
2451
2458
  &data->can_symlink, repo, GIT_CVAR_SYMLINKS)) < 0)
2452
2459
  goto cleanup;
2453
2460
 
2461
+ if ((error = git_repository__cvar(
2462
+ &data->respect_filemode, repo, GIT_CVAR_FILEMODE)) < 0)
2463
+ goto cleanup;
2464
+
2454
2465
  if (!data->opts.baseline && !data->opts.baseline_index) {
2455
2466
  data->opts_free_baseline = true;
2456
2467
  error = 0;