diff --git a/functions/_fifc_source_files.fish b/functions/_fifc_source_files.fish index 91e0a68..4561b63 100644 --- a/functions/_fifc_source_files.fish +++ b/functions/_fifc_source_files.fish @@ -18,9 +18,11 @@ function _fifc_source_files -d "Return a command to recursively find files" else if test "$raw_path" = "." echo "fd . $fifc_fd_opts --color=always --hidden $fd_custom_opts" else if test -n "$hidden" - echo "fd . $fifc_fd_opts --color=always --hidden -- $escaped_path | string replace --regex -- \"$home_re\" '~'" + # Explicitly-typed path: reveal gitignored entries (bare completion still respects .gitignore) + echo "fd . $fifc_fd_opts --color=always --no-ignore-vcs --hidden -- $escaped_path | string replace --regex -- \"$home_re\" '~'" else - echo "fd . $fifc_fd_opts --color=always -- $escaped_path | string replace --regex -- \"$home_re\" '~'" + # Explicitly-typed path: reveal gitignored entries (bare completion still respects .gitignore) + echo "fd . $fifc_fd_opts --color=always --no-ignore-vcs -- $escaped_path | string replace --regex -- \"$home_re\" '~'" end else if test -n "$hidden" # Use sed to strip cwd prefix diff --git a/tests/test_source_files.fish b/tests/test_source_files.fish index a63bc42..5da2d9b 100644 --- a/tests/test_source_files.fish +++ b/tests/test_source_files.fish @@ -16,6 +16,29 @@ set actual (_fifc_source_files) @test "source files cwd with spaces" "$actual" = "fd . --type f --color=always --strip-cwd-prefix" cd "$curr_pwd" + +# An explicitly-typed subdirectory bypasses gitignore so its ignored entries appear. +set fifc_fd_opts +set fifc_query +set fifc_token docs/ +set typed (_fifc_source_files) +if string match --quiet -- "*--no-ignore-vcs*" "$typed" + set has_no_ignore yes +else + set has_no_ignore no +end +@test "source files typed path bypasses gitignore" "$has_no_ignore" = yes + +# Bare completion keeps respecting gitignore (no unignore flag). +set fifc_token "" +set bare (_fifc_source_files) +if string match --quiet -- "*--no-ignore*" "$bare" + set bare_no_ignore yes +else + set bare_no_ignore no +end +@test "source files bare completion respects gitignore" "$bare_no_ignore" = no + set fifc_fd_opts $curr_fifc_fd_opts set fifc_query $curr_fifc_query set fifc_token $curr_fifc_token