Var `___git_ps_color_suffix_done` is supposed to be
`___fish_git_prompt_color_suffix_done`. This bug was found by an
experimental change to detect the use of undefined variables (#4163).
Similarly, we should simply test whether `__fish_git_prompt_showcolorhints`
is set rather than set to a non-empty string.
I hate doing this but I am tired of touching a fish script as part of
some change and having `make style` radically change it. Which makes
editing fish scripts more painful than it needs to be. It is time to do
a wholesale reformatting of these scripts to conform to the documented
style as implemented by the `fish_indent` program.
It's not ideal since we can't get the real result so we just assume it's
"0". That triggers the easier path, which still might display the wrong
thing, but we have to pick something.
Possible fix for #3321.
This speeds up the common case when IO is slow, e.g. when used with
sshfs.
We only use the short sha for figuring out whether the state is
valid (for which a long sha should also work) and for display when HEAD
is detached (I think that's the correct git-ism).
Working towards #3083.
I believe apm must have been buggy - example output that I found online
showed `tr` was mangling paths with spaces in it. Should be fixed.
Also, use dscl on OS X in __fish_complete_users.fish like
__fish_print_users.fish already does.
At some point the non-verbose, non-informative variant of the prompt
(e.g. the variant that looks like the bash prompt) was modified to try
and show the behind/ahead counts the same way the informative prompt
does. Besides being wrong, it also didn't work because behind/ahead
weren't defined.
There is no need to explicitly check for two arguments and set --bold.
Instead the user can simply "set __fish_git_prompt_color_flags --bold
red".
The current check violates the expectation set by the documentation
that you can use any set_color argument as the current code interprets
"--bold red" as "--bold --bold" instead.
Plus, by passing the full contents of the variable directly, the user
can do more adventurous things like set the background as well.
git.git's git-prompt may not contain a configurable prefix, but it
does display a space before the upstream information when displaying
verbose information. Rather than using a space always or never,
default to a space whenever verbose is in showupstream.
Adds a "name" option to __fish_git_prompt_showupstream that shows an
abbreviated branch name when the upstream type is verbose.
Based on git.git 1f6806c: git-prompt.sh: optionally show upstream
branch name
git.git's __git_ps1 doesn't have an upstream prefix. I'm not sure why
one was added to our __fish_git_prompt, but it certainly shouldn't
default to a space.
It reuses $__fish_git_prompt_char_stateseparator, since it has a
similar meaning and goes otherwise unused when
$__fish_git_prompt_show_informative_status is set.
This changes the defaults for several characters when
$__fish_git_prompt_show_informative_status is set so that the prompt
looks more like the typical informative prompt.
Before: (master >1<2|+3#4*5%6)
After: (master↑1↓2|●3✖4✚5…6)
The defaults were taken from magicmonty/bash-git-prompt
This makes $__fish_git_prompt_show_informative_status imply
$__fish_git_prompt_showupstream = "informative", while adding a none
option for showupstream to disable it if desired.
A few characters and colors got added without being added to the event
list for repainting.
Also sort and re-align list of characters in validate_chars.
The code invoked `git rev-parse` several times when the required
information could be collected all at once.
This is based on the following commits from git.git:
efaa0c1: bash prompt: combine 'git rev-parse' executions in the main code path
e3e0b93: bash prompt: combine 'git rev-parse' for detached head
0f37c12: bash prompt: use bash builtins to check for unborn branch for dirty state
dd0b72c: bash prompt: use bash builtins to check stash state
It's a one line function called in a single place. I suspect it only
existed because the bash equivalent __gitdir existed (it was more
complex), but that function no longer exists either, as of git.git
511ad15: "bash prompt: run 'git rev-parse --git-dir' directly instead
of __gitdir()"
Simply using cut duplicates (poorly) `git rev-parse --short`
This also restores the ... printed after the abbreviation which
__fish_git_prompt had been missing.
Based on git.git e8f21ca: "bash prompt: print unique detached HEAD
abbreviated object name"
Unlike the rest of the __fish_git_prompt_char_* variables, it does not
have its own color because the most likely values are a space and
nothing.
based on git.git 15a54fb: prompt: introduce GIT_PS1_STATESEPARATOR
Adds a progress indicator to the rebase messages. (e.g. |REBASE 2/5)
based on the git-prompt portion of git.git b71dc3e: "bash-prompt.sh:
show where rebase is at when stopped"
git revert was taught to revert multiple commits, and it stores it
branch information in REVERT_HEAD just like the other *_HEAD files.
based on git.git 3ee4452: bash: teach __git_ps1 about REVERT_HEAD
Based on GIT_PS1_SHOW_COLORHINTS, it introduces more color by default
and also changes the color of the branch name based on if it is a real
branch or detached.
Based on the following commits from git.git:
9b7e776: show color hints based on state of the git tree
9b3aaf8: Fix up colored git-prompt
76c36c0: coloured git-prompt: paint detached HEAD marker in red
This is mostly useful for the next commit that will have different
colors default to different values, but it has one immediate change:
all __fish_git_prompt_color_* variables now default to
__fish_git_prompt_color instead of to nothing, as they used to.