| 181 | } |
| 182 | |
| 183 | static 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; |
| 204 | reject: |
| 205 | free(sym); |
| 206 | return; |
| 207 | } |
| 208 | |
| 209 | static void annotate_refs_with_symref_info(struct ref *ref) |
| 210 | { |
no test coverage detected