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 30struct remote *remote_get(const char*name); 31 32typedefinteach_remote_fn(struct remote *remote,void*priv); 33intfor_each_remote(each_remote_fn fn,void*priv); 34 35intremote_has_url(struct remote *remote,const char*url); 36 37struct refspec { 38unsigned force :1; 39unsigned pattern :1; 40 41char*src; 42char*dst; 43}; 44 45struct ref *alloc_ref(unsigned namelen); 46 47/* 48 * Frees the entire list and peers of elements. 49 */ 50voidfree_refs(struct ref *ref); 51 52/* 53 * Removes and frees any duplicate refs in the map. 54 */ 55voidref_remove_duplicates(struct ref *ref_map); 56 57struct refspec *parse_ref_spec(int nr_refspec,const char**refspec); 58 59intmatch_refs(struct ref *src,struct ref *dst,struct ref ***dst_tail, 60int nr_refspec,char**refspec,int all); 61 62/* 63 * Given a list of the remote refs and the specification of things to 64 * fetch, makes a (separate) list of the refs to fetch and the local 65 * refs to store into. 66 * 67 * *tail is the pointer to the tail pointer of the list of results 68 * beforehand, and will be set to the tail pointer of the list of 69 * results afterward. 70 * 71 * missing_ok is usually false, but when we are adding branch.$name.merge 72 * it is Ok if the branch is not at the remote anymore. 73 */ 74intget_fetch_map(struct ref *remote_refs,const struct refspec *refspec, 75struct ref ***tail,int missing_ok); 76 77struct ref *get_remote_ref(struct ref *remote_refs,const char*name); 78 79/* 80 * For the given remote, reads the refspec's src and sets the other fields. 81 */ 82intremote_find_tracking(struct remote *remote,struct refspec *refspec); 83 84struct branch { 85const char*name; 86const char*refname; 87 88const char*remote_name; 89struct remote *remote; 90 91const char**merge_name; 92struct refspec **merge; 93int merge_nr; 94}; 95 96struct branch *branch_get(const char*name); 97 98intbranch_has_merge_config(struct branch *branch); 99intbranch_merge_matches(struct branch *,int n,const char*); 100 101#endif