]> git.proxmox.com Git - libgit2.git/blame - include/git2/remote.h
Cleanup legal data
[libgit2.git] / include / git2 / remote.h
CommitLineData
bdd18829 1/*
bb742ede 2 * Copyright (C) 2009-2011 the libgit2 contributors
bdd18829 3 *
bb742ede
VM
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.
bdd18829 6 */
9c82357b
CMN
7#ifndef INCLUDE_git_remote_h__
8#define INCLUDE_git_remote_h__
9
10#include "git2/common.h"
11#include "git2/repository.h"
12#include "git2/refspec.h"
1e76676f
CMN
13/**
14 * @file git2/remote.h
15 * @brief Git remote management functions
16 * @defgroup git_remote remote management functions
17 * @ingroup Git
18 * @{
19 */
20GIT_BEGIN_DECL
9c82357b 21
f8f3feb0
CMN
22/*
23 * TODO: This functions still need to be implemented:
24 * - _listcb/_foreach
25 * - _add
26 * - _rename
27 * - _del (needs support from config)
28 */
29
778e1c73
CMN
30/**
31 * Create a new unnamed remote
32 *
33 * Useful when you don't want to store the remote
34 *
35 * @param out pointer to the new remote object
36 * @param repo the associtated repository
37 * @param url the remote repository's URL
d9111722 38 * @return GIT_SUCCESS or an error code
778e1c73
CMN
39 */
40int git_remote_new(git_remote **out, git_repository *repo, const char *url);
41
9c82357b
CMN
42/**
43 * Get the information for a particular remote
44 *
45 * @param out pointer to the new remote object
46 * @param cfg the repository's configuration
47 * @param name the remote's name
d9111722 48 * @return GIT_SUCCESS or an error code
9c82357b
CMN
49 */
50GIT_EXTERN(int) git_remote_get(struct git_remote **out, struct git_config *cfg, const char *name);
51
52/**
53 * Get the remote's name
54 *
55 * @param remote the remote
56 * @return a pointer to the name
57 */
58GIT_EXTERN(const char *) git_remote_name(struct git_remote *remote);
59
60/**
61 * Get the remote's url
62 *
63 * @param remote the remote
64 * @return a pointer to the url
65 */
66GIT_EXTERN(const char *) git_remote_url(struct git_remote *remote);
67
68/**
69 * Get the fetch refspec
70 *
71 * @param remote the remote
72 * @return a pointer to the fetch refspec or NULL if it doesn't exist
73 */
74GIT_EXTERN(const git_refspec *) git_remote_fetchspec(struct git_remote *remote);
75
76/**
77 * Get the push refspec
78 *
79 * @param remote the remote
80 * @return a pointer to the push refspec or NULL if it doesn't exist
81 */
82
91d8a4c0 83GIT_EXTERN(const git_refspec *) git_remote_pushspec(struct git_remote *remote);
9c82357b 84
9ba49bb5
CMN
85/**
86 * Open a connection to a remote
87 *
e1d88030
CMN
88 * The transport is selected based on the URL. The direction argument
89 * is due to a limitation of the git protocol (over TCP or SSH) which
90 * starts up a specific binary which can only do the one or the other.
9ba49bb5
CMN
91 *
92 * @param remote the remote to connect to
e1d88030 93 * @param direction whether you want to receive or send data
9ba49bb5
CMN
94 * @return GIT_SUCCESS or an error code
95 */
0ac2726f 96GIT_EXTERN(int) git_remote_connect(struct git_remote *remote, int direction);
9ba49bb5
CMN
97
98/**
99 * Get a list of refs at the remote
100 *
101 * The remote (or more exactly its transport) must be connected.
102 *
103 * @param refs where to store the refs
104 * @param remote the remote
105 * @return GIT_SUCCESS or an error code
106 */
107GIT_EXTERN(int) git_remote_ls(git_remote *remote, git_headarray *refs);
108
e1d88030
CMN
109/**
110 * Negotiate what data needs to be exchanged to synchroize the remtoe
111 * and local references
112 *
113 * @param remote the remote you want to negotiate with
114 */
115GIT_EXTERN(int) git_remote_negotiate(git_remote *remote);
116
48a65a07
CMN
117/**
118 * Download the packfile
119 *
120 * The packfile is downloaded with a temporary filename, as it's final
121 * name is not known yet. If there was no packfile needed (all the
122 * objects were available locally), filename will be NULL and the
123 * function will return success.
124 *
125 * @param remote the remote to download from
126 * @param filename where to store the temproray filename
127 * @return GIT_SUCCESS or an error code
128 */
129GIT_EXTERN(int) git_remote_download(char **filename, git_remote *remote);
130
9c82357b
CMN
131/**
132 * Free the memory associated with a remote
133 *
134 * @param remote the remote to free
135 */
136GIT_EXTERN(void) git_remote_free(struct git_remote *remote);
137
441f57c2
CMN
138/**
139 * Update the tips to the new state
140 *
141 * Make sure that you only call this once you've successfully indexed
142 * or expanded the packfile.
143 *
144 * @param remote the remote to update
145 */
146GIT_EXTERN(int) git_remote_update_tips(struct git_remote *remote);
147
1e76676f 148/** @} */
bdd18829 149GIT_END_DECL
9c82357b 150#endif