diff --git a/share/completions/git.fish b/share/completions/git.fish index 5f0dcc653..49ce8da59 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -125,6 +125,9 @@ function __fish_git_files # A " " means it's unmodified. # # Be careful about the ordering here! + # + # HACK: To allow this to work both with and without '?' globs + set -l dq '??' switch "$stat" case DD AU UD UA DU AA UU # Unmerged @@ -166,7 +169,7 @@ function __fish_git_files # For our purposes, we assume this is a staged deletion. contains -- deleted-staged $argv; or contains -- all-staged $argv and printf '%s\t%s\n' "$file" $staged_deleted_desc - case '\?\?' + case "$dq" # a literal '??' # Untracked contains -- untracked $argv and printf '%s\t%s\n' "$file" $untracked_desc diff --git a/share/functions/__fish_hg_prompt.fish b/share/functions/__fish_hg_prompt.fish index 6a4a3e721..b59cf203b 100644 --- a/share/functions/__fish_hg_prompt.fish +++ b/share/functions/__fish_hg_prompt.fish @@ -68,6 +68,8 @@ function __fish_hg_prompt --description 'Write out the hg prompt' for line in $repo_status # Add a character for each file status if we have one + # HACK: To allow this to work both with and without '?' globs + set -l q '?' switch $line case 'A ' set -a hg_statuses added @@ -77,7 +79,7 @@ function __fish_hg_prompt --description 'Write out the hg prompt' set -a hg_statuses copied case 'D ' ' D' set -a hg_statuses deleted - case '\? ' + case "$dq " set -a hg_statuses untracked case 'U*' '*U' 'DD' 'AA' set -a hg_statuses unmerged diff --git a/share/functions/__terlar_git_prompt.fish b/share/functions/__terlar_git_prompt.fish index 170f8e08c..1068944fb 100644 --- a/share/functions/__terlar_git_prompt.fish +++ b/share/functions/__terlar_git_prompt.fish @@ -50,6 +50,8 @@ function __terlar_git_prompt --description 'Write out the git prompt' set staged 1 end + # HACK: To allow matching a literal `??` both with and without `?` globs. + set -l dq '??' switch $i case 'A ' set -a gs added @@ -61,7 +63,7 @@ function __terlar_git_prompt --description 'Write out the git prompt' set -a gs copied case 'D ' ' D' set -a gs deleted - case '\?\?' + case "$dq" set -a gs untracked case 'U*' '*U' 'DD' 'AA' set -a gs unmerged