@@ -50,6 +50,7 @@ static int add_revision(struct log_state *s, const char *revstr);
5050/** log_options holds other command line options that affect log output */
5151struct log_options {
5252 int show_diff ;
53+ int show_log_size ;
5354 int skip , limit ;
5455 int min_parents , max_parents ;
5556 git_time_t before ;
@@ -63,7 +64,7 @@ struct log_options {
6364static int parse_options (
6465 struct log_state * s , struct log_options * opt , int argc , char * * argv );
6566static void print_time (const git_time * intime , const char * prefix );
66- static void print_commit (git_commit * commit );
67+ static void print_commit (git_commit * commit , struct log_options * opts );
6768static int match_with_parent (git_commit * commit , int i , git_diff_options * );
6869
6970/** utility functions for filtering */
@@ -148,7 +149,7 @@ int main(int argc, char *argv[])
148149 break ;
149150 }
150151
151- print_commit (commit );
152+ print_commit (commit , & opt );
152153
153154 if (opt .show_diff ) {
154155 git_tree * a = NULL , * b = NULL ;
@@ -337,7 +338,7 @@ static void print_time(const git_time *intime, const char *prefix)
337338}
338339
339340/** Helper to print a commit object. */
340- static void print_commit (git_commit * commit )
341+ static void print_commit (git_commit * commit , struct log_options * opts )
341342{
342343 char buf [GIT_OID_HEXSZ + 1 ];
343344 int i , count ;
@@ -347,6 +348,10 @@ static void print_commit(git_commit *commit)
347348 git_oid_tostr (buf , sizeof (buf ), git_commit_id (commit ));
348349 printf ("commit %s\n" , buf );
349350
351+ if (opts -> show_log_size ) {
352+ printf ("log size %d\n" , (int )strlen (git_commit_message (commit )));
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