]>
git.proxmox.com Git - libgit2.git/blob - include/git2/remote.h
2 * Copyright (C) 2009-2012 the libgit2 contributors
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.
7 #ifndef INCLUDE_git_remote_h__
8 #define INCLUDE_git_remote_h__
11 #include "repository.h"
17 * @brief Git remote management functions
18 * @defgroup git_remote remote management functions
25 * TODO: This functions still need to be implemented:
29 * - _del (needs support from config)
33 * Create a remote in memory
35 * Create a remote with the default refspecs in memory. You can use
36 * this when you have a URL instead of a remote's name.
38 * @param out pointer to the new remote object
39 * @param repo the associtated repository
40 * @param url the remote repository's URL
41 * @param name the remote's name
42 * @return GIT_SUCCESS or an error code
44 GIT_EXTERN(int) git_remote_new(git_remote
**out
, git_repository
*repo
, const char *url
, const char *name
);
47 * Get the information for a particular remote
49 * @param out pointer to the new remote object
50 * @param cfg the repository's configuration
51 * @param name the remote's name
52 * @return GIT_SUCCESS or an error code
54 GIT_EXTERN(int) git_remote_load(git_remote
**out
, git_repository
*repo
, const char *name
);
57 * Get the remote's name
59 * @param remote the remote
60 * @return a pointer to the name
62 GIT_EXTERN(const char *) git_remote_name(git_remote
*remote
);
65 * Get the remote's url
67 * @param remote the remote
68 * @return a pointer to the url
70 GIT_EXTERN(const char *) git_remote_url(git_remote
*remote
);
73 * Get the fetch refspec
75 * @param remote the remote
76 * @return a pointer to the fetch refspec or NULL if it doesn't exist
78 GIT_EXTERN(const git_refspec
*) git_remote_fetchspec(git_remote
*remote
);
81 * Get the push refspec
83 * @param remote the remote
84 * @return a pointer to the push refspec or NULL if it doesn't exist
87 GIT_EXTERN(const git_refspec
*) git_remote_pushspec(git_remote
*remote
);
90 * Open a connection to a remote
92 * The transport is selected based on the URL. The direction argument
93 * is due to a limitation of the git protocol (over TCP or SSH) which
94 * starts up a specific binary which can only do the one or the other.
96 * @param remote the remote to connect to
97 * @param direction whether you want to receive or send data
98 * @return GIT_SUCCESS or an error code
100 GIT_EXTERN(int) git_remote_connect(git_remote
*remote
, int direction
);
103 * Get a list of refs at the remote
105 * The remote (or more exactly its transport) must be connected. The
106 * memory belongs to the remote.
108 * @param refs where to store the refs
109 * @param remote the remote
110 * @return GIT_SUCCESS or an error code
112 GIT_EXTERN(int) git_remote_ls(git_remote
*remote
, git_headlist_cb list_cb
, void *payload
);
115 * Download the packfile
117 * Negotiate what objects should be downloaded and download the
118 * packfile with those objects. The packfile is downloaded with a
119 * temporary filename, as it's final name is not known yet. If there
120 * was no packfile needed (all the objects were available locally),
121 * filename will be NULL and the function will return success.
123 * @param remote the remote to download from
124 * @param filename where to store the temproray filename
125 * @return GIT_SUCCESS or an error code
127 GIT_EXTERN(int) git_remote_download(char **filename
, git_remote
*remote
);
130 * Check whether the remote is connected
132 * Check whether the remote's underlying transport is connected to the
135 * @return 1 if it's connected, 0 otherwise.
137 GIT_EXTERN(int) git_remote_connected(git_remote
*remote
);
140 * Disconnect from the remote
142 * Close the connection to the remote and free the underlying
145 * @param remote the remote to disconnect from
147 GIT_EXTERN(void) git_remote_disconnect(git_remote
*remote
);
150 * Free the memory associated with a remote
152 * @param remote the remote to free
154 GIT_EXTERN(void) git_remote_free(git_remote
*remote
);
157 * Update the tips to the new state
159 * Make sure that you only call this once you've successfully indexed
160 * or expanded the packfile.
162 * @param remote the remote to update
164 GIT_EXTERN(int) git_remote_update_tips(git_remote
*remote
);
167 * Return whether a string is a valid remote URL
169 * @param tranport the url to check
170 * @param 1 if the url is valid, 0 otherwise
172 GIT_EXTERN(int) git_remote_valid_url(const char *url
);