Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 991e829

Browse files
committed
fix(git): Improves error checking in get_tags
`git tag` is has return code of zero whether or not tags exist so we should always expect the code to be zero.
1 parent 91ed065 commit 991e829

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

‎commitizen/git.py‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from tempfile import NamedTemporaryFile
66
from typing import List, Optional
77

8-
from commitizen import cmd
8+
from commitizen import cmd, out
99
from commitizen.exceptions import GitCommandError
1010

1111
UNIX_EOL = "\n"
@@ -150,8 +150,13 @@ def get_tags(dateformat: str = "%Y-%m-%d") -> List[GitTag]:
150150
f'%(object)"'
151151
)
152152
c = cmd.run(f"git tag --format={formatter} --sort=-creatordate")
153+
if c.return_code != 0:
154+
raise GitCommandError(c.err)
153155

154-
if c.err or not c.out:
156+
if c.err:
157+
out.warn(f"Attempting to proceed after: {c.err}")
158+
159+
if not c.out:
155160
return []
156161

157162
git_tags = [

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /