aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/__fish_git_prompt.fish
diff options
context:
space:
mode:
authorGravatar Konrad Borowski <glitchmr@myopera.com>2013-11-27 11:34:00 +0100
committerGravatar Konrad Borowski <glitchmr@myopera.com>2013-11-27 11:35:01 +0100
commit9862eb930d941a6fb93471bbb8e125076e95103a (patch)
tree4ac9bbf251542c131f068ede6f43cf5df37fc46c /share/functions/__fish_git_prompt.fish
parent0c4dab54f1544dff96c0e2d01f4c661e07f7fa49 (diff)
Use sed instead of sh for Informative Git Prompt.
Informative Git Prompt assumes that sh is bash compatible, but that's not the case for FreeBSD. Fixes #1140.
Diffstat (limited to 'share/functions/__fish_git_prompt.fish')
-rw-r--r--share/functions/__fish_git_prompt.fish12
1 files changed, 6 insertions, 6 deletions
diff --git a/share/functions/__fish_git_prompt.fish b/share/functions/__fish_git_prompt.fish
index e6647284..3012f8ef 100644
--- a/share/functions/__fish_git_prompt.fish
+++ b/share/functions/__fish_git_prompt.fish
@@ -205,7 +205,7 @@ function __fish_git_prompt_show_upstream --description "Helper function for __fi
set upstream svn+git # default upstream is SVN if available, else git
# Save the config key (without .url) for later use
- set -l remote_prefix (/bin/sh -c 'echo "${1%.url}"' -- $key)
+ set -l remote_prefix (echo $key | sed 's/\.url$//')
set svn_prefix $svn_prefix $remote_prefix
end
end
@@ -242,11 +242,11 @@ function __fish_git_prompt_show_upstream --description "Helper function for __fi
set -l svn_upstream (git log --first-parent -1 --grep="^git-svn-id: \($svn_url_pattern\)" ^/dev/null)
if test (count $svn_upstream) -ne 0
echo $svn_upstream[-1] | read -l _ svn_upstream _
- set svn_upstream (/bin/sh -c 'echo "${1%@*}"' -- $svn_upstream)
+ set svn_upstream (echo $svn_upstream | sed 's/@.*//')
set -l cur_prefix
for i in (seq (count $svn_remote))
set -l remote $svn_remote[$i]
- set -l mod_upstream (/bin/sh -c 'echo "${1#$2}"' -- $svn_upstream $remote)
+ set -l mod_upstream (echo $svn_upstream | sed "s/$remote//")
if test "$svn_upstream" != "$mod_upstream"
# we found a valid remote
set svn_upstream $mod_upstream
@@ -263,14 +263,14 @@ function __fish_git_prompt_show_upstream --description "Helper function for __fi
set upstream git-svn
end
else
- set upstream (/bin/sh -c 'val=${1#/branches}; echo "${val#/}"' -- $svn_upstream)
+ set upstream (echo $svn_upstream | sed 's|/branches||; s|/||g')
# Use fetch config to fix upstream
set -l fetch_val (command git config "$cur_prefix".fetch)
if test -n "$fetch_val"
set -l IFS :
echo "$fetch_val" | read -l trunk pattern
- set upstream (/bin/sh -c 'echo "${1%/$2}"' -- $pattern $trunk)/$upstream
+ set upstream (echo $pattern | sed -e "s|/$trunk\$||") /$upstream
end
end
else if test $upstream = svn+git
@@ -426,7 +426,7 @@ function __fish_git_prompt --description "Prompt function for Git"
if test -n "$u"
set u "$___fish_git_prompt_color_untrackedfiles$u$___fish_git_prompt_color_untrackedfiles_done"
end
- set b (/bin/sh -c 'echo "${1#refs/heads/}"' -- $b)
+ set b (echo $b | sed 's|refs/heads/||')
if test -n "$b"
set b "$branch_color$b$branch_done"
end