about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2015-05-13 15:06:05 +0200
committerDaniel Hahler <git@thequod.de>2015-05-18 02:48:03 +0200
commit1d5b2254988ceeca2a2a04db2e77733f265afbd2 (patch)
tree352880479eeff5bf4761287bd6fc247c4c4887c4
parentb6404e18c0a391365e319141b6b59b4f0280f90b (diff)
downloadzsh-1d5b2254988ceeca2a2a04db2e77733f265afbd2.tar.gz
zsh-1d5b2254988ceeca2a2a04db2e77733f265afbd2.tar.xz
zsh-1d5b2254988ceeca2a2a04db2e77733f265afbd2.zip
35100: __git_recent_commits: massage ' ->*' from heads
Handle " -> master, origin/master" in decorated git-log output, and add
it as separate entries.
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Command/_git2
2 files changed, 7 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 031c1249d..f96c27d2e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,11 @@
 	* 35126: Completion/Unix/Command/_git: __git_recent_commits:
 	add "return $ret" to make it useful when being called in a pipeline.
 
+	* 35100: Completion/Unix/Command/_git: __git_recent_commits:
+	massage ' ->*' from heads.
+	Handle " -> master, origin/master" in decorated git-log output, and
+	add it as separate entries.
+
 2015-05-16  Daniel Shahaf  <d.s@daniel.shahaf.name>
 
 	* 35161: Completion/Unix/Command/_git: completion: git: Fix
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index d9d1015c3..92835387d 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -5666,6 +5666,7 @@ __git_recent_commits () {
   local i j k
 
   # 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.
   : "${(A)commits::=${(@f)"$(_call_program commits git --no-pager log -20 --format='%h%n%d%n%s')"}}"
   __git_command_successful $pipestatus || return 1
 
@@ -5674,6 +5675,7 @@ __git_recent_commits () {
     # see workers/34768
     descr+=("$i:[$i] $k")
     j=${${j# \(}%\)} # strip leading ' (' and trailing ')'
+    j=${j/ ->/,}  # Convert " -> master, origin/master".
     for j in ${(s:, :)j}; do
       if [[ $j == 'tag: '* ]] ; then
         tags+=( ${j#tag: } )