From 88d1317eaa002840da4883b04ed0ea114a9673e4 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 31 Jul 2022 00:05:11 +0200 Subject: [PATCH] completions/git: forward a ./-prefix from the command line "git add ./" shows only hidden files (if at all). It should show all files that can be added. The problem is that candidates come from "git status" which prints clean relative paths. Let's allow some unclean paths. This is far from a complete fix but it should work for the common scenario. Observe that wildcard_complete_internal() actually filters out all non-hidden files, if the query is `./`. Closes #9091 --- share/completions/git.fish | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/share/completions/git.fish b/share/completions/git.fish index 7d85963ab..ccb1153a0 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -334,8 +334,12 @@ function __fish_git_files # If this contains newlines or tabs, # there is nothing we can do, but that's a general issue with scripted completions. set file (string trim -c \" -- $file) - # First the relative filename. - printf '%s\t%s\n' "$file" $d + # The relative filename. + if string match -q './*' -- (commandline -ct) + printf './%s\t%s\n' $file $d + else + printf '%s\t%s\n' "$file" $d + end # Now from repo root. # Only do this if the filename isn't a simple child, # or the current token starts with ":"