-
-
Notifications
You must be signed in to change notification settings - Fork 266
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
fix(commit): correct the stage checker before commiting #420
Conversation
Codecov Report
@@ Coverage Diff @@
## master #420 +/- ##
==========================================
- Coverage 97.90% 97.90% -0.01%
==========================================
Files 39 39
Lines 1383 1382 -1
==========================================
- Hits 1354 1353 -1
Misses 29 29
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Hi @xaviml thanks for the contribution! Sorry for the inconvinience 😅 |
Hi @woile , Of course, I totally understand. Is there any test example in the test suite that actually test with the real git command? Is it okay if I do so? Otherwise, I don't see a way to test this properly since it only calls the git command. Regards, |
You can write it in https://github.com/commitizen-tools/commitizen/blob/master/tests/test_git.py You can call git with this: Line 148 in 79b3156
By using this fixture you'll have a git folder ready: Line 60 in 79b3156
Example: @pytest.mark.usefixtures("tmp_commitizen_project")
def test_git_something():
c = cmd.run("git something") |
f720d2b
to
a2d6312
Compare
Hi @woile, Thank you for pointing me to the right test file. I did the following:
The new test fails in the second The bug was (as described in #418) that the is_stage_clean worked when adding a file (as it was tested), but not when modifying an existing file (it was not tested). Let me know if anything needs changing. Regards, |
I see it now, wow I thought this was working. |
fixes #418
Checklist
./script/format
and./script/test
locally to ensure this change passes linter check and testThis part of the code was not originally tested, since changing the code did not break the existing tests. If interested, I could add tests for this with real git calls.
I did not add this to the documentation or README since it fixes a behaviour that was supposed to happen already.