@@ -205,6 +205,22 @@ static void *get_obj(const unsigned char *sha1, struct object **obj, unsigned lo
205
205
return buf ;
206
206
}
207
207
208
+ static int grab_objectname (const char * name , const unsigned char * sha1 ,
209
+ struct atom_value * v )
210
+ {
211
+ if (!strcmp (name , "objectname" )) {
212
+ char * s = xmalloc (41 );
213
+ strcpy (s , sha1_to_hex (sha1 ));
214
+ v -> s = s ;
215
+ return 1 ;
216
+ }
217
+ if (!strcmp (name , "objectname:short" )) {
218
+ v -> s = xstrdup (find_unique_abbrev (sha1 , DEFAULT_ABBREV ));
219
+ return 1 ;
220
+ }
221
+ return 0 ;
222
+ }
223
+
208
224
/* See grab_values */
209
225
static void grab_common_values (struct atom_value * val , int deref , struct object * obj , void * buf , unsigned long sz )
210
226
{
@@ -225,15 +241,8 @@ static void grab_common_values(struct atom_value *val, int deref, struct object
225
241
v -> ul = sz ;
226
242
v -> s = s ;
227
243
}
228
- else if (!strcmp (name , "objectname" )) {
229
- char * s = xmalloc (41 );
230
- strcpy (s , sha1_to_hex (obj -> sha1 ));
231
- v -> s = s ;
232
- }
233
- else if (!strcmp (name , "objectname:short" )) {
234
- v -> s = xstrdup (find_unique_abbrev (obj -> sha1 ,
235
- DEFAULT_ABBREV ));
236
- }
244
+ else if (deref )
245
+ grab_objectname (name , obj -> sha1 , v );
237
246
}
238
247
}
239
248
@@ -676,6 +685,8 @@ static void populate_value(struct refinfo *ref)
676
685
}
677
686
continue ;
678
687
}
688
+ else if (!deref && grab_objectname (name , ref -> objectname , v ))
689
+ continue ;
679
690
else
680
691
continue ;
681
692
0 commit comments