From 95057b85034a226ed5f9bcd7a461a296bbdb7bd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Fri, 18 Nov 2011 21:18:39 +0100 Subject: remote: get rid of git_remote_negotiate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is no good reason to expose the negotiation as a different step to downloading the packfile. Signed-off-by: Carlos Martín Nieto --- include/git2/remote.h | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'include') diff --git a/include/git2/remote.h b/include/git2/remote.h index 54116c22..0781bb77 100644 --- a/include/git2/remote.h +++ b/include/git2/remote.h @@ -106,21 +106,14 @@ GIT_EXTERN(int) git_remote_connect(struct git_remote *remote, int direction); */ GIT_EXTERN(int) git_remote_ls(git_remote *remote, git_headarray *refs); -/** - * Negotiate what data needs to be exchanged to synchroize the remtoe - * and local references - * - * @param remote the remote you want to negotiate with - */ -GIT_EXTERN(int) git_remote_negotiate(git_remote *remote); - /** * Download the packfile * - * The packfile is downloaded with a temporary filename, as it's final - * name is not known yet. If there was no packfile needed (all the - * objects were available locally), filename will be NULL and the - * function will return success. + * Negotiate what objects should be downloaded and download the + * packfile with those objects. The packfile is downloaded with a + * temporary filename, as it's final name is not known yet. If there + * was no packfile needed (all the objects were available locally), + * filename will be NULL and the function will return success. * * @param remote the remote to download from * @param filename where to store the temproray filename -- cgit v1.2.1 From 617bfdf47fbe307070dcd084a4e3ea410823c88c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Fri, 18 Nov 2011 21:28:07 +0100 Subject: Add a name to a remote created from the API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make it a bit more resilient. Signed-off-by: Carlos Martín Nieto --- include/git2/remote.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/git2/remote.h b/include/git2/remote.h index 0781bb77..15d0aa3c 100644 --- a/include/git2/remote.h +++ b/include/git2/remote.h @@ -28,16 +28,18 @@ GIT_BEGIN_DECL */ /** - * Create a new unnamed remote + * Create a remote in memory * - * Useful when you don't want to store the remote + * Create a remote with the default refspecs in memory. You can use + * this when you have a URL instead of a remote's name. * * @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 */ -int git_remote_new(git_remote **out, git_repository *repo, const char *url); +int git_remote_new(git_remote **out, git_repository *repo, const char *url, const char *name); /** * Get the information for a particular remote -- cgit v1.2.1 From 4cf01e9a1a3b81d1c8bc77fcdf7e0c20792175a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Mon, 21 Nov 2011 20:44:03 +0100 Subject: Add git_remote_disconnect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It can be useful to separate disconnecting from actually destroying the object. Signed-off-by: Carlos Martín Nieto --- include/git2/remote.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include') diff --git a/include/git2/remote.h b/include/git2/remote.h index 15d0aa3c..94453db5 100644 --- a/include/git2/remote.h +++ b/include/git2/remote.h @@ -123,6 +123,16 @@ GIT_EXTERN(int) git_remote_ls(git_remote *remote, git_headarray *refs); */ GIT_EXTERN(int) git_remote_download(char **filename, git_remote *remote); +/** + * Disconnect from the remote + * + * Close the connection to the remote and free the underlying + * transport. + * + * @param remote the remote to disconnect from + */ +GIT_EXTERN(void) git_remote_disconnect(git_remote *remote); + /** * Free the memory associated with a remote * -- cgit v1.2.1 From 6ac3b707b14217602152c032a11304757c88612c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Mon, 21 Nov 2011 20:48:59 +0100 Subject: Add git_remote_connected MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Carlos Martín Nieto --- include/git2/remote.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include') diff --git a/include/git2/remote.h b/include/git2/remote.h index 94453db5..87f84f8e 100644 --- a/include/git2/remote.h +++ b/include/git2/remote.h @@ -123,6 +123,16 @@ GIT_EXTERN(int) git_remote_ls(git_remote *remote, git_headarray *refs); */ GIT_EXTERN(int) git_remote_download(char **filename, git_remote *remote); +/** + * Check whether the remote is connected + * + * Check whether the remote's underlying transport is connected to the + * remote host. + * + * @return 1 if it's connected, 0 otherwise. + */ +GIT_EXTERN(int) git_remote_connected(git_remote *remote); + /** * Disconnect from the remote * -- cgit v1.2.1