rugged 0.21.4 → 0.22.0b1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (224) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +12 -5
  3. data/ext/rugged/extconf.rb +9 -9
  4. data/ext/rugged/rugged.c +4 -2
  5. data/ext/rugged/rugged.h +3 -7
  6. data/ext/rugged/rugged_blob.c +57 -0
  7. data/ext/rugged/rugged_cred.c +23 -0
  8. data/ext/rugged/rugged_index.c +6 -2
  9. data/ext/rugged/rugged_remote.c +65 -52
  10. data/ext/rugged/rugged_remote_collection.c +59 -10
  11. data/ext/rugged/rugged_repo.c +345 -11
  12. data/ext/rugged/rugged_revwalk.c +10 -0
  13. data/ext/rugged/rugged_submodule.c +1042 -0
  14. data/ext/rugged/rugged_submodule_collection.c +236 -0
  15. data/ext/rugged/rugged_tag_collection.c +70 -2
  16. data/ext/rugged/rugged_tree.c +29 -10
  17. data/lib/rugged.rb +3 -0
  18. data/lib/rugged/attributes.rb +41 -0
  19. data/lib/rugged/blob.rb +28 -0
  20. data/lib/rugged/diff.rb +0 -1
  21. data/lib/rugged/diff/line.rb +1 -3
  22. data/lib/rugged/patch.rb +12 -2
  23. data/lib/rugged/repository.rb +7 -0
  24. data/lib/rugged/submodule_collection.rb +48 -0
  25. data/lib/rugged/version.rb +1 -1
  26. data/vendor/libgit2/CMakeLists.txt +27 -3
  27. data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +324 -0
  28. data/vendor/libgit2/deps/http-parser/http_parser.h +2 -0
  29. data/vendor/libgit2/deps/zlib/adler32.c +39 -29
  30. data/vendor/libgit2/deps/zlib/crc32.c +33 -50
  31. data/vendor/libgit2/deps/zlib/crc32.h +1 -1
  32. data/vendor/libgit2/deps/zlib/deflate.c +198 -65
  33. data/vendor/libgit2/deps/zlib/deflate.h +8 -4
  34. data/vendor/libgit2/deps/zlib/infback.c +640 -0
  35. data/vendor/libgit2/deps/zlib/inffast.c +3 -3
  36. data/vendor/libgit2/deps/zlib/inffixed.h +3 -3
  37. data/vendor/libgit2/deps/zlib/inflate.c +84 -52
  38. data/vendor/libgit2/deps/zlib/inftrees.c +15 -39
  39. data/vendor/libgit2/deps/zlib/trees.c +18 -36
  40. data/vendor/libgit2/deps/zlib/zconf.h +4 -0
  41. data/vendor/libgit2/deps/zlib/zlib.h +250 -95
  42. data/vendor/libgit2/deps/zlib/zutil.c +13 -10
  43. data/vendor/libgit2/deps/zlib/zutil.h +41 -62
  44. data/vendor/libgit2/include/git2.h +4 -0
  45. data/vendor/libgit2/include/git2/annotated_commit.h +99 -0
  46. data/vendor/libgit2/include/git2/attr.h +16 -13
  47. data/vendor/libgit2/include/git2/branch.h +11 -0
  48. data/vendor/libgit2/include/git2/buffer.h +16 -0
  49. data/vendor/libgit2/include/git2/checkout.h +12 -12
  50. data/vendor/libgit2/include/git2/cherrypick.h +15 -15
  51. data/vendor/libgit2/include/git2/clone.h +77 -69
  52. data/vendor/libgit2/include/git2/common.h +13 -1
  53. data/vendor/libgit2/include/git2/config.h +0 -14
  54. data/vendor/libgit2/include/git2/describe.h +162 -0
  55. data/vendor/libgit2/include/git2/diff.h +13 -8
  56. data/vendor/libgit2/include/git2/errors.h +5 -0
  57. data/vendor/libgit2/include/git2/global.h +38 -0
  58. data/vendor/libgit2/include/git2/merge.h +38 -64
  59. data/vendor/libgit2/include/git2/net.h +2 -2
  60. data/vendor/libgit2/include/git2/notes.h +17 -0
  61. data/vendor/libgit2/include/git2/oid.h +8 -4
  62. data/vendor/libgit2/include/git2/oidarray.h +40 -0
  63. data/vendor/libgit2/include/git2/rebase.h +261 -0
  64. data/vendor/libgit2/include/git2/reflog.h +1 -1
  65. data/vendor/libgit2/include/git2/remote.h +25 -47
  66. data/vendor/libgit2/include/git2/repository.h +4 -1
  67. data/vendor/libgit2/include/git2/reset.h +10 -1
  68. data/vendor/libgit2/include/git2/revert.h +1 -1
  69. data/vendor/libgit2/include/git2/revwalk.h +28 -23
  70. data/vendor/libgit2/include/git2/status.h +19 -15
  71. data/vendor/libgit2/include/git2/submodule.h +18 -0
  72. data/vendor/libgit2/include/git2/sys/config.h +0 -1
  73. data/vendor/libgit2/{src → include/git2/sys}/hashsig.h +11 -7
  74. data/vendor/libgit2/include/git2/sys/refdb_backend.h +13 -0
  75. data/vendor/libgit2/include/git2/sys/refs.h +0 -11
  76. data/vendor/libgit2/include/git2/sys/repository.h +13 -0
  77. data/vendor/libgit2/include/git2/sys/transport.h +352 -0
  78. data/vendor/libgit2/include/git2/threads.h +10 -20
  79. data/vendor/libgit2/include/git2/transaction.h +111 -0
  80. data/vendor/libgit2/include/git2/transport.h +79 -313
  81. data/vendor/libgit2/include/git2/tree.h +4 -2
  82. data/vendor/libgit2/include/git2/types.h +77 -8
  83. data/vendor/libgit2/include/git2/version.h +2 -2
  84. data/vendor/libgit2/src/annotated_commit.c +121 -0
  85. data/vendor/libgit2/src/annotated_commit.h +22 -0
  86. data/vendor/libgit2/src/attr.c +8 -4
  87. data/vendor/libgit2/src/attr_file.c +24 -2
  88. data/vendor/libgit2/src/blame.c +0 -1
  89. data/vendor/libgit2/src/branch.c +32 -3
  90. data/vendor/libgit2/src/buf_text.c +9 -5
  91. data/vendor/libgit2/src/buf_text.h +3 -2
  92. data/vendor/libgit2/src/buffer.c +67 -10
  93. data/vendor/libgit2/src/buffer.h +4 -2
  94. data/vendor/libgit2/src/cache.c +9 -9
  95. data/vendor/libgit2/src/cache.h +1 -1
  96. data/vendor/libgit2/src/cc-compat.h +2 -0
  97. data/vendor/libgit2/src/checkout.c +263 -82
  98. data/vendor/libgit2/src/checkout.h +1 -0
  99. data/vendor/libgit2/src/cherrypick.c +41 -44
  100. data/vendor/libgit2/src/clone.c +96 -58
  101. data/vendor/libgit2/src/commit.c +5 -31
  102. data/vendor/libgit2/src/commit_list.h +3 -1
  103. data/vendor/libgit2/src/config.c +0 -17
  104. data/vendor/libgit2/src/config_cache.c +0 -2
  105. data/vendor/libgit2/src/config_file.c +12 -15
  106. data/vendor/libgit2/src/crlf.c +2 -1
  107. data/vendor/libgit2/src/describe.c +886 -0
  108. data/vendor/libgit2/src/diff.c +29 -3
  109. data/vendor/libgit2/src/diff_file.c +1 -0
  110. data/vendor/libgit2/src/diff_patch.c +2 -3
  111. data/vendor/libgit2/src/diff_print.c +11 -9
  112. data/vendor/libgit2/src/diff_tform.c +4 -4
  113. data/vendor/libgit2/src/errors.c +9 -7
  114. data/vendor/libgit2/src/fetch.c +6 -6
  115. data/vendor/libgit2/src/fetchhead.h +2 -4
  116. data/vendor/libgit2/src/filebuf.c +0 -2
  117. data/vendor/libgit2/src/filebuf.h +2 -3
  118. data/vendor/libgit2/src/fileops.c +9 -7
  119. data/vendor/libgit2/src/global.c +44 -35
  120. data/vendor/libgit2/src/global.h +2 -0
  121. data/vendor/libgit2/src/graph.c +2 -2
  122. data/vendor/libgit2/src/hash.h +3 -1
  123. data/vendor/libgit2/src/hash/hash_common_crypto.h +44 -0
  124. data/vendor/libgit2/src/hash/hash_win32.c +1 -1
  125. data/vendor/libgit2/src/hashsig.c +1 -1
  126. data/vendor/libgit2/src/ignore.c +5 -88
  127. data/vendor/libgit2/src/index.c +70 -57
  128. data/vendor/libgit2/src/index.h +1 -0
  129. data/vendor/libgit2/src/indexer.c +16 -5
  130. data/vendor/libgit2/src/iterator.c +70 -1
  131. data/vendor/libgit2/src/iterator.h +5 -1
  132. data/vendor/libgit2/src/map.h +0 -1
  133. data/vendor/libgit2/src/merge.c +203 -327
  134. data/vendor/libgit2/src/merge.h +3 -13
  135. data/vendor/libgit2/src/mwindow.c +119 -8
  136. data/vendor/libgit2/src/mwindow.h +9 -1
  137. data/vendor/libgit2/src/netops.c +7 -8
  138. data/vendor/libgit2/src/netops.h +6 -16
  139. data/vendor/libgit2/src/notes.c +31 -4
  140. data/vendor/libgit2/src/notes.h +3 -0
  141. data/vendor/libgit2/src/odb.c +23 -1
  142. data/vendor/libgit2/src/odb_loose.c +1 -1
  143. data/vendor/libgit2/src/odb_pack.c +6 -3
  144. data/vendor/libgit2/src/oid.c +9 -1
  145. data/vendor/libgit2/src/oid.h +11 -0
  146. data/vendor/libgit2/src/oidarray.c +21 -0
  147. data/vendor/libgit2/src/oidarray.h +18 -0
  148. data/vendor/libgit2/src/oidmap.h +16 -0
  149. data/vendor/libgit2/src/pack.c +20 -7
  150. data/vendor/libgit2/src/pack.h +3 -0
  151. data/vendor/libgit2/src/path.c +120 -293
  152. data/vendor/libgit2/src/path.h +21 -44
  153. data/vendor/libgit2/src/pathspec.c +1 -1
  154. data/vendor/libgit2/src/pool.c +5 -11
  155. data/vendor/libgit2/src/pool.h +0 -2
  156. data/vendor/libgit2/src/posix.c +6 -6
  157. data/vendor/libgit2/src/posix.h +48 -28
  158. data/vendor/libgit2/src/push.c +19 -48
  159. data/vendor/libgit2/src/push.h +2 -4
  160. data/vendor/libgit2/src/rebase.c +1125 -0
  161. data/vendor/libgit2/src/refdb.c +19 -0
  162. data/vendor/libgit2/src/refdb.h +2 -1
  163. data/vendor/libgit2/src/refdb_fs.c +101 -29
  164. data/vendor/libgit2/src/reflog.c +1 -1
  165. data/vendor/libgit2/src/refs.c +38 -3
  166. data/vendor/libgit2/src/refs.h +13 -2
  167. data/vendor/libgit2/src/refspec.c +20 -2
  168. data/vendor/libgit2/src/remote.c +288 -154
  169. data/vendor/libgit2/src/remote.h +5 -1
  170. data/vendor/libgit2/src/repository.c +75 -36
  171. data/vendor/libgit2/src/repository.h +3 -25
  172. data/vendor/libgit2/src/reset.c +5 -1
  173. data/vendor/libgit2/src/revert.c +4 -6
  174. data/vendor/libgit2/src/revparse.c +15 -18
  175. data/vendor/libgit2/src/revwalk.c +96 -22
  176. data/vendor/libgit2/src/revwalk.h +5 -4
  177. data/vendor/libgit2/src/settings.c +22 -0
  178. data/vendor/libgit2/src/signature.c +37 -2
  179. data/vendor/libgit2/src/signature.h +3 -0
  180. data/vendor/libgit2/src/stash.c +17 -12
  181. data/vendor/libgit2/src/status.c +13 -3
  182. data/vendor/libgit2/src/strnlen.h +2 -1
  183. data/vendor/libgit2/src/submodule.c +75 -35
  184. data/vendor/libgit2/src/thread-utils.h +4 -9
  185. data/vendor/libgit2/src/trace.h +9 -1
  186. data/vendor/libgit2/src/transaction.c +352 -0
  187. data/vendor/libgit2/src/transport.c +91 -97
  188. data/vendor/libgit2/src/transports/auth.c +71 -0
  189. data/vendor/libgit2/src/transports/auth.h +63 -0
  190. data/vendor/libgit2/src/transports/auth_negotiate.c +275 -0
  191. data/vendor/libgit2/src/transports/auth_negotiate.h +27 -0
  192. data/vendor/libgit2/src/transports/cred.c +58 -0
  193. data/vendor/libgit2/src/transports/cred.h +14 -0
  194. data/vendor/libgit2/src/transports/cred_helpers.c +3 -0
  195. data/vendor/libgit2/src/transports/git.c +1 -0
  196. data/vendor/libgit2/src/transports/http.c +208 -82
  197. data/vendor/libgit2/src/transports/local.c +2 -2
  198. data/vendor/libgit2/src/transports/smart.c +2 -0
  199. data/vendor/libgit2/src/transports/smart.h +2 -0
  200. data/vendor/libgit2/src/transports/smart_protocol.c +10 -10
  201. data/vendor/libgit2/src/transports/ssh.c +243 -57
  202. data/vendor/libgit2/src/transports/winhttp.c +139 -35
  203. data/vendor/libgit2/src/tree-cache.c +118 -31
  204. data/vendor/libgit2/src/tree-cache.h +12 -7
  205. data/vendor/libgit2/src/tree.c +83 -64
  206. data/vendor/libgit2/src/tree.h +2 -3
  207. data/vendor/libgit2/src/unix/map.c +8 -2
  208. data/vendor/libgit2/src/unix/posix.h +23 -9
  209. data/vendor/libgit2/src/unix/realpath.c +8 -7
  210. data/vendor/libgit2/src/userdiff.h +3 -3
  211. data/vendor/libgit2/src/util.c +2 -92
  212. data/vendor/libgit2/src/util.h +3 -15
  213. data/vendor/libgit2/src/win32/findfile.c +0 -1
  214. data/vendor/libgit2/src/win32/map.c +3 -2
  215. data/vendor/libgit2/src/win32/mingw-compat.h +5 -12
  216. data/vendor/libgit2/src/win32/msvc-compat.h +3 -32
  217. data/vendor/libgit2/src/win32/posix.h +20 -32
  218. data/vendor/libgit2/src/win32/posix_w32.c +103 -31
  219. data/vendor/libgit2/src/win32/utf-conv.c +6 -36
  220. data/vendor/libgit2/src/win32/utf-conv.h +39 -0
  221. data/vendor/libgit2/src/win32/w32_util.h +0 -1
  222. metadata +32 -7
  223. data/vendor/libgit2/src/win32/path_w32.c +0 -305
  224. data/vendor/libgit2/src/win32/path_w32.h +0 -82
