diff options
Diffstat (limited to 'include/git2')
-rw-r--r-- | include/git2/checkout.h | 3 | ||||
-rw-r--r-- | include/git2/config.h | 3 | ||||
-rw-r--r-- | include/git2/diff.h | 21 | ||||
-rw-r--r-- | include/git2/odb_backend.h | 4 | ||||
-rw-r--r-- | include/git2/refs.h | 2 | ||||
-rw-r--r-- | include/git2/remote.h | 7 | ||||
-rw-r--r-- | include/git2/repository.h | 4 | ||||
-rw-r--r-- | include/git2/status.h | 3 | ||||
-rw-r--r-- | include/git2/strarray.h | 5 | ||||
-rw-r--r-- | include/git2/transport.h | 5 |
10 files changed, 43 insertions, 14 deletions
diff --git a/include/git2/checkout.h b/include/git2/checkout.h index bd988db2c..ea6e219ba 100644 --- a/include/git2/checkout.h +++ b/include/git2/checkout.h @@ -186,7 +186,8 @@ typedef struct git_checkout_opts { git_strarray paths; } git_checkout_opts; -#define GIT_CHECKOUT_OPTS_INIT {1, 0} +#define GIT_CHECKOUT_OPTS_VERSION 1 +#define GIT_CHECKOUT_OPTS_INIT {GIT_CHECKOUT_OPTS_VERSION, 0} /** * Updates files in the index and the working tree to match the content of the diff --git a/include/git2/config.h b/include/git2/config.h index af4d54044..4855babec 100644 --- a/include/git2/config.h +++ b/include/git2/config.h @@ -49,6 +49,7 @@ typedef int (*git_config_foreach_cb)(const git_config_entry *, void *); * access a configuration file */ struct git_config_backend { + unsigned int version; struct git_config *cfg; /* Open means open the file/database and parse if necessary */ @@ -62,6 +63,8 @@ struct git_config_backend { int (*refresh)(struct git_config_backend *); void (*free)(struct git_config_backend *); }; +#define GIT_CONFIG_BACKEND_VERSION 1 +#define GIT_CONFIG_BACKEND_INIT {GIT_CONFIG_BACKEND_VERSION, 0} typedef enum { GIT_CVAR_FALSE = 0, diff --git a/include/git2/diff.h b/include/git2/diff.h index fd00378af..6732c30da 100644 --- a/include/git2/diff.h +++ b/include/git2/diff.h @@ -106,16 +106,19 @@ typedef enum { * - max_size: maximum blob size to diff, above this treated as binary */ typedef struct { - unsigned int version; /**< version for the struct */ - uint32_t flags; /**< defaults to GIT_DIFF_NORMAL */ - uint16_t context_lines; /**< defaults to 3 */ - uint16_t interhunk_lines; /**< defaults to 0 */ - char *old_prefix; /**< defaults to "a" */ - char *new_prefix; /**< defaults to "b" */ - git_strarray pathspec; /**< defaults to show all paths */ - git_off_t max_size; /**< defaults to 512Mb */ + unsigned int version; /**< version for the struct */ + uint32_t flags; /**< defaults to GIT_DIFF_NORMAL */ + uint16_t context_lines; /**< defaults to 3 */ + uint16_t interhunk_lines; /**< defaults to 0 */ + char *old_prefix; /**< defaults to "a" */ + char *new_prefix; /**< defaults to "b" */ + git_strarray pathspec; /**< defaults to show all paths */ + git_off_t max_size; /**< defaults to 512mb */ } git_diff_options; +#define GIT_DIFF_OPTIONS_VERSION 1 +#define GIT_DIFF_OPTIONS_INIT {GIT_DIFF_OPTIONS_VERSION, 0} + /** * The diff list object that contains all individual file deltas. */ @@ -304,6 +307,8 @@ typedef struct { unsigned int target_limit; } git_diff_find_options; +#define GIT_DIFF_FIND_OPTIONS_VERSION 1 +#define GIT_DIFF_FIND_OPTIONS_INIT {GIT_DIFF_FIND_OPTIONS_VERSION, 0} /** @name Diff List Generator Functions * diff --git a/include/git2/odb_backend.h b/include/git2/odb_backend.h index 04658f9b3..3963ae531 100644 --- a/include/git2/odb_backend.h +++ b/include/git2/odb_backend.h @@ -33,6 +33,7 @@ typedef int (*git_odb_foreach_cb)(const git_oid *id, void *payload); * An instance for a custom backend */ struct git_odb_backend { + unsigned int version; git_odb *odb; /* read and read_prefix each return to libgit2 a buffer which @@ -98,6 +99,9 @@ struct git_odb_backend { void (* free)(struct git_odb_backend *); }; +#define GIT_ODB_BACKEND_VERSION 1 +#define GIT_ODB_BACKEND_INIT {GIT_ODB_BACKEND_VERSION, 0} + /** Streaming mode */ enum { GIT_STREAM_RDONLY = (1 << 1), diff --git a/include/git2/refs.h b/include/git2/refs.h index f3082102f..cfc96a68c 100644 --- a/include/git2/refs.h +++ b/include/git2/refs.h @@ -387,7 +387,7 @@ GIT_EXTERN(int) git_reference_foreach_glob( git_repository *repo, const char *glob, unsigned int list_flags, - int (*callback)(const char *reference_name, void *payload), + git_reference_foreach_cb callback, void *payload); /** diff --git a/include/git2/remote.h b/include/git2/remote.h index 0483cfc4b..75e2a59d8 100644 --- a/include/git2/remote.h +++ b/include/git2/remote.h @@ -347,12 +347,16 @@ typedef enum git_remote_completion_type { * Set the calbacks to be called by the remote. */ struct git_remote_callbacks { + unsigned int version; void (*progress)(const char *str, int len, void *data); int (*completion)(git_remote_completion_type type, void *data); int (*update_tips)(const char *refname, const git_oid *a, const git_oid *b, void *data); void *payload; }; +#define GIT_REMOTE_CALLBACKS_VERSION 1 +#define GIT_REMOTE_CALLBACKS_INIT {GIT_REMOTE_CALLBACKS_VERSION, 0} + /** * Set the callbacks for a remote * @@ -361,8 +365,9 @@ struct git_remote_callbacks { * * @param remote the remote to configure * @param callbacks a pointer to the user's callback settings + * @return 0 or an error code */ -GIT_EXTERN(void) git_remote_set_callbacks(git_remote *remote, git_remote_callbacks *callbacks); +GIT_EXTERN(int) git_remote_set_callbacks(git_remote *remote, git_remote_callbacks *callbacks); /** * Get the statistics structure that is filled in by the fetch operation. diff --git a/include/git2/repository.h b/include/git2/repository.h index e91108a33..0d82b9810 100644 --- a/include/git2/repository.h +++ b/include/git2/repository.h @@ -239,6 +239,7 @@ typedef enum { * will be added pointing to this URL. */ typedef struct { + unsigned int version; uint32_t flags; uint32_t mode; const char *workdir_path; @@ -248,6 +249,9 @@ typedef struct { const char *origin_url; } git_repository_init_options; +#define GIT_REPOSITORY_INIT_OPTIONS_VERSION 1 +#define GIT_REPOSITORY_INIT_OPTIONS_INIT {GIT_REPOSITORY_INIT_OPTIONS_VERSION, 0} + /** * Create a new Git repository in the given folder with extended controls. * diff --git a/include/git2/status.h b/include/git2/status.h index c6926f343..1211f1d9f 100644 --- a/include/git2/status.h +++ b/include/git2/status.h @@ -164,6 +164,9 @@ typedef struct { git_strarray pathspec; } git_status_options; +#define GIT_STATUS_OPTIONS_VERSION 1 +#define GIT_STATUS_OPTIONS_INIT {GIT_STATUS_OPTIONS_VERSION, 0} + /** * Gather file status information and run callbacks as requested. * diff --git a/include/git2/strarray.h b/include/git2/strarray.h index 030567978..338d13873 100644 --- a/include/git2/strarray.h +++ b/include/git2/strarray.h @@ -19,11 +19,10 @@ GIT_BEGIN_DECL /** Array of strings */ -typedef struct _git_strarray git_strarray; -struct _git_strarray { +typedef struct git_strarray { char **strings; size_t count; -}; +} git_strarray; /** * Close a string array object diff --git a/include/git2/transport.h b/include/git2/transport.h index 61726922f..60ac3f242 100644 --- a/include/git2/transport.h +++ b/include/git2/transport.h @@ -82,6 +82,7 @@ typedef enum { typedef void (*git_transport_message_cb)(const char *str, int len, void *data); typedef struct git_transport { + unsigned int version; /* Set progress and error callbacks */ int (*set_callbacks)(struct git_transport *transport, git_transport_message_cb progress_cb, @@ -140,6 +141,9 @@ typedef struct git_transport { void (*free)(struct git_transport *transport); } git_transport; +#define GIT_TRANSPORT_VERSION 1 +#define GIT_TRANSPORT_INIT {GIT_TRANSPORT_VERSION, 0} + /** * Function to use to create a transport from a URL. The transport database * is scanned to find a transport that implements the scheme of the URI (i.e. @@ -284,6 +288,7 @@ typedef int (*git_smart_subtransport_cb)( typedef struct git_smart_subtransport_definition { /* The function to use to create the git_smart_subtransport */ git_smart_subtransport_cb callback; + /* True if the protocol is stateless; false otherwise. For example, * http:// is stateless, but git:// is not. */ unsigned rpc : 1; |