git: Add revert to special action contexts

revert is very similar to cherry-pick and has a sequence variant.
main
Zhiming Wang 9 years ago committed by Kaleb Elwert
parent 0f3a5f745e
commit d25b251ef7

@ -389,6 +389,8 @@ The following contexts must be enabled with the following zstyle:
| rebase | value | Rebasing
| rebase-interactive | value | Rebasing interactively
| rebase-merge | value | Rebasing merge
| revert | value | Reverting
| revert-sequence | value | Reverting sequence
First, format the repository state attributes. For example, to format the branch
and remote names, define the following styles.

@ -5,7 +5,7 @@
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# Gets the Git special action (am, bisect, cherry, merge, rebase).
# Gets the Git special action (am, bisect, cherry, merge, rebase, revert).
# Borrowed from vcs_info and edited.
function _git-action {
local action_dir
@ -18,6 +18,8 @@ function _git-action {
local rebase_formatted
local rebase_interactive_formatted
local rebase_merge_formatted
local revert_formatted
local revert_sequence_formatted
for action_dir in \
"${git_dir}/rebase-apply" \
@ -80,6 +82,18 @@ function _git-action {
return 0
fi
if [[ -f "${git_dir}/REVERT_HEAD" ]]; then
if [[ -d "${git_dir}/sequencer" ]] ; then
zstyle -s ':prezto:module:git:info:action:revert-sequence' format 'revert_sequence_formatted' || revert_sequence_formatted='revert-sequence'
print "$revert_sequence_formatted"
else
zstyle -s ':prezto:module:git:info:action:revert' format 'revert_formatted' || revert_formatted='revert'
print "$revert_formatted"
fi
return 0
fi
if [[ -f "${git_dir}/BISECT_LOG" ]]; then
zstyle -s ':prezto:module:git:info:action:bisect' format 'bisect_formatted' || bisect_formatted='bisect'
print "$bisect_formatted"

Loading…
Cancel
Save