@@ -102,7 +102,7 @@ GIT_EXTERN(size_t) git_reflog_entrycount(git_reflog *reflog);
102
102
  * equal to 0 (zero) and less than `git_reflog_entrycount()`.
103
103
  * @return the entry; NULL if not found
104
104
  */
105
- GIT_EXTERN(const git_reflog_entry *) git_reflog_entry_byindex(git_reflog *reflog, size_t idx);
105
+ GIT_EXTERN(const git_reflog_entry *) git_reflog_entry_byindex(const git_reflog *reflog, size_t idx);
106
106
 
107
107
  /**
108
108
  * Remove an entry from the reflog by its index
@@ -94,7 +94,7 @@ GIT_EXTERN(int) git_remote_create_anonymous(
94
94
  * @param name the remote's name
95
95
  * @return 0, GIT_ENOTFOUND, GIT_EINVALIDSPEC or an error code
96
96
  */
97
- GIT_EXTERN(int) git_remote_load(git_remote **out, git_repository *repo, const char *name);
97
+ GIT_EXTERN(int) git_remote_lookup(git_remote **out, git_repository *repo, const char *name);
98
98
 
99
99
  /**
100
100
  * Save a remote to its repository's configuration
@@ -306,9 +306,12 @@ GIT_EXTERN(int) git_remote_ls(const git_remote_head ***out, size_t *size, git_r
306
306
  * The .idx file will be created and both it and the packfile with be
307
307
  * renamed to their final name.
308
308
  *
309
+ * @param remote the remote
310
+ * @param refspecs the refspecs to use for this negotiation and
311
+ * download. Use NULL or an empty array to use the base refspecs
309
312
  * @return 0 or an error code
310
313
  */
