Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Pure prompt does not show git dirty state #18

Closed
Debilski opened this issue Aug 20, 2020 · 2 comments
Closed

Pure prompt does not show git dirty state #18

Debilski opened this issue Aug 20, 2020 · 2 comments
Labels
🐛 bug Something isn't working

Comments

@Debilski
Copy link

I look at funced _tide_item_git_prompt and see that it calls fish_git_prompt (in share/fish/functions/fish_git_prompt.fish), which tells me:

# In addition, if you set __fish_git_prompt_showdirtystate to a nonempty value,
# unstaged (*) and staged (+) changes will be shown next to the branch name.
# You can configure this per-repository with the bash.showDirtyState variable,
# which defaults to true once __fish_git_prompt_showdirtystate is enabled. The
# choice to leave the variable as 'bash' instead of renaming to 'fish' is done
# to preserve compatibility with existing configured repositories.

I have set both

set __fish_git_prompt_showdirtystate 1
set __bash_git_prompt_showdirtystate 1

But dirty files are still not marked with a * when I’m in a git repo. What’s the trick to enable this?

@Debilski Debilski added the ❓ question This issue is a question label Aug 20, 2020
@IlanCosman IlanCosman added 🐛 bug Something isn't working and removed ❓ question This issue is a question labels Aug 20, 2020
@IlanCosman
Copy link
Owner

Thanks for reporting this. This is in fact a "bug" though not in the code.

I was misled when creating the Pure style because Pure does a strange thing in that it indicates either the staged state or dirty state with a single * character:

~/clownfish master
❯ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

~/clownfish master
❯ touch blah.rs # Doesn't effect prompt

~/clownfish master
❯ git add blah.rs # Stages a file, activating * in prompt

~/clownfish master*
❯ git restore --staged blah.rs # Unstaged file, removes * in prompt

~/clownfish master
❯ echo foo >> README.md # Makes a file dirty, thus producing a * in prompt

~/clownfish master*
❯ git add blah.rs # Stages blah.rs, but doesn't activate a second *

~/clownfish master*

fish_git_prompt won't let you do this because it separates the staged and dirty states. Pure style will now indicate both states with the * character, but there will be 2 *s when both are true.

@Debilski
Copy link
Author

Thanks for the quick fix. This is much better as a default. As I still enjoy the distinction between * and +, I guess, I’ll have to add a

set __fish_git_prompt_char_stagedstate +

to my config then.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 13, 2022
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants