| 1560 | } |
| 1561 | |
| 1562 | static void fetch_symref(const char *path, char **symref, struct object_id *oid) |
| 1563 | { |
| 1564 | char *url = xstrfmt("%s%s", repo->url, path); |
| 1565 | struct strbuf buffer = STRBUF_INIT; |
| 1566 | const char *name; |
| 1567 | |
| 1568 | if (http_get_strbuf(url, &buffer, NULL) != HTTP_OK) |
| 1569 | die("Couldn't get %s for remote symref\n%s", url, |
| 1570 | curl_errorstr); |
| 1571 | free(url); |
| 1572 | |
| 1573 | FREE_AND_NULL(*symref); |
| 1574 | oidclr(oid, the_repository->hash_algo); |
| 1575 | |
| 1576 | if (buffer.len == 0) |
| 1577 | return; |
| 1578 | |
| 1579 | /* Cut off trailing newline. */ |
| 1580 | strbuf_rtrim(&buffer); |
| 1581 | |
| 1582 | /* If it's a symref, set the refname; otherwise try for a sha1 */ |
| 1583 | if (skip_prefix(buffer.buf, "ref: ", &name)) { |
| 1584 | *symref = xmemdupz(name, buffer.len - (name - buffer.buf)); |
| 1585 | } else { |
| 1586 | get_oid_hex(buffer.buf, oid); |
| 1587 | } |
| 1588 | |
| 1589 | strbuf_release(&buffer); |
| 1590 | } |
| 1591 | |
| 1592 | static int verify_merge_base(struct object_id *head_oid, struct ref *remote) |
| 1593 | { |
no test coverage detected