311
- GIT_EXTERN(int) git_remote_download(git_remote *remote);
314
+ GIT_EXTERN(int) git_remote_download(git_remote *remote, const git_strarray *refspecs);
312
315
 
313
316
  /**
314
317
  * Check whether the remote is connected
@@ -373,6 +376,8 @@ GIT_EXTERN(int) git_remote_update_tips(
373
376
  * disconnect and update the remote-tracking branches.
374
377
  *
375
378
  * @param remote the remote to fetch from
379
+ * @param refspecs the refspecs to use for this fetch. Pass NULL or an
380
+ * empty array to use the base refspecs.
376
381
  * @param signature The identity to use when updating reflogs
377
382
  * @param reflog_message The message to insert into the reflogs. If NULL, the
378
383
  * default is "fetch"
@@ -380,25 +385,10 @@ GIT_EXTERN(int) git_remote_update_tips(
380
385
  */
381
386
  GIT_EXTERN(int) git_remote_fetch(
382
387
  git_remote *remote,
388
+ const git_strarray *refspecs,
383
389
  const git_signature *signature,
384
390
  const char *reflog_message);
385
391
 
386
- /**
387
- * Return whether a string is a valid remote URL
388
- *
389
- * @param url the url to check
390
- * @return 1 if the url is valid, 0 otherwise
391
- */
392
- GIT_EXTERN(int) git_remote_valid_url(const char *url);
393
-
394
- /**
395
- * Return whether the passed URL is supported by this version of the library.
396
- *
397
- * @param url the url to check
398
- * @return 1 if the url is supported, 0 otherwise
399
- */
400
- GIT_EXTERN(int) git_remote_supported_url(const char* url);
401
-
402
392
  /**
403
393
  * Get a list of the configured remotes for a repo
404
394
  *
@@ -410,30 +400,6 @@ GIT_EXTERN(int) git_remote_supported_url(const char* url);
410
400
  */
