Skip to content

git.get_commits error check #540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 21, 2022
Prev Previous commit
Next Next commit
test(check): fixes logic issue made evident by the latest fix(git) co…
…mmit

git was failing with "fatal: ambiguous argument 'master..master': unknown revision or path not in the working tree". git `master` branch doesn't exist unless there is at least one "initial" commit or when only the PR branch has been cloned (e.g. CI).
  • Loading branch information
bhelgs committed Aug 14, 2022
commit 91ed06516f9494f3b12b343503336ef96bfb6bd6
6 changes: 6 additions & 0 deletions tests/commands/test_check_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
InvalidCommitMessageError,
NoCommitsFoundError,
)
from tests.utils import create_file_and_commit

COMMIT_LOG = [
"refactor: A code change that neither fixes a bug nor adds a feature",
Expand Down Expand Up @@ -217,7 +218,12 @@ def test_check_command_with_invalid_argument(config):
)


@pytest.mark.usefixtures("tmp_commitizen_project")
def test_check_command_with_empty_range(config, mocker):

# must initialize git with a commit
create_file_and_commit("feat: initial")

check_cmd = commands.Check(config=config, arguments={"rev_range": "master..master"})
with pytest.raises(NoCommitsFoundError) as excinfo:
check_cmd()
Expand Down