@@ -244,7 +244,28 @@ int cmd_whatchanged(int argc, const char **argv, const char *prefix)
244244 return cmd_log_walk (& rev );
245245}
246246
247- static int show_object (const unsigned char * sha1 , int suppress_header )
247+ static void show_tagger (char * buf , int len , struct rev_info * rev )
248+ {
249+ char * email_end , * p ;
250+ unsigned long date ;
251+ int tz ;
252+
253+ email_end = memchr (buf , '>' , len );
254+ if (!email_end )
255+ return ;
256+ p = ++ email_end ;
257+ while (isspace (* p ))
258+ p ++ ;
259+ date = strtoul (p , & p , 10 );
260+ while (isspace (* p ))
261+ p ++ ;
262+ tz = (int )strtol (p , NULL , 10 );
263+ printf ("Tagger: %.*s\nDate: %s\n" , (int )(email_end - buf ), buf ,
264+ show_date (date , tz , rev -> date_mode ));
265+ }
266+
267+ static int show_object (const unsigned char * sha1 , int show_tag_object ,
268+ struct rev_info * rev )
248269{
249270 unsigned long size ;
250271 enum object_type type ;
@@ -254,11 +275,14 @@ static int show_object(const unsigned char *sha1, int suppress_header)
254275 if (!buf )
255276 return error ("Could not read object %s" , sha1_to_hex (sha1 ));
256277
257- if (suppress_header )
258- while (offset < size && buf [offset ++ ] != '\n' ) {
259- int new_offset = offset ;
278+ if (show_tag_object )
279+ while (offset < size && buf [offset ] != '\n' ) {
280+ int new_offset = offset + 1 ;
260281 while (new_offset < size && buf [new_offset ++ ] != '\n' )
261282 ; /* do nothing */
283+ if (!prefixcmp (buf + offset , "tagger " ))
284+ show_tagger (buf + offset + 7 ,
285+ new_offset - offset - 7 , rev );
262286 offset = new_offset ;
263287 }
264288
@@ -299,16 +323,16 @@ int cmd_show(int argc, const char **argv, const char *prefix)
299323 const char * name = objects [i ].name ;
300324 switch (o -> type ) {
301325 case OBJ_BLOB :
302- ret = show_object (o -> sha1 , 0 );
326+ ret = show_object (o -> sha1 , 0 , NULL );
303327 break ;
304328 case OBJ_TAG : {
305329 struct tag * t = (struct tag * )o ;
306330
307- printf ("%stag %s%s\n\n " ,
331+ printf ("%stag %s%s\n" ,
308332 diff_get_color_opt (& rev .diffopt , DIFF_COMMIT ),
309333 t -> tag ,
310334 diff_get_color_opt (& rev .diffopt , DIFF_RESET ));
311- ret = show_object (o -> sha1 , 1 );
335+ ret = show_object (o -> sha1 , 1 , & rev );
312336 objects [i ].item = (struct object * )t -> tagged ;
313337 i -- ;
314338 break ;
0 commit comments