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

[PATCH RFC] for-each-ref: Field with abbreviated objectname

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
May 3, 2010, 20:25 UTC
Message-ID
<61d114759b023b3937f8417ce44c3361f345c6f1.1272918259.git.git@drmicha.warpmail.net>

Introduce a :short modifier to objectname which outputs the abbreviated object name.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
Notes:
    I hope this finds the favour of the for-each-ref-man.
    
    TODO: test, doc
 builtin/for-each-ref.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index 62be1bb..3a97953 100644
--- a/builtin/for-each-ref.c
+++ b/builtin/for-each-ref.c
@@ -227,6 +227,9 @@ static void grab_common_values(struct atom_value *val, int deref, struct object
 			strcpy(s, sha1_to_hex(obj->sha1));
 			v->s = s;
 		}
+		else if (!strcmp(name, "objectname:short")) {
+			v->s = find_unique_abbrev(obj->sha1, DEFAULT_ABBREV);
+		}
 	}
 }
 
-- 
1.7.1.328.g9993c
Next: Jeff King
Message 1 of 4 in “for-each-ref: Field with abbreviated objectname”
  1. for-each-ref: Field with abbreviated objectnameMichael J Gruber, May 3, 2010
  2. Jeff KingMay 4, 2010
  3. for-each-ref: Field with abbreviated objectnameMichael J Gruber, May 13, 2010
  4. Jeff KingMay 14, 2010

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.