summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Command/_git20
-rw-r--r--README6
3 files changed, 29 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index ef2a6575e..cb7f07687 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-05-12  Daniel Hahler  <git@thequod.de>
+
+	* 35060 + 35072: Completion/Unix/Command/_git: completion: git: split
+	__git_heads into local and remote
+
 2015-05-12  Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
 
 	* 35075: Doc/Zsh/builtins.yo, Doc/Zsh/calsys.yo,
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 979e3e76f..c01333ba4 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -5614,10 +5614,16 @@ __git_commits () {
 
 (( $+functions[__git_heads] )) ||
 __git_heads () {
+  __git_heads_local
+  __git_heads_remote
+}
+
+(( $+functions[__git_heads_local] )) ||
+__git_heads_local () {
   local gitdir expl start
   declare -a heads
 
-  heads=(${${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname)"' refs/heads refs/remotes 2>/dev/null)"}#refs/(heads|remotes)/})
+  heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)" refs/heads' 2>/dev/null)"})
   gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null)
   if __git_command_successful $pipestatus; then
     for f in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do
@@ -5626,7 +5632,17 @@ __git_heads () {
     [[ -f $gitdir/refs/stash ]] && heads+=stash
   fi
 
-  _wanted heads expl head compadd "$@" -a - heads
+  _wanted heads-local expl "local head" compadd "$@" -a - heads
+}
+
+(( $+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 "$@" -a - heads
 }
 
 (( $+functions[__git_commit_objects] )) ||
diff --git a/README b/README
index 142daadf1..10f29a4ed 100644
--- a/README
+++ b/README
@@ -117,6 +117,12 @@ New behaviour:
 0.5
 
 
+4) The _git completion used to offer both local and remote heads under the
+tag 'heads'.  The tag has now been split into 'heads-local' and
+'heads-remote' in all contexts that existed in 5.0.7.  The --fixup/--squash
+context still uses the tag 'heads' (but this may change in a future release).
+
+
 Incompatibilities between 5.0.2 and 5.0.5
 -----------------------------------------