-
-
Notifications
You must be signed in to change notification settings - Fork 94
Description
Request
git diff -- <TAB> will suggest all the files in the current directory. Other completion systems filter this list so that only relevant files appear in the suggestions.
Same for git diff ./<TAB>.
Would also be great if git diff mydirec<TAB> would work like this.
Proposed solution
I have a branch where git diff -- works as I'm used to, i.e. completes one level of path at a time, ignoring the unchanged files and directories.
master...mytskine:carapace-bin:git-diff-cached
It still lacks path normalization. For instance, having a prefix like ./ breaks completion.
Anything else?
I tried to apply this the other file completion of git-diff, but the prefix makes it hard. I think it would require converting the partial value into a relative path, i.e. "./a" into "a" and "$(cwd)/a" into "a".
But I think it shows a bigger problem with carapace's completion of paths in git commands. I find it inconsistent, and that's the only thing preventing me from using this excellent tool. For instance, with a modified file inside the directory completers/ :
git add com<TAB> (success, smart completion, by file list)
git add ./com<TAB> (fails)
git add -- com<TAB> (fails)
git add -- ./com<TAB> (fails)
git diff ./com<TAB> (success, dumb completion, by path)
git diff com<TAB> (fails)
git diff -- com<TAB> (success, dumb completion, by file list) (my branch: smart completion, by path)
git diff -- ./com<TAB> (fails)
git log com<TAB> (fails)
git log ./com<TAB> (success, by path)
git status (success for all 4 cases, by path)
(edit: two use cases were swapped)