for-each-ref: Field with abbreviated objectname
[gitweb.git] / builtin / for-each-ref.c
index 62be1bbfd6659f9dfac73a17acd1e2d5322dac66..3a97953177eee234c310bbf37bab5f2d7e03e5aa 100644 (file)
@@ -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);
+               }
        }
 }