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 3ecbe83

Browse files
refactor(git): retype get_commits parameter to make it more friendly to call sites
1 parent a9cd957 commit 3ecbe83

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

‎commitizen/commands/bump.py‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,7 @@ def __call__(self) -> None:
253253
) from exc
254254
else:
255255
if increment is None:
256-
if current_tag:
257-
commits = git.get_commits(current_tag.name)
258-
else:
259-
commits = git.get_commits()
256+
commits = git.get_commits(current_tag.name if current_tag else None)
260257

261258
# No commits, there is no need to create an empty tag.
262259
# Unless we previously had a prerelease.

‎commitizen/commands/check.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def _get_commits(self) -> list[git.GitCommit]:
110110
return [git.GitCommit(rev="", title="", body=self._filter_comments(msg))]
111111

112112
# Get commit messages from git log (--rev-range)
113-
return git.get_commits(end=self.rev_rangeor"HEAD")
113+
return git.get_commits(end=self.rev_range)
114114

115115
@staticmethod
116116
def _filter_comments(msg: str) -> str:

‎commitizen/git.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,18 @@ def _create_commit_cmd_string(args: str, committer_date: str | None, name: str)
203203

204204
def get_commits(
205205
start: str | None = None,
206-
end: str ="HEAD",
206+
end: str |None=None,
207207
*,
208208
args: str = "",
209209
) -> list[GitCommit]:
210210
"""Get the commits between start and end."""
211+
if end is None:
212+
end = "HEAD"
211213
git_log_entries = _get_log_as_str_list(start, end, args)
212214
return [
213215
GitCommit.from_rev_and_commit(rev_and_commit)
214-
for rev_and_commit in filter(None, git_log_entries)
216+
for rev_and_commit in git_log_entries
217+
if rev_and_commit
215218
]
216219

217220

0 commit comments

Comments
(0)

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