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

Re: git describe candidate filtering

From
Shawn O. Pearce <spearce@spearce.org>
Date
Dec 13, 2007, 05:57 UTC
Message-ID
<20071213055746.GV14735@spearce.org>
In-Reply-To
<4760C250.5080103@byu.net>
Eric Blake <ebb9@byu.net> wrote:
Show 6 quoted lines
> Would it be possible to add an option to git-describe that limits the
> candidate tags to those matching a glob pattern or regular expression?
> I've got a repository imported from CVS which has a number of less
> interesting tags for events such as branch creation, but I'm only
> interested in describing the current commit relative to tags matching
> v[0-9]\.[0-9]*, rather than the closest tag of any spelling.

Sure, it shouldn't be too difficult, just need to alter the get_name() function to add the item with add_to_known_names() only if it matches the pattern. Take a look at builtin-describe.c around line 74...

We only match things that were "added". So if you don't add a tag via add_to_known_names() then git-describe won't return it.

However that's only true for the standard case; for --contains its a different story as we are actually passing everything to name-rev.

-- 
Shawn.
Previous: Eric BlakeNext: Junio C Hamano
Message 2 of 3 in “git describe candidate filtering”
  1. Eric BlakeDec 13, 2007
  2. Shawn O. PearceDec 13, 2007
  3. Junio C HamanoDec 13, 2007

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.