summaryrefslogtreecommitdiff
path: root/include/git2
diff options
context:
space:
mode:
Diffstat (limited to 'include/git2')
-rw-r--r--include/git2/common.h3
-rw-r--r--include/git2/diff.h29
-rw-r--r--include/git2/sys/stream.h13
3 files changed, 40 insertions, 5 deletions
diff --git a/include/git2/common.h b/include/git2/common.h
index 577906115..bf341e79f 100644
--- a/include/git2/common.h
+++ b/include/git2/common.h
@@ -145,6 +145,7 @@ typedef enum {
GIT_OPT_GET_TEMPLATE_PATH,
GIT_OPT_SET_TEMPLATE_PATH,
GIT_OPT_SET_SSL_CERT_LOCATIONS,
+ GIT_OPT_SET_USER_AGENT,
} git_libgit2_opt_t;
/**
@@ -240,6 +241,8 @@ typedef enum {
* >
* > Either parameter may be `NULL`, but not both.
*
+ * * opts(GIT_OPT_SET_USER_AGENT, const char *user_agent)
+ *
* @param option Option key
* @param ... value to set the option
* @return 0 on success, <0 on failure
diff --git a/include/git2/diff.h b/include/git2/diff.h
index a0f6db350..cbffdb49a 100644
--- a/include/git2/diff.h
+++ b/include/git2/diff.h
@@ -351,6 +351,22 @@ typedef int (*git_diff_notify_cb)(
void *payload);
/**
+ * Diff progress callback.
+ *
+ * Called before each file comparison.
+ *
+ * @param diff_so_far The diff being generated.
+ * @param old_path The path to the old file or NULL.
+ * @param new_path The path to the new file or NULL.
+ * @return Non-zero to abort the diff.
+ */
+typedef int (*git_diff_progress_cb)(
+ const git_diff *diff_so_far,
+ const char *old_path,
+ const char *new_path,
+ void *payload);
+
+/**
* Structure describing options about how the diff should be executed.
*
* Setting all values of the structure to zero will yield the default
@@ -370,8 +386,10 @@ typedef int (*git_diff_notify_cb)(
* - `max_size` is a file size (in bytes) above which a blob will be marked
* as binary automatically; pass a negative value to disable.
* - `notify_cb` is an optional callback function, notifying the consumer of
- * which files are being examined as the diff is generated
- * - `notify_payload` is the payload data to pass to the `notify_cb` function
+ * changes to the diff as new deltas are added.
+ * - `progress_cb` is an optional callback function, notifying the consumer of
+ * which files are being examined as the diff is generated.
+ * - `payload` is the payload to pass to the callback functions.
* - `ignore_submodules` overrides the submodule ignore setting for all
* submodules in the diff.
*/
@@ -383,8 +401,9 @@ typedef struct {
git_submodule_ignore_t ignore_submodules; /**< submodule ignore rule */
git_strarray pathspec; /**< defaults to include all paths */
- git_diff_notify_cb notify_cb;
- void *notify_payload;
+ git_diff_notify_cb notify_cb;
+ git_diff_progress_cb progress_cb;
+ void *payload;
/* options controlling how to diff text is generated */
@@ -403,7 +422,7 @@ typedef struct {
* `git_diff_options_init` programmatic initialization.
*/
#define GIT_DIFF_OPTIONS_INIT \
- {GIT_DIFF_OPTIONS_VERSION, 0, GIT_SUBMODULE_IGNORE_UNSPECIFIED, {NULL,0}, NULL, NULL, 3}
+ {GIT_DIFF_OPTIONS_VERSION, 0, GIT_SUBMODULE_IGNORE_UNSPECIFIED, {NULL,0}, NULL, NULL, NULL, 3}
/**
* Initializes a `git_diff_options` with default values. Equivalent to
diff --git a/include/git2/sys/stream.h b/include/git2/sys/stream.h
index 55a714bbb..2b4ff7fd8 100644
--- a/include/git2/sys/stream.h
+++ b/include/git2/sys/stream.h
@@ -39,6 +39,19 @@ typedef struct git_stream {
void (*free)(struct git_stream *);
} git_stream;
+typedef int (*git_stream_cb)(git_stream **out, const char *host, const char *port);
+
+/**
+ * Register a TLS stream constructor for the library to use
+ *
+ * If a constructor is already set, it will be overwritten. Pass
+ * `NULL` in order to deregister the current constructor.
+ *
+ * @param ctor the constructor to use
+ * @return 0 or an error code
+ */
+GIT_EXTERN(int) git_stream_register_tls(git_stream_cb ctor);
+
GIT_END_DECL
#endif