1#ifndef REMOTE_H 2#define REMOTE_H 3 4struct remote { 5const char*name; 6 7const char**url; 8int url_nr; 9 10const char**push_refspec; 11struct refspec *push; 12int push_refspec_nr; 13 14const char**fetch_refspec; 15struct refspec *fetch; 16int fetch_refspec_nr; 17 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 */ 24int fetch_tags; 25 26const char*receivepack; 27const char*uploadpack; 28 29/* 30 * for curl remotes only 31 */ 32char*http_proxy; 33}; 34 35struct remote *remote_get(const char*name); 36 37typedefinteach_remote_fn(struct remote *remote,void*priv); 38intfor_each_remote(each_remote_fn fn,void*priv); 39 40intremote_has_url(struct remote *remote,const char*url); 41 42struct refspec { 43unsigned force :1; 44unsigned pattern :1; 45 46char*src; 47char*dst; 48}; 49 50struct ref *alloc_ref(unsigned namelen); 51 52struct ref *copy_ref_list(const struct ref *ref); 53 54intcheck_ref_type(const struct ref *ref,int flags); 55 56/* 57 * Frees the entire list and peers of elements. 58 */ 59voidfree_refs(struct ref *ref); 60 61/* 62 * Removes and frees any duplicate refs in the map. 63 */ 64voidref_remove_duplicates(struct ref *ref_map); 65 66struct refspec *parse_ref_spec(int nr_refspec,const char**refspec); 67 68intmatch_refs(struct ref *src,struct ref *dst,struct ref ***dst_tail, 69int nr_refspec,const char**refspec,int all); 70 71/* 72 * Given a list of the remote refs and the specification of things to 73 * fetch, makes a (separate) list of the refs to fetch and the local 74 * refs to store into. 75 * 76 * *tail is the pointer to the tail pointer of the list of results 77 * beforehand, and will be set to the tail pointer of the list of 78 * results afterward. 79 * 80 * missing_ok is usually false, but when we are adding branch.$name.merge 81 * it is Ok if the branch is not at the remote anymore. 82 */ 83intget_fetch_map(const struct ref *remote_refs,const struct refspec *refspec, 84struct ref ***tail,int missing_ok); 85 86struct ref *get_remote_ref(const struct ref *remote_refs,const char*name); 87 88/* 89 * For the given remote, reads the refspec's src and sets the other fields. 90 */ 91intremote_find_tracking(struct remote *remote,struct refspec *refspec); 92 93struct branch { 94const char*name; 95const char*refname; 96 97const char*remote_name; 98struct remote *remote; 99 100const char**merge_name; 101struct refspec **merge; 102int merge_nr; 103}; 104 105struct branch *branch_get(const char*name); 106 107intbranch_has_merge_config(struct branch *branch); 108intbranch_merge_matches(struct branch *,int n,const char*); 109 110/* Flags to match_refs. */ 111enum match_refs_flags { 112 MATCH_REFS_NONE =0, 113 MATCH_REFS_ALL = (1<<0), 114 MATCH_REFS_MIRROR = (1<<1), 115}; 116 117#endif