git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC] for-each-ref: Field with abbreviated objectname
@ 2010-05-03 20:25 Michael J Gruber
  2010-05-04 11:01 ` Jeff King
  0 siblings, 1 reply; 4+ messages in thread
From: Michael J Gruber @ 2010-05-03 20:25 UTC (permalink / raw)
  To: git; +Cc: Jeff King

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-05-14  5:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-03 20:25 [PATCH RFC] for-each-ref: Field with abbreviated objectname Michael J Gruber
2010-05-04 11:01 ` Jeff King
2010-05-13 12:31   ` [PATCH] " Michael J Gruber
2010-05-14  5:12     ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).