File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed
Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -82,20 +82,18 @@ def __call__(self):
8282 out .success ("Commit validation: successful!" )
8383
8484 def _get_commits (self ):
85+ msg = None
8586 # Get commit message from file (--commit-msg-file)
8687 if self .commit_msg_file is not None :
8788 # Enter this branch if commit_msg_file is "".
8889 with open (self .commit_msg_file , "r" , encoding = "utf-8" ) as commit_file :
8990 msg = commit_file .read ()
91+ # Get commit message from command line (--message)
92+ elif self .commit_msg :
93+ msg = self .commit_msg
94+ if msg is not None :
9095 msg = self ._filter_comments (msg )
91- msg = msg .lstrip ("\n " )
92- commit_title = msg .split ("\n " )[0 ]
93- commit_body = "\n " .join (msg .split ("\n " )[1 :])
94- return [git .GitCommit (rev = "" , title = commit_title , body = commit_body )]
95- elif self .commit_msg is not None :
96- # Enter this branch if commit_msg is "".
97- self .commit_msg = self ._filter_comments (self .commit_msg )
98- return [git .GitCommit (rev = "" , title = "" , body = self .commit_msg )]
96+ return [git .GitCommit (rev = "" , title = "" , body = msg )]
9997
10098 # Get commit messages from git log (--rev-range)
10199 return git .get_commits (end = self .rev_range )
You can’t perform that action at this time.
0 commit comments