@@ -549,8 +549,9 @@ static void add_header(const char *value)
549549
550550#define THREAD_SHALLOW 1
551551#define THREAD_DEEP 2
552- static int thread = 0 ;
553- static int do_signoff = 0 ;
552+ static int thread ;
553+ static int do_signoff ;
554+ static const char * signature = git_version_string ;
554555
555556static int git_format_config (const char * var , const char * value , void * cb )
556557{
@@ -609,6 +610,8 @@ static int git_format_config(const char *var, const char *value, void *cb)
609610 do_signoff = git_config_bool (var , value );
610611 return 0 ;
611612 }
613+ if (!strcmp (var , "format.signature" ))
614+ return git_config_string (& signature , var , value );
612615
613616 return git_log_config (var , value , cb );
614617}
@@ -703,6 +706,12 @@ static void gen_message_id(struct rev_info *info, char *base)
703706 info -> message_id = strbuf_detach (& buf , NULL );
704707}
705708
709+ static void print_signature (void )
710+ {
711+ if (signature && * signature )
712+ printf ("-- \n%s\n\n" , signature );
713+ }
714+
706715static void make_cover_letter (struct rev_info * rev , int use_stdout ,
707716 int numbered , int numbered_files ,
708717 struct commit * origin ,
@@ -796,6 +805,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
796805 diff_flush (& opts );
797806
798807 printf ("\n" );
808+ print_signature ();
799809}
800810
801811static const char * clean_message_id (const char * msg_id )
@@ -1035,6 +1045,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
10351045 { OPTION_CALLBACK , 0 , "thread" , & thread , "style" ,
10361046 "enable message threading, styles: shallow, deep" ,
10371047 PARSE_OPT_OPTARG , thread_callback },
1048+ OPT_STRING (0 , "signature" , & signature , "signature" ,
1049+ "add a signature" ),
10381050 OPT_END ()
10391051 };
10401052
@@ -1313,7 +1325,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
13131325 mime_boundary_leader ,
13141326 rev .mime_boundary );
13151327 else
1316- printf ( "-- \n%s\n\n" , git_version_string );
1328+ print_signature ( );
13171329 }
13181330 if (!use_stdout )
13191331 fclose (stdout );
0 commit comments