22 const char **push_refspec
;
25 int push_refspec_alloc
;
27 const char **fetch_refspec
;
28 struct refspec
*fetch
;
30 int fetch_refspec_alloc
;
33 * -1 to never fetch tags
34 * 0 to auto-follow tags on heuristic (default)
35 * 1 to always auto-follow tags
36 * 2 to always fetch tags
39 int skip_default_update
;
41 struct tracking_config track
;
43 const char *receivepack
;
44 const char *uploadpack
;
47 * for curl remotes only
52 struct remote
*remote_get(const char *name
);
53 int remote_is_configured(const char *name
);
55 typedef int each_remote_fn(struct remote
*remote
, void *priv
);
56 int for_each_remote(each_remote_fn fn
, void *priv
);
58 int remote_has_url(struct remote
*remote
, const char *url
);
63 unsigned matching
: 1;
69 extern const struct refspec
*tag_refspec
;
71 struct ref
*alloc_ref(const char *name
);
73 struct ref
*copy_ref_list(const struct ref
*ref
);
75 int check_ref_type(const struct ref
*ref
, int flags
);
78 * Frees the entire list and peers of elements.
80 void free_refs(struct ref
*ref
);
82 int resolve_remote_symref(struct ref
*ref
, struct ref
*list
);
83 int ref_newer(const unsigned char *new_sha1
, const unsigned char *old_sha1
);
86 * Removes and frees any duplicate refs in the map.
88 void ref_remove_duplicates(struct ref
*ref_map
);
90 int valid_fetch_refspec(const char *refspec
);
91 struct refspec
*parse_fetch_refspec(int nr_refspec
, const char **refspec
);
93 int match_refs(struct ref
*src
, struct ref
**dst
,
94 int nr_refspec
, const char **refspec
, int all
);
97 * Given a list of the remote refs and the specification of things to
98 * fetch, makes a (separate) list of the refs to fetch and the local
101 * *tail is the pointer to the tail pointer of the list of results
102 * beforehand, and will be set to the tail pointer of the list of
105 * missing_ok is usually false, but when we are adding branch.$name.merge
106 * it is Ok if the branch is not at the remote anymore.
108 int get_fetch_map(const struct ref
*remote_refs
, const struct refspec
*refspec
,
109 struct ref
***tail
, int missing_ok
);
111 struct ref
*get_remote_ref(const struct ref
*remote_refs
, const char *name
);
114 * For the given remote, reads the refspec's src and sets the other fields.
116 int remote_find_tracking(struct remote
*remote
, struct refspec
*refspec
);
122 const char *remote_name
;
123 struct remote
*remote
;
125 const char **merge_name
;
126 struct refspec
**merge
;
131 struct branch
*branch_get(const char *name
);
133 int branch_has_merge_config(struct branch
*branch
);
134 int branch_merge_matches(struct branch
*, int n
, const char *);
136 /* Flags to match_refs. */
137 enum match_refs_flags
{
139 MATCH_REFS_ALL
= (1 << 0),
140 MATCH_REFS_MIRROR
= (1 << 1),
143 /* Reporting of tracking info */
144 int stat_tracking_info(struct branch
*branch
, int *num_ours
, int *num_theirs
);
145 int format_tracking_info(struct branch
*branch
, struct strbuf
*sb
);
147 struct ref
*get_local_heads(void);
149 * Find refs from a list which are likely to be pointed to by the given HEAD
150 * ref. If 'all' is false, returns the most likely ref; otherwise, returns a
151 * list of all candidate refs. If no match is found (or 'head' is NULL),
152 * returns NULL. All returns are newly allocated and should be freed.
154 struct ref
*guess_remote_head(const struct ref
*head
,
155 const struct ref
*refs
,