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):
82
82
out .success ("Commit validation: successful!" )
83
83
84
84
def _get_commits (self ):
85
+ msg = None
85
86
# Get commit message from file (--commit-msg-file)
86
87
if self .commit_msg_file is not None :
87
88
# Enter this branch if commit_msg_file is "".
88
89
with open (self .commit_msg_file , "r" , encoding = "utf-8" ) as commit_file :
89
90
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 :
90
95
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 )]
99
97
100
98
# Get commit messages from git log (--rev-range)
101
99
return git .get_commits (end = self .rev_range )
You can’t perform that action at this time.
0 commit comments