path: root/builtin/describe.c
diff options
authorJunio C Hamano <>2013-07-18 21:46:51 (GMT)
committerJunio C Hamano <>2013-07-18 22:16:23 (GMT)
commitadfc1857bdb090786fd9d22c1acec39371c76048 (patch)
tree2f0fb03ae59fac4c1495ace15b24e1fba14f9944 /builtin/describe.c
parent118aa4acff6afae733c206df7049ea54f7e0b282 (diff)
describe: fix --contains when a tag is given as input
"git describe" takes a commit and gives it a name based on tags in its neighbourhood. The command does take a commit-ish but when given a tag that points at a commit, it should dereference the tag before computing the name for the commit. As the whole processing is internally delegated to name-rev, if we unwrap tags down to the underlying commit when invoking name-rev, it will make the name-rev issue an error message based on the unwrapped object name (i.e. either 40-hex object name, or "$tag^0") that is different from what the end-user gave to the command when the commit cannot be described. Introduce an internal option --peel-tag to the name-rev to tell it to unwrap a tag in its input from the command line. Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin/describe.c')
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/describe.c b/builtin/describe.c
index db41cd7..7d73722 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -446,7 +446,8 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
struct argv_array args;
- argv_array_pushl(&args, "name-rev", "--name-only", "--no-undefined",
+ argv_array_pushl(&args, "name-rev",
+ "--peel-tag", "--name-only", "--no-undefined",
if (always)
argv_array_push(&args, "--always");