git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: "git describe" documentation and behavior mismatch

From
Daniel Knittl-Frank <knittl89@googlemail.com>
Date
Dec 11, 2017, 18:34 UTC
Message-ID
<CACx-yZ1DGz2z6qqAX=pzeExT689y0sON+wVDaocdWk75a5SOxA@mail.gmail.com>
In-Reply-To
<xmqqefocjrp2.fsf@gitster.mtv.corp.google.com>
On Sun, Dec 3, 2017 at 6:39 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 6 quoted lines
> I suspect that "see if the name recorded in the tag object matches
> the name of the ref that stores the tag after refs/tags/" code *is*
> not just verifying what it claims to (which may be good) but also
> unintentionally affecting the output (i.e. "--all" promises that the
> prefix tags/ should be shown).  Perhaps the code needs to be fixed
> if that is the case.

What is the course of action then? I wrote up a really dumb 2-line patch which simply checks if --all was specified and prepends the output with "tags/".

Good enough? Should we instead update the documentation? Still not sure, what the behavior _should_ be in the case of annotated tags with embedded names.

-- >8 --
From 7243d700aad280b11e647e04ade027c412dde54c Mon Sep 17 00:00:00 2001
From: Daniel Knittl-Frank <knittl89+git@googlemail.com>
Date: Mon, 11 Dec 2017 19:24:54 +0100
Subject: [PATCH] Prepend "tags/" when describing tags with embedded name
Signed-off-by: Daniel Knittl-Frank <knittl89+git@googlemail.com>
---
 builtin/describe.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/builtin/describe.c b/builtin/describe.c
index e14e162ef6..54aaf30562 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -272,6 +272,8 @@ static void display_name(struct commit_name *n)
     }

     if (n->tag)
+        if (all)
+            printf("tags/");
         printf("%s", n->tag->tag);
     else
         printf("%s", n->path);
-- 
2.15.GIT



-- 
typed with http://neo-layout.org
Previous: Junio C HamanoNext: Daniel Knittl-Frank
Message 4 of 6 in “"git describe" documentation and behavior mismatch”
  1. Daniel Knittl-FrankNov 30, 2017
  2. Daniel Knittl-FrankNov 30, 2017
  3. Junio C HamanoDec 3, 2017
  4. Daniel Knittl-FrankDec 11, 2017
  5. Daniel Knittl-FrankDec 11, 2017
  6. Junio C HamanoDec 15, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.