replaced references to git with command git, to make the shell faster for git wrapper users

This commit is contained in:
Niam Patel 2013-07-09 21:50:56 +01:00
parent 06572e0d59
commit 9767a6d2ce
7 changed files with 20 additions and 20 deletions

View File

@ -26,7 +26,7 @@ set -g __fish_git_prompt_char_cleanstate ''
function parse_git_dirty function parse_git_dirty
set -l submodule_syntax set -l submodule_syntax
set submodule_syntax "--ignore-submodules=dirty" set submodule_syntax "--ignore-submodules=dirty"
set git_dirty (git status -s $submodule_syntax 2> /dev/null) set git_dirty (command git status -s $submodule_syntax 2> /dev/null)
if [ -n "$git_dirty" ] if [ -n "$git_dirty" ]
if [ $__fish_git_prompt_showdirtystate = "yes" ] if [ $__fish_git_prompt_showdirtystate = "yes" ]
echo -n "$__fish_git_prompt_char_dirtystate" echo -n "$__fish_git_prompt_char_dirtystate"
@ -105,12 +105,12 @@ end
function prompt_git -d "Display the actual git state" function prompt_git -d "Display the actual git state"
set -l ref set -l ref
set -l dirty set -l dirty
if git rev-parse --is-inside-work-tree >/dev/null 2>&1 if command git rev-parse --is-inside-work-tree >/dev/null 2>&1
set dirty (parse_git_dirty) set dirty (parse_git_dirty)
set ref (git symbolic-ref HEAD 2> /dev/null) set ref (command git symbolic-ref HEAD 2> /dev/null)
set ref (git symbolic-ref HEAD 2> /dev/null) set ref (command git symbolic-ref HEAD 2> /dev/null)
if [ $status -gt 0 ] if [ $status -gt 0 ]
set -l branch (git show-ref --head -s --abbrev |head -n1 2> /dev/null) set -l branch (command git show-ref --head -s --abbrev |head -n1 2> /dev/null)
set ref "$branch " set ref "$branch "
end end
set -l branch (echo $ref | sed 's-refs/heads/-⭠ -') set -l branch (echo $ref | sed 's-refs/heads/-⭠ -')

View File

@ -1,11 +1,11 @@
# Display git branch and dirty bit and current time on the right # Display git branch and dirty bit and current time on the right
function _git_branch_name function _git_branch_name
echo (git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||') echo (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
end end
function _is_git_dirty function _is_git_dirty
echo (git status -s --ignore-submodules=dirty ^/dev/null) echo (command git status -s --ignore-submodules=dirty ^/dev/null)
end end
function fish_right_prompt function fish_right_prompt

View File

@ -4,11 +4,11 @@
# * Git branch and dirty state (if inside a git repo) # * Git branch and dirty state (if inside a git repo)
function _git_branch_name function _git_branch_name
echo (git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||') echo (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
end end
function _is_git_dirty function _is_git_dirty
echo (git status -s --ignore-submodules=dirty ^/dev/null) echo (command git status -s --ignore-submodules=dirty ^/dev/null)
end end
function fish_prompt function fish_prompt

View File

@ -1,9 +1,9 @@
function _git_branch_name function _git_branch_name
echo (git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||') echo (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
end end
function _is_git_dirty function _is_git_dirty
echo (git status -s --ignore-submodules=dirty ^/dev/null) echo (command git status -s --ignore-submodules=dirty ^/dev/null)
end end
function fish_prompt function fish_prompt

View File

@ -1,9 +1,9 @@
function _git_branch_name function _git_branch_name
echo (git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||') echo (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
end end
function _is_git_dirty function _is_git_dirty
echo (git status -s --ignore-submodules=dirty ^/dev/null) echo (command git status -s --ignore-submodules=dirty ^/dev/null)
end end
function fish_prompt function fish_prompt
@ -25,4 +25,4 @@ function fish_prompt
end end
echo -n -s $cwd $git_info $normal ' ' $arrow ' ' echo -n -s $cwd $git_info $normal ' ' $arrow ' '
end end

View File

@ -50,17 +50,17 @@ function fish_prompt
# Git stuff # Git stuff
set -l git_info set -l git_info
if [ (git rev-parse --is-inside-work-tree ^/dev/null) ] if [ (command git rev-parse --is-inside-work-tree ^/dev/null) ]
# Get the current branch name/commit # Get the current branch name/commit
set -l git_branch_name (git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||') set -l git_branch_name (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
if [ -z $git_branch_name ] if [ -z $git_branch_name ]
set git_branch_name (git show-ref --head -s --abbrev | head -n1 2> /dev/null) set git_branch_name (command git show-ref --head -s --abbrev | head -n1 2> /dev/null)
end end
# Unconditional git component # Unconditional git component
set git_info "$normal""on $white$git_branch_name" set git_info "$normal""on $white$git_branch_name"
if [ (git status -s --ignore-submodules=dirty | wc -l) -gt 0 ] if [ (command git status -s --ignore-submodules=dirty | wc -l) -gt 0 ]
set git_info "$git_info$yellow*" set git_info "$git_info$yellow*"
end end

View File

@ -1,9 +1,9 @@
function _git_branch_name function _git_branch_name
echo (git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||') echo (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
end end
function _is_git_dirty function _is_git_dirty
echo (git status -s --ignore-submodules=dirty ^/dev/null) echo (command git status -s --ignore-submodules=dirty ^/dev/null)
end end
function fish_prompt function fish_prompt