diff options
author | Vicent Marti <tanoku@gmail.com> | 2012-05-19 03:46:11 +0400 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2012-05-19 03:46:11 +0400 |
commit | 5b9fac39d8a76b9139667c26a63e6b3f204b3977 (patch) | |
tree | e6ba28025f92c16563c4ffa8bc60b95f17d69691 /include/git2/remote.h | |
parent | 7ef9f1b5606c2672105ecbbf34c022a71ef212fe (diff) | |
parent | ad5df35a47d56c3d716d7a56eac4aeb611987c11 (diff) |
Merge branch 'development'v0.17.0
Conflicts:
.travis.yml
Diffstat (limited to 'include/git2/remote.h')
-rw-r--r-- | include/git2/remote.h | 84 |
1 files changed, 71 insertions, 13 deletions
diff --git a/include/git2/remote.h b/include/git2/remote.h index 0ae38165c..865dfef04 100644 --- a/include/git2/remote.h +++ b/include/git2/remote.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2011 the libgit2 contributors + * Copyright (C) 2009-2012 the libgit2 contributors * * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. @@ -11,6 +11,7 @@ #include "repository.h" #include "refspec.h" #include "net.h" +#include "indexer.h" /** * @file git2/remote.h @@ -37,11 +38,12 @@ GIT_BEGIN_DECL * * @param out pointer to the new remote object * @param repo the associtated repository - * @param url the remote repository's URL * @param name the remote's name - * @return GIT_SUCCESS or an error code + * @param url the remote repository's URL + * @param fetch the fetch refspec to use for this remote + * @return 0 or an error code */ -GIT_EXTERN(int) git_remote_new(git_remote **out, git_repository *repo, const char *url, const char *name); +GIT_EXTERN(int) git_remote_new(git_remote **out, git_repository *repo, const char *name, const char *url, const char *fetch); /** * Get the information for a particular remote @@ -49,11 +51,19 @@ GIT_EXTERN(int) git_remote_new(git_remote **out, git_repository *repo, const cha * @param out pointer to the new remote object * @param cfg the repository's configuration * @param name the remote's name - * @return GIT_SUCCESS or an error code + * @return 0 or an error code */ GIT_EXTERN(int) git_remote_load(git_remote **out, git_repository *repo, const char *name); /** + * Save a remote to its repository's configuration + * + * @param remote the remote to save to config + * @return 0 or an error code + */ +GIT_EXTERN(int) git_remote_save(const git_remote *remote); + +/** * Get the remote's name * * @param remote the remote @@ -70,6 +80,15 @@ GIT_EXTERN(const char *) git_remote_name(git_remote *remote); GIT_EXTERN(const char *) git_remote_url(git_remote *remote); /** + * Set the remote's fetch refspec + * + * @param remote the remote + * @apram spec the new fetch refspec + * @return 0 or an error value + */ +GIT_EXTERN(int) git_remote_set_fetchspec(git_remote *remote, const char *spec); + +/** * Get the fetch refspec * * @param remote the remote @@ -78,6 +97,15 @@ GIT_EXTERN(const char *) git_remote_url(git_remote *remote); GIT_EXTERN(const git_refspec *) git_remote_fetchspec(git_remote *remote); /** + * Set the remote's push refspec + * + * @param remote the remote + * @apram spec the new push refspec + * @return 0 or an error value + */ +GIT_EXTERN(int) git_remote_set_pushspec(git_remote *remote, const char *spec); + +/** * Get the push refspec * * @param remote the remote @@ -95,7 +123,7 @@ GIT_EXTERN(const git_refspec *) git_remote_pushspec(git_remote *remote); * * @param remote the remote to connect to * @param direction whether you want to receive or send data - * @return GIT_SUCCESS or an error code + * @return 0 or an error code */ GIT_EXTERN(int) git_remote_connect(git_remote *remote, int direction); @@ -107,7 +135,7 @@ GIT_EXTERN(int) git_remote_connect(git_remote *remote, int direction); * * @param refs where to store the refs * @param remote the remote - * @return GIT_SUCCESS or an error code + * @return 0 or an error code */ GIT_EXTERN(int) git_remote_ls(git_remote *remote, git_headlist_cb list_cb, void *payload); @@ -122,9 +150,9 @@ GIT_EXTERN(int) git_remote_ls(git_remote *remote, git_headlist_cb list_cb, void * * @param remote the remote to download from * @param filename where to store the temproray filename - * @return GIT_SUCCESS or an error code + * @return 0 or an error code */ -GIT_EXTERN(int) git_remote_download(char **filename, git_remote *remote); +GIT_EXTERN(int) git_remote_download(git_remote *remote, git_off_t *bytes, git_indexer_stats *stats); /** * Check whether the remote is connected @@ -149,6 +177,9 @@ GIT_EXTERN(void) git_remote_disconnect(git_remote *remote); /** * Free the memory associated with a remote * + * This also disconnects from the remote, if the connection + * has not been closed yet (using git_remote_disconnect). + * * @param remote the remote to free */ GIT_EXTERN(void) git_remote_free(git_remote *remote); @@ -156,12 +187,10 @@ GIT_EXTERN(void) git_remote_free(git_remote *remote); /** * Update the tips to the new state * - * Make sure that you only call this once you've successfully indexed - * or expanded the packfile. - * * @param remote the remote to update + * @param cb callback to run on each ref update. 'a' is the old value, 'b' is then new value */ -GIT_EXTERN(int) git_remote_update_tips(git_remote *remote); +GIT_EXTERN(int) git_remote_update_tips(git_remote *remote, int (*cb)(const char *refname, const git_oid *a, const git_oid *b)); /** * Return whether a string is a valid remote URL @@ -171,6 +200,35 @@ GIT_EXTERN(int) git_remote_update_tips(git_remote *remote); */ GIT_EXTERN(int) git_remote_valid_url(const char *url); +/** + * Return whether the passed URL is supported by this version of the library. + * + * @param url the url to check + * @return 1 if the url is supported, 0 otherwise +*/ +GIT_EXTERN(int) git_remote_supported_url(const char* url); + +/** + * Get a list of the configured remotes for a repo + * + * The string array must be freed by the user. + * + * @param remotes_list a string array with the names of the remotes + * @param repo the repository to query + * @return 0 or an error code + */ +GIT_EXTERN(int) git_remote_list(git_strarray *remotes_list, git_repository *repo); + +/** + * Add a remote with the default fetch refspec to the repository's configuration + * + * @param out the resulting remote + * @param repo the repository in which to create the remote + * @param name the remote's name + * @param url the remote's url + */ +GIT_EXTERN(int) git_remote_add(git_remote **out, git_repository *repo, const char *name, const char *url); + /** @} */ GIT_END_DECL #endif |