MCPcopy Create free account
hub / github.com/git/git / parse_one_symref_info

Function parse_one_symref_info

connect.c:183–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181}
182
183static void parse_one_symref_info(struct string_list *symref, const char *val, int len)
184{
185 char *sym, *target;
186 struct string_list_item *item;
187
188 if (!len)
189 return; /* just "symref" */
190 /* e.g. "symref=HEAD:refs/heads/master" */
191 sym = xmemdupz(val, len);
192 target = strchr(sym, ':');
193 if (!target)
194 /* just "symref=something" */
195 goto reject;
196 *(target++) = '\0';
197 if (check_refname_format(sym, REFNAME_ALLOW_ONELEVEL) ||
198 check_refname_format(target, REFNAME_ALLOW_ONELEVEL))
199 /* "symref=bogus:pair */
200 goto reject;
201 item = string_list_append_nodup(symref, sym);
202 item->util = target;
203 return;
204reject:
205 free(sym);
206 return;
207}
208
209static void annotate_refs_with_symref_info(struct ref *ref)
210{

Callers 1

Calls 3

xmemdupzFunction · 0.85
check_refname_formatFunction · 0.85
string_list_append_nodupFunction · 0.85

Tested by

no test coverage detected