mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-29 05:21:00 +01:00
38182: _git: Invoke reflog completion from the 'complete commit objects' codepath.
The reflog will only be used if the user has typed as "@" by hand.
This commit is contained in:
parent
ce4c9eafc4
commit
9f70404714
2 changed files with 13 additions and 3 deletions
|
|
@ -1,5 +1,8 @@
|
||||||
2016-03-21 Daniel Shahaf <d.s@daniel.shahaf.name>
|
2016-03-21 Daniel Shahaf <d.s@daniel.shahaf.name>
|
||||||
|
|
||||||
|
* 38182: Completion/Unix/Command/_git: Invoke reflog completion
|
||||||
|
from the 'complete commit objects' codepath.
|
||||||
|
|
||||||
* 38181: Completion/Unix/Command/_git: _git reflog: Complete
|
* 38181: Completion/Unix/Command/_git: _git reflog: Complete
|
||||||
'@{N}' instead of 'HEAD@{N}'.
|
'@{N}' instead of 'HEAD@{N}'.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5474,7 +5474,9 @@ __git_reflog_entries () {
|
||||||
local expl
|
local expl
|
||||||
declare -a reflog_entries
|
declare -a reflog_entries
|
||||||
|
|
||||||
reflog_entries=(${(f)"$(_call_program reflog-entries "git reflog -1000 --pretty='%gD:[%h] %gs'" 2>/dev/null)"})
|
# Repeat the %gD on the RHS due to uniquify the matches, to avoid bad
|
||||||
|
# completion list layout. (Compare workers/34768)
|
||||||
|
reflog_entries=(${(f)"$(_call_program reflog-entries "git reflog -1000 --pretty='%gD:[%h] %gs (%gD)'" 2>/dev/null)"})
|
||||||
reflog_entries=( ${reflog_entries/HEAD@$'\x7b'/@$'\x7b'} )
|
reflog_entries=( ${reflog_entries/HEAD@$'\x7b'/@$'\x7b'} )
|
||||||
__git_command_successful $pipestatus || return 1
|
__git_command_successful $pipestatus || return 1
|
||||||
|
|
||||||
|
|
@ -5671,8 +5673,13 @@ __git_commit_objects () {
|
||||||
local gitdir expl start
|
local gitdir expl start
|
||||||
declare -a commits
|
declare -a commits
|
||||||
|
|
||||||
# Abort if the argument does not match a commit hash (including empty).
|
if [[ -n $PREFIX[(r)@] ]] || [[ -n $SUFFIX[(r)@] ]]; then
|
||||||
[[ "$PREFIX$SUFFIX" == [[:xdigit:]](#c1,40) ]] || return 1
|
# doesn't match a commit hash, but might be a reflog entry
|
||||||
|
__git_reflog_entries; return $?
|
||||||
|
elif ! [[ "$PREFIX$SUFFIX" == [[:xdigit:]](#c1,40) ]]; then
|
||||||
|
# Abort if the argument does not match a commit hash (including empty).
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Note: the after-the-colon part must be unique across the entire array;
|
# Note: the after-the-colon part must be unique across the entire array;
|
||||||
# see workers/34768
|
# see workers/34768
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue