Skip to content
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

The behavior when there are no files in the staging area. #126

Open
ryo246912 opened this issue Jan 10, 2025 · 0 comments
Open

The behavior when there are no files in the staging area. #126

ryo246912 opened this issue Jan 10, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@ryo246912
Copy link

ryo246912 commented Jan 10, 2025

Is your feature request related to a problem? Please describe.

When executed with no files in the staging area, interactive questions are displayed despite there being no files to commit, and after answering all questions, the commit fails with an error.

Describe the solution you'd like

I would like koji to exit early before displaying interactive questions when executed with no files in the staging area.
This would help users recognize mistakes earlier and prevent the unnecessary effort of re-answering their questions.

Describe alternatives you've considered

None.

Additional context

This is an excellent tool! I would love to use it actively and have a few requests.
I usually use czg, and I think koji could become an even more attractive tool by referencing some of its features.

in czg, if there are no files in the staging area, it exits early with the following behavior:

~/.local/share/chezmoi % git status
On branch main
Your branch is ahead of 'origin/main' by 2 commits.
  (use "git push" to publish your local commits)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   dot_zshrc.lazy.tmpl

no changes added to commit (use "git add" and/or "git commit -a")

~/.local/share/chezmoi % koji
> What type of change are you committing? feat
> What's the scope of this change?
> Write a short, imperative tense description of the change: x
> Provide a longer description of the change:
> Are there any breaking changes? No
> Does this change affect any open issues? No
Error: On branch main

Untracked files :
        modified: dot_zshrc.lazy.tmpl

nothing added to commit but untracked files present (use "git add" to track)

~/.local/share/chezmoi % czg
>>> No files added to staging! Did you forget to run `git add` ?

~/.local/share/chezmoi % 
@ryo246912 ryo246912 added the enhancement New feature or request label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant