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
@@ -233,18 +233,18 @@ typedef void (*git_checkout_progress_cb)(
233
233
  typedef struct git_checkout_options {
234
234
  unsigned int version;
235
235
 
236
- unsigned int checkout_strategy; /** default will be a dry run */
236
+ unsigned int checkout_strategy; /**< default will be a dry run */
237
237
 
238
- int disable_filters; /** don't apply filters like CRLF conversion */
239
- unsigned int dir_mode; /** default is 0755 */
240
- unsigned int file_mode; /** default is 0644 or 0755 as dictated by blob */
241
- int file_open_flags; /** default is O_CREAT | O_TRUNC | O_WRONLY */
238
+ int disable_filters; /**< don't apply filters like CRLF conversion */
239
+ unsigned int dir_mode; /**< default is 0755 */
240
+ unsigned int file_mode; /**< default is 0644 or 0755 as dictated by blob */
241
+ int file_open_flags; /**< default is O_CREAT | O_TRUNC | O_WRONLY */
242
242
 
243
- unsigned int notify_flags; /** see `git_checkout_notify_t` above */
243
+ unsigned int notify_flags; /**< see `git_checkout_notify_t` above */
244
244
  git_checkout_notify_cb notify_cb;
245
245
  void *notify_payload;
246
246
 
247
- /* Optional callback to notify the consumer of checkout progress. */
247
+ /** Optional callback to notify the consumer of checkout progress. */
248
248
  git_checkout_progress_cb progress_cb;
249
249
  void *progress_payload;
250
250
 
@@ -254,13 +254,13 @@ typedef struct git_checkout_options {
254
254
  */
255
255
  git_strarray paths;
256
256
 
257
- git_tree *baseline; /** expected content of workdir, defaults to HEAD */
257
+ git_tree *baseline; /**< expected content of workdir, defaults to HEAD */
258
258
 
259
- const char *target_directory; /** alternative checkout path to workdir */
259
+ const char *target_directory; /**< alternative checkout path to workdir */
260
260
 
261
- const char *ancestor_label; /** the name of the common ancestor side of conflicts */
262
- const char *our_label; /** the name of the "our" side of conflicts */
263
- const char *their_label; /** the name of the "their" side of conflicts */
261
+ const char *ancestor_label; /**< the name of the common ancestor side of conflicts */
262
+ const char *our_label; /**< the name of the "our" side of conflicts */
263
+ const char *their_label; /**< the name of the "their" side of conflicts */
264
264
  } git_checkout_options;
265
265
 
266
266
  #define GIT_CHECKOUT_OPTIONS_VERSION 1
@@ -28,21 +28,21 @@ typedef struct {
28
28
 
29
29
  git_merge_options merge_opts;
30
30
  git_checkout_options checkout_opts;
31
- } git_cherry_pick_options;
31
+ } git_cherrypick_options;
32
32
 
33
- #define GIT_CHERRY_PICK_OPTIONS_VERSION 1
34
- #define GIT_CHERRY_PICK_OPTIONS_INIT {GIT_CHERRY_PICK_OPTIONS_VERSION, 0, GIT_MERGE_OPTIONS_INIT, GIT_CHECKOUT_OPTIONS_INIT}
33
+ #define GIT_CHERRYPICK_OPTIONS_VERSION 1
34
+ #define GIT_CHERRYPICK_OPTIONS_INIT {GIT_CHERRYPICK_OPTIONS_VERSION, 0, GIT_MERGE_OPTIONS_INIT, GIT_CHECKOUT_OPTIONS_INIT}
35
35
 
36
36
  /**
37
- * Initializes a `git_cherry_pick_options` with default values. Equivalent to
38
- * creating an instance with GIT_CHERRY_PICK_OPTIONS_INIT.
37
+ * Initializes a `git_cherrypick_options` with default values. Equivalent to
38
+ * creating an instance with GIT_CHERRYPICK_OPTIONS_INIT.
39
39
  *
40
- * @param opts the `git_cherry_pick_options` struct to initialize
41
- * @param version Version of struct; pass `GIT_CHERRY_PICK_OPTIONS_VERSION`
40
+ * @param opts the `git_cherrypick_options` struct to initialize
41
+ * @param version Version of struct; pass `GIT_CHERRYPICK_OPTIONS_VERSION`
42
42
  * @return Zero on success; -1 on failure.
43
43
  */
44
- GIT_EXTERN(int) git_cherry_pick_init_options(
45
- git_cherry_pick_options *opts,
44
+ GIT_EXTERN(int) git_cherrypick_init_options(
45
+ git_cherrypick_options *opts,
46
46
  unsigned int version);
47
47
 
48
48
  /**
@@ -53,16 +53,16 @@ GIT_EXTERN(int) git_cherry_pick_init_options(
53
53
  *
54
54
  * @param out pointer to store the index result in
55
55
  * @param repo the repository that contains the given commits
56
- * @param cherry_pick_commit the commit to cherry-pick
56
+ * @param cherrypick_commit the commit to cherry-pick
57
57
  * @param our_commit the commit to revert against (eg, HEAD)
58
58
  * @param mainline the parent of the revert commit, if it is a merge
59
59
  * @param merge_options the merge options (or null for defaults)
60
60
  * @return zero on success, -1 on failure.
61
61
  */
62
- GIT_EXTERN(int) git_cherry_pick_commit(
62
+ GIT_EXTERN(int) git_cherrypick_commit(
63
63
  git_index **out,
64
64
  git_repository *repo,
65
- git_commit *cherry_pick_commit,
65
+ git_commit *cherrypick_commit,
66
66
  git_commit *our_commit,
67
67
  unsigned int mainline,
68
68
  const git_merge_options *merge_options);
@@ -72,13 +72,13 @@ GIT_EXTERN(int) git_cherry_pick_commit(
72
72
  *
73
73
  * @param repo the repository to cherry-pick
74
74
  * @param commit the commit to cherry-pick
75
- * @param cherry_pick_options the cherry-pick options (or null for defaults)
75
+ * @param cherrypick_options the cherry-pick options (or null for defaults)
76
76
  * @return zero on success, -1 on failure.
77
77
  */
78
- GIT_EXTERN(int) git_cherry_pick(
78
+ GIT_EXTERN(int) git_cherrypick(
79
79
  git_repository *repo,
80
80
  git_commit *commit,
81
- const git_cherry_pick_options *cherry_pick_options);
81
+ const git_cherrypick_options *cherrypick_options);
82
82
 
83
83
  /** @} */
84
84
  GIT_END_DECL
@@ -12,6 +12,7 @@
12
12
  #include "indexer.h"
13
13
  #include "checkout.h"
14
14
  #include "remote.h"
15
+ #include "transport.h"
15
16
 
16
17
 
17
18
  /**
@@ -51,6 +52,47 @@ typedef enum {
51
52
  GIT_CLONE_LOCAL_NO_LINKS,
52
53
  } git_clone_local_t;
53
54
 
55
+ /**
56
+ * The signature of a function matching git_remote_create, with an additional
57
+ * void* as a callback payload.
58
+ *
59
+ * Callers of git_clone may provide a function matching this signature to override
60
+ * the remote creation and customization process during a clone operation.
61
+ *
62
+ * @param out the resulting remote
63
+ * @param repo the repository in which to create the remote
64
+ * @param name the remote's name
65
+ * @param url the remote's url
66
+ * @param payload an opaque payload
67
+ * @return 0, GIT_EINVALIDSPEC, GIT_EEXISTS or an error code
68
+ */
69
+ typedef int (*git_remote_create_cb)(
70
+ git_remote **out,
71
+ git_repository *repo,
72
+ const char *name,
73
+ const char *url,
74
+ void *payload);
75
+
76
+ /**
77
+ * The signature of a function matchin git_repository_init, with an
78
+ * aditional void * as callback payload.
79
+ *
80
+ * Callers of git_clone my provide a function matching this signature
81
+ * to override the repository creation and customization process
82
+ * during a clone operation.
83
+ *
84
+ * @param out the resulting repository
85
+ * @param path path in which to create the repository
86
+ * @param bare whether the repository is bare. This is the value from the clone options
87
+ * @param payload payload specified by the options
88
+ * @return 0, or a negative value to indicate error
89
+ */
90
+ typedef int (*git_repository_create_cb)(
91
+ git_repository **out,
92
+ const char *path,
93
+ int bare,
94
+ void *payload);
95
+
54
96
  /**
55
97
  * Clone options structure
56
98
  *
@@ -72,7 +114,11 @@ typedef struct git_clone_options {
72
114
  git_checkout_options checkout_opts;
73
115
 
74
116
  /**
75
- * Callbacks to use for reporting fetch progress.
117
+ * Callbacks to use for reporting fetch progress, and for acquiring
118
+ * credentials in the event they are needed. This parameter is ignored if
119
+ * the remote_cb parameter is set; if you provide a remote creation
120
+ * callback, then you have the opportunity to configure remote callbacks in
121
+ * provided function.
76
122
  */
77
123
  git_remote_callbacks remote_callbacks;
78
124
 
@@ -82,23 +128,11 @@ typedef struct git_clone_options {
82
128
  */
83
129
  int bare;
84
130
 
85
- /**
86
- * Set to 1 if errors validating the remote host's certificate
87
- * should be ignored.
88
- */
89
- int ignore_cert_errors;
90
-
91
131
  /**
92
132
  * Whether to use a fetch or copy the object database.
93
133
  */
94
134
  git_clone_local_t local;
95
135
 
96
- /**
97
- * The name to be given to the remote that will be
98
- * created. The default is "origin".
99
- */
100
- const char *remote_name;
101
-
102
136
  /**
103
137
  * The name of the branch to checkout. NULL means use the
104
138
  * remote's default branch.
@@ -110,6 +144,33 @@ typedef struct git_clone_options {
110
144
  * use the default signature using the config.
111
145
  */
112
146
  git_signature *signature;
147
+
148
+ /**
149
+ * A callback used to create the new repository into which to
150
+ * clone. If NULL, the 'bare' field will be used to determine
151
+ * whether to create a bare repository.
152
+ */
153
+ git_repository_create_cb repository_cb;
154
+
155
+ /**
156
+ * An opaque payload to pass to the git_repository creation callback.
157
+ * This parameter is ignored unless repository_cb is non-NULL.
158
+ */
159
+ void *repository_cb_payload;
160
+
161
+ /**
162
+ * A callback used to create the git_remote, prior to its being
163
+ * used to perform the clone operation. See the documentation for
164
+ * git_remote_create_cb for details. This parameter may be NULL,
165
+ * indicating that git_clone should provide default behavior.
166
+ */
167
+ git_remote_create_cb remote_cb;
168
+
169
+ /**
170
+ * An opaque payload to pass to the git_remote creation callback.
171
+ * This parameter is ignored unless remote_cb is non-NULL.
172
+ */
173
+ void *remote_cb_payload;
113
174
  } git_clone_options;
114
175
 
115
176
  #define GIT_CLONE_OPTIONS_VERSION 1
@@ -130,9 +191,9 @@ GIT_EXTERN(int) git_clone_init_options(
130
191
  /**
131
192
  * Clone a remote repository.
132
193
  *
133
- * This version handles the simple case. If you'd like to create the
134
- * repository or remote with non-default settings, you can create and
135
- * configure them and then use `git_clone_into()`.
194
+ * By default this creates its repository and initial remote to match
195
+ * git's defaults. You can use the options in the callback to
196
+ * customize how these are created.
136
197
  *
137
198
  * @param out pointer that will receive the resulting repository object
138
199
  * @param url the remote repository to clone
@@ -149,59 +210,6 @@ GIT_EXTERN(int) git_clone(
149
210
  const char *local_path,
150
211
  const git_clone_options *options);
151
212
 
152
- /**
153
- * Clone into a repository
154
- *
155
- * After creating the repository and remote and configuring them for
156
- * paths and callbacks respectively, you can call this function to
157
- * perform the clone operation and optionally checkout files.
158
- *
159
- * @param repo the repository to use
160
- * @param remote the remote repository to clone from
161
- * @param co_opts options to use during checkout
162
- * @param branch the branch to checkout after the clone, pass NULL for the
163
- * remote's default branch
164
- * @param signature The identity used when updating the reflog.
165
- * @return 0 on success, any non-zero return value from a callback
166
- * function, or a negative value to indicate an error (use
167
- * `giterr_last` for a detailed error message)
168
- */
169
- GIT_EXTERN(int) git_clone_into(
170
- git_repository *repo,
171
- git_remote *remote,
172
- const git_checkout_options *co_opts,
173
- const char *branch,
174
- const git_signature *signature);
175
-
176
- /**
177
- * Perform a local clone into a repository
178
- *
179
- * A "local clone" bypasses any git-aware protocols and simply copies
180
- * over the object database from the source repository. It is often
181
- * faster than a git-aware clone, but no verification of the data is
182
- * performed, and can copy over too much data.
183
- *
184
- * @param repo the repository to use
185
- * @param remote the remote repository to clone from
186
- * @param co_opts options to use during checkout
187
- * @param branch the branch to checkout after the clone, pass NULL for the
188
- * remote's default branch
189
- * @param link wether to use hardlinks instead of copying
190
- * objects. This is only possible if both repositories are on the same
191
- * filesystem.
192
- * @param signature the identity used when updating the reflog
193
- * @return 0 on success, any non-zero return value from a callback
194
- * function, or a negative value to indicate an error (use
195
- * `giterr_last` for a detailed error message)
196
- */
197
- GIT_EXTERN(int) git_clone_local_into(
198
- git_repository *repo,
199
- git_remote *remote,
200
- const git_checkout_options *co_opts,
201
- const char *branch,
202
- int link,
203
- const git_signature *signature);
204
-
205
213
  /** @} */
206
214
  GIT_END_DECL
207
215
  #endif
@@ -136,7 +136,8 @@ typedef enum {
136
136
  GIT_OPT_ENABLE_CACHING,
137
137
  GIT_OPT_GET_CACHED_MEMORY,
138
138
  GIT_OPT_GET_TEMPLATE_PATH,
139
- GIT_OPT_SET_TEMPLATE_PATH
139
+ GIT_OPT_SET_TEMPLATE_PATH,
140
+ GIT_OPT_SET_SSL_CERT_LOCATIONS,
140
141
  } git_libgit2_opt_t;
141
142
 
142
143
  /**
@@ -221,6 +222,17 @@ typedef enum {
221
222
  * >
222
223
  * > - `path` directory of template.
223
224
  *
225
+ * * opts(GIT_OPT_SET_SSL_CERT_LOCATIONS, const char *file, const char *path)
226
+ *
227
+ * > Set the SSL certificate-authority locations.
228
+ * >
229
+ * > - `file` is the location of a file containing several
230
+ * > certificates concatenated together.
231
+ * > - `path` is the location of a directory holding several
232
+ * > certificates, one per file.
233
+ * >
234
+ * > Either parameter may be `NULL`, but not both.
235
+ *
224
236
  * @param option Option key
225
237
  * @param ... value to set the option
226
238
  * @return 0 on success, <0 on failure
@@ -242,20 +242,6 @@ GIT_EXTERN(int) git_config_open_global(git_config **out, git_config *config);
242
242
  */
243
243
  GIT_EXTERN(int) git_config_snapshot(git_config **out, git_config *config);
244
244
 
245
-
246
- /**
247
- * Reload changed config files
248
- *
249
- * A config file may be changed on disk out from under the in-memory
250
- * config object. This function causes us to look for files that have
251
- * been modified since we last loaded them and refresh the config with
252
- * the latest information.
253
- *
254
- * @param cfg The configuration to refresh
255
- * @return 0 or an error code
256
- */
257
- GIT_EXTERN(int) git_config_refresh(git_config *cfg);
258
-
259
245
  /**
260
246
  * Free the configuration and its associated memory and files
261
247
  *
@@ -0,0 +1,162 @@
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
+ #ifndef INCLUDE_git_describe_h__
8
+ #define INCLUDE_git_describe_h__
9
+
10
+ #include "common.h"
11
+ #include "types.h"
12
+ #include "buffer.h"
13
+
14
+ /**
15
+ * @file git2/describe.h
16
+ * @brief Git describing routines
17
+ * @defgroup git_describe Git describing routines
18
+ * @ingroup Git
19
+ * @{
20
+ */
21
+ GIT_BEGIN_DECL
22
+
23
+ /**
24
+ * Reference lookup strategy
25
+ *
26
+ * These behave like the --tags and --all optios to git-describe,
27
+ * namely they say to look for any reference in either refs/tags/ or
28
+ * refs/ respectively.
29
+ */
30
+ typedef enum {
31
+ GIT_DESCRIBE_DEFAULT,
32
+ GIT_DESCRIBE_TAGS,
33
+ GIT_DESCRIBE_ALL,
34
+ } git_describe_strategy_t;
35
+
36
+ /**
37
+ * Describe options structure
38
+ *
39
+ * Initialize with `GIT_DESCRIBE_OPTIONS_INIT` macro to correctly set
40
+ * the `version` field. E.g.
41
+ *
42
+ * git_describe_options opts = GIT_DESCRIBE_OPTIONS_INIT;
43
+ */
44
+ typedef struct git_describe_options {
45
+ unsigned int version;
46
+
47
+ unsigned int max_candidates_tags; /** default: 10 */
48
+ unsigned int describe_strategy; /** default: GIT_DESCRIBE_DEFAULT */
49
+ const char *pattern;
50
+ /**
51
+ * When calculating the distance from the matching tag or
52
+ * reference, only walk down the first-parent ancestry.
53
+ */
54
+ int only_follow_first_parent;
55
+ /**
56
+ * If no matching tag or reference is found, the describe
57
+ * operation would normally fail. If this option is set, it
58
+ * will instead fall back to showing the full id of the
59
+ * commit.
60
+ */
61
+ int show_commit_oid_as_fallback;
62
+ } git_describe_options;
63
+
64
+ #define GIT_DESCRIBE_DEFAULT_MAX_CANDIDATES_TAGS 10
65
+ #define GIT_DESCRIBE_DEFAULT_ABBREVIATED_SIZE 7
66
+
67
+ #define GIT_DESCRIBE_OPTIONS_VERSION 1
68
+ #define GIT_DESCRIBE_OPTIONS_INIT { \
69
+ GIT_DESCRIBE_OPTIONS_VERSION, \
70
+ GIT_DESCRIBE_DEFAULT_MAX_CANDIDATES_TAGS, \
71
+ }
72
+
73
+ GIT_EXTERN(int) git_describe_init_options(git_describe_options *opts, unsigned int version);
74
+
75
+ /**
76
+ * Options for formatting the describe string
77
+ */
78
+ typedef struct {
79
+ unsigned int version;
80
+
81
+ /**
82
+ * Size of the abbreviated commit id to use. This value is the
83
+ * lower bound for the length of the abbreviated string. The
84
+ * default is 7.
85
+ */
86
+ unsigned int abbreviated_size;
87
+
88
+ /**
89
+ * Set to use the long format even when a shorter name could be used.
90
+ */
91
+ int always_use_long_format;
92
+
93
+ /**
94
+ * If the workdir is dirty and this is set, this string will
95
+ * be appended to the description string.
96
+ */
97
+ char *dirty_suffix;
98
+ } git_describe_format_options;
99
+
100
+ #define GIT_DESCRIBE_FORMAT_OPTIONS_VERSION 1
101
+ #define GIT_DESCRIBE_FORMAT_OPTIONS_INIT { \
102
+ GIT_DESCRIBE_FORMAT_OPTIONS_VERSION, \
103
+ GIT_DESCRIBE_DEFAULT_ABBREVIATED_SIZE, \
104
+ }
105
+
106
+ GIT_EXTERN(int) git_describe_init_format_options(git_describe_format_options *opts, unsigned int version);
107
+
108
+ typedef struct git_describe_result git_describe_result;
109
+
110
+ /**
111
+ * Describe a commit
112
+ *
113
+ * Perform the describe operation on the given committish object.
114
+ *
115
+ * @param result pointer to store the result. You must free this once
116
+ * you're done with it.
117
+ * @param committish a committish to describe
118
+ * @param opts the lookup options
119
+ */
120
+ GIT_EXTERN(int) git_describe_commit(
121
+ git_describe_result **result,
122
+ git_object *committish,
123
+ git_describe_options *opts);
124
+
125
+ /**
126
+ * Describe a commit
127
+ *
128
+ * Perform the describe operation on the current commit and the
129
+ * worktree. After peforming describe on HEAD, a status is run and the
130
+ * description is considered to be dirty if there are.
131
+ *
132
+ * @param result pointer to store the result. You must free this once
133
+ * you're done with it.
134
+ * @param repo the repository in which to perform the describe
135
+ * @param opts the lookup options
136
+ */
137
+ GIT_EXTERN(int) git_describe_workdir(
138
+ git_describe_result **out,
139
+ git_repository *repo,
140
+ git_describe_options *opts);
141
+
142
+ /**
143
+ * Print the describe result to a buffer
144
+ *
145
+ * @param result the result from `git_describe_commit()` or
146
+ * `git_describe_workdir()`.
147
+ * @param opt the formatting options
148
+ */
149
+ GIT_EXTERN(int) git_describe_format(
150
+ git_buf *out,
151
+ const git_describe_result *result,
152
+ const git_describe_format_options *opts);
153
+
154
+ /**
155
+ * Free the describe result.
156
+ */
157
+ GIT_EXTERN(void) git_describe_result_free(git_describe_result *result);
158
+
159
+ /** @} */
160
+ GIT_END_DECL
161
+
162
+ #endif