@@ -51,7 +51,7 @@ static const char *template_file;
5151static char * edit_message , * use_message ;
5252static char * author_name , * author_email , * author_date ;
5353static int all , edit_flag , also , interactive , only , amend , signoff ;
54- static int quiet , verbose , no_verify , allow_empty , dry_run ;
54+ static int quiet , verbose , no_verify , allow_empty , dry_run , renew_authorship ;
5555static char * untracked_files_arg ;
5656/*
5757 * The default commit message cleanup mode will remove the lines
@@ -91,8 +91,9 @@ static struct option builtin_commit_options[] = {
9191 OPT_FILENAME ('F' , "file" , & logfile , "read log from file" ),
9292 OPT_STRING (0 , "author" , & force_author , "AUTHOR" , "override author for commit" ),
9393 OPT_CALLBACK ('m' , "message" , & message , "MESSAGE" , "specify commit message" , opt_parse_m ),
94- OPT_STRING ('c' , "reedit-message" , & edit_message , "COMMIT" , "reuse and edit message from specified commit " ),
94+ OPT_STRING ('c' , "reedit-message" , & edit_message , "COMMIT" , "reuse and edit message from specified commit" ),
9595 OPT_STRING ('C' , "reuse-message" , & use_message , "COMMIT" , "reuse message from specified commit" ),
96+ OPT_BOOLEAN (0 , "reset-author" , & renew_authorship , "the commit is authored by me now (used with -C-c/--amend)" ),
9697 OPT_BOOLEAN ('s' , "signoff" , & signoff , "add Signed-off-by:" ),
9798 OPT_FILENAME ('t' , "template" , & template_file , "use specified template file" ),
9899 OPT_BOOLEAN ('e' , "edit" , & edit_flag , "force edit of commit" ),
@@ -381,7 +382,7 @@ static void determine_author_info(void)
381382 email = getenv ("GIT_AUTHOR_EMAIL" );
382383 date = getenv ("GIT_AUTHOR_DATE" );
383384
384- if (use_message ) {
385+ if (use_message && ! renew_authorship ) {
385386 const char * a , * lb , * rb , * eol ;
386387
387388 a = strstr (use_message_buffer , "\nauthor " );
@@ -747,6 +748,9 @@ static int parse_and_validate_options(int argc, const char *argv[],
747748 if (force_author && !strchr (force_author , '>' ))
748749 force_author = find_author_by_nickname (force_author );
749750
751+ if (force_author && renew_authorship )
752+ die ("Using both --reset-author and --author does not make sense" );
753+
750754 if (logfile || message .len || use_message )
751755 use_editor = 0 ;
752756 if (edit_flag )
@@ -780,6 +784,8 @@ static int parse_and_validate_options(int argc, const char *argv[],
780784 use_message = edit_message ;
781785 if (amend && !use_message )
782786 use_message = "HEAD" ;
787+ if (!use_message && renew_authorship )
788+ die ("--reset-author can be used only with -C, -c or --amend." );
783789 if (use_message ) {
784790 unsigned char sha1 [20 ];
785791 static char utf8 [] = "UTF-8" ;
0 commit comments