@@ -49,7 +49,7 @@ static int add_revision(struct log_state *s, const char *revstr);
4949
5050/** log_options holds other command line options that affect log output */
5151struct log_options {
52- int show_diff ;
52+ int show_diff , show_log_size ;
5353 int skip , limit ;
5454 int min_parents , max_parents ;
5555 git_time_t before ;
@@ -63,7 +63,7 @@ struct log_options {
6363static int parse_options (
6464 struct log_state * s , struct log_options * opt , int argc , char * * argv );
6565static void print_time (const git_time * intime , const char * prefix );
66- static void print_commit (git_commit * commit );
66+ static void print_commit (git_commit * commit , int show_log_size );
6767static int match_with_parent (git_commit * commit , int i , git_diff_options * );
6868
6969/** utility functions for filtering */
@@ -148,7 +148,7 @@ int main(int argc, char *argv[])
148148 break ;
149149 }
150150
151- print_commit (commit );
151+ print_commit (commit , opt . show_log_size );
152152
153153 if (opt .show_diff ) {
154154 git_tree * a = NULL , * b = NULL ;
@@ -337,7 +337,7 @@ static void print_time(const git_time *intime, const char *prefix)
337337}
338338
339339/** Helper to print a commit object. */
340- static void print_commit (git_commit * commit )
340+ static void print_commit (git_commit * commit , int show_log_size )
341341{
342342 char buf [GIT_OID_HEXSZ + 1 ];
343343 int i , count ;
@@ -347,6 +347,11 @@ static void print_commit(git_commit *commit)
347347 git_oid_tostr (buf , sizeof (buf ), git_commit_id (commit ));
348348 printf ("commit %s\n" , buf );
349349
350+ if (show_log_size ) {
351+ printf ("log size %d" , (int )strlen (git_commit_message (commit )));
352+ printf ("\n" );
353+ }
354+
350355 if ((count = (int )git_commit_parentcount (commit )) > 1 ) {
351356 printf ("Merge:" );
352357 for (i = 0 ; i < count ; ++ i ) {
@@ -470,6 +475,8 @@ static int parse_options(
470475 /** Found valid --min_parents. */ ;
471476 else if (!strcmp (a , "-p" ) || !strcmp (a , "-u" ) || !strcmp (a , "--patch" ))
472477 opt -> show_diff = 1 ;
478+ else if (!strcmp (a , "--log-size" ))
479+ opt -> show_log_size = 1 ;
473480 else
474481 usage ("Unsupported argument" , a );
475482 }
0 commit comments