summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorMichael J Gruber <git@drmicha.warpmail.net>2010-05-13 12:31:46 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-05-19 04:49:04 (GMT)
commit67687feae52ff2d3ab7edf3ac42a39c5e44be299 (patch)
treeba6200d9cbf29a9c1acaa17bfaa4a782d531b249 /builtin
parent04794fdc2701f15d79d92805cfe94c9e754e2e05 (diff)
downloadgit-67687feae52ff2d3ab7edf3ac42a39c5e44be299.zip
git-67687feae52ff2d3ab7edf3ac42a39c5e44be299.tar.gz
git-67687feae52ff2d3ab7edf3ac42a39c5e44be299.tar.bz2
for-each-ref: Field with abbreviated objectname
Introduce a :short modifier to objectname which outputs the abbreviated object name. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/for-each-ref.c3
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);
+ }
}
}