mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-12 21:18:53 +00:00
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.
This commit is contained in:
parent
0c4dab54f1
commit
9862eb930d
1 changed files with 6 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue