]> git.ipfire.org Git - thirdparty/git.git/commit
completion: hide dotfiles for selected path completion
authorZakariyah Ali <zakariyahali100@gmail.com>
Tue, 26 May 2026 15:23:07 +0000 (15:23 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 27 May 2026 03:14:53 +0000 (12:14 +0900)
commit96d1225ad904bf865fecc89ddfde62e1f4281c19
tree7abbfd885b6fc76baf9ebad8eea49abd368cc147
parent56a4f3c3a221adf1df9b39da69b8a6890f803157
completion: hide dotfiles for selected path completion

The completion helper for index paths uses git ls-files rather than
shell filename completion. As a result, leading-dot paths such as a
tracked .gitignore were offered even when the user had not started the
path with ".".

Hide leading-dot path components for git rm, git mv, and git ls-files
when completing an empty path component. Explicit dot completion is
still preserved, so git rm . can still complete .gitignore.

This matches standard shell filename completion behavior, where dotfiles
are hidden by default unless the user starts their input with a dot.
This also resolves four TODO comments in t/9902-completion.sh which
have been present since 2013 (commit ddf07bddef9a, "completion: add file
completion tests", 2013-04-27), expecting that .gitignore would not be
shown when completing on an empty path component.

Signed-off-by: Zakariyah Ali <zakariyahali100@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash
t/t9902-completion.sh