]> git.ipfire.org Git - thirdparty/git.git/blame - remote.h
GIT 1.5.4.6
[thirdparty/git.git] / remote.h
CommitLineData
5751f490
DB
1#ifndef REMOTE_H
2#define REMOTE_H
3
4struct remote {
5 const char *name;
6
28b91f8a
SP
7 const char **url;
8 int url_nr;
5751f490
DB
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
d71ab174
DB
18 /*
19 * -1 to never fetch tags
20 * 0 to auto-follow tags on heuristic (default)
21 * 1 to always auto-follow tags
22 * 2 to always fetch tags
23 */
24 int fetch_tags;
25
5751f490 26 const char *receivepack;
0012ba21 27 const char *uploadpack;
14c98218
SV
28
29 /*
30 * for curl remotes only
31 */
32 char *http_proxy;
5751f490
DB
33};
34
35struct remote *remote_get(const char *name);
36
b42f6927
JS
37typedef int each_remote_fn(struct remote *remote, void *priv);
38int for_each_remote(each_remote_fn fn, void *priv);
39
28b91f8a 40int remote_has_url(struct remote *remote, const char *url);
5d46c9d4 41
6b62816c
DB
42struct refspec {
43 unsigned force : 1;
44 unsigned pattern : 1;
45
b42f6927 46 char *src;
6b62816c
DB
47 char *dst;
48};
49
dfd255dd
DB
50struct ref *alloc_ref(unsigned namelen);
51
4577370e
DB
52struct ref *copy_ref_list(const struct ref *ref);
53
54int check_ref_type(const struct ref *ref, int flags);
55
dfd255dd
DB
56/*
57 * Frees the entire list and peers of elements.
58 */
59void free_refs(struct ref *ref);
60
2467a4fa
DB
61/*
62 * Removes and frees any duplicate refs in the map.
63 */
64void ref_remove_duplicates(struct ref *ref_map);
65
c091b3d4
DB
66struct refspec *parse_fetch_refspec(int nr_refspec, const char **refspec);
67struct refspec *parse_push_refspec(int nr_refspec, const char **refspec);
d71ab174 68
6b62816c 69int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
4577370e 70 int nr_refspec, const char **refspec, int all);
6b62816c 71
d71ab174
DB
72/*
73 * Given a list of the remote refs and the specification of things to
74 * fetch, makes a (separate) list of the refs to fetch and the local
75 * refs to store into.
76 *
77 * *tail is the pointer to the tail pointer of the list of results
78 * beforehand, and will be set to the tail pointer of the list of
79 * results afterward.
9ad7c5ae
JH
80 *
81 * missing_ok is usually false, but when we are adding branch.$name.merge
82 * it is Ok if the branch is not at the remote anymore.
d71ab174 83 */
4577370e 84int get_fetch_map(const struct ref *remote_refs, const struct refspec *refspec,
9ad7c5ae 85 struct ref ***tail, int missing_ok);
d71ab174 86
4577370e 87struct ref *get_remote_ref(const struct ref *remote_refs, const char *name);
d71ab174 88
5d46c9d4
DB
89/*
90 * For the given remote, reads the refspec's src and sets the other fields.
91 */
92int remote_find_tracking(struct remote *remote, struct refspec *refspec);
93
cf818348
DB
94struct branch {
95 const char *name;
96 const char *refname;
97
98 const char *remote_name;
99 struct remote *remote;
100
101 const char **merge_name;
102 struct refspec **merge;
103 int merge_nr;
104};
105
106struct branch *branch_get(const char *name);
107
108int branch_has_merge_config(struct branch *branch);
85682c19 109int branch_merge_matches(struct branch *, int n, const char *);
cf818348 110
28b9d6e5
AW
111/* Flags to match_refs. */
112enum match_refs_flags {
113 MATCH_REFS_NONE = 0,
114 MATCH_REFS_ALL = (1 << 0),
115 MATCH_REFS_MIRROR = (1 << 1),
116};
117
5751f490 118#endif