Subject: bug#67830: 30.0.50; find-file completion sometimes unexpectedly omits directories

From: Visuwesh <[email-masked]>
Date: Fri, 15 Dec 2023 09:43:28 +0530

[Thursday December 14, 2023] Markus Triska wrote:

> To reproduce this issue, please first create the directory ~/issue/.git,
> and the file ~/issue/.gitignore, for example with:
>
>     $ mkdir issue
>     $ cd issue/
>     $ mkdir .git
>     $ touch .gitignore
>
> Then, from your home directory, start Emacs with:
>
>     $ emacs -Q
>
> and do:
>
>     C-x C-f ~/issue/.git TAB
>
> As expected, the minibuffer displays:
>
>     [Complete, but not unique]
>
> and Emacs also shows the 2 possible completions:
>
>     2 possible completions:
>     .git/
>     .gitignore
>
> In contrast, when I do:
>
>     C-x C-f ~/issue/. TAB
>
> then the minibuffer prematurely completes it to the file:
>
>     ~/issue/.gitignore
>
> This is even though the directory ~/issue/.git exists, and also forms a
> valid and expected completion of "~/issue/.".
>
> The expected behaviour is the same as above, on the grounds that
> "~/issue/." is a proper prefix of "~/issue/.git" and therefore should
> never yield fewer possible completions.
>
> Thank you and all the best,
> Markus
>

Completion is working as intended, AFAIU.  Have a look at
completion-ignored-extensions.