411
401
  GIT_EXTERN(int) git_remote_list(git_strarray *out, git_repository *repo);
412
402
 
413
- /**
414
- * Choose whether to check the server's certificate (applies to HTTPS only)
415
- *
416
- * @param remote the remote to configure
417
- * @param check whether to check the server's certificate (defaults to yes)
418
- */
419
- GIT_EXTERN(void) git_remote_check_cert(git_remote *remote, int check);
420
-
421
- /**
422
- * Sets a custom transport for the remote. The caller can use this function
423
- * to bypass the automatic discovery of a transport by URL scheme (i.e.
424
- * http://, https://, git://) and supply their own transport to be used
425
- * instead. After providing the transport to a remote using this function,
426
- * the transport object belongs exclusively to that remote, and the remote will
427
- * free it when it is freed with git_remote_free.
428
- *
429
- * @param remote the remote to configure
430
- * @param transport the transport object for the remote to use
431
- * @return 0 or an error code
432
- */
433
- GIT_EXTERN(int) git_remote_set_transport(
434
- git_remote *remote,
435
- git_transport *transport);
436
-
437
403
  /**
438
404
  * Argument to the completion callback which tells it which operation
439
405
  * finished.
@@ -474,6 +440,14 @@ struct git_remote_callbacks {
474
440
  */
