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

[PATCH v2 4/4] show-ref: Inline show_one

From
Vladimir Panteleev <git@thecybershadow.net>
Date
Jan 21, 2017, 01:08 UTC
Message-ID
<20170121010821.25046-5-git@thecybershadow.net>
In-Reply-To
<20170121010821.25046-1-git@thecybershadow.net>

As the small function is now only called from a single place, there is no point in keeping it as a separate function any longer.

Signed-off-by: Vladimir Panteleev <git@thecybershadow.net>
---
 builtin/show-ref.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/builtin/show-ref.c b/builtin/show-ref.c
index 3cf344d47..ec44164d8 100644
--- a/builtin/show-ref.c
+++ b/builtin/show-ref.c
@@ -17,15 +17,6 @@ static int deref_tags, show_head, tags_only, heads_only, found_match, verify,
 static const char **pattern;
 static const char *exclude_existing_arg;
 
-static void show_one(const char *refname, const struct object_id *oid)
-{
-	const char *hex = find_unique_abbrev(oid->hash, abbrev);
-	if (hash_only)
-		printf("%s\n", hex);
-	else
-		printf("%s %s\n", hex, refname);
-}
-
 static int show_ref(const char *refname, const struct object_id *oid,
 		    int flag, void *cbdata)
 {
@@ -74,7 +65,11 @@ static int show_ref(const char *refname, const struct object_id *oid,
 	if (quiet)
 		return 0;
 
-	show_one(refname, oid);
+	hex = find_unique_abbrev(oid->hash, abbrev);
+	if (hash_only)
+		printf("%s\n", hex);
+	else
+		printf("%s %s\n", hex, refname);
 
 	if (!deref_tags)
 		return 0;
-- 
2.11.0
Previous: Vladimir PanteleevNext: Vladimir Panteleev
Message 2 of 7 in “show-ref: Allow -d, --head to work with --verify”
  1. show-ref: Allow -d, --head to work with --verifyVladimir Panteleev, Jan 21, 2017
  2. 4/4 show-ref: Inline show_oneVladimir Panteleev, Jan 21, 2017
  3. 3/4 show-ref: Optimize show_ref a bitVladimir Panteleev, Jan 21, 2017
  4. Junio C HamanoJan 22, 2017
  5. Junio C HamanoJan 22, 2017
  6. 1/4 show-ref: Allow --head to work with --verifyVladimir Panteleev, Jan 21, 2017
  7. 2/4 show-ref: Allow -d to work with --verifyVladimir Panteleev, Jan 21, 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.