mirror of
https://github.com/IlanCosman/tide.git
synced 2024-12-23 20:13:05 +03:00
Add operations
This commit is contained in:
parent
defc649b43
commit
aa55231eae
@ -1,7 +1,40 @@
|
|||||||
function git_prompt
|
function git_prompt
|
||||||
# Branch or SHA
|
# Branch or SHA
|
||||||
set -l location (git branch --show-current 2>/dev/null) || return
|
set -l location (git branch --show-current 2>/dev/null) || return
|
||||||
test -z "$location" && set -l location (git rev-parse --short HEAD)
|
git rev-parse --git-dir --short HEAD | read --local --line gitDir sha
|
||||||
|
test -z "$location" && set location $sha
|
||||||
|
|
||||||
|
set -l operation
|
||||||
|
set -l step
|
||||||
|
set -l totalSteps
|
||||||
|
|
||||||
|
if test -d $gitDir/rebase-merge
|
||||||
|
set step (cat $gitDir/rebase-merge/msgnum 2>/dev/null)
|
||||||
|
set totalSteps (cat $gitDir/rebase-merge/end 2>/dev/null)
|
||||||
|
if test -f $gitDir/rebase-merge/interactive
|
||||||
|
set operation rebase-i
|
||||||
|
else
|
||||||
|
set operation rebase-m
|
||||||
|
end
|
||||||
|
else if test -d $gitDir/rebase-apply
|
||||||
|
set step (cat $gitDir/rebase-apply/next 2>/dev/null)
|
||||||
|
set totalSteps (cat $gitDir/rebase-apply/last 2>/dev/null)
|
||||||
|
if test -f $gitDir/rebase-apply/rebasing
|
||||||
|
set operation rebase
|
||||||
|
else if test -f $gitDir/rebase-apply/applying
|
||||||
|
set operation am
|
||||||
|
else
|
||||||
|
set operation am/rebase
|
||||||
|
end
|
||||||
|
else if test -f $gitDir/MERGE_HEAD
|
||||||
|
set operation merge
|
||||||
|
else if test -f $gitDir/CHERRY_PICK_HEAD
|
||||||
|
set operation cherry-picking
|
||||||
|
else if test -f $gitDir/REVERT_HEAD
|
||||||
|
set operation revert
|
||||||
|
else if test -f $gitDir/BISECT_LOG
|
||||||
|
set operation bisect
|
||||||
|
end
|
||||||
|
|
||||||
# Upstream behind/ahead
|
# Upstream behind/ahead
|
||||||
git rev-list --count --left-right @{upstream}...HEAD 2>/dev/null |
|
git rev-list --count --left-right @{upstream}...HEAD 2>/dev/null |
|
||||||
@ -22,6 +55,8 @@ function git_prompt
|
|||||||
# Print the information
|
# Print the information
|
||||||
printf '%s' \
|
printf '%s' \
|
||||||
' '$location \
|
' '$location \
|
||||||
|
' '$operation \
|
||||||
|
' '$step/$totalSteps \
|
||||||
' ⇣'$upstreamBehind \
|
' ⇣'$upstreamBehind \
|
||||||
' ⇡'$upstreamAhead \
|
' ⇡'$upstreamAhead \
|
||||||
' ~'$unmerged \
|
' ~'$unmerged \
|
||||||
|
Loading…
Reference in New Issue
Block a user