From 228c5c131927f1d255aeb0d103c2feec57c90b5f Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Wed, 14 Mar 2018 10:55:52 +0100 Subject: [PATCH] [git completions] Filter unreplaced $PWD Otherwise this'd let the full filename through if it isn't in $PWD. --- share/completions/git.fish | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/completions/git.fish b/share/completions/git.fish index 000766efd..31997c5b5 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -101,8 +101,8 @@ function __fish_git_files # The entire line is the "from" from a rename. if set -q use_next[1] if contains -- $use_next $argv - string replace -- "$PWD/" "" "$root/$line" - or string replace "$root/" ":/" "$root/$line" + string replace -f -- "$PWD/" "" "$root/$line" + or string replace -- "$root/" ":/" "$root/$line" end set -e use_next[1] continue @@ -118,7 +118,7 @@ function __fish_git_files # Print files from the current $PWD as-is, prepend all others with ":/" (relative to toplevel in git-speak) # This is a bit simplistic but finding the lowest common directory # and then replacing everything else in $PWD with ".." is a bit annoying - set file (string replace -- "$PWD/" "" "$root/$file"; or string replace -- "$root/" ":/" "$root/$file") + set file (string replace -f -- "$PWD/" "" "$root/$file"; or string replace -- "$root/" ":/" "$root/$file") set -e IFS # The basic status format is "XY", where X is "our" state (meaning the staging area),