From: Junio C Hamano Date: Thu, 26 Apr 2012 17:57:43 +0000 (-0700) Subject: Merge branch 'mb/fetch-call-a-non-branch-a-ref' X-Git-Tag: v1.7.11-rc0~100 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8a90ddd7055c3659e0e429d319b31bbabb8dc982;p=git.git Merge branch 'mb/fetch-call-a-non-branch-a-ref' The report from "git fetch" said "new branch" even for a non branch ref. By Marc Branchaud * mb/fetch-call-a-non-branch-a-ref: fetch: describe new refs based on where it came from fetch: Give remote_ref to update_local_ref() as well --- 8a90ddd7055c3659e0e429d319b31bbabb8dc982 diff --cc builtin/fetch.c index cfb43df4e,0f80cf818..1c8cb6244 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@@ -293,18 -294,26 +294,26 @@@ static int update_local_ref(struct ref 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]"); - if ((recurse_submodules != RECURSE_SUBMODULES_OFF) && - (recurse_submodules != RECURSE_SUBMODULES_ON)) - check_for_new_submodule_commits(ref->new_sha1); + } else { + msg = "storing ref"; + what = _("[new ref]"); } + if ((recurse_submodules != RECURSE_SUBMODULES_OFF) && + (recurse_submodules != RECURSE_SUBMODULES_ON)) + check_for_new_submodule_commits(ref->new_sha1); r = s_update_ref(msg, ref, 0); strbuf_addf(display, "%c %-*s %-*s -> %s%s", r ? '!' : '*',