File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -335,16 +335,11 @@ git_revert <- function(
335335 if (no_commit ) {
336336 return (NULL )
337337 }
338- if (! length(message )) {
339- info <- git_commit_info(sha , repo = repo )
340- subject <- strsplit(info $ message , " \n " )[[1 ]][1 ]
341- subject <- sub(" \\ s+$" , " " , subject )
342- message <- sprintf(
343- ' Revert "%s"\n\n This reverts commit %s.\n ' ,
344- subject ,
345- info $ id
346- )
338+
339+ if (is.null(message )) {
340+ message <- revert_message(sha , repo )
347341 }
342+
348343 invisible (git_commit(
349344 message ,
350345 author = author ,
@@ -358,3 +353,15 @@ assert_string <- function(x) {
358353 stop(" Argument must be a string of length 1" )
359354 }
360355}
356+
357+ revert_message <- function (sha , repo ) {
358+ info <- git_commit_info(sha , repo = repo )
359+ subject <- strsplit(info $ message , " \n " )[[1 ]][1 ]
360+ subject <- sub(" \\ s+$" , " " , subject )
361+
362+ sprintf(
363+ ' Revert "%s"\n\n This reverts commit %s.\n ' ,
364+ subject ,
365+ info $ id
366+ )
367+ }
You can’t perform that action at this time.
0 commit comments