File tree 3 files changed +9
-0
lines changed 3 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ class ExitCode(enum.IntEnum):
27
27
NOT_ALLOWED = 20
28
28
NO_INCREMENT = 21
29
29
UNRECOGNIZED_CHARACTERSET_ENCODING = 22
30
+ GIT_COMMAND_ERROR = 23
30
31
31
32
32
33
class CommitizenException (Exception ):
@@ -153,3 +154,7 @@ class NotAllowed(CommitizenException):
153
154
154
155
class CharacterSetDecodeError (CommitizenException ):
155
156
exit_code = ExitCode .UNRECOGNIZED_CHARACTERSET_ENCODING
157
+
158
+
159
+ class GitCommandError (CommitizenException ):
160
+ exit_code = ExitCode .GIT_COMMAND_ERROR
Original file line number Diff line number Diff line change 6
6
from typing import List , Optional
7
7
8
8
from commitizen import cmd
9
+ from commitizen .exceptions import GitCommandError
9
10
10
11
UNIX_EOL = "\n "
11
12
WINDOWS_EOL = "\r \n "
@@ -118,6 +119,8 @@ def get_commits(
118
119
else :
119
120
command = f"{ git_log_cmd } { end } "
120
121
c = cmd .run (command )
122
+ if c .return_code != 0 :
123
+ raise GitCommandError (c .err )
121
124
if not c .out :
122
125
return []
123
126
Original file line number Diff line number Diff line change @@ -30,3 +30,4 @@ These exit codes can be found in `commitizen/exceptions.py::ExitCode`.
30
30
| NotAllowed | 20 | ` --incremental ` cannot be combined with a ` rev_range ` |
31
31
| NoneIncrementExit | 21 | The commits found are not eligible to be bumped |
32
32
| CharacterSetDecodeError | 22 | The character encoding of the command output could not be determined |
33
+ | GitCommandError | 23 | Unexpected failure while calling a git command |
You can’t perform that action at this time.
0 commit comments