Merge pull request #47 from playonverbs/master

Making `git` faster for `hub` users
pull/2/head
Bruno 11 years ago
commit 7e6b66585a

@ -26,7 +26,7 @@ set -g __fish_git_prompt_char_cleanstate ''
function parse_git_dirty
set -l submodule_syntax
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 [ $__fish_git_prompt_showdirtystate = "yes" ]
echo -n "$__fish_git_prompt_char_dirtystate"
@ -105,12 +105,12 @@ end
function prompt_git -d "Display the actual git state"
set -l ref
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 ref (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)
set ref (command git symbolic-ref HEAD 2> /dev/null)
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 "
end
set -l branch (echo $ref | sed 's-refs/heads/-⭠ -')

@ -1,11 +1,11 @@
# Display git branch and dirty bit and current time on the right
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
function _is_git_dirty
echo (git status -s --ignore-submodules=dirty ^/dev/null)
echo (command git status -s --ignore-submodules=dirty ^/dev/null)
end
function fish_right_prompt

@ -4,11 +4,11 @@
# * Git branch and dirty state (if inside a git repo)
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
function _is_git_dirty
echo (git status -s --ignore-submodules=dirty ^/dev/null)
echo (command git status -s --ignore-submodules=dirty ^/dev/null)
end
function fish_prompt

@ -1,9 +1,9 @@
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
function _is_git_dirty
echo (git status -s --ignore-submodules=dirty ^/dev/null)
echo (command git status -s --ignore-submodules=dirty ^/dev/null)
end
function fish_prompt

@ -1,9 +1,9 @@
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
function _is_git_dirty
echo (git status -s --ignore-submodules=dirty ^/dev/null)
echo (command git status -s --ignore-submodules=dirty ^/dev/null)
end
function fish_prompt
@ -25,4 +25,4 @@ function fish_prompt
end
echo -n -s $cwd $git_info $normal ' ' $arrow ' '
end
end

@ -50,17 +50,17 @@ function fish_prompt
# Git stuff
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
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 ]
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
# Unconditional git component
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*"
end

@ -1,9 +1,9 @@
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
function _is_git_dirty
echo (git status -s --ignore-submodules=dirty ^/dev/null)
echo (command git status -s --ignore-submodules=dirty ^/dev/null)
end
function fish_prompt

Loading…
Cancel
Save