wfxr / forgit

:zzz: A utility tool powered by fzf for using git interactively.
MIT License
4.32k stars 136 forks source link

Do not hide error messages when trying to return early #318

Closed sandr01d closed 11 months ago

sandr01d commented 11 months ago

Check list

Description

Most of forgits functions allow to invoke git directly when arguments were passed. In most of these functions we only return early when the git command that is executed returns successfully. This hides error messages from the user. As discussed with @carlfriedrich in #316, I've modified this behavior to also return early when the git command was not successful, so we're transparent about gits error messages and return values. Because gbl and gclean allow passing arguments to the git command that is invoked when we don't return early, I've modified their behavior to only invoke git directly (and return early) in the case that non flag arguments were passed. I've also modified gclean to use the -q flag instead of piping it's output to /dev/null. This PR supersedes #316.

Type of change

Test environment

sandr01d commented 11 months ago

I've used this for a week now and did not find any issues. I'd like to merge this PR soon. Any thoughts on this?

carlfriedrich commented 11 months ago

Sorry for the late reply! Thanks a lot for your work on this @sandr01d . I haven't had time to test it out, yet, but code-wise it looks good to me. I would suggest squashing the two commits when merging this, though, and use the really good explanation in the PR's description as a commit message.

sandr01d commented 11 months ago

I would suggest squashing the two commits when merging this, though, and use the really good explanation in the PR's description as a commit message.

Will do.

I'll leave this hanging for a bit in case somebody wants to test this. I'll merge this next weekend when there are no objections.