summaryrefslogtreecommitdiff
path: root/name-rev.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2006-01-11 14:20:09 -0800
committerLibravatar Junio C Hamano <junkio@cox.net>2006-01-11 14:47:20 -0800
commit2c817df25d54b557d6cac0800cacfd0a255cd56d (patch)
tree0217463c24b8d982aea3d83a165c1875e988c495 /name-rev.c
parentupdate-index: work with c-quoted name (diff)
downloadtgif-2c817df25d54b557d6cac0800cacfd0a255cd56d.tar.xz
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 <junkio@cox.net>
Diffstat (limited to 'name-rev.c')
-rw-r--r--name-rev.c7
1 files changed, 4 insertions, 3 deletions
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);
}