completions/git: Handle MM files

These are files with staged modifications, and additional unstaged
ones.

In practice what happened was that you ran

   git add somefile

then editted it some more and tried to

   git add <TAB>

which didn't offer it anymore.

Now, we offer it if either modified or modified-staged is set.

Currently modified-staged isn't ever set alone, but through
all-staged, so we still need to keep offering the file then.

(This shows that the current switch/case might have some holes)

Fixes #5648.

[ci skip]
This commit is contained in:
Fabian Homborg
2019-02-12 16:54:14 +01:00
parent 7200f7ff4a
commit 016d83c3fc

View File

@@ -206,6 +206,16 @@ function __fish_git_files
set -ql modified_staged
and set file "$line[9..-1]"
and set desc $staged_modified_desc
case '1 MM*'
# Staged-modified with unstaged modifications
# These need to be offered for both kinds of modified.
if set -ql modified
set file "$line[9..-1]"
set desc $modified_desc
else if set -ql modified_staged
set file "$line[9..-1]"
set desc $staged_modified_desc
end
case '1 .D*'
set -ql deleted
and set file "$line[9..-1]"