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

[PATCH] builtin/tag.c: return appropriate value when --points-at finds an empty list

From
George Papanikolaou <g3orge.app@gmail.com>
Date
Dec 11, 2017, 13:44 UTC
Message-ID
<20171211134409.13339-1-g3orge.app@gmail.com>
`git tag --points-at` can simply return if the given rev does not have
any tags pointing to it. It's not a failure but it shouldn't return
with 0 value.
---
 builtin/tag.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/builtin/tag.c b/builtin/tag.c
index b38329b59..68b84db2a 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -58,6 +58,10 @@ static int list_tags(struct ref_filter *filter, struct ref_sorting *sorting,
 		die(_("unable to parse format string"));
 	filter->with_commit_tag_algo = 1;
 	filter_refs(&array, filter, FILTER_REFS_TAGS);
+
+	if (array.nr == 0)
+		return -1;
+
 	ref_array_sort(sorting, &array);
 
 	for (i = 0; i < array.nr; i++)
-- 
2.11.0
Next: Derrick Stolee
Message 1 of 3 in “builtin/tag.c: return appropriate value when --points-at finds an empty list”
  1. builtin/tag.c: return appropriate value when --points-at finds an empty listGeorge Papanikolaou, Dec 11, 2017
  2. Derrick StoleeDec 11, 2017
  3. George PapanikolaouDec 11, 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.