-
-
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
File stage checker not working as expected #418
Comments
We could also show a warning before starting with the questionnaire |
I just test out and confirm this error. Will changing |
Hi both,
This is not a bad idea. This is what commitizen/cz-cli already has, and the fix for commitizen/cz-cli#818 will:
Considering this commitizen does not have the option for def is_staging_clean() -> bool:
"""Check if staing is clean."""
c = cmd.run("git diff --no-ext-diff --cached --name-only")
return not bool(c.out) Does this make sense to you both? Regards, |
I created #420, we can review changes in there. |
Description
If we have changed files not staged, and not staged files, then I don't get the "No files added to staging!".
Steps to reproduce
Assuming you have a project with commitizen installed and the project is tracked by git, then we can do:
cz commit
Current behavior
The questionnaire will pop up without erroring out with
No files added to staging!
since no files are yet added to stage.Desired behavior
The desired behaviour should be what the error says ("No files added to staging!"), so if no files are added to the stage, then the error should pop.
Environment
This is an application bug, so it happens with any Python version and OS.
Extra
This issue is related to #45 (fixed in #49), which was the original issue related to this problem, but in my opinion, was never fixed the right way. I am not randomly opening this issue, I am doing it because I bumped into this frustrating problem all the time where:
cz commit
cz commit --retry
It seems that this was deliberately done in the code since just this command is needed:
The no-cached one will pick up files that are unstaged. In fact, in the more recent versions of
git
one can use--staged
flag which is an alias for--cached
.I understand if this was picked up from here in cz-cli, but it has the same problem in there, and this PR is a proposal for the fix in that repo (not yet merged).
If this is a recognized bug, and we are willing to fix it, I offer myself to open the PR if needed.
Thank you for the great work and this amazing tool!
Regards,
Xavi M.
The text was updated successfully, but these errors were encountered: