[Bug 1862338] [NEW] ZSH git add completion problems

Gonzalo Peci 1862338 at bugs.launchpad.net
Fri Feb 7 11:36:44 UTC 2020


Public bug reported:

There seem to be a problem when trying to autocomplete some git commands
due to a bad prefix detection for "git ls-files".

If you check the new version of this package in the Arch repos, along
with other updates you can find this file update:

> /usr/share/zsh/functions/Completion/Unix/_git
------
diff --git i/git.zsh w/git.zsh
index cf95bcd..745a57c 100644
--- i/git.zsh
+++ w/git.zsh
@@ -6625,7 +6625,7 @@ __git_files () {
   local pref=$gitcdup$gitprefix$PREFIX

   # First allow ls-files to pattern-match in case of remote repository
-  files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- ${(q)${pref:+$pref\\\*}} 2>/dev/null)"})
+  files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- ${(q)${pref:+$pref\*}:-.} 2>/dev/null)"})
   __git_command_successful $pipestatus || return

   # If ls-files succeeded but returned nothing, try again with no pattern
------


If this is not applied, the command basically becomes:
> git ls-files -z --exclude-standard --others -- \'\'
when on the root of the git repository and fails with:
> fatal: empty string is not a valid pathspec. please use . instead if you meant to match all paths


This affects the "git add<tab>" command autocompletion and potentially others.

PS: This seems to be in "zsh-commons" but the report form did not allow
me to select it

** Affects: zsh (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to zsh in Ubuntu.
https://bugs.launchpad.net/bugs/1862338

Title:
  ZSH git add completion problems

Status in zsh package in Ubuntu:
  New

Bug description:
  There seem to be a problem when trying to autocomplete some git
  commands due to a bad prefix detection for "git ls-files".

  If you check the new version of this package in the Arch repos, along
  with other updates you can find this file update:

  > /usr/share/zsh/functions/Completion/Unix/_git
  ------
  diff --git i/git.zsh w/git.zsh
  index cf95bcd..745a57c 100644
  --- i/git.zsh
  +++ w/git.zsh
  @@ -6625,7 +6625,7 @@ __git_files () {
     local pref=$gitcdup$gitprefix$PREFIX

     # First allow ls-files to pattern-match in case of remote repository
  -  files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- ${(q)${pref:+$pref\\\*}} 2>/dev/null)"})
  +  files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- ${(q)${pref:+$pref\*}:-.} 2>/dev/null)"})
     __git_command_successful $pipestatus || return

     # If ls-files succeeded but returned nothing, try again with no pattern
  ------

  
  If this is not applied, the command basically becomes:
  > git ls-files -z --exclude-standard --others -- \'\'
  when on the root of the git repository and fails with:
  > fatal: empty string is not a valid pathspec. please use . instead if you meant to match all paths

  
  This affects the "git add<tab>" command autocompletion and potentially others.

  PS: This seems to be in "zsh-commons" but the report form did not
  allow me to select it

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/zsh/+bug/1862338/+subscriptions



More information about the foundations-bugs mailing list