From 2c817df25d54b557d6cac0800cacfd0a255cd56d Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 11 Jan 2006 14:20:09 -0800 Subject: name-rev: do not omit leading components of ref name. In a repository with mainto/1.0 (to keep maintaining the 1.0.X series) and fixo/1.0 (to keep fixes that apply to both 1.0.X series and upwards) branches, "git-name-rev mainto/1.0" answered just "1.0" making things ambiguous. Show refnames unambiguously like show-branch does. Signed-off-by: Junio C Hamano --- name-rev.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'name-rev.c') diff --git a/name-rev.c b/name-rev.c index 65333d4166..bbadb91aa0 100644 --- a/name-rev.c +++ b/name-rev.c @@ -93,10 +93,11 @@ static int name_ref(const char *path, const unsigned char *sha1) } if (o && o->type == commit_type) { struct commit *commit = (struct commit *)o; - const char *p; - while ((p = strchr(path, '/'))) - path = p+1; + if (!strncmp(path, "refs/heads/", 11)) + path = path + 11; + else if (!strncmp(path, "refs/", 5)) + path = path + 5; name_rev(commit, strdup(path), 0, 0, deref); } -- cgit v1.2.1