475
441
  git_cred_acquire_cb credentials;
476
442
 
443
+ /**
444
+ * If cert verification fails, this will be called to let the
445
+ * user make the final decision of whether to allow the
446
+ * connection to proceed. Returns 1 to allow the connection, 0
447
+ * to disallow it or a negative value to indicate an error.
448
+ */
449
+ git_transport_certificate_check_cb certificate_check;
450
+
477
451
  /**
478
452
  * During the download of new data, this will be regularly
479
453
  * called with the current count of progress done by the
@@ -570,18 +544,21 @@ GIT_EXTERN(void) git_remote_set_autotag(
570
544
  * The new name will be checked for validity.
571
545
  * See `git_tag_create()` for rules about valid names.
572
546
  *
573
- * A temporary in-memory remote cannot be given a name with this method.
547
+ * No loaded instances of a the remote with the old name will change
548
+ * their name or their list of refspecs.
574
549
  *
575
550
  * @param problems non-default refspecs cannot be renamed and will be
576
551
  * stored here for further processing by the caller. Always free this
577
552
  * strarray on succesful return.
578
- * @param remote the remote to rename
553
+ * @param repo the repository in which to rename
554
+ * @param name the current name of the reamote
579
555
  * @param new_name the new name the remote should bear
580
556
  * @return 0, GIT_EINVALIDSPEC, GIT_EEXISTS or an error code
581
557
  */
582
558
  GIT_EXTERN(int) git_remote_rename(
583
559
  git_strarray *problems,
584
- git_remote *remote,
560
+ git_repository *repo,
561
+ const char *name,
585
562
  const char *new_name);
586
563
 
587
564
  /**
@@ -615,10 +592,11 @@ GIT_EXTERN(int) git_remote_is_valid_name(const char *remote_name);
615
592
  * All remote-tracking branches and configuration settings
616
593
  * for the remote will be removed.
617
594
  *
618
- * @param remote A valid remote
595
+ * @param repo the repository in which to act
596
+ * @param name the name of the remove to delete
619
597
  * @return 0 on success, or an error code.
620
598
  */
621
- GIT_EXTERN(int) git_remote_delete(git_remote *remote);
599
+ GIT_EXTERN(int) git_remote_delete(git_repository *repo, const char *name);
622
600
 
623
601
  /**
624
602
  * Retrieve the name of the remote's default branch
@@ -196,6 +196,8 @@ GIT_EXTERN(int) git_repository_init(
196
196
  * looking the "template_path" from the options if set, or the
197
197
  * `init.templatedir` global config if not, or falling back on
198
198
  * "/usr/share/git-core/templates" if it exists.
199
+ * * GIT_REPOSITORY_INIT_RELATIVE_GITLINK - If an alternate workdir is
200
+ * specified, use relative paths for the gitdir and core.worktree.
199
201
  */
