Push code for transport library
[git/git.git] / remote.h
CommitLineData
5751f490
DB
1#ifndef REMOTE_H
2#define REMOTE_H
3
4struct remote {
5 const char *name;
6
7 const char **uri;
8 int uri_nr;
9
10 const char **push_refspec;
6b62816c 11 struct refspec *push;
5751f490
DB
12 int push_refspec_nr;
13
5d46c9d4
DB
14 const char **fetch_refspec;
15 struct refspec *fetch;
16 int fetch_refspec_nr;
17
5751f490 18 const char *receivepack;
0012ba21 19 const char *uploadpack;
5751f490
DB
20};
21
22struct remote *remote_get(const char *name);
23
b42f6927
JS
24typedef int each_remote_fn(struct remote *remote, void *priv);
25int for_each_remote(each_remote_fn fn, void *priv);
26
5d46c9d4
DB
27int remote_has_uri(struct remote *remote, const char *uri);
28
6b62816c
DB
29struct refspec {
30 unsigned force : 1;
31 unsigned pattern : 1;
32
b42f6927 33 char *src;
6b62816c
DB
34 char *dst;
35};
36
dfd255dd
DB
37struct ref *alloc_ref(unsigned namelen);
38
39/*
40 * Frees the entire list and peers of elements.
41 */
42void free_refs(struct ref *ref);
43
6b62816c
DB
44int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
45 int nr_refspec, char **refspec, int all);
46
5d46c9d4
DB
47/*
48 * For the given remote, reads the refspec's src and sets the other fields.
49 */
50int remote_find_tracking(struct remote *remote, struct refspec *refspec);
51
cf818348
DB
52struct branch {
53 const char *name;
54 const char *refname;
55
56 const char *remote_name;
57 struct remote *remote;
58
59 const char **merge_name;
60 struct refspec **merge;
61 int merge_nr;
62};
63
64struct branch *branch_get(const char *name);
65
66int branch_has_merge_config(struct branch *branch);
67
68int branch_merges(struct branch *branch, const char *refname);
69
5751f490 70#endif