| 1138 | } |
| 1139 | |
| 1140 | static char *guess_ref(const char *name, struct ref *peer) |
| 1141 | { |
| 1142 | struct strbuf buf = STRBUF_INIT; |
| 1143 | |
| 1144 | const char *r = refs_resolve_ref_unsafe(get_main_ref_store(the_repository), |
| 1145 | peer->name, |
| 1146 | RESOLVE_REF_READING, |
| 1147 | NULL, NULL); |
| 1148 | if (!r) |
| 1149 | return NULL; |
| 1150 | |
| 1151 | if (starts_with(r, "refs/heads/")) { |
| 1152 | strbuf_addstr(&buf, "refs/heads/"); |
| 1153 | } else if (starts_with(r, "refs/tags/")) { |
| 1154 | strbuf_addstr(&buf, "refs/tags/"); |
| 1155 | } else { |
| 1156 | return NULL; |
| 1157 | } |
| 1158 | |
| 1159 | strbuf_addstr(&buf, name); |
| 1160 | return strbuf_detach(&buf, NULL); |
| 1161 | } |
| 1162 | |
| 1163 | static int match_explicit_lhs(struct ref *src, |
| 1164 | struct refspec_item *rs, |
no test coverage detected