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
feat(git_commit): Add only_detached
option
#738
Conversation
a885fc6
to
9d77904
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matchai I think that this is a splendid idea! And very useful too! Ship it 🚀 |
I'm happy to get it merged :) Just let me know if I should change the defaults once there's a consensus or feel free to change it yourself, of course :) OT: Other prompts have this combined. If on branch show |
only_detached
option to git_commit
module (#706)only_detached
option to git_commit
module
only_detached
option to git_commit
moduleonly_detached
option
Unfortunately this PR got lost in the mix. Can anyone else verify that it's working for them? |
It works here, just checked. Have you set Edit: I also rebased on master right now. |
9d77904
to
452ea5b
Compare
There we go! Yep, looked like a blunder on my end. 😅 Could you please set the default behavior to the following: disabled = false
only_detached = true You'll want to update the config, docs, and remove these lines here: starship/src/modules/git_commit.rs Lines 12 to 14 in 452ea5b
|
Sure, I changed it :) Maybe someone can have a look at the commit. Especially the tests, if it's ok this way, or needs more work (I only apply the minimal changes to the tests, but maybe we want to change them, so they reflect the default better?). About the line you suggested to remove: I'm not sure if understand. Isn't that still needed if someone wants to disable the module? |
That line was there due to us not yet implementing logic to handle disabled-by-default modules. We do, however, have logic to handle manually disabled modules via configuration here: https://github.com/starship/starship/blob/master/src/context.rs#L106-L113 |
…d' set (+ adapt docs accordingly)
2f23564
to
5edfe88
Compare
Ok, I see. Thanks for explaining! :) Removed that and rebased the branch on master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! 👍
Thank you for seeing this PR through. 😊
I went ahead and removed the updates to the localized docs since those are automatically done by Crowdin.
Description
This adds a new option
only_detached
to thegit_commit
module. It doesn't change default behavior as its default value isfalse
. Set totrue
, it will only show the commit hash if the repo is in detached HEAD state; if HEAD is on a branch, it will not output the hash. Also see #706.Motivation and Context
Closes #706
Types of changes
Screenshots (if appropriate):
How Has This Been Tested?
Checklist: