Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: completion: git: various improvements to commit object handling



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I will push this series later.

- From discussion on IRC with Daniel Shahaf, I've ended up with the following interdiff:

  diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
  index 858f817..708eb2a 100644
  --- a/Completion/Unix/Command/_git
  +++ b/Completion/Unix/Command/_git
  @@ -5675,7 +5675,8 @@ __git_recent_commits () {
     integer distance_from_head
   
     # Careful: most %d will expand to the empty string.  Quote properly!
  -  : "${(A)commits::=${(@f)"$(_call_program commits git --no-pager log -20 --format='%h%n%D%n%s\ \(%cr\)')"}}"
  +  # 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\ \(%cr\)')"}}"
     __git_command_successful $pipestatus || return 1
   
     for i j k in "$commits[@]" ; do
  @@ -5694,7 +5695,8 @@ __git_recent_commits () {
       fi
       (( ++distance_from_head ))
   
  -    j=${j%% ->*}  # Remove " -> master, origin/master" etc.
  +    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: } )
  @@ -5712,6 +5714,7 @@ __git_recent_commits () {
     _wanted heads expl 'head' compadd "$@" -a - heads && ret=0
     expl=()
     _describe -2Vx -t commits 'recent commit object name' descr && ret=0
  +  return $ret
   }
   
   (( $+functions[__git_blob_objects] )) ||


Regards,
Daniel.

On 13.05.2015 16:26, Daniel Hahler wrote:
> I've also submitted it as a pull request against the zsh-users' mirror on Github:
> https://github.com/zsh-users/zsh/pull/4
> 
> [PATCH 1/7] completion: git: __git_recent_commits: remove ' ->*' from
> [PATCH 2/7] completion: git: use %D for %d, without the " (", ")"
> [PATCH 3/7] completion: git: add __git_commit_objects_prefer_recent
> [PATCH 4/7] completion: git: __git_commit_objects: query 1000 commits
> [PATCH 5/7] completion: git: add %cr to commit objects (all and
> [PATCH 6/7] completion: git: unique name for __git_recent_commits
> [PATCH 7/7] completion: git: add distance_from_head to
> 
> 
> Regards,
> Daniel.
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iD8DBQFVWOdffAK/hT/mPgARAtgfAKDMwzqAiPBQGR+feZ+aK9gK0Ote5ACg2jHo
reNSvIDJRWAWMNochFIbUBk=
=elZp
-----END PGP SIGNATURE-----



Messages sorted by: Reverse Date, Date, Thread, Author