diff --git a/Documentation/git-name-rev.txt b/Documentation/git-name-rev.txt
index 6b0f1ba..7cde4b3 100644
--- a/Documentation/git-name-rev.txt
+++ b/Documentation/git-name-rev.txt
@@ -37,9 +37,9 @@ OPTIONS
--name-only::
Instead of printing both the SHA-1 and the name, print only
- the name. If given with --tags the usual tag prefix of
- "tags/" is also omitted from the name, matching the output
- of `git-describe` more closely.
+ the name. The usual tag prefix of "tags/" is also omitted
+ from the name, matching the output of `git-describe` more
+ closely.
--no-undefined::
Die with error code != 0 when a reference is undefined,
diff --git a/builtin/name-rev.c b/builtin/name-rev.c
index 87d4854..37207a9 100644
--- a/builtin/name-rev.c
+++ b/builtin/name-rev.c
@@ -138,6 +138,9 @@ static int name_ref(const char *path, const unsigned char *sha1, int flags, void
path = shorten_unambiguous_ref(path, 0);
else if (!prefixcmp(path, "refs/heads/"))
path = path + 11;
+ else if (data->name_only
+ && !prefixcmp(path, "refs/tags/"))
+ path = path + 10;
else if (!prefixcmp(path, "refs/"))
path = path + 5;
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index cb03d28..9bec360 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -302,7 +302,7 @@ cat > expect <<\EOF
| |
| | side-2
| |
-| * commit tags/side-1
+| * commit side-1
| | Author: A U Thor <author@example.com>
| |
| | side-1
@@ -327,17 +327,17 @@ cat > expect <<\EOF
|
| fourth
|
-* commit tags/side-1~1
+* commit side-1~1
| Author: A U Thor <author@example.com>
|
| third
|
-* commit tags/side-1~2
+* commit side-1~2
| Author: A U Thor <author@example.com>
|
| second
|
-* commit tags/side-1~3
+* commit side-1~3
Author: A U Thor <author@example.com>
initialdiff --git a/t/t6007-rev-list-cherry-pick-file.sh b/t/t6007-rev-list-cherry-pick-file.sh
index 28d4f6b..5a8175e 100755
--- a/t/t6007-rev-list-cherry-pick-file.sh
+++ b/t/t6007-rev-list-cherry-pick-file.sh
@@ -49,8 +49,8 @@ test_expect_success setup '
'
cat >expect <<EOF
-<tags/B
->tags/C
+<B
+>C
EOF
test_expect_success '--left-right' '
@@ -70,7 +70,7 @@ test_expect_success '--cherry-pick foo comes up empty' '
'
cat >expect <<EOF
->tags/C
+>C
EOF
test_expect_success '--cherry-pick bar does not come up empty' '
@@ -88,8 +88,8 @@ test_expect_success 'bar does not come up empty' '
'
cat >expect <<EOF
-<tags/F
->tags/E
+<F
+>E
EOF
test_expect_success '--cherry-pick bar does not come up empty (II)' '
@@ -100,10 +100,10 @@ test_expect_success '--cherry-pick bar does not come up empty (II)' '
'
cat >expect <<EOF
-+tags/F
-=tags/D
-+tags/E
-=tags/C
++F
+=D
++E
+=C
EOF
test_expect_success '--cherry-mark' '
@@ -114,10 +114,10 @@ test_expect_success '--cherry-mark' '
'
cat >expect <<EOF
-<tags/F
-=tags/D
->tags/E
-=tags/C
+<F
+=D
+>E
+=C
EOF
test_expect_success '--cherry-mark --left-right' '
@@ -128,7 +128,7 @@ test_expect_success '--cherry-mark --left-right' '
'
cat >expect <<EOF
-tags/E
+E
EOF
test_expect_success '--cherry-pick --right-only' '
@@ -146,8 +146,8 @@ test_expect_success '--cherry-pick --left-only' '
'
cat >expect <<EOF
-+tags/E
-=tags/C
++E
+=C
EOF
test_expect_success '--cherry' '
--
1.8.3.2.737.gcbc076a.dirty