* [PATCH - maint review] name-rev: do not omit leading components of ref name.
@ 2006-01-12 0:04 Junio C Hamano
0 siblings, 0 replies; only message in thread
From: Junio C Hamano @ 2006-01-12 0:04 UTC (permalink / raw)
To: git; +Cc: Johannes Schindelin
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>
---
* For 1.0.10 and 1.1.2
name-rev.c | 7 ++++---
t/t6010-merge-base.sh | 6 +++---
2 files changed, 7 insertions(+), 6 deletions(-)
2c817df25d54b557d6cac0800cacfd0a255cd56d
diff --git a/name-rev.c b/name-rev.c
index 65333d4..bbadb91 100644
--- a/name-rev.c
+++ b/name-rev.c
@@ -93,10 +93,11 @@ static int name_ref(const char *path, co
}
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);
}
diff --git a/t/t6010-merge-base.sh b/t/t6010-merge-base.sh
index c3a9680..1dce123 100755
--- a/t/t6010-merge-base.sh
+++ b/t/t6010-merge-base.sh
@@ -46,14 +46,14 @@ H=$(doit 8 H $A $F)
test_expect_success 'compute merge-base (single)' \
'MB=$(git-merge-base G H) &&
- expr "$(git-name-rev "$MB")" : "[0-9a-f]* B"'
+ expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/B"'
test_expect_success 'compute merge-base (all)' \
'MB=$(git-merge-base --all G H) &&
- expr "$(git-name-rev "$MB")" : "[0-9a-f]* B"'
+ expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/B"'
test_expect_success 'compute merge-base with show-branch' \
'MB=$(git-show-branch --merge-base G H) &&
- expr "$(git-name-rev "$MB")" : "[0-9a-f]* B"'
+ expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/B"'
test_done
--
1.1.1-g8ecb
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2006-01-12 0:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-12 0:04 [PATCH - maint review] name-rev: do not omit leading components of ref name Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox