File tree Expand file tree Collapse file tree 3 files changed +9
-0
lines changed Expand file tree Collapse file tree 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):
2727 NOT_ALLOWED = 20
2828 NO_INCREMENT = 21
2929 UNRECOGNIZED_CHARACTERSET_ENCODING = 22
30+ GIT_COMMAND_ERROR = 23
3031
3132
3233class CommitizenException (Exception ):
@@ -153,3 +154,7 @@ class NotAllowed(CommitizenException):
153154
154155class CharacterSetDecodeError (CommitizenException ):
155156 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 66from typing import List , Optional
77
88from commitizen import cmd
9+ from commitizen .exceptions import GitCommandError
910
1011UNIX_EOL = "\n "
1112WINDOWS_EOL = "\r \n "
@@ -118,6 +119,8 @@ def get_commits(
118119 else :
119120 command = f"{ git_log_cmd } { end } "
120121 c = cmd .run (command )
122+ if c .return_code != 0 :
123+ raise GitCommandError (c .err )
121124 if not c .out :
122125 return []
123126
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`.
3030| NotAllowed | 20 | ` --incremental ` cannot be combined with a ` rev_range ` |
3131| NoneIncrementExit | 21 | The commits found are not eligible to be bumped |
3232| 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