describe: prepend "tags/" when describing tags with embedded name
The man page of the "git describe" command explains the expected
output when using the --all option, i.e. the full reference path is
shown, including heads/ or tags/ prefix.
When 212945d4a8
("Teach git-describe
to verify annotated tag names before output") made Git favor the
embedded name of annotated tags, it accidentally changed the output
format when the --all flag is given, only printing the tag's name
without the prefix.
Check if --all was specified and re-add the "tags/" prefix for this
special case to fix the regresssion.
Signed-off-by: Daniel Knittl-Frank <knittl89+git@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
parent
3013dff866
commit
1bba00130a
|
@ -271,10 +271,13 @@ static void display_name(struct commit_name *n)
|
||||||
n->name_checked = 1;
|
n->name_checked = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n->tag)
|
if (n->tag) {
|
||||||
|
if (all)
|
||||||
|
printf("tags/");
|
||||||
printf("%s", n->tag->tag);
|
printf("%s", n->tag->tag);
|
||||||
else
|
} else {
|
||||||
printf("%s", n->path);
|
printf("%s", n->path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show_suffix(int depth, const struct object_id *oid)
|
static void show_suffix(int depth, const struct object_id *oid)
|
||||||
|
|
|
@ -122,7 +122,7 @@ test_expect_success 'describe --contains defaults to HEAD without commit-ish' '
|
||||||
'
|
'
|
||||||
|
|
||||||
: >err.expect
|
: >err.expect
|
||||||
check_describe A --all A^0
|
check_describe tags/A --all A^0
|
||||||
test_expect_success 'no warning was displayed for A' '
|
test_expect_success 'no warning was displayed for A' '
|
||||||
test_cmp err.expect err.actual
|
test_cmp err.expect err.actual
|
||||||
'
|
'
|
||||||
|
@ -340,4 +340,8 @@ test_expect_success ULIMIT_STACK_SIZE 'describe works in a deep repo' '
|
||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
'
|
'
|
||||||
|
|
||||||
|
check_describe tags/A --all A
|
||||||
|
check_describe tags/c --all c
|
||||||
|
check_describe heads/branch_A --all --match='branch_*' branch_A
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
Loading…
Reference in New Issue