200
202
  typedef enum {
201
203
  GIT_REPOSITORY_INIT_BARE = (1u << 0),
@@ -204,6 +206,7 @@ typedef enum {
204
206
  GIT_REPOSITORY_INIT_MKDIR = (1u << 3),
205
207
  GIT_REPOSITORY_INIT_MKPATH = (1u << 4),
206
208
  GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE = (1u << 5),
209
+ GIT_REPOSITORY_INIT_RELATIVE_GITLINK = (1u << 6),
207
210
  } git_repository_init_flag_t;
208
211
 
209
212
  /**
@@ -662,7 +665,7 @@ typedef enum {
662
665
  GIT_REPOSITORY_STATE_NONE,
663
666
  GIT_REPOSITORY_STATE_MERGE,
664
667
  GIT_REPOSITORY_STATE_REVERT,
665
- GIT_REPOSITORY_STATE_CHERRY_PICK,
668
+ GIT_REPOSITORY_STATE_CHERRYPICK,
666
669
  GIT_REPOSITORY_STATE_BISECT,
667
670
  GIT_REPOSITORY_STATE_REBASE,
668
671
  GIT_REPOSITORY_STATE_REBASE_INTERACTIVE,
@@ -7,6 +7,10 @@
7
7
  #ifndef INCLUDE_git_reset_h__
8
8
  #define INCLUDE_git_reset_h__
9
9
 
10
+ #include "common.h"
11
+ #include "types.h"
12
+ #include "strarray.h"
13
+
10
14
  /**
11
15
  * @file git2/reset.h
12
16
  * @brief Git reset management routines
@@ -48,6 +52,10 @@ typedef enum {
48
52
  *
49
53
  * @param reset_type Kind of reset operation to perform.
50
54
  *
55
+ * @param checkout_opts Checkout options to be used for a HARD reset.
56
+ * The checkout_strategy field will be overridden (based on reset_type).
57
+ * This parameter can be used to propagate notify and progress callbacks.
58
+ *
51
59
  * @param signature The identity that will used to populate the reflog entry
52
60
  *
53
61
  * @param log_message The one line long message to be appended to the reflog.
@@ -61,7 +69,8 @@ GIT_EXTERN(int) git_reset(
61
69
  git_repository *repo,
62
70
  git_object *target,
63
71
  git_reset_t reset_type,
64
- git_signature *signature,
72
+ git_checkout_options *checkout_opts,
73
+ const git_signature *signature,
65
74
  const char *log_message);
66
75
 
67
76
  /**
@@ -59,7 +59,7 @@ GIT_EXTERN(int) git_revert_init_options(
59
59
  * @param merge_options the merge options (or null for defaults)
60
60
  * @return zero on success, -1 on failure.
61
61
  */
62
- int git_revert_commit(
62
+ GIT_EXTERN(int) git_revert_commit(
63
63
  git_index **out,
64
64
  git_repository *repo,
65
65
  git_commit *revert_commit,
@@ -21,33 +21,38 @@
21
21
  GIT_BEGIN_DECL
22
22
 
23
23
  /**
24
- * Sort the repository contents in no particular ordering;
25
- * this sorting is arbitrary, implementation-specific
26
- * and subject to change at any time.
27
- * This is the default sorting for new walkers.
24
+ * Flags to specify the sorting which a revwalk should perform.
28
25
  */
29
- #define GIT_SORT_NONE (0)
26
+ typedef enum {
27
+ /**
28
+ * Sort the repository contents in no particular ordering;
29
+ * this sorting is arbitrary, implementation-specific
30
+ * and subject to change at any time.
31
+ * This is the default sorting for new walkers.
32
+ */
33
+ GIT_SORT_NONE = 0,
30
34
 
31
- /**
32
- * Sort the repository contents in topological order
33
- * (parents before children); this sorting mode
34
- * can be combined with time sorting.
35
- */
36
- #define GIT_SORT_TOPOLOGICAL (1 << 0)
35
+ /**
36
+ * Sort the repository contents in topological order
37
+ * (parents before children); this sorting mode
38
+ * can be combined with time sorting.
39
+ */
40
+ GIT_SORT_TOPOLOGICAL = 1 << 0,
37
41
 
38
- /**
39
- * Sort the repository contents by commit time;
40
- * this sorting mode can be combined with
41
- * topological sorting.
42
- */
43
- #define GIT_SORT_TIME (1 << 1)
42
+ /**
43
+ * Sort the repository contents by commit time;
44
+ * this sorting mode can be combined with
45
+ * topological sorting.
46
+ */
47
+ GIT_SORT_TIME = 1 << 1,
44
48
 
45
- /**
46
- * Iterate through the repository contents in reverse
47
- * order; this sorting mode can be combined with
48
- * any of the above.
49
- */
50
- #define GIT_SORT_REVERSE (1 << 2)
49
+ /**
50
+ * Iterate through the repository contents in reverse
51
+ * order; this sorting mode can be combined with
52
+ * any of the above.
53
+ */
54
+ GIT_SORT_REVERSE = 1 << 2,
55
+ } git_sort_t;
51
56
 
52
57
  /**
53
58
  * Allocate a new revision walker to iterate through a repo.
@@ -43,6 +43,7 @@ typedef enum {
43
43
  GIT_STATUS_WT_DELETED = (1u << 9),
44
44
  GIT_STATUS_WT_TYPECHANGE = (1u << 10),
45
45
  GIT_STATUS_WT_RENAMED = (1u << 11),
46
+ GIT_STATUS_WT_UNREADABLE = (1u << 12),
46
47
 
47
48
  GIT_STATUS_IGNORED = (1u << 14),
48
49
  } git_status_t;
@@ -133,20 +134,22 @@ typedef enum {
133
134
  * together as `GIT_STATUS_OPT_DEFAULTS` if you want them as a baseline.
134
135
  */
135
136
  typedef enum {
136
- GIT_STATUS_OPT_INCLUDE_UNTRACKED = (1u << 0),
137
- GIT_STATUS_OPT_INCLUDE_IGNORED = (1u << 1),
138
- GIT_STATUS_OPT_INCLUDE_UNMODIFIED = (1u << 2),
139
- GIT_STATUS_OPT_EXCLUDE_SUBMODULES = (1u << 3),
140
- GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS = (1u << 4),
141
- GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH = (1u << 5),
142
- GIT_STATUS_OPT_RECURSE_IGNORED_DIRS = (1u << 6),
143
- GIT_STATUS_OPT_RENAMES_HEAD_TO_INDEX = (1u << 7),
144
- GIT_STATUS_OPT_RENAMES_INDEX_TO_WORKDIR = (1u << 8),
145
- GIT_STATUS_OPT_SORT_CASE_SENSITIVELY = (1u << 9),
146
- GIT_STATUS_OPT_SORT_CASE_INSENSITIVELY = (1u << 10),
147
- GIT_STATUS_OPT_RENAMES_FROM_REWRITES = (1u << 11),
148
- GIT_STATUS_OPT_NO_REFRESH = (1u << 12),
149
- GIT_STATUS_OPT_UPDATE_INDEX = (1u << 13),
137
+ GIT_STATUS_OPT_INCLUDE_UNTRACKED = (1u << 0),
138
+ GIT_STATUS_OPT_INCLUDE_IGNORED = (1u << 1),
139
+ GIT_STATUS_OPT_INCLUDE_UNMODIFIED = (1u << 2),
140
+ GIT_STATUS_OPT_EXCLUDE_SUBMODULES = (1u << 3),
141
+ GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS = (1u << 4),
142
+ GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH = (1u << 5),
143
+ GIT_STATUS_OPT_RECURSE_IGNORED_DIRS = (1u << 6),
144
+ GIT_STATUS_OPT_RENAMES_HEAD_TO_INDEX = (1u << 7),
145
+ GIT_STATUS_OPT_RENAMES_INDEX_TO_WORKDIR = (1u << 8),
146
+ GIT_STATUS_OPT_SORT_CASE_SENSITIVELY = (1u << 9),
147
+ GIT_STATUS_OPT_SORT_CASE_INSENSITIVELY = (1u << 10),
148
+ GIT_STATUS_OPT_RENAMES_FROM_REWRITES = (1u << 11),
149
+ GIT_STATUS_OPT_NO_REFRESH = (1u << 12),
150
+ GIT_STATUS_OPT_UPDATE_INDEX = (1u << 13),
151
+ GIT_STATUS_OPT_INCLUDE_UNREADABLE = (1u << 14),
152
+ GIT_STATUS_OPT_INCLUDE_UNREADABLE_AS_UNTRACKED = (1u << 15),
150
153
  } git_status_opt_t;
151
154
 
152
155
  #define GIT_STATUS_OPT_DEFAULTS \
@@ -278,7 +281,8 @@ GIT_EXTERN(int) git_status_foreach_ext(
278
281
  *
279
282
  * @param status_flags Output combination of git_status_t values for file
280
283
  * @param repo A repository object
281
- * @param path The file to retrieve status for relative to the repo workdir
284
+ * @param path The exact path to retrieve status for relative to the
285
+ * repository working directory
282
286
  * @return 0 on success, GIT_ENOTFOUND if the file is not found in the HEAD,
283
287
  * index, and work tree, GIT_EAMBIGUOUS if `path` matches multiple files
284
288
  * or if it refers to a folder, and -1 on other errors.
@@ -470,6 +470,24 @@ GIT_EXTERN(git_submodule_recurse_t) git_submodule_set_fetch_recurse_submodules(
470
470
  */
471
471
  GIT_EXTERN(int) git_submodule_init(git_submodule *submodule, int overwrite);
472
472
 
473
+ /**
474
+ * Set up the subrepository for a submodule in preparation for clone.
475
+ *
476
+ * This function can be called to init and set up a submodule
477
+ * repository from a submodule in preparation to clone it from
478
+ * its remote.
479
+ *
480
+ * @param out Output pointer to the created git repository.
481
+ * @param sm The submodule to create a new subrepository from.
482
+ * @param use_gitlink Should the workdir contain a gitlink to
483
+ * the repo in .git/modules vs. repo directly in workdir.
484
+ * @return 0 on success, <0 on failure.
485
+ */
486
+ GIT_EXTERN(int) git_submodule_repo_init(
487
+ git_repository **out,
488
+ const git_submodule *sm,
489
+ int use_gitlink);
490
+
473
491
  /**
474
492
  * Copy submodule remote info into submodule repo.
475
493
  *
@@ -63,7 +63,6 @@ struct git_config_backend {
63
63
  int (*del)(struct git_config_backend *, const char *key);
64
64
  int (*del_multivar)(struct git_config_backend *, const char *key, const char *regexp);
65
65
  int (*iterator)(git_config_iterator **, struct git_config_backend *);
66
- int (*refresh)(struct git_config_backend *);
67
66
  /** Produce a read-only version of this backend */
68
67
  int (*snapshot)(struct git_config_backend **, struct git_config_backend *);
69
68
  void (*free)(struct git_config_backend *);
@@ -4,10 +4,12 @@
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_hashsig_h__
8
- #define INCLUDE_hashsig_h__
7
+ #ifndef INCLUDE_sys_hashsig_h__
8
+ #define INCLUDE_sys_hashsig_h__
9
9
 
10
- #include "common.h"
10
+ #include "git2/common.h"
11
+
12
+ GIT_BEGIN_DECL
11
13
 
12
14
  /**
13
15
  * Similarity signature of line hashes for a buffer
@@ -35,7 +37,7 @@ typedef enum {
35
37
  * @param buflen The length of the data at `buf`
36
38
  * @param generate_pairwise_hashes Should pairwise runs be hashed
37
39
  */
38
- extern int git_hashsig_create(
40
+ GIT_EXTERN(int) git_hashsig_create(
39
41
  git_hashsig **out,
40
42
  const char *buf,
41
43
  size_t buflen,
@@ -50,7 +52,7 @@ extern int git_hashsig_create(
50
52
  * This will return an error if the file doesn't contain enough data to
51
53
  * compute a valid signature.
52
54
  */
53
- extern int git_hashsig_create_fromfile(
55
+ GIT_EXTERN(int) git_hashsig_create_fromfile(
54
56
  git_hashsig **out,
55
57
  const char *path,
56
58
  git_hashsig_option_t opts);
@@ -58,15 +60,17 @@ extern int git_hashsig_create_fromfile(
58
60
  /**
59
61
  * Release memory for a content similarity signature
60
62
  */
61
- extern void git_hashsig_free(git_hashsig *sig);
63
+ GIT_EXTERN(void) git_hashsig_free(git_hashsig *sig);
62
64
 
63
65
  /**
64
66
  * Measure similarity between two files
65
67
  *
66
68
  * @return <0 for error, [0 to 100] as similarity score
67
69
  */
68
- extern int git_hashsig_compare(
70
+ GIT_EXTERN(int) git_hashsig_compare(
69
71
  const git_hashsig *a,
70
72
  const git_hashsig *b);
71
73
 
74
+ GIT_END_DECL
75
+
72
76
  #endif
@@ -153,6 +153,19 @@ struct git_refdb_backend {
153
153
  * Remove a reflog.
154
154
  */
155
155
  int (*reflog_delete)(git_refdb_backend *backend, const char *name);
156
+
157
+ /**
158
+ * Lock a reference. The opaque parameter will be passed to the unlock function
159
+ */
160
+ int (*lock)(void **payload_out, git_refdb_backend *backend, const char *refname);
161
+
162
+ /**
163
+ * Unlock a reference. Only one of target or symbolic_target
164
+ * will be set. success indicates whether to update the
165
+ * reference or discard the lock (if it's false)
166
+ */
167
+ int (*unlock)(git_refdb_backend *backend, void *payload, int success, int update_reflog,
168
+ const git_reference *ref, const git_signature *sig, const char *message);
156
169
  };
157
170
 
158
171
  #define GIT_REFDB_BACKEND_VERSION 1
@@ -11,15 +11,6 @@
11
11
  #include "git2/types.h"
12
12
  #include "git2/oid.h"
13
13
 
14
- /**
15
- * @file git2/sys/refs.h
16
- * @brief Low-level Git ref creation
17
- * @defgroup git_backend Git custom backend APIs
18
- * @ingroup Git
19
- * @{
20
- */
21
- GIT_BEGIN_DECL
22
-
23
14
  /**
24
15
  * Create a new direct reference from an OID.
25
16
  *
@@ -44,6 +35,4 @@ GIT_EXTERN(git_reference *) git_reference__alloc_symbolic(
44
35
  const char *name,
45
36
  const char *target);
46
37
 
47
- /** @} */
48
- GIT_END_DECL
49
38
  #endif