aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/__fish_git_prompt.fish
diff options
context:
space:
mode:
authorGravatar Brian Gernhardt <brian@gernhardtsoftware.com>2013-07-02 11:16:11 -0400
committerGravatar Brian Gernhardt <brian@gernhardtsoftware.com>2013-07-26 16:10:38 -0400
commitd5c1bf98d7d49d214bbf500d004d96ef2df77b60 (patch)
tree690501f2a2caa95c1a7feae41fbbf2cf536d2d2e /share/functions/__fish_git_prompt.fish
parent5753fa2106688115802eaae79005e1ec87f309e9 (diff)
git_prompt: Add branch information for rebase
Diffstat (limited to 'share/functions/__fish_git_prompt.fish')
-rw-r--r--share/functions/__fish_git_prompt.fish35
1 files changed, 20 insertions, 15 deletions
diff --git a/share/functions/__fish_git_prompt.fish b/share/functions/__fish_git_prompt.fish
index 84ce0901..e39b2c1a 100644
--- a/share/functions/__fish_git_prompt.fish
+++ b/share/functions/__fish_git_prompt.fish
@@ -390,8 +390,10 @@ function __fish_git_prompt_operation_branch_bare --description "__fish_git_promp
if test -f $git_dir/rebase-merge/interactive
set operation "|REBASE-i"
+ set branch (cat $git_dir/rebase-merge/head-name ^/dev/null)
else if test -d $git_dir/rebase-merge
set operation "|REBASE-m"
+ set branch (cat $git_dir/rebase-merge/head-name ^/dev/null)
else
if test -d $git_dir/rebase-apply
if test -f $git_dir/rebase-apply/rebasing
@@ -410,25 +412,28 @@ function __fish_git_prompt_operation_branch_bare --description "__fish_git_promp
end
end
- set branch (git symbolic-ref HEAD ^/dev/null; set os $status)
- if test $os -ne 0
- set branch (switch "$__fish_git_prompt_describe_style"
- case contains
- git describe --contains HEAD
- case branch
- git describe --contains --all HEAD
- case describe
- git describe HEAD
- case default '*'
- git describe --tags --exact-match HEAD
- end ^/dev/null; set os $status)
+ if test -z "$branch"
+ set branch (git symbolic-ref HEAD ^/dev/null; set os $status)
if test $os -ne 0
- set branch (cut -c1-7 $git_dir/HEAD ^/dev/null; set os $status)
+ set detached yes
+ set branch (switch "$__fish_git_prompt_describe_style"
+ case contains
+ git describe --contains HEAD
+ case branch
+ git describe --contains --all HEAD
+ case describe
+ git describe HEAD
+ case default '*'
+ git describe --tags --exact-match HEAD
+ end ^/dev/null; set os $status)
if test $os -ne 0
- set branch unknown
+ set branch (cut -c1-7 $git_dir/HEAD ^/dev/null; set os $status)
+ if test $os -ne 0
+ set branch unknown
+ end
end
+ set branch "($branch)"
end
- set branch "($branch)"
end
if test "true" = (git rev-parse --is-inside-git-dir ^/dev/null)