From 9064483b6c73286cd892acd5d30366db14a77371 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 1 Oct 2015 09:47:15 +0100 Subject: 36722: allow git range to complete after ^. Take account of backslash quoting. --- Completion/Unix/Command/_git | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 40a9fb63b..1fcde9015 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5753,7 +5753,14 @@ __git_commit_ranges () { if compset -P '*..(.|)'; then expl=( $* ) else - compset -S '..*' || suf=( -S .. -r '.@~ ^:\t\n\-' ) + if ! compset -S '..*'; then + local match mbegin mend + if [[ ${PREFIX} = (#b)((\\|)\^)* ]]; then + compset -p ${#match[1]} + else + suf=( -S .. -r '.@~ ^:\t\n\-' ) + fi + fi expl=( $* $suf ) fi -- cgit v1.2.3 From 98875bcb05d552cc59b300e33fe9000d295b1ffe Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Tue, 20 Oct 2015 14:22:25 +0000 Subject: 36900: _git: stash names completion: Display log messages The "$@" argument to compadd is removed because (I think) it contains a -J, which conflicts with the -V. Joint with Daniel Hahler. --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 13 +++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 4d8b15c69..04883a152 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-10-20 Daniel Shahaf + + * 36900: Completion/Unix/Command/_git: _git: stash names + completion: Display log messages + 2015-10-19 Oliver Kiddle * 36642: Eric Cook: Completion/Unix/Command/_zfs: diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 1fcde9015..719d717d7 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5487,12 +5487,21 @@ __git_signoff_file () { (( $+functions[__git_stashes] )) || __git_stashes () { local expl + declare -a interleaved declare -a stashes + declare -a descriptions - stashes=(${(f)"$(_call_program stashes git stash list --pretty=format:%gd 2>/dev/null)"}) + interleaved=(${(ps:\0:)"$(_call_program stashes git stash list -z --pretty='format:%gd%x00%s%x00\(%cr\)' 2>/dev/null)"}) __git_command_successful $pipestatus || return 1 + () { + local i j k + for i j k in $interleaved; do + stashes+=($i) + descriptions+=("$i: $j $k") + done + } - _wanted stashes expl stash compadd "$@" -a - stashes + _wanted stashes expl 'stash' compadd -Vx -d descriptions -a - stashes } (( $+functions[__git_svn_revisions] )) || -- cgit v1.2.3 From f8b2c13c97228c9a1a0319f07d1ae7c1268e12db Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sun, 25 Oct 2015 18:39:31 +0000 Subject: unposted: _git: Fix 'commit object name' completion messages. Offer the "this alternative is still valid, but I don't know to offer completions for it" for hash completion but not for recent object completion; the former is protected by a _guard and the latter incorrectly appeared also in cases such as 'git log a/b' which were not the start of a gitrevisions(7) expression. --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 8bf01dc3f..812ef3540 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-10-25 Daniel Shahaf + + * unposted: Completion/Unix/Command/_git: _git: Fix 'commit + object name' completion messages. + 2015-10-25 Jun-ichi Takimoto * 36911: Src/Zle/computil.c: '-optarg' should not match diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 719d717d7..e38b1c6e7 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5640,7 +5640,7 @@ __git_commit_objects () { commits=(${(f)"$(_call_program commits git --no-pager log -1000 --all --reflog --format='%h:\[%h\]\ %s\ \(%cr\)')"}) __git_command_successful $pipestatus || return 1 - _describe -V -t commits 'commit object name' commits + _describe -Vx -t commits 'commit object name' commits } (( $+functions[__git_recent_commits] )) || @@ -5704,7 +5704,7 @@ __git_recent_commits () { expl=() _wanted heads expl 'head' compadd "$@" -a - heads && ret=0 expl=() - _describe -Vx -t commits 'recent commit object name' descr && ret=0 + _describe -V -t commits 'recent commit object name' descr && ret=0 return $ret } -- cgit v1.2.3 From 17af119089379ec1b65b327c72eee3aac93fada7 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sun, 25 Oct 2015 18:34:08 +0000 Subject: 36958: _git: Fix recent commit completion descriptions. The uniquifiers 'HEAD~$n' were incorrect when a recent commit was the second parent of a merge commit. Detect that case and print something correct instead. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 41 +++++++++++++++++++++++++++++------------ 2 files changed, 32 insertions(+), 12 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 812ef3540..234f26f11 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2015-10-25 Daniel Shahaf + * 36958: Completion/Unix/Command/_git: _git: Fix recent commit + completion descriptions. + * unposted: Completion/Unix/Command/_git: _git: Fix 'commit object name' completion messages. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index e38b1c6e7..279331b00 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5650,6 +5650,8 @@ __git_recent_commits () { local i j k ret integer distance_from_head local label + local parents + local next_first_parent_ancestral_line_commit zparseopts -D -E O:=argument_array_names # Turn (-O foo:bar) to (foo bar) @@ -5659,10 +5661,10 @@ __git_recent_commits () { # Careful: most %d will expand to the empty string. Quote properly! # NOTE: we could use %D directly, but it's not available in git 1.9.1 at least. - commits=("${(f)"$(_call_program commits git --no-pager log $commit_opts -20 --format='%h%n%d%n%s\ \(%cr\)')"}") + commits=("${(f)"$(_call_program commits git --no-pager log $commit_opts -20 --format='%h%n%d%n%s\ \(%cr\)%n%p')"}") __git_command_successful $pipestatus || return 1 - for i j k in "$commits[@]" ; do + for i j k parents in "$commits[@]" ; do # Note: the after-the-colon part must be unique across the entire array; # see workers/34768 if (( $#commit_opts )); then @@ -5671,20 +5673,35 @@ __git_recent_commits () { # description unique (due to workers/34768), which we do by including the # hash. Git always prints enough hash digits to make the output unique.) label="[$i]" - elif (( distance_from_head == 0 )); then - label="[HEAD] " - elif (( distance_from_head == 1 )); then - label="[HEAD^] " - elif (( distance_from_head == 2 )); then - label="[HEAD^^] " - elif (( distance_from_head < 10 )); then - label="[HEAD~$distance_from_head] " + elif (( distance_from_head )) && [[ $i != $next_first_parent_ancestral_line_commit ]]; then + # The first commit (HEAD), and its ancestors along the first-parent line, + # get HEAD~$n labels. + # + # For other commits, we just print the hash. (${parents} does provide enough + # information to compute HEAD~3^2~4 -style labels, though, if somebody cared + # enough to implement that.) + label="[$i]" else - label="[HEAD~$distance_from_head]" + # Compute a first-parent-ancestry commit's label. + if false ; then + elif (( distance_from_head == 0 )); then + label="[HEAD] " + elif (( distance_from_head == 1 )); then + label="[HEAD^] " + elif (( distance_from_head == 2 )); then + label="[HEAD^^] " + elif (( distance_from_head < 10 )); then + label="[HEAD~$distance_from_head] " + else + label="[HEAD~$distance_from_head]" + fi + + # Prepare for the next first-parent-ancestry commit. + (( ++distance_from_head )) + next_first_parent_ancestral_line_commit=${parents%% *} fi # label is now 9 bytes, so the descriptions ($k) will be aligned. descr+=($i:"${label} $k") - (( ++distance_from_head )) j=${${j# \(}%\)} # strip leading ' (' and trailing ')' j=${j/ ->/,} # Convert " -> master, origin/master". -- cgit v1.2.3 From f890d442e22fccb94997c400710a88f8415388cf Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sun, 25 Oct 2015 18:34:58 +0000 Subject: 36959: _git: Offer @~$n as completion of recent commits. Suggested-by: Oliver Kiddle (users/20705) --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 234f26f11..67129de6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2015-10-25 Daniel Shahaf + * 36959: Completion/Unix/Command/_git: _git: Offer @~$n as + completion of recent commits. + * 36958: Completion/Unix/Command/_git: _git: Fix recent commit completion descriptions. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 279331b00..740aec4cd 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5695,13 +5695,14 @@ __git_recent_commits () { else label="[HEAD~$distance_from_head]" fi + descr+=("@~${distance_from_head}":"${label} $k") # CROSSREF: use the same label as below # Prepare for the next first-parent-ancestry commit. (( ++distance_from_head )) next_first_parent_ancestral_line_commit=${parents%% *} fi # label is now 9 bytes, so the descriptions ($k) will be aligned. - descr+=($i:"${label} $k") + descr+=($i:"${label} $k") # CROSSREF: use the same label as above j=${${j# \(}%\)} # strip leading ' (' and trailing ')' j=${j/ ->/,} # Convert " -> master, origin/master". -- cgit v1.2.3 From b4f7482e44ec59bfe99c8d0f23503570eda0ca1b Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sun, 25 Oct 2015 18:35:20 +0000 Subject: 36960: _git: Enable slash matcher for more branch and tag completions, include 'git branch ' and 'git tag '. --- ChangeLog | 4 ++++ Completion/Unix/Command/_git | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 67129de6e..c77e0a525 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2015-10-25 Daniel Shahaf + * 36960: Completion/Unix/Command/_git: _git: Enable slash matcher + for more branch and tag completions, include 'git branch ' + and 'git tag '. + * 36959: Completion/Unix/Command/_git: _git: Offer @~$n as completion of recent commits. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 740aec4cd..e5005f1c3 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5540,7 +5540,7 @@ __git_branch_names () { branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/}) __git_command_successful $pipestatus || return 1 - _wanted branch-names expl branch-name compadd "$@" -a - branch_names + _wanted branch-names expl branch-name compadd -M 'r:|/=**' "$@" -a - branch_names } (( $+functions[__git_remote_branch_names] )) || @@ -5848,7 +5848,7 @@ __git_tags () { tags=(${${(f)"$(_call_program tagrefs git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/}) __git_command_successful $pipestatus || return 1 - _wanted tags expl tag compadd "$@" -a - tags + _wanted tags expl tag compadd -M 'r:|/=**' "$@" -a - tags } (( $+functions[__git_commit_tags] )) || @@ -5871,7 +5871,7 @@ __git_tags_of_type () { tags=(${${(M)${(f)"$(_call_program $type-tag-refs "git for-each-ref --format='%(*objecttype)%(objecttype) %(refname)' refs/tags 2>/dev/null")"}:#$type(tag|) *}#$type(tag|) refs/tags/}) __git_command_successful $pipestatus || return 1 - _wanted $type-tags expl "$type tag" compadd "$@" -a - tags + _wanted $type-tags expl "$type tag" compadd -M 'r:|/=**' "$@" -a - tags } # Reference Argument Types -- cgit v1.2.3 From cc19bb96b91904cc650512297df63b834aa42d28 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sun, 25 Oct 2015 18:35:38 +0000 Subject: 36964: _git: Complete remotes branch names with slashes correctly. For example, 'git push remote HEAD:foo/bar' creates such branches. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index c77e0a525..2e5b99cd3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2015-10-25 Daniel Shahaf + * 36964: Completion/Unix/Command/_git: _git: Complete remotes + branch names with slashes correctly. + * 36960: Completion/Unix/Command/_git: _git: Enable slash matcher for more branch and tag completions, include 'git branch ' and 'git tag '. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index e5005f1c3..f22cddb3e 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5559,7 +5559,7 @@ __git_remote_branch_names_noprefix () { local expl declare -a heads - branch_names=(${${${(f)"$(_call_program remote-branch-refs-noprefix git for-each-ref --format='"%(refname)"' refs/remotes 2>/dev/null)"}##*/}:#HEAD}) + branch_names=(${${${${(f)"$(_call_program remote-branch-refs-noprefix git for-each-ref --format='"%(refname)"' refs/remotes 2>/dev/null)"}#refs/remotes/}#*/}:#HEAD}) __git_command_successful $pipestatus || return 1 _wanted remote-branch-names-noprefix expl 'remote branch name' compadd -M 'r:|/=**' "$@" -a - branch_names -- cgit v1.2.3 From 8b5158424637834f242bb1e2114dee4ac7cca328 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sun, 25 Oct 2015 18:35:50 +0000 Subject: 36962: _git: Fix completion of RHS of refspecs. Before this patch, 'git push $remote :' completed branch names (as though by `git branch -a`), instead of completing remote branch names sans the ${remote}/ prefix. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 2e5b99cd3..e26e62e5f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2015-10-25 Daniel Shahaf + * 36962: Completion/Unix/Command/_git: _git: Fix completion of + RHS of refspecs. + * 36964: Completion/Unix/Command/_git: _git: Complete remotes branch names with slashes correctly. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index f22cddb3e..320bfa712 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5313,7 +5313,8 @@ __git_remotes () { __git_ref_specs () { # TODO: This needs to deal with a lot more types of things. if compset -P '*:'; then - __git_heads + # TODO: have the caller supply the correct remote name, restrict to refs/remotes/${that_remote}/* only + __git_remote_branch_names_noprefix else compset -P '+' if compset -S ':*'; then -- cgit v1.2.3 From 0e510f0c3522c9b18e9320388dd232a84fa79351 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sat, 31 Oct 2015 12:54:56 +0000 Subject: 37032: Temporarily revert 36959. --- ChangeLog | 4 ++++ Completion/Unix/Command/_git | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index ed5cd5e6b..499c871e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2015-10-31 Daniel Shahaf + + * 37032: Completion/Unix/Command/_git: Temporarily revert 36959. + 2015-10-30 Daniel Shahaf * unposted (after 37018): Src/params.c, Test/E01options.ztst: Fix diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 320bfa712..df7a7d900 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5696,7 +5696,10 @@ __git_recent_commits () { else label="[HEAD~$distance_from_head]" fi - descr+=("@~${distance_from_head}":"${label} $k") # CROSSREF: use the same label as below + ## Disabled because _describe renders the output unhelpfuly when this function + ## is called twice during a single completion operation, and list-grouped is + ## in its default setting (enabled). + #descr+=("@~${distance_from_head}":"${label} $k") # CROSSREF: use the same label as below # Prepare for the next first-parent-ancestry commit. (( ++distance_from_head )) -- cgit v1.2.3 From 20153c573e1d9156fdee02fb854298bc0b88545f Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 4 Nov 2015 17:37:17 +0000 Subject: 37062: tentative mechanism for git commit descriptions. Mechanism for forcing completion system into verbose mode is subject to change. --- ChangeLog | 6 ++++++ Completion/Unix/Command/_git | 42 +++++++++++++++++++++++++++++++++--------- 2 files changed, 39 insertions(+), 9 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index bb6575b3a..6b4a38a85 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2015-11-04 Peter Stephenson + + * 37062: Completion/Unix/Command/_git: allow verbose + descriptions of commits and branches using git log. Mechanism + for turning this on subject to change. + 2015-11-02 Daniel Hahler * 35303: Completion/Unix/Command/_systemd: remove it in favour of the diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index df7a7d900..61386bfac 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5004,6 +5004,33 @@ __git_is_in_middle_of_merge () { [[ -f $gitdir/MERGE_HEAD ]] } +(( $+functions[__git_describe_branch] )) || +__git_describe_branch () { + local __commits_in=$1 + local __tag=$2 + local __desc=$3 + shift 3 + + integer maxverbose + if zstyle -s :completion:$curcontext max-verbose maxverbose && + (( ${compstate[nmatches]} <= maxverbose )); then + local __c + local -a __commits + for __c in ${(P)__commits_in}; do + __commits+=("${__c}:${$(_call_program describe git log -1 --oneline $__c)//:/\\:}") + done + _describe -t $__tag $__desc __commits "$@" + else + local expl + _wanted $__tag expl $__desc compadd "$@" -a - $__commits_in + fi +} + +(( $+functions[__git_describe_commit] )) || +__git_describe_commit () { + __git_describe_branch $1 $2 $3 -M 'r:|/=**' "${(@)argv[4,-1]}" +} + # Completion Wrappers (( $+functions[__git_ignore_line] )) || @@ -5541,29 +5568,27 @@ __git_branch_names () { branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/}) __git_command_successful $pipestatus || return 1 - _wanted branch-names expl branch-name compadd -M 'r:|/=**' "$@" -a - branch_names + __git_describe_commit branch_names branch-names 'branch name' "$@" } (( $+functions[__git_remote_branch_names] )) || __git_remote_branch_names () { - local expl declare -a branch_names branch_names=(${${(f)"$(_call_program remote-branch-refs git for-each-ref --format='"%(refname)"' refs/remotes 2>/dev/null)"}#refs/remotes/}) __git_command_successful $pipestatus || return 1 - _wanted remote-branch-names expl 'remote branch name' compadd -M 'r:|/=**' "$@" -a - branch_names + __git_describe_commit branch_names remote-branch-names 'remote branch name' "$@" } (( $+functions[__git_remote_branch_names_noprefix] )) || __git_remote_branch_names_noprefix () { - local expl declare -a heads branch_names=(${${${${(f)"$(_call_program remote-branch-refs-noprefix git for-each-ref --format='"%(refname)"' refs/remotes 2>/dev/null)"}#refs/remotes/}#*/}:#HEAD}) __git_command_successful $pipestatus || return 1 - _wanted remote-branch-names-noprefix expl 'remote branch name' compadd -M 'r:|/=**' "$@" -a - branch_names + __git_describe_commit branch_names remote-branch-names-noprefix 'remote branch name' "$@" } (( $+functions[__git_commit_objects_prefer_recent] )) || @@ -5603,7 +5628,7 @@ __git_heads () { (( $+functions[__git_heads_local] )) || __git_heads_local () { - local gitdir expl start + local gitdir declare -a heads heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)" refs/heads' 2>/dev/null)"}) @@ -5615,17 +5640,16 @@ __git_heads_local () { [[ -f $gitdir/refs/stash ]] && heads+=stash fi - _wanted heads-local expl "local head" compadd -M 'r:|/=**' "$@" -a - heads + __git_describe_commit heads heads-local "local head" "$@" } (( $+functions[__git_heads_remote] )) || __git_heads_remote () { - local gitdir expl start declare -a heads heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)" refs/remotes' 2>/dev/null)"}) - _wanted heads-remote expl "remote head" compadd -M 'r:|/=**' "$@" -a - heads + __git_describe_commit heads heads-remote "remote head" "$@" } (( $+functions[__git_commit_objects] )) || -- cgit v1.2.3 From 6198f7ffbae48230561fdd6996358fd553d954db Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sat, 31 Oct 2015 12:52:46 +0000 Subject: 37031: _git-merge: Exclude ancestors of HEAD from recent commit completion As done for _git-cherry-pick in a428c6b62cb2 (36328 + 36340). --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index f314e82f4..9fd23ada9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2015-11-13 Daniel Shahaf + * 37031: Completion/Unix/Command/_git: _git-merge: Exclude + ancestors of HEAD from recent commit completion + * 37025: Functions/VCS_Info/Backends/VCS_INFO_get_data_git: vcs_info git: Add a cherry-pick patch-format diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 61386bfac..3dfd604e9 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1131,6 +1131,7 @@ _git-log () { _git-merge () { local -a merge_options __git_setup_merge_options + local -a git_commit_opts=(--all --not HEAD --not) _arguments -w -S -s \ $merge_options \ @@ -1138,7 +1139,7 @@ _git-merge () { '( --no-rerere-autoupdate)--rerere-autoupdate[allow the rerere mechanism to update the index]' \ '(--rerere-autoupdate )--no-rerere-autoupdate[do not allow the rerere mechanism to update the index]' \ '--abort[restore the original branch and abort the merge operation]' \ - '*: :__git_commits' + '*: : __git_commits -O expl:git_commit_opts' } (( $+functions[_git-mv] )) || -- cgit v1.2.3 From 9ce000db220d0c676ff14cfe4fa436e6988f59ad Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sat, 14 Nov 2015 21:22:17 -0800 Subject: 37115: update for changes in ${(P)...} evaluation. --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 2 +- Doc/Zsh/expn.yo | 27 ++++++++++++++++++++++----- 3 files changed, 28 insertions(+), 6 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 52c770b00..a27c49817 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-11-14 Barton E. Schaefer + + * 37115: Completion/Unix/Commmand/_git, Doc/Zsh/expn.yo: update + for changes in ${(P)...} evaluation. + 2015-11-13 Daniel Shahaf * unposted: Src/Zle/zle_tricky.c: Make $EDITOR's diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 3dfd604e9..614185ebb 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5244,7 +5244,7 @@ _git_commands () { for cmdtype in aliases $cmdtypes; do local -a ${cmdtype}_d (( $#disp )) && set -A ${cmdtype}_d \ - ${${(Pr.COLUMNS-4.)cmdtype/(#s)(#m)[^:]##:/${(r.len.)MATCH[1,-2]} $sep }%% #} + ${${(r.COLUMNS-4.)${(P)cmdtype}/(#s)(#m)[^:]##:/${(r.len.)MATCH[1,-2]} $sep }%% #} alts+=( "${cmdtype//_/-}:${${cmdtype//_/ }%%(e|)s}:compadd ${(e)disp} -a ${cmdtype}_m" ) done diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo index 4c373d1f2..6f08d7d47 100644 --- a/Doc/Zsh/expn.yo +++ b/Doc/Zsh/expn.yo @@ -1380,9 +1380,13 @@ outermost. The flags are not propagated up to enclosing substitutions; the nested substitution will return either a scalar or an array as determined by the flags, possibly adjusted for quoting. All the following steps take place where applicable at all levels of substitution. -Note that, unless the `tt((P))' flag is present, the flags and any subscripts -apply directly to the value of the nested substitution; for example, the -expansion tt(${${foo}}) behaves exactly the same as tt(${foo}). + +Note that, unless the `tt((P))' flag is present, the flags and any +subscripts apply directly to the value of the nested substitution; for +example, the expansion tt(${${foo}}) behaves exactly the same as +tt(${foo}). When the `tt((P))' flag is present in a nested substitution, +the other substitution rules are applied to the value em(before) it is +interpreted as a name, so tt(${${(P)foo}}) may differ from tt(${(P)foo}). At each nested level of substitution, the substituted words undergo all forms of single-word substitution (i.e. not filename generation), including @@ -1400,6 +1404,12 @@ in particular the tt(L), tt(R), tt(Z), tt(u) and tt(l) flags for padding and capitalization, are applied directly to the parameter value. Note these flags are options to the command, e.g. `tt(typeset -Z)'; they are not the same as the flags used within parameter substitutions. + +At the outermost level of substitution, the `tt((P))' flag ignores these +transformations and uses the unmodified value of the parameter as the name +to be replaced. This is usually the desired behavior because padding may +make the value syntactically illegal as a parameter name, but if +capitalization changes are desired, use the tt(${${(P)foo}}) form. ) item(tt(3.) em(Parameter subscripting))( If the value is a raw parameter reference with a subscript, such as @@ -1413,8 +1423,10 @@ original array). Any number of subscripts may appear. Flags such as tt((k)) and tt((v)) which alter the result of subscripting are applied. ) item(tt(4.) em(Parameter name replacement))( -The effect of any tt((P)) flag, which treats the value so far as a -parameter name and replaces it with the corresponding value, is applied. +At the outermost level of nesting only, the effect of any tt((P)) flag, +which treats the value so far as a parameter name and replaces it with the +corresponding value, is applied. This replacement occurs later if the +tt((P)) flag appears in a nested substitution. ) item(tt(5.) em(Double-quoted joining))( If the value after this process is an array, and the substitution @@ -1534,6 +1546,11 @@ Strictly speaking, the removal happens later as the same happens with other forms of substitution; the point to note here is simply that it occurs after any of the above parameter operations. ) +item(tt(25.) em(Parameter name replacement))( +If the `tt((P))' flag is present and this has not yet been done, the value +so far is looked up as a parameter name. Errors may occur if the value is +neither a valid identifier nor an identifier plus subscript expression. +) enditem() subsect(Examples) -- cgit v1.2.3 From afc4d416524f186e3bdb01c512b7c7795eb5572b Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Tue, 17 Nov 2015 22:14:04 +0000 Subject: 37129: _git: Complete 'commit -p' --- ChangeLog | 4 ++++ Completion/Unix/Command/_git | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 1000ae611..14e5783c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2015-11-17 Daniel Shahaf + + * 37129: Completion/Unix/Command/_git: _git: Complete 'commit -p' + 2015-11-17 Peter Stephenson * 37128: Src/lex.c, Test/D06subscript.ztst: work around alias diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 614185ebb..c97fed399 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -656,7 +656,7 @@ _git-commit () { '( --porcelain --dry-run)--short[output dry run in short format]' \ '(--short --dry-run)--porcelain[output dry run in porcelain-ready format]' \ '(--short --porcelain --dry-run -z --null)'{-z,--null}'[separate dry run entry output with NUL]' \ - '--patch[use the interactive patch selection interface to chose which changes to commit]' \ + {-p,--patch}'[use the interactive patch selection interface to chose which changes to commit]' \ '(--reset-author)--author[override the author name used in the commit]:author name' \ '--date=[override the author date used in the commit]:date' \ '(-s --signoff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \ -- cgit v1.2.3 From d554f31bcbe1264f69e22e990d356ab7ee6e87a8 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 20 Nov 2015 03:39:26 +0000 Subject: 37149: _git: Complete 'bisect/bad' ref --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 1 + 2 files changed, 6 insertions(+) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 5355abaa6..5ab68f7a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-11-20 Daniel Shahaf + + * 37149: Completion/Unix/Command/_git: _git: Complete + 'bisect/bad' ref + 2015-11-19 Peter Stephenson * 37159: NEWS, README: update for next version. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index c97fed399..6e8e9c665 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5639,6 +5639,7 @@ __git_heads_local () { [[ -f $gitdir/$f ]] && heads+=$f done [[ -f $gitdir/refs/stash ]] && heads+=stash + [[ -f $gitdir/refs/bisect/bad ]] && heads+=bisect/bad fi __git_describe_commit heads heads-local "local head" "$@" -- cgit v1.2.3