completion: hide dotfiles for selected path completion#2311
completion: hide dotfiles for selected path completion#2311alibaba0010 wants to merge 577 commits into
Conversation
Test clean-up. * ss/t9123-setup-inside-test-expect-success: t9123: use test_when_finished for cleanup
"git send-email" learns to pass hostname/port to Authen::SASL module. * ag/send-email-sasl-with-host-port: send-email: pass smtp hostname and port to Authen::SASL
Move gitlab CI from macOS 14 images that are being deprecated. * ps/ci-gitlab-prepare-for-macos-14-deprecation: gitlab-ci: update to macOS 15 images meson: detect broken iconv that requires ICONV_RESTART_RESET meson: simplify iconv-emits-BOM check
"git send-email" learns to support use of client-side certificates. * dt/send-email-client-cert: send-email: add client certificate options
"git send-email" has learned to be a bit more careful when it accepts charset to use from the end-user, to avoid 'y' (mistaken 'yes' when expecting a charset like 'UTF-8') and other nonsense. * sp/send-email-validate-charset: send-email: validate charset name in 8bit encoding prompt
Reduce dependence on the global the_hash_algo and the_repository variables of wt-status code path. * sp/wt-status-wo-the-repository: wt-status: use hash_algo from local repository instead of global the_hash_algo wt-status: replace uses of the_repository with local repository instances wt-status: pass struct repository through function parameters
"git repo structure" command learns to report maximum values on various aspects of objects it inspects. * jt/repo-structure-extrema: builtin/repo: find tree with most entries builtin/repo: find commit with most parents builtin/repo: add OID annotations to table output builtin/repo: collect largest inflated objects builtin/repo: add helper for printing keyvalue output builtin/repo: update stats for each object
"git format-patch --cover-letter" learns to use a simpler format instead of the traditional shortlog format to list its commits with a new --cover-letter-format option and format.commitListFormat configuration variable. * mf/format-patch-cover-letter-format: docs: add usage for the cover-letter fmt feature format-patch: add commitListFormat config format-patch: add ability to use alt cover format format-patch: move cover letter summary generation pretty.c: add %(count) and %(total) placeholders
The construct 'test "$(command)" = expectation' loses the exit status from the command, which has been fixed by breaking up the statement into pieces. * fp/t3310-unhide-git-failures: t3310: avoid hiding failures from rev-parse in command substitutions
Doc update. * os/doc-git-custom-commands: doc: make it easier to find custom command information
While discovering a ".git" directory, the code treats any stat() failure as a sign that a filesystem entity .git does not exist there, and ignores ".git" that is not a "gitdir" file or a directory. The code has been tightened to notice and report filesystem corruption better. * ty/setup-error-tightening: setup: improve error diagnosis for invalid .git files
Plug a few leaks where mmap'ed memory regions are not unmapped. * jk/unleak-mmap: meson: turn on NO_MMAP when building with LSan Makefile: turn on NO_MMAP when building with LSan object-file: fix mmap() leak in odb_source_loose_read_object_stream() pack-revindex: avoid double-loading .rev files check_connected(): fix leak of pack-index mmap check_connected(): delay opening new_pack
Fix use of uninitialized variable. * rs/history-ergonomics-updates-fix: history: initialize rev_info in cmd_history_reword()
In-code comment update to record a design decision to allow lazy computation of patch IDs. * ty/patch-ids-document-lazy-eval: patch-ids: document intentional const-casting in patch_id_neq()
Test update. * ps/t9200-test-path-is-helpers: t9200: replace test -f with modern path helper t9200: handle missing CVS with skip_all
Revamp the way combined option filter is parsed. * dd/list-objects-filter-options-wo-strbuf-split: list-objects-filter-options: avoid strbuf_split_str() worktree: do not pass strbuf by value
A test now use symbolic constant $ZERO_OID instead of 40 "0" to work better with SHA-256 as well as SHA-1. * ss/t3200-test-zero-oid: t3200: replace hardcoded null OID with $ZERO_OID
Editorconfig filename patterns were specified incorrectly, making many source files inside subdirectories uncovered, which has been corrected. * ps/editorconfig-unanchor: editorconfig: fix style not applying to subdirs anymore
The run_command() API lost its implicit dependence on the singleton the_repository instance. * bk/run-command-wo-the-repository: run-command: wean auto_maintenance() functions off the_repository run-command: wean start_command() off the_repository
Try to resurrect and reboot a stalled "avoid sending risky escape sequences taken from sideband to the terminal" topic by Dscho. The plan is to keep it in 'next' long enough to see if anybody screams with the "everything dropped except for ANSI color escape sequence" default. * jc/neuter-sideband-fixup: sideband: drop 'default' configuration sideband: offer to configure sanitizing on a per-URL basis sideband: add options to allow more control sequences to be passed through sideband: do allow ANSI color sequences by default sideband: introduce an "escape hatch" to allow control characters sideband: mask control characters
"git rebase" learns "--trailer" command to drive the interpret-trailers machinery. * lc/rebase-trailer: rebase: support --trailer commit, tag: parse --trailer with OPT_STRVEC trailer: append trailers without fork/exec trailer: libify a couple of functions interpret-trailers: refactor create_in_place_tempfile() interpret-trailers: factor trailer rewriting
Small code clean-up around constness area. * cf/constness-fixes: dir: avoid -Wdiscarded-qualifiers in remove_path() bloom: remove a misleading const qualifier
Doc update. * jc/doc-wholesale-replace-before-next: SubmittingPatches: spell out "replace fully to pretend to be perfect"
The unit test helper function was taught to use backslash + mneomnic notation for certain control characters like "\t", instead of octal notation like "\011". * ps/unit-test-c-escape-names.txt: test-lib: print escape sequence names
Code clean-up. * ss/submodule--helper-use-xmalloc: submodule--helper: replace malloc with xmalloc
Test updates. * ms/t7605-test-path-is-helpers: t7605: use test_path_is_file instead of test -f
|
There was a status update in the "Cooking" section about the branch The path completion for commands like `git rm` and `git mv`, is being updated to hide dotfiles by default, unless the user explicitly starts the path with a dot, matching standard shell-completion behavior. Waiting for response(s) to review comment(s). cf. <xmqqik7qusuc.fsf@gitster.g> source: <pull.2311.v2.git.git.1779808987825.gitgitgadget@gmail.com> |
|
Thanks for the review. I'll examine all callers of _git_complete_index_file to better understand the current behavior and evaluate whether a more explicit or consistent API would make sense before preparing the next revision. |
You will need to follow the guidance in the "Reply to this" link to ensure that your answer actually finds the intended recipient(s). PR comments here are not mirrored to the Git mailing list. |
|
@alibaba0010 ☝️ |
|
There is an issue in commit d43fc98:
|
|
Thank you for the guidance @dscho, i would follow suit. |
|
/submit |
|
There is an issue in commit d43fc98:
|
The previous implementation required callers to explicitly pass a "hide-dotfiles" flag to __git_complete_index_file to avoid cluttering completions with hidden files. This led to inconsistent behavior across commands (e.g., `git add` and `git mv` behaved differently) and forced callers to maintain repetitive logic. As suggested by Junio C Hamano, this commit simplifies the logic: 1. __git_complete_index_file now unconditionally hides dotfiles when no match pattern is provided. 2. The awk loop in __git_index_files is refactored to check the dotfile condition in a single, obvious place after handling path dequoting, removing the previous duplication. 3. Callers no longer need to pass "hide-dotfiles". This provides a cleaner API and ensures a consistent, expected behavior where dotfiles are hidden unless explicitly requested by typing a dot. Signed-off-by: Zakariyah Ali <zakariyahali100@gmail.com>
d43fc98 to
7482ee4
Compare
|
/submit |
|
Submitted as pull.2311.v3.git.git.1781978156.gitgitgadget@gmail.com To fetch this version into To fetch this version to local tag |
|
There was a status update in the "Cooking" section about the branch The path completion for commands like `git rm` and `git mv`, is being updated to hide dotfiles by default, unless the user explicitly starts the path with a dot, matching standard shell-completion behavior. Waiting for response(s) to review comment(s). cf. <xmqqik7qusuc.fsf@gitster.g> source: <pull.2311.v2.git.git.1779808987825.gitgitgadget@gmail.com> |
|
There was a status update in the "Cooking" section about the branch The path completion for commands like `git rm` and `git mv`, is being updated to hide dotfiles by default, unless the user explicitly starts the path with a dot, matching standard shell-completion behavior. Waiting for response(s) to review comment(s). cf. <xmqqik7qusuc.fsf@gitster.g> source: <pull.2311.v2.git.git.1779808987825.gitgitgadget@gmail.com> |
|
There was a status update in the "Cooking" section about the branch The path completion for commands like `git rm` and `git mv`, is being updated to hide dotfiles by default, unless the user explicitly starts the path with a dot, matching standard shell-completion behavior. Waiting for response(s) to review comment(s). cf. <xmqqik7qusuc.fsf@gitster.g> source: <pull.2311.v2.git.git.1779808987825.gitgitgadget@gmail.com> |
|
Junio C Hamano wrote on the Git mailing list (how to reply to this email): "Zakariyah Ali via GitGitGadget" <gitgitgadget@gmail.com> writes:
> 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 removes the existing TODO expectations in t/t9902-completion.sh and
> adds coverage for explicit dot completion.
OK.
> Validation:
>
> * git diff --check -- contrib/completion/git-completion.bash
> t/t9902-completion.sh
> * bash -n contrib/completion/git-completion.bash
> * ./t9902-completion.sh
I am not sure what you wanted to say with these lines. If you did
the above to build confidence that your patch works, that would be
great. Or are you telling readers to do these things and when they
do not see any issues consider your patch perfect?
What is missing around here in this cover letter is a description of
how this iteration is different from the previous one. And ...
> Zakariyah Ali (2):
> completion: hide dotfiles for selected path completion
> completion: hide dotfiles by default for path completion
>
> contrib/completion/git-completion.bash | 53 +++++++++++++++-----------
> t/t9902-completion.sh | 19 ++++-----
> 2 files changed, 40 insertions(+), 32 deletions(-)
>
>
> base-commit: 9b7fa37559a1b95ee32e32858b0d038b4cf583e5
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2311%2Falibaba0010%2Fcompletion-hide-dotfiles-v3
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2311/alibaba0010/completion-hide-dotfiles-v3
> Pull-Request: https://github.com/git/git/pull/2311
>
> Range-diff vs v2:
>
> 1: 056e239e06 = 1: 056e239e06 completion: hide dotfiles for selected path completion
> -: ---------- > 2: 7482ee4645 completion: hide dotfiles by default for path completion
... I find this range diff very troubling. If we look at patch 2,
it seems that it redoes some part of what is done in patch 1 saying
"oops that was wrong, so let's do it better this time". Such a
drunken-mans' walk that goes in one direction in an earlier step,
only to be corrected to move to a different course, is now how we
want a new topic to be presented.
The end result may be much easier to read, mostly thanks to updated
loop in the awk script, so if we really want to pretend this as two
patches for "small pieces are easier to digest" value, perhaps have
[PATCH 1/2] that updates the awk script (without doing anything
related to hide-dotfiles theme) to make it easier to read by not
having multiple "print pfx p" in it, and then build on top of that
improved base, have [PATCH 2/2] that adds the support to hide
dotfiles, perhaps?
Since the initial iteration was quite a while ago, I no longer
remember the details of the review I gave, but I recall having hard
time telling which callers of the complete-index-file helper hide
dotfiles from their output and which callers do not hide them, and
how the patch decided to choose which ones should and should not
hide. Has it been improved and if so how? That is something we
expect the cover letter to tell, too.
Thanks. |
|
"D. Ben Knoble" wrote on the Git mailing list (how to reply to this email): [Small typo correction that may affect how the message is read]
On Sat, Jun 20, 2026 at 9:18 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> "Zakariyah Ali via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > 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 removes the existing TODO expectations in t/t9902-completion.sh and
> > adds coverage for explicit dot completion.
>
> OK.
>
> > Validation:
> >
> > * git diff --check -- contrib/completion/git-completion.bash
> > t/t9902-completion.sh
> > * bash -n contrib/completion/git-completion.bash
> > * ./t9902-completion.sh
>
> I am not sure what you wanted to say with these lines. If you did
> the above to build confidence that your patch works, that would be
> great. Or are you telling readers to do these things and when they
> do not see any issues consider your patch perfect?
>
> What is missing around here in this cover letter is a description of
> how this iteration is different from the previous one. And ...
>
> > Zakariyah Ali (2):
> > completion: hide dotfiles for selected path completion
> > completion: hide dotfiles by default for path completion
> >
> > contrib/completion/git-completion.bash | 53 +++++++++++++++-----------
> > t/t9902-completion.sh | 19 ++++-----
> > 2 files changed, 40 insertions(+), 32 deletions(-)
> >
> >
> > base-commit: 9b7fa37559a1b95ee32e32858b0d038b4cf583e5
> > Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2311%2Falibaba0010%2Fcompletion-hide-dotfiles-v3
> > Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2311/alibaba0010/completion-hide-dotfiles-v3
> > Pull-Request: https://github.com/git/git/pull/2311
> >
> > Range-diff vs v2:
> >
> > 1: 056e239e06 = 1: 056e239e06 completion: hide dotfiles for selected path completion
> > -: ---------- > 2: 7482ee4645 completion: hide dotfiles by default for path completion
>
> ... I find this range diff very troubling. If we look at patch 2,
> it seems that it redoes some part of what is done in patch 1 saying
> "oops that was wrong, so let's do it better this time". Such a
> drunken-mans' walk that goes in one direction in an earlier step,
> only to be corrected to move to a different course, is now how we
"is not" :)
> want a new topic to be presented.
>
> The end result may be much easier to read, mostly thanks to updated
> loop in the awk script, so if we really want to pretend this as two
> patches for "small pieces are easier to digest" value, perhaps have
> [PATCH 1/2] that updates the awk script (without doing anything
> related to hide-dotfiles theme) to make it easier to read by not
> having multiple "print pfx p" in it, and then build on top of that
> improved base, have [PATCH 2/2] that adds the support to hide
> dotfiles, perhaps?
>
> Since the initial iteration was quite a while ago, I no longer
> remember the details of the review I gave, but I recall having hard
> time telling which callers of the complete-index-file helper hide
> dotfiles from their output and which callers do not hide them, and
> how the patch decided to choose which ones should and should not
> hide. Has it been improved and if so how? That is something we
> expect the cover letter to tell, too.
>
> Thanks.
>
--
D. Ben Knoble |
|
User |
|
Junio C Hamano wrote on the Git mailing list (how to reply to this email): "D. Ben Knoble" <ben.knoble@gmail.com> writes:
> [Small typo correction that may affect how the message is read]
Thanks, I spotted another one.
>> ... I find this range diff very troubling. If we look at patch 2,
>> it seems that it redoes some part of what is done in patch 1 saying
>> "oops that was wrong, so let's do it better this time". Such a
>> drunken-mans' walk that goes in one direction in an earlier step,
>> only to be corrected to move to a different course, is now how we
>
> "is not" :)
True.
>> want a new topic to be presented.
>>
>> The end result may be much easier to read, mostly thanks to updated
>> loop in the awk script, so if we really want to pretend this as two
"pretend" -> "present".
>> patches for "small pieces are easier to digest" value, perhaps have
>> [PATCH 1/2] that updates the awk script (without doing anything
>> related to hide-dotfiles theme) to make it easier to read by not
>> having multiple "print pfx p" in it, and then build on top of that
>> improved base, have [PATCH 2/2] that adds the support to hide
>> dotfiles, perhaps? |
|
There was a status update in the "Cooking" section about the branch The path completion for commands like `git rm` and `git mv`, is being updated to hide dotfiles by default, unless the user explicitly starts the path with a dot, matching standard shell-completion behavior. Waiting for response(s) to review comment(s). cf. <xmqq1pe0g08t.fsf@gitster.g> source: <pull.2311.v3.git.git.1781978156.gitgitgadget@gmail.com> |
|
There was a status update in the "Cooking" section about the branch The path completion for commands like `git rm` and `git mv`, is being updated to hide dotfiles by default, unless the user explicitly starts the path with a dot, matching standard shell-completion behavior. Waiting for response(s) to review comment(s). cf. <xmqq1pe0g08t.fsf@gitster.g> source: <pull.2311.v3.git.git.1781978156.gitgitgadget@gmail.com> |
|
There was a status update in the "Cooking" section about the branch The path completion for commands like `git rm` and `git mv`, is being updated to hide dotfiles by default, unless the user explicitly starts the path with a dot, matching standard shell-completion behavior. Waiting for response(s) to review comment(s). cf. <xmqq1pe0g08t.fsf@gitster.g> source: <pull.2311.v3.git.git.1781978156.gitgitgadget@gmail.com> |
|
There was a status update in the "Cooking" section about the branch The path completion for commands like `git rm` and `git mv`, is being updated to hide dotfiles by default, unless the user explicitly starts the path with a dot, matching standard shell-completion behavior. Waiting for response(s) to review comment(s). cf. <xmqq1pe0g08t.fsf@gitster.g> cf. <xmqqbjd37i4y.fsf@gitster.g> source: <pull.2311.v3.git.git.1781978156.gitgitgadget@gmail.com> |
|
Junio C Hamano wrote on the Git mailing list (how to reply to this email): "Zakariyah Ali via GitGitGadget" <gitgitgadget@gmail.com> writes:
> 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 ..
Will we see a hopefully small and final update (v4) to conclude this
topic anytime soom? No rush, but just wondering... |
|
There was a status update in the "Cooking" section about the branch The path completion for commands like `git rm` and `git mv`, is being updated to hide dotfiles by default, unless the user explicitly starts the path with a dot, matching standard shell-completion behavior. Waiting for response(s) to review comment(s). cf. <xmqqik71t3nr.fsf@gitster.g> source: <pull.2311.v3.git.git.1781978156.gitgitgadget@gmail.com> |
|
There was a status update in the "Cooking" section about the branch Path completion for commands like 'git rm' and 'git mv' has been updated to hide dotfiles by default unless the user explicitly starts the path with a dot, matching standard shell-completion behavior. Waiting for response(s) to review comment(s). cf. <xmqqik71t3nr.fsf@gitster.g> source: <pull.2311.v3.git.git.1781978156.gitgitgadget@gmail.com> |
|
There was a status update in the "Cooking" section about the branch Path completion for commands like 'git rm' and 'git mv' has been updated to hide dotfiles by default unless the user explicitly starts the path with a dot, matching standard shell-completion behavior. Waiting for response(s) to review comment(s). cf. <xmqqik71t3nr.fsf@gitster.g> source: <pull.2311.v3.git.git.1781978156.gitgitgadget@gmail.com> |
|
There was a status update in the "Cooking" section about the branch Path completion for commands like 'git rm' and 'git mv' has been updated to hide dotfiles by default unless the user explicitly starts the path with a dot, matching standard shell-completion behavior. Waiting for response(s) to review comment(s), stalled. cf. <xmqqik71t3nr.fsf@gitster.g> source: <pull.2311.v3.git.git.1781978156.gitgitgadget@gmail.com> |
|
There was a status update in the "Cooking" section about the branch Path completion for commands like 'git rm' and 'git mv' has been updated to hide dotfiles by default unless the user explicitly starts the path with a dot, matching standard shell-completion behavior. Waiting for response(s) to review comment(s), stalled. cf. <xmqqik71t3nr.fsf@gitster.g> source: <pull.2311.v3.git.git.1781978156.gitgitgadget@gmail.com> |
The completion helper for index paths uses
git ls-filesrather than shell filename completion. As a result, leading-dot paths such as a tracked.gitignorewere offered even when the user had not started the path with..Hide leading-dot path components for
git rm,git mv, andgit ls-fileswhen completing an empty path component. Explicit dot completion is still preserved, sogit rm .can still complete.gitignore.This removes the existing TODO expectations in
t/t9902-completion.shand adds coverage for explicit dot completion.Validation:
git diff --check -- contrib/completion/git-completion.bash t/t9902-completion.shbash -n contrib/completion/git-completion.bash./t9902-completion.shcc: Zakariyah Ali zakariyahali100@gmail.com
cc: "D. Ben Knoble" ben.knoble@gmail.com