static int update_local_ref(struct ref *ref,
const char *remote,
+ const struct ref *remote_ref,
struct strbuf *display)
{
struct commit *current = NULL, *updated;
const char *msg;
const char *what;
int r;
- if (!strncmp(ref->name, "refs/tags/", 10)) {
+ /*
+ * Nicely describe the new ref we're fetching.
+ * Base this on the remote's ref name, as it's
+ * more likely to follow a standard layout.
+ */
+ const char *name = remote_ref ? remote_ref->name : "";
+ if (!prefixcmp(name, "refs/tags/")) {
msg = "storing tag";
what = _("[new tag]");
- }
- else {
+ } else if (!prefixcmp(name, "refs/heads/")) {
msg = "storing head";
what = _("[new branch]");
+ } else {
+ msg = "storing ref";
+ what = _("[new ref]");
}
if ((recurse_submodules != RECURSE_SUBMODULES_OFF) &&
strbuf_reset(¬e);
if (ref) {
- rc |= update_local_ref(ref, what, ¬e);
+ rc |= update_local_ref(ref, what, rm, ¬e);
free(ref);
} else
strbuf_addf(¬e, "* %-*s %-*s -> FETCH_HEAD",