{"thread":{"id":"65681","subject":"[PATCH] completion: hide dotfiles for selected path completion","startedAt":"2026-05-24T02:36:26Z","lastAt":"2026-07-23T23:48:25Z","messageCount":14,"participants":["Zakariyah Ali via GitGitGadget","Junio C Hamano","Zakariyah Ali","D. Ben Knoble"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"543990","messageId":"pull.2311.git.git.1779590184752.gitgitgadget@gmail.com","threadId":"65681","inReplyTo":null,"subject":"[PATCH] completion: hide dotfiles for selected path completion","fromName":"Zakariyah Ali via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-05-24T02:36:24Z","receivedAt":"2026-05-24T02:36:26Z","isPatch":true,"body":"From: Zakariyah Ali <zakariyahali100@gmail.com>\n\nSigned-off-by: Zakariyah Ali <zakariyahali100@gmail.com>\n---\n    completion: hide dotfiles for selected path completion\n    \n    The completion helper for index paths uses git ls-files rather than\n    shell filename completion. As a result, leading-dot paths such as a\n    tracked .gitignore were offered even when the user had not started the\n    path with ..\n    \n    Hide leading-dot path components for git rm, git mv, and git ls-files\n    when completing an empty path component. Explicit dot completion is\n    still preserved, so git rm . can still complete .gitignore.\n    \n    This removes the existing TODO expectations in t/t9902-completion.sh and\n    adds coverage for explicit dot completion.\n    \n    Validation:\n    \n     * git diff --check -- contrib/completion/git-completion.bash\n       t/t9902-completion.sh\n     * bash -n contrib/completion/git-completion.bash\n     * ./t9902-completion.sh\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2311%2Falibaba0010%2Fcompletion-hide-dotfiles-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2311/alibaba0010/completion-hide-dotfiles-v1\nPull-Request: https://github.com/git/git/pull/2311\n\n contrib/completion/git-completion.bash | 36 +++++++++++++++++---------\n t/t9902-completion.sh                  | 10 ++-----\n 2 files changed, 26 insertions(+), 20 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex a8e7c6ddbf..e8f8fab125 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -638,25 +638,33 @@ __git_ls_files_helper ()\n }\n \n \n-# __git_index_files accepts 1 or 2 arguments:\n+# __git_index_files accepts 1 to 4 arguments:\n # 1: Options to pass to ls-files (required).\n # 2: A directory path (optional).\n #    If provided, only files within the specified directory are listed.\n #    Sub directories are never recursed.  Path must have a trailing\n #    slash.\n # 3: List only paths matching this path component (optional).\n+# 4: Hide paths whose first component starts with a dot if this is\n+#    \"hide-dotfiles\" and the third argument is empty (optional).\n __git_index_files ()\n {\n-\tlocal root=\"$2\" match=\"$3\"\n+\tlocal root=\"$2\" match=\"$3\" hide_dotfiles=\"${4-}\"\n+\tlocal hide_dotfiles_awk=0\n+\tif [ \"$hide_dotfiles\" = \"hide-dotfiles\" ] && [ -z \"$match\" ]; then\n+\t\thide_dotfiles_awk=1\n+\tfi\n \n \t__git_ls_files_helper \"$root\" \"$1\" \"${match:-?}\" |\n-\tawk -F / -v pfx=\"${2//\\\\/\\\\\\\\}\" '{\n+\tawk -F / -v pfx=\"${2//\\\\/\\\\\\\\}\" -v hide_dotfiles=\"$hide_dotfiles_awk\" '{\n \t\tpaths[$1] = 1\n \t}\n \tEND {\n \t\tfor (p in paths) {\n \t\t\tif (substr(p, 1, 1) != \"\\\"\") {\n \t\t\t\t# No special characters, easy!\n+\t\t\t\tif (hide_dotfiles == 1 && substr(p, 1, 1) == \".\")\n+\t\t\t\t\tcontinue\n \t\t\t\tprint pfx p\n \t\t\t\tcontinue\n \t\t\t}\n@@ -675,8 +683,10 @@ __git_index_files ()\n \t\t\t\t# We have seen the same directory unquoted,\n \t\t\t\t# skip it.\n \t\t\t\tcontinue\n-\t\t\telse\n-\t\t\t\tprint pfx p\n+\n+\t\t\tif (hide_dotfiles == 1 && substr(p, 1, 1) == \".\")\n+\t\t\t\tcontinue\n+\t\t\tprint pfx p\n \t\t}\n \t}\n \tfunction dequote(p,    bs_idx, out, esc, esc_idx, dec) {\n@@ -721,13 +731,15 @@ __git_index_files ()\n \t}'\n }\n \n-# __git_complete_index_file requires 1 argument:\n+# __git_complete_index_file accepts 1 or 2 arguments:\n # 1: the options to pass to ls-file\n+# 2: Hide paths whose first component starts with a dot if this is\n+#    \"hide-dotfiles\" and the current word is empty (optional).\n #\n # The exception is --committable, which finds the files appropriate commit.\n __git_complete_index_file ()\n {\n-\tlocal dequoted_word pfx=\"\" cur_\n+\tlocal dequoted_word pfx=\"\" cur_ hide_dotfiles=\"${2-}\"\n \n \t__git_dequote \"$cur\"\n \n@@ -740,7 +752,7 @@ __git_complete_index_file ()\n \t\tcur_=\"$dequoted_word\"\n \tesac\n \n-\t__gitcomp_file_direct \"$(__git_index_files \"$1\" \"$pfx\" \"$cur_\")\"\n+\t__gitcomp_file_direct \"$(__git_index_files \"$1\" \"$pfx\" \"$cur_\" \"$hide_dotfiles\")\"\n }\n \n # Lists branches from the local repository.\n@@ -2164,7 +2176,7 @@ _git_ls_files ()\n \n \t# XXX ignore options like --modified and always suggest all cached\n \t# files.\n-\t__git_complete_index_file \"--cached\"\n+\t__git_complete_index_file \"--cached\" hide-dotfiles\n }\n \n _git_ls_remote ()\n@@ -2397,9 +2409,9 @@ _git_mv ()\n \tif [ $(__git_count_arguments \"mv\") -gt 0 ]; then\n \t\t# We need to show both cached and untracked files (including\n \t\t# empty directories) since this may not be the last argument.\n-\t\t__git_complete_index_file \"--cached --others --directory\"\n+\t\t__git_complete_index_file \"--cached --others --directory\" hide-dotfiles\n \telse\n-\t\t__git_complete_index_file \"--cached\"\n+\t\t__git_complete_index_file \"--cached\" hide-dotfiles\n \tfi\n }\n \n@@ -3219,7 +3231,7 @@ _git_rm ()\n \t\t;;\n \tesac\n \n-\t__git_complete_index_file \"--cached\"\n+\t__git_complete_index_file \"--cached\" hide-dotfiles\n }\n \n _git_shortlog ()\ndiff --git a/t/t9902-completion.sh b/t/t9902-completion.sh\nindex 28f61f08fb..02aaf71876 100755\n--- a/t/t9902-completion.sh\n+++ b/t/t9902-completion.sh\n@@ -2811,17 +2811,15 @@ test_expect_success 'complete files' '\n \n \ttouch untracked &&\n \n-\t: TODO .gitignore should not be here &&\n \ttest_completion \"git rm \" <<-\\EOF &&\n-\t.gitignore\n \tmodified\n \tEOF\n \n+\ttest_completion \"git rm .\" \".gitignore\" &&\n+\n \ttest_completion \"git clean \" \"untracked\" &&\n \n-\t: TODO .gitignore should not be here &&\n \ttest_completion \"git mv \" <<-\\EOF &&\n-\t.gitignore\n \tmodified\n \tEOF\n \n@@ -2832,9 +2830,7 @@ test_expect_success 'complete files' '\n \n \tmkdir untracked-dir &&\n \n-\t: TODO .gitignore should not be here &&\n \ttest_completion \"git mv modified \" <<-\\EOF &&\n-\t.gitignore\n \tdir\n \tmodified\n \tuntracked\n@@ -2843,9 +2839,7 @@ test_expect_success 'complete files' '\n \n \ttest_completion \"git commit \" \"modified\" &&\n \n-\t: TODO .gitignore should not be here &&\n \ttest_completion \"git ls-files \" <<-\\EOF &&\n-\t.gitignore\n \tdir\n \tmodified\n \tEOF\n\nbase-commit: 9b7fa37559a1b95ee32e32858b0d038b4cf583e5\n-- \ngitgitgadget\n"},{"id":"543996","messageId":"xmqq8q99huw5.fsf@gitster.g","threadId":"65681","inReplyTo":"pull.2311.git.git.1779590184752.gitgitgadget@gmail.com","subject":"Re: [PATCH] completion: hide dotfiles for selected path completion","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-05-24T12:08:58Z","receivedAt":"2026-05-24T12:09:00Z","isPatch":true,"body":"\"Zakariyah Ali via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: Zakariyah Ali <zakariyahali100@gmail.com>\n>\n> Signed-off-by: Zakariyah Ali <zakariyahali100@gmail.com>\n> ---\n>     completion: hide dotfiles for selected path completion\n>     \n>     The completion helper for index paths uses git ls-files rather than\n>     shell filename completion. As a result, leading-dot paths such as a\n>     tracked .gitignore were offered even when the user had not started the\n>     path with ..\n\nWriting 'path with \".\".' would have been easieer to grok.\n\n>     Hide leading-dot path components for git rm, git mv, and git ls-files\n>     when completing an empty path component. Explicit dot completion is\n>     still preserved, so git rm . can still complete .gitignore.\n\nI am not sure why this is a good idea.  If we said \"git rm g<TAB>\nand offered \".gitignore\" as a candidate, it may be annoying, but\ntracked (or untracked for that matter) \".gitignore\" and \"gitfoo\"\nshould be treated the same way by \"git rm <TAB>\" no?\n\n>     This removes the existing TODO expectations in t/t9902-completion.sh and\n>     adds coverage for explicit dot completion.\n\nIn any case, all of the above should be in the proposed log message,\nnot below the three-dash line.\n"},{"id":"544111","messageId":"pull.2311.v2.git.git.1779808987825.gitgitgadget@gmail.com","threadId":"65681","inReplyTo":"pull.2311.git.git.1779590184752.gitgitgadget@gmail.com","subject":"[PATCH v2] completion: hide dotfiles for selected path completion","fromName":"Zakariyah Ali via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-05-26T15:23:07Z","receivedAt":"2026-05-26T15:23:10Z","isPatch":true,"body":"From: Zakariyah Ali <zakariyahali100@gmail.com>\n\nThe completion helper for index paths uses git ls-files rather than\nshell filename completion. As a result, leading-dot paths such as a\ntracked .gitignore were offered even when the user had not started the\npath with \".\".\n\nHide leading-dot path components for git rm, git mv, and git ls-files\nwhen completing an empty path component. Explicit dot completion is\nstill preserved, so git rm . can still complete .gitignore.\n\nThis matches standard shell filename completion behavior, where dotfiles\nare hidden by default unless the user starts their input with a dot.\nThis also resolves four TODO comments in t/9902-completion.sh which\nhave been present since 2013 (commit ddf07bddef9a, \"completion: add file\ncompletion tests\", 2013-04-27), expecting that .gitignore would not be\nshown when completing on an empty path component.\n\nSigned-off-by: Zakariyah Ali <zakariyahali100@gmail.com>\n---\n    completion: hide dotfiles for selected path completion\n    \n    The completion helper for index paths uses git ls-files rather than\n    shell filename completion. As a result, leading-dot paths such as a\n    tracked .gitignore were offered even when the user had not started the\n    path with ..\n    \n    Hide leading-dot path components for git rm, git mv, and git ls-files\n    when completing an empty path component. Explicit dot completion is\n    still preserved, so git rm . can still complete .gitignore.\n    \n    This removes the existing TODO expectations in t/t9902-completion.sh and\n    adds coverage for explicit dot completion.\n    \n    Validation:\n    \n     * git diff --check -- contrib/completion/git-completion.bash\n       t/t9902-completion.sh\n     * bash -n contrib/completion/git-completion.bash\n     * ./t9902-completion.sh\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2311%2Falibaba0010%2Fcompletion-hide-dotfiles-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2311/alibaba0010/completion-hide-dotfiles-v2\nPull-Request: https://github.com/git/git/pull/2311\n\nRange-diff vs v1:\n\n 1:  5ccb408fd5 ! 1:  056e239e06 completion: hide dotfiles for selected path completion\n     @@ Metadata\n       ## Commit message ##\n          completion: hide dotfiles for selected path completion\n      \n     +    The completion helper for index paths uses git ls-files rather than\n     +    shell filename completion. As a result, leading-dot paths such as a\n     +    tracked .gitignore were offered even when the user had not started the\n     +    path with \".\".\n     +\n     +    Hide leading-dot path components for git rm, git mv, and git ls-files\n     +    when completing an empty path component. Explicit dot completion is\n     +    still preserved, so git rm . can still complete .gitignore.\n     +\n     +    This matches standard shell filename completion behavior, where dotfiles\n     +    are hidden by default unless the user starts their input with a dot.\n     +    This also resolves four TODO comments in t/9902-completion.sh which\n     +    have been present since 2013 (commit ddf07bddef9a, \"completion: add file\n     +    completion tests\", 2013-04-27), expecting that .gitignore would not be\n     +    shown when completing on an empty path component.\n     +\n          Signed-off-by: Zakariyah Ali <zakariyahali100@gmail.com>\n      \n       ## contrib/completion/git-completion.bash ##\n\n\n contrib/completion/git-completion.bash | 36 +++++++++++++++++---------\n t/t9902-completion.sh                  | 10 ++-----\n 2 files changed, 26 insertions(+), 20 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex a8e7c6ddbf..e8f8fab125 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -638,25 +638,33 @@ __git_ls_files_helper ()\n }\n \n \n-# __git_index_files accepts 1 or 2 arguments:\n+# __git_index_files accepts 1 to 4 arguments:\n # 1: Options to pass to ls-files (required).\n # 2: A directory path (optional).\n #    If provided, only files within the specified directory are listed.\n #    Sub directories are never recursed.  Path must have a trailing\n #    slash.\n # 3: List only paths matching this path component (optional).\n+# 4: Hide paths whose first component starts with a dot if this is\n+#    \"hide-dotfiles\" and the third argument is empty (optional).\n __git_index_files ()\n {\n-\tlocal root=\"$2\" match=\"$3\"\n+\tlocal root=\"$2\" match=\"$3\" hide_dotfiles=\"${4-}\"\n+\tlocal hide_dotfiles_awk=0\n+\tif [ \"$hide_dotfiles\" = \"hide-dotfiles\" ] && [ -z \"$match\" ]; then\n+\t\thide_dotfiles_awk=1\n+\tfi\n \n \t__git_ls_files_helper \"$root\" \"$1\" \"${match:-?}\" |\n-\tawk -F / -v pfx=\"${2//\\\\/\\\\\\\\}\" '{\n+\tawk -F / -v pfx=\"${2//\\\\/\\\\\\\\}\" -v hide_dotfiles=\"$hide_dotfiles_awk\" '{\n \t\tpaths[$1] = 1\n \t}\n \tEND {\n \t\tfor (p in paths) {\n \t\t\tif (substr(p, 1, 1) != \"\\\"\") {\n \t\t\t\t# No special characters, easy!\n+\t\t\t\tif (hide_dotfiles == 1 && substr(p, 1, 1) == \".\")\n+\t\t\t\t\tcontinue\n \t\t\t\tprint pfx p\n \t\t\t\tcontinue\n \t\t\t}\n@@ -675,8 +683,10 @@ __git_index_files ()\n \t\t\t\t# We have seen the same directory unquoted,\n \t\t\t\t# skip it.\n \t\t\t\tcontinue\n-\t\t\telse\n-\t\t\t\tprint pfx p\n+\n+\t\t\tif (hide_dotfiles == 1 && substr(p, 1, 1) == \".\")\n+\t\t\t\tcontinue\n+\t\t\tprint pfx p\n \t\t}\n \t}\n \tfunction dequote(p,    bs_idx, out, esc, esc_idx, dec) {\n@@ -721,13 +731,15 @@ __git_index_files ()\n \t}'\n }\n \n-# __git_complete_index_file requires 1 argument:\n+# __git_complete_index_file accepts 1 or 2 arguments:\n # 1: the options to pass to ls-file\n+# 2: Hide paths whose first component starts with a dot if this is\n+#    \"hide-dotfiles\" and the current word is empty (optional).\n #\n # The exception is --committable, which finds the files appropriate commit.\n __git_complete_index_file ()\n {\n-\tlocal dequoted_word pfx=\"\" cur_\n+\tlocal dequoted_word pfx=\"\" cur_ hide_dotfiles=\"${2-}\"\n \n \t__git_dequote \"$cur\"\n \n@@ -740,7 +752,7 @@ __git_complete_index_file ()\n \t\tcur_=\"$dequoted_word\"\n \tesac\n \n-\t__gitcomp_file_direct \"$(__git_index_files \"$1\" \"$pfx\" \"$cur_\")\"\n+\t__gitcomp_file_direct \"$(__git_index_files \"$1\" \"$pfx\" \"$cur_\" \"$hide_dotfiles\")\"\n }\n \n # Lists branches from the local repository.\n@@ -2164,7 +2176,7 @@ _git_ls_files ()\n \n \t# XXX ignore options like --modified and always suggest all cached\n \t# files.\n-\t__git_complete_index_file \"--cached\"\n+\t__git_complete_index_file \"--cached\" hide-dotfiles\n }\n \n _git_ls_remote ()\n@@ -2397,9 +2409,9 @@ _git_mv ()\n \tif [ $(__git_count_arguments \"mv\") -gt 0 ]; then\n \t\t# We need to show both cached and untracked files (including\n \t\t# empty directories) since this may not be the last argument.\n-\t\t__git_complete_index_file \"--cached --others --directory\"\n+\t\t__git_complete_index_file \"--cached --others --directory\" hide-dotfiles\n \telse\n-\t\t__git_complete_index_file \"--cached\"\n+\t\t__git_complete_index_file \"--cached\" hide-dotfiles\n \tfi\n }\n \n@@ -3219,7 +3231,7 @@ _git_rm ()\n \t\t;;\n \tesac\n \n-\t__git_complete_index_file \"--cached\"\n+\t__git_complete_index_file \"--cached\" hide-dotfiles\n }\n \n _git_shortlog ()\ndiff --git a/t/t9902-completion.sh b/t/t9902-completion.sh\nindex 28f61f08fb..02aaf71876 100755\n--- a/t/t9902-completion.sh\n+++ b/t/t9902-completion.sh\n@@ -2811,17 +2811,15 @@ test_expect_success 'complete files' '\n \n \ttouch untracked &&\n \n-\t: TODO .gitignore should not be here &&\n \ttest_completion \"git rm \" <<-\\EOF &&\n-\t.gitignore\n \tmodified\n \tEOF\n \n+\ttest_completion \"git rm .\" \".gitignore\" &&\n+\n \ttest_completion \"git clean \" \"untracked\" &&\n \n-\t: TODO .gitignore should not be here &&\n \ttest_completion \"git mv \" <<-\\EOF &&\n-\t.gitignore\n \tmodified\n \tEOF\n \n@@ -2832,9 +2830,7 @@ test_expect_success 'complete files' '\n \n \tmkdir untracked-dir &&\n \n-\t: TODO .gitignore should not be here &&\n \ttest_completion \"git mv modified \" <<-\\EOF &&\n-\t.gitignore\n \tdir\n \tmodified\n \tuntracked\n@@ -2843,9 +2839,7 @@ test_expect_success 'complete files' '\n \n \ttest_completion \"git commit \" \"modified\" &&\n \n-\t: TODO .gitignore should not be here &&\n \ttest_completion \"git ls-files \" <<-\\EOF &&\n-\t.gitignore\n \tdir\n \tmodified\n \tEOF\n\nbase-commit: 9b7fa37559a1b95ee32e32858b0d038b4cf583e5\n-- \ngitgitgadget\n"},{"id":"544134","messageId":"xmqqqzmxlep3.fsf@gitster.g","threadId":"65681","inReplyTo":"pull.2311.v2.git.git.1779808987825.gitgitgadget@gmail.com","subject":"Re: [PATCH v2] completion: hide dotfiles for selected path completion","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-05-27T03:22:00Z","receivedAt":"2026-05-27T03:22:03Z","isPatch":true,"body":"\"Zakariyah Ali via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> This matches standard shell filename completion behavior, where dotfiles\n> are hidden by default unless the user starts their input with a dot.\n\nOK, with this rationale added, I no longer have problem with the\nproposed new behaviour.\n\nAs I'm not going to give a serious review  on the patch body itself,\nI would really appreciate somebody more knowledgeable on the\nexisting bach completion code than I am to take a look.\n\nThanks.\n"},{"id":"544638","messageId":"20260603180951.86323-1-zakariyahali100@gmail.com","threadId":"65681","inReplyTo":"pull.2311.v2.git.git.1779808987825.gitgitgadget@gmail.com","subject":"Follow-up and appreciation regarding Git contributions","fromName":"Zakariyah Ali","fromEmail":"zakariyahali100@gmail.com","sentAt":"2026-06-03T18:09:51Z","receivedAt":"2026-06-03T18:10:38Z","isPatch":false,"body":"Dear Junio,\n\nI hope you are doing well.\n\nI wanted to briefly follow up on my recent patch submission (Message-ID: <pull.2311.v2.git.git.1779808987825.gitgitgadget@gmail.com>). Thank you for accepting the rationale for the new behavior! Since you mentioned it would be helpful for someone more familiar with the bash completion code to review the patch itself, I wanted to ask if there is anyone specific I should CC, or if I should simply wait for another reviewer to pick it up. I would be grateful if you would let me know if there is anything else needed from my side.\n\nAlso, thank you again for the detailed reviews and guidance on my recent Git contributions. Your feedback on patch structure, commit messaging, and contribution workflow has been extremely valuable, and I genuinely appreciate the time you invest in reviewing contributions from newer developers.\n\nSeparately, I also wanted to ask for your advice professionally. I am a software engineer with over four years of experience, currently looking for entry-level or internship opportunities where I can continue growing as a systems and open-source developer. If you happen to know of any relevant opportunities, or have suggestions on how I might better position myself through open-source work  or any other opportunities, I would sincerely appreciate any guidance.\n\nThank you again for your time and for maintaining such a high-quality development and review culture around Git.\n\nBest regards,\nZakariyah Ali.\n"},{"id":"545184","messageId":"xmqqik7qusuc.fsf@gitster.g","threadId":"65681","inReplyTo":"pull.2311.v2.git.git.1779808987825.gitgitgadget@gmail.com","subject":"Re: [PATCH v2] completion: hide dotfiles for selected path completion","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-06-10T18:56:59Z","receivedAt":"2026-06-10T18:57:02Z","isPatch":true,"body":"\"Zakariyah Ali via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> -# __git_index_files accepts 1 or 2 arguments:\n> +# __git_index_files accepts 1 to 4 arguments:\n>  # 1: Options to pass to ls-files (required).\n>  # 2: A directory path (optional).\n>  #    If provided, only files within the specified directory are listed.\n>  #    Sub directories are never recursed.  Path must have a trailing\n>  #    slash.\n>  # 3: List only paths matching this path component (optional).\n> +# 4: Hide paths whose first component starts with a dot if this is\n> +#    \"hide-dotfiles\" and the third argument is empty (optional).\n>  __git_index_files ()\n>  {\n> -\tlocal root=\"$2\" match=\"$3\"\n> +\tlocal root=\"$2\" match=\"$3\" hide_dotfiles=\"${4-}\"\n> +\tlocal hide_dotfiles_awk=0\n> +\tif [ \"$hide_dotfiles\" = \"hide-dotfiles\" ] && [ -z \"$match\" ]; then\n> +\t\thide_dotfiles_awk=1\n> +\tfi\n>  \n>  \t__git_ls_files_helper \"$root\" \"$1\" \"${match:-?}\" |\n> -\tawk -F / -v pfx=\"${2//\\\\/\\\\\\\\}\" '{\n> +\tawk -F / -v pfx=\"${2//\\\\/\\\\\\\\}\" -v hide_dotfiles=\"$hide_dotfiles_awk\" '{\n>  \t\tpaths[$1] = 1\n>  \t}\n>  \tEND {\n>  \t\tfor (p in paths) {\n>  \t\t\tif (substr(p, 1, 1) != \"\\\"\") {\n>  \t\t\t\t# No special characters, easy!\n> +\t\t\t\tif (hide_dotfiles == 1 && substr(p, 1, 1) == \".\")\n> +\t\t\t\t\tcontinue\n>  \t\t\t\tprint pfx p\n>  \t\t\t\tcontinue\n>  \t\t\t}\n> @@ -675,8 +683,10 @@ __git_index_files ()\n>  \t\t\t\t# We have seen the same directory unquoted,\n>  \t\t\t\t# skip it.\n>  \t\t\t\tcontinue\n> -\t\t\telse\n> -\t\t\t\tprint pfx p\n> +\n> +\t\t\tif (hide_dotfiles == 1 && substr(p, 1, 1) == \".\")\n> +\t\t\t\tcontinue\n> +\t\t\tprint pfx p\n>  \t\t}\n>  \t}\n\nHaving to repeat the same thing twice here is a bit unsatisfying,\nbut that is not a fault of this addition.  I suspect that it would\nhave been simpler to patch if the original were first simplified\ninto something like:\n\n\tfor (p in paths) {\n\t\tif (substr(p, 1, 1) == \"\\\"\") {\n\t\t\tp = dequote(p);\n\t\t\tif ((p == \"\") || (p in paths))\n\t\t\t\tcontinue\n\t\t}\n                print pfx p\n\t}\n\nThen the new \"ah, that thing begins with a dot\" logic can be added\nonly once and at an obvious place.\n\n> @@ -2164,7 +2176,7 @@ _git_ls_files ()\n>  \n>  \t# XXX ignore options like --modified and always suggest all cached\n>  \t# files.\n> -\t__git_complete_index_file \"--cached\"\n> +\t__git_complete_index_file \"--cached\" hide-dotfiles\n>  }\n\nIn this patch, it is hard to tell from the patch what _other_ calls\nto the __git_complete_index_file helper lack hide-dotfiles flag\n(i.e., they are to show everything including the path that begins\nwith a dot).  I will not try to be exhaustive, but for example\n_git_add does not get hide-dotfiles but it is unclear why.  The same\nfor _clean, _commit.  But _mv does hide them.  The choice seems\narbitrary and incoherent.\n\nA few ideas (some of them may be mutually incompatible)\n\n * Instead of \"empty vs hide-dotfiles\", perhaps make the 2nd option\n   mandatory for __git_complete_index_file, e.g., \"hide-\" vs\n   \"include-\" dotfiles, to make it easier to see in the patch which\n   ones exclude and which ones include dotfiles.\n\n * Extend comments like we saw in the above hunk to say why we treat\n   files that begin with dot specially.\n\n * Make __git_complete_index_file unconditionally hide the dotfiles\n   when there is no match pattern for consistency (getting rid of\n   the need to explay why).\n\n"},{"id":"546040","messageId":"pull.2311.v3.git.git.1781978156.gitgitgadget@gmail.com","threadId":"65681","inReplyTo":"pull.2311.v2.git.git.1779808987825.gitgitgadget@gmail.com","subject":"[PATCH v3 0/2] completion: hide dotfiles for selected path completion","fromName":"Zakariyah Ali via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-06-20T17:55:54Z","receivedAt":"2026-06-20T17:55:58Z","isPatch":true,"body":"The completion helper for index paths uses git ls-files rather than shell\nfilename completion. As a result, leading-dot paths such as a tracked\n.gitignore were offered even when the user had not started the path with ..\n\nHide leading-dot path components for git rm, git mv, and git ls-files when\ncompleting an empty path component. Explicit dot completion is still\npreserved, so git rm . can still complete .gitignore.\n\nThis removes the existing TODO expectations in t/t9902-completion.sh and\nadds coverage for explicit dot completion.\n\nValidation:\n\n * git diff --check -- contrib/completion/git-completion.bash\n   t/t9902-completion.sh\n * bash -n contrib/completion/git-completion.bash\n * ./t9902-completion.sh\n\nZakariyah Ali (2):\n  completion: hide dotfiles for selected path completion\n  completion: hide dotfiles by default for path completion\n\n contrib/completion/git-completion.bash | 53 +++++++++++++++-----------\n t/t9902-completion.sh                  | 19 ++++-----\n 2 files changed, 40 insertions(+), 32 deletions(-)\n\n\nbase-commit: 9b7fa37559a1b95ee32e32858b0d038b4cf583e5\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2311%2Falibaba0010%2Fcompletion-hide-dotfiles-v3\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2311/alibaba0010/completion-hide-dotfiles-v3\nPull-Request: https://github.com/git/git/pull/2311\n\nRange-diff vs v2:\n\n 1:  056e239e06 = 1:  056e239e06 completion: hide dotfiles for selected path completion\n -:  ---------- > 2:  7482ee4645 completion: hide dotfiles by default for path completion\n\n-- \ngitgitgadget\n"},{"id":"546041","messageId":"056e239e06ae7f54e9d23a8adce6ea1ec4002b32.1781978156.git.gitgitgadget@gmail.com","threadId":"65681","inReplyTo":"pull.2311.v3.git.git.1781978156.gitgitgadget@gmail.com","subject":"[PATCH v3 1/2] completion: hide dotfiles for selected path completion","fromName":"Zakariyah Ali via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-06-20T17:55:55Z","receivedAt":"2026-06-20T17:55:59Z","isPatch":true,"body":"From: Zakariyah Ali <zakariyahali100@gmail.com>\n\nThe completion helper for index paths uses git ls-files rather than\nshell filename completion. As a result, leading-dot paths such as a\ntracked .gitignore were offered even when the user had not started the\npath with \".\".\n\nHide leading-dot path components for git rm, git mv, and git ls-files\nwhen completing an empty path component. Explicit dot completion is\nstill preserved, so git rm . can still complete .gitignore.\n\nThis matches standard shell filename completion behavior, where dotfiles\nare hidden by default unless the user starts their input with a dot.\nThis also resolves four TODO comments in t/9902-completion.sh which\nhave been present since 2013 (commit ddf07bddef9a, \"completion: add file\ncompletion tests\", 2013-04-27), expecting that .gitignore would not be\nshown when completing on an empty path component.\n\nSigned-off-by: Zakariyah Ali <zakariyahali100@gmail.com>\n---\n contrib/completion/git-completion.bash | 36 +++++++++++++++++---------\n t/t9902-completion.sh                  | 10 ++-----\n 2 files changed, 26 insertions(+), 20 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex a8e7c6ddbf..e8f8fab125 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -638,25 +638,33 @@ __git_ls_files_helper ()\n }\n \n \n-# __git_index_files accepts 1 or 2 arguments:\n+# __git_index_files accepts 1 to 4 arguments:\n # 1: Options to pass to ls-files (required).\n # 2: A directory path (optional).\n #    If provided, only files within the specified directory are listed.\n #    Sub directories are never recursed.  Path must have a trailing\n #    slash.\n # 3: List only paths matching this path component (optional).\n+# 4: Hide paths whose first component starts with a dot if this is\n+#    \"hide-dotfiles\" and the third argument is empty (optional).\n __git_index_files ()\n {\n-\tlocal root=\"$2\" match=\"$3\"\n+\tlocal root=\"$2\" match=\"$3\" hide_dotfiles=\"${4-}\"\n+\tlocal hide_dotfiles_awk=0\n+\tif [ \"$hide_dotfiles\" = \"hide-dotfiles\" ] && [ -z \"$match\" ]; then\n+\t\thide_dotfiles_awk=1\n+\tfi\n \n \t__git_ls_files_helper \"$root\" \"$1\" \"${match:-?}\" |\n-\tawk -F / -v pfx=\"${2//\\\\/\\\\\\\\}\" '{\n+\tawk -F / -v pfx=\"${2//\\\\/\\\\\\\\}\" -v hide_dotfiles=\"$hide_dotfiles_awk\" '{\n \t\tpaths[$1] = 1\n \t}\n \tEND {\n \t\tfor (p in paths) {\n \t\t\tif (substr(p, 1, 1) != \"\\\"\") {\n \t\t\t\t# No special characters, easy!\n+\t\t\t\tif (hide_dotfiles == 1 && substr(p, 1, 1) == \".\")\n+\t\t\t\t\tcontinue\n \t\t\t\tprint pfx p\n \t\t\t\tcontinue\n \t\t\t}\n@@ -675,8 +683,10 @@ __git_index_files ()\n \t\t\t\t# We have seen the same directory unquoted,\n \t\t\t\t# skip it.\n \t\t\t\tcontinue\n-\t\t\telse\n-\t\t\t\tprint pfx p\n+\n+\t\t\tif (hide_dotfiles == 1 && substr(p, 1, 1) == \".\")\n+\t\t\t\tcontinue\n+\t\t\tprint pfx p\n \t\t}\n \t}\n \tfunction dequote(p,    bs_idx, out, esc, esc_idx, dec) {\n@@ -721,13 +731,15 @@ __git_index_files ()\n \t}'\n }\n \n-# __git_complete_index_file requires 1 argument:\n+# __git_complete_index_file accepts 1 or 2 arguments:\n # 1: the options to pass to ls-file\n+# 2: Hide paths whose first component starts with a dot if this is\n+#    \"hide-dotfiles\" and the current word is empty (optional).\n #\n # The exception is --committable, which finds the files appropriate commit.\n __git_complete_index_file ()\n {\n-\tlocal dequoted_word pfx=\"\" cur_\n+\tlocal dequoted_word pfx=\"\" cur_ hide_dotfiles=\"${2-}\"\n \n \t__git_dequote \"$cur\"\n \n@@ -740,7 +752,7 @@ __git_complete_index_file ()\n \t\tcur_=\"$dequoted_word\"\n \tesac\n \n-\t__gitcomp_file_direct \"$(__git_index_files \"$1\" \"$pfx\" \"$cur_\")\"\n+\t__gitcomp_file_direct \"$(__git_index_files \"$1\" \"$pfx\" \"$cur_\" \"$hide_dotfiles\")\"\n }\n \n # Lists branches from the local repository.\n@@ -2164,7 +2176,7 @@ _git_ls_files ()\n \n \t# XXX ignore options like --modified and always suggest all cached\n \t# files.\n-\t__git_complete_index_file \"--cached\"\n+\t__git_complete_index_file \"--cached\" hide-dotfiles\n }\n \n _git_ls_remote ()\n@@ -2397,9 +2409,9 @@ _git_mv ()\n \tif [ $(__git_count_arguments \"mv\") -gt 0 ]; then\n \t\t# We need to show both cached and untracked files (including\n \t\t# empty directories) since this may not be the last argument.\n-\t\t__git_complete_index_file \"--cached --others --directory\"\n+\t\t__git_complete_index_file \"--cached --others --directory\" hide-dotfiles\n \telse\n-\t\t__git_complete_index_file \"--cached\"\n+\t\t__git_complete_index_file \"--cached\" hide-dotfiles\n \tfi\n }\n \n@@ -3219,7 +3231,7 @@ _git_rm ()\n \t\t;;\n \tesac\n \n-\t__git_complete_index_file \"--cached\"\n+\t__git_complete_index_file \"--cached\" hide-dotfiles\n }\n \n _git_shortlog ()\ndiff --git a/t/t9902-completion.sh b/t/t9902-completion.sh\nindex 28f61f08fb..02aaf71876 100755\n--- a/t/t9902-completion.sh\n+++ b/t/t9902-completion.sh\n@@ -2811,17 +2811,15 @@ test_expect_success 'complete files' '\n \n \ttouch untracked &&\n \n-\t: TODO .gitignore should not be here &&\n \ttest_completion \"git rm \" <<-\\EOF &&\n-\t.gitignore\n \tmodified\n \tEOF\n \n+\ttest_completion \"git rm .\" \".gitignore\" &&\n+\n \ttest_completion \"git clean \" \"untracked\" &&\n \n-\t: TODO .gitignore should not be here &&\n \ttest_completion \"git mv \" <<-\\EOF &&\n-\t.gitignore\n \tmodified\n \tEOF\n \n@@ -2832,9 +2830,7 @@ test_expect_success 'complete files' '\n \n \tmkdir untracked-dir &&\n \n-\t: TODO .gitignore should not be here &&\n \ttest_completion \"git mv modified \" <<-\\EOF &&\n-\t.gitignore\n \tdir\n \tmodified\n \tuntracked\n@@ -2843,9 +2839,7 @@ test_expect_success 'complete files' '\n \n \ttest_completion \"git commit \" \"modified\" &&\n \n-\t: TODO .gitignore should not be here &&\n \ttest_completion \"git ls-files \" <<-\\EOF &&\n-\t.gitignore\n \tdir\n \tmodified\n \tEOF\n-- \ngitgitgadget\n\n"},{"id":"546042","messageId":"7482ee46454606a0883117d6cded6df809de710c.1781978156.git.gitgitgadget@gmail.com","threadId":"65681","inReplyTo":"pull.2311.v3.git.git.1781978156.gitgitgadget@gmail.com","subject":"[PATCH v3 2/2] completion: hide dotfiles by default for path completion","fromName":"Zakariyah Ali via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-06-20T17:55:56Z","receivedAt":"2026-06-20T17:56:00Z","isPatch":true,"body":"From: Zakariyah Ali <zakariyahali100@gmail.com>\n\nThe previous implementation required callers to explicitly pass a\n\"hide-dotfiles\" flag to __git_complete_index_file to avoid cluttering\ncompletions with hidden files. This led to inconsistent behavior across\ncommands (e.g., `git add` and `git mv` behaved differently) and forced\ncallers to maintain repetitive logic.\n\nAs suggested by Junio C Hamano, this commit simplifies the logic:\n1. __git_complete_index_file now unconditionally hides dotfiles when\n   no match pattern is provided.\n2. The awk loop in __git_index_files is refactored to check the dotfile\n   condition in a single, obvious place after handling path dequoting,\n   removing the previous duplication.\n3. Callers no longer need to pass \"hide-dotfiles\".\n\nThis provides a cleaner API and ensures a consistent, expected behavior\nwhere dotfiles are hidden unless explicitly requested by typing a dot.\n\nSigned-off-by: Zakariyah Ali <zakariyahali100@gmail.com>\n---\n contrib/completion/git-completion.bash | 65 ++++++++++++--------------\n t/t9902-completion.sh                  |  9 +++-\n 2 files changed, 38 insertions(+), 36 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex e8f8fab125..b0b1b3c27a 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -638,20 +638,23 @@ __git_ls_files_helper ()\n }\n \n \n-# __git_index_files accepts 1 to 4 arguments:\n+# __git_index_files accepts 1 to 3 arguments:\n # 1: Options to pass to ls-files (required).\n # 2: A directory path (optional).\n #    If provided, only files within the specified directory are listed.\n #    Sub directories are never recursed.  Path must have a trailing\n #    slash.\n # 3: List only paths matching this path component (optional).\n-# 4: Hide paths whose first component starts with a dot if this is\n-#    \"hide-dotfiles\" and the third argument is empty (optional).\n+#\n+# If the third argument is empty, paths that begin with a dot (dotfiles)\n+# are hidden. This matches user expectations where dotfiles are considered\n+# hidden configuration files/directories and shouldn't clutter default\n+# completions unless explicitly requested by typing a dot.\n __git_index_files ()\n {\n-\tlocal root=\"$2\" match=\"$3\" hide_dotfiles=\"${4-}\"\n+\tlocal root=\"$2\" match=\"$3\"\n \tlocal hide_dotfiles_awk=0\n-\tif [ \"$hide_dotfiles\" = \"hide-dotfiles\" ] && [ -z \"$match\" ]; then\n+\tif [ -z \"$match\" ]; then\n \t\thide_dotfiles_awk=1\n \tfi\n \n@@ -661,28 +664,22 @@ __git_index_files ()\n \t}\n \tEND {\n \t\tfor (p in paths) {\n-\t\t\tif (substr(p, 1, 1) != \"\\\"\") {\n-\t\t\t\t# No special characters, easy!\n-\t\t\t\tif (hide_dotfiles == 1 && substr(p, 1, 1) == \".\")\n+\t\t\tif (substr(p, 1, 1) == \"\\\"\") {\n+\t\t\t\t# The path is quoted.\n+\t\t\t\tp = dequote(p)\n+\t\t\t\tif (p == \"\")\n \t\t\t\t\tcontinue\n-\t\t\t\tprint pfx p\n-\t\t\t\tcontinue\n-\t\t\t}\n-\n-\t\t\t# The path is quoted.\n-\t\t\tp = dequote(p)\n-\t\t\tif (p == \"\")\n-\t\t\t\tcontinue\n \n-\t\t\t# Even when a directory name itself does not contain\n-\t\t\t# any special characters, it will still be quoted if\n-\t\t\t# any of its (stripped) trailing path components do.\n-\t\t\t# Because of this we may have seen the same directory\n-\t\t\t# both quoted and unquoted.\n-\t\t\tif (p in paths)\n-\t\t\t\t# We have seen the same directory unquoted,\n-\t\t\t\t# skip it.\n-\t\t\t\tcontinue\n+\t\t\t\t# Even when a directory name itself does not contain\n+\t\t\t\t# any special characters, it will still be quoted if\n+\t\t\t\t# any of its (stripped) trailing path components do.\n+\t\t\t\t# Because of this we may have seen the same directory\n+\t\t\t\t# both quoted and unquoted.\n+\t\t\t\tif (p in paths)\n+\t\t\t\t\t# We have seen the same directory unquoted,\n+\t\t\t\t\t# skip it.\n+\t\t\t\t\tcontinue\n+\t\t\t}\n \n \t\t\tif (hide_dotfiles == 1 && substr(p, 1, 1) == \".\")\n \t\t\t\tcontinue\n@@ -731,15 +728,13 @@ __git_index_files ()\n \t}'\n }\n \n-# __git_complete_index_file accepts 1 or 2 arguments:\n-# 1: the options to pass to ls-file\n-# 2: Hide paths whose first component starts with a dot if this is\n-#    \"hide-dotfiles\" and the current word is empty (optional).\n+# __git_complete_index_file accepts 1 argument:\n+# 1: the options to pass to ls-files\n #\n # The exception is --committable, which finds the files appropriate commit.\n __git_complete_index_file ()\n {\n-\tlocal dequoted_word pfx=\"\" cur_ hide_dotfiles=\"${2-}\"\n+\tlocal dequoted_word pfx=\"\" cur_\n \n \t__git_dequote \"$cur\"\n \n@@ -752,7 +747,7 @@ __git_complete_index_file ()\n \t\tcur_=\"$dequoted_word\"\n \tesac\n \n-\t__gitcomp_file_direct \"$(__git_index_files \"$1\" \"$pfx\" \"$cur_\" \"$hide_dotfiles\")\"\n+\t__gitcomp_file_direct \"$(__git_index_files \"$1\" \"$pfx\" \"$cur_\")\"\n }\n \n # Lists branches from the local repository.\n@@ -2176,7 +2171,7 @@ _git_ls_files ()\n \n \t# XXX ignore options like --modified and always suggest all cached\n \t# files.\n-\t__git_complete_index_file \"--cached\" hide-dotfiles\n+\t__git_complete_index_file \"--cached\"\n }\n \n _git_ls_remote ()\n@@ -2409,9 +2404,9 @@ _git_mv ()\n \tif [ $(__git_count_arguments \"mv\") -gt 0 ]; then\n \t\t# We need to show both cached and untracked files (including\n \t\t# empty directories) since this may not be the last argument.\n-\t\t__git_complete_index_file \"--cached --others --directory\" hide-dotfiles\n+\t\t__git_complete_index_file \"--cached --others --directory\"\n \telse\n-\t\t__git_complete_index_file \"--cached\" hide-dotfiles\n+\t\t__git_complete_index_file \"--cached\"\n \tfi\n }\n \n@@ -3231,7 +3226,7 @@ _git_rm ()\n \t\t;;\n \tesac\n \n-\t__git_complete_index_file \"--cached\" hide-dotfiles\n+\t__git_complete_index_file \"--cached\"\n }\n \n _git_shortlog ()\ndiff --git a/t/t9902-completion.sh b/t/t9902-completion.sh\nindex 02aaf71876..7a7594455c 100755\n--- a/t/t9902-completion.sh\n+++ b/t/t9902-completion.sh\n@@ -2360,6 +2360,7 @@ test_expect_success 'setup for path completion tests' '\n \t      \"spaces in dir\" \\\n \t      árvíztűrő &&\n \ttouch simple-dir/simple-file \\\n+\t      simple-dir/.dotfile-in-dir \\\n \t      \"spaces in dir/spaces in file\" \\\n \t      \"árvíztűrő/Сайн яваарай\" &&\n \tif test_have_prereq !MINGW &&\n@@ -2380,6 +2381,11 @@ test_expect_success '__git_complete_index_file - simple' '\n \ttest_path_completion simple-dir/simple simple-dir/simple-file\n '\n \n+test_expect_success '__git_complete_index_file - dotfiles' '\n+\ttest_path_completion \"simple-dir/\" \"simple-dir/simple-file\" &&\n+\ttest_path_completion \"simple-dir/.\" \"simple-dir/.dotfile-in-dir\"\n+'\n+\n test_expect_success \\\n     '__git_complete_index_file - escaped characters on cmdline' '\n \ttest_path_completion spac \"spaces in dir\" &&  # Bash will turn this\n@@ -2789,7 +2795,8 @@ test_expect_success 'complete files' '\n \techo \"out_sorted\" >> .gitignore &&\n \n \tgit add .gitignore &&\n-\ttest_completion \"git commit \" \".gitignore\" &&\n+\ttest_completion \"git commit \" \"\" &&\n+\ttest_completion \"git commit .\" \".gitignore\" &&\n \n \tgit commit -m ignore &&\n \n-- \ngitgitgadget\n"},{"id":"546048","messageId":"xmqq1pe0g08t.fsf@gitster.g","threadId":"65681","inReplyTo":"pull.2311.v3.git.git.1781978156.gitgitgadget@gmail.com","subject":"Re: [PATCH v3 0/2] completion: hide dotfiles for selected path completion","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-06-21T01:17:54Z","receivedAt":"2026-06-21T01:17:56Z","isPatch":true,"body":"\"Zakariyah Ali via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> The completion helper for index paths uses git ls-files rather than shell\n> filename completion. As a result, leading-dot paths such as a tracked\n> .gitignore were offered even when the user had not started the path with ..\n>\n> Hide leading-dot path components for git rm, git mv, and git ls-files when\n> completing an empty path component. Explicit dot completion is still\n> preserved, so git rm . can still complete .gitignore.\n>\n> This removes the existing TODO expectations in t/t9902-completion.sh and\n> adds coverage for explicit dot completion.\n\nOK.\n\n> Validation:\n>\n>  * git diff --check -- contrib/completion/git-completion.bash\n>    t/t9902-completion.sh\n>  * bash -n contrib/completion/git-completion.bash\n>  * ./t9902-completion.sh\n\nI am not sure what you wanted to say with these lines.  If you did\nthe above to build confidence that your patch works, that would be\ngreat.  Or are you telling readers to do these things and when they\ndo not see any issues consider your patch perfect?\n\nWhat is missing around here in this cover letter is a description of\nhow this iteration is different from the previous one.  And ...\n\n> Zakariyah Ali (2):\n>   completion: hide dotfiles for selected path completion\n>   completion: hide dotfiles by default for path completion\n>\n>  contrib/completion/git-completion.bash | 53 +++++++++++++++-----------\n>  t/t9902-completion.sh                  | 19 ++++-----\n>  2 files changed, 40 insertions(+), 32 deletions(-)\n>\n>\n> base-commit: 9b7fa37559a1b95ee32e32858b0d038b4cf583e5\n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2311%2Falibaba0010%2Fcompletion-hide-dotfiles-v3\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2311/alibaba0010/completion-hide-dotfiles-v3\n> Pull-Request: https://github.com/git/git/pull/2311\n>\n> Range-diff vs v2:\n>\n>  1:  056e239e06 = 1:  056e239e06 completion: hide dotfiles for selected path completion\n>  -:  ---------- > 2:  7482ee4645 completion: hide dotfiles by default for path completion\n\n... I find this range diff very troubling.  If we look at patch 2,\nit seems that it redoes some part of what is done in patch 1 saying\n\"oops that was wrong, so let's do it better this time\".  Such a\ndrunken-mans' walk that goes in one direction in an earlier step,\nonly to be corrected to move to a different course, is now how we\nwant a new topic to be presented.\n\nThe end result may be much easier to read, mostly thanks to updated\nloop in the awk script, so if we really want to pretend this as two\npatches for \"small pieces are easier to digest\" value, perhaps have\n[PATCH 1/2] that updates the awk script (without doing anything\nrelated to hide-dotfiles theme) to make it easier to read by not\nhaving multiple \"print pfx p\" in it, and then build on top of that\nimproved base, have [PATCH 2/2] that adds the support to hide\ndotfiles, perhaps?\n\nSince the initial iteration was quite a while ago, I no longer\nremember the details of the review I gave, but I recall having hard\ntime telling which callers of the complete-index-file helper hide\ndotfiles from their output and which callers do not hide them, and\nhow the patch decided to choose which ones should and should not\nhide.  Has it been improved and if so how?  That is something we\nexpect the cover letter to tell, too.\n\nThanks.\n"},{"id":"546079","messageId":"CALnO6CBuxz_5x808Km0Z4Y4dh-WcZRKpT1fTNMWOF8_7Pjxt1w@mail.gmail.com","threadId":"65681","inReplyTo":"xmqq1pe0g08t.fsf@gitster.g","subject":"Re: [PATCH v3 0/2] completion: hide dotfiles for selected path completion","fromName":"D. Ben Knoble","fromEmail":"ben.knoble@gmail.com","sentAt":"2026-06-21T16:46:19Z","receivedAt":"2026-06-21T16:46:31Z","isPatch":true,"body":"[Small typo correction that may affect how the message is read]\n\nOn Sat, Jun 20, 2026 at 9:18 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> \"Zakariyah Ali via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n>\n> > The completion helper for index paths uses git ls-files rather than shell\n> > filename completion. As a result, leading-dot paths such as a tracked\n> > .gitignore were offered even when the user had not started the path with ..\n> >\n> > Hide leading-dot path components for git rm, git mv, and git ls-files when\n> > completing an empty path component. Explicit dot completion is still\n> > preserved, so git rm . can still complete .gitignore.\n> >\n> > This removes the existing TODO expectations in t/t9902-completion.sh and\n> > adds coverage for explicit dot completion.\n>\n> OK.\n>\n> > Validation:\n> >\n> >  * git diff --check -- contrib/completion/git-completion.bash\n> >    t/t9902-completion.sh\n> >  * bash -n contrib/completion/git-completion.bash\n> >  * ./t9902-completion.sh\n>\n> I am not sure what you wanted to say with these lines.  If you did\n> the above to build confidence that your patch works, that would be\n> great.  Or are you telling readers to do these things and when they\n> do not see any issues consider your patch perfect?\n>\n> What is missing around here in this cover letter is a description of\n> how this iteration is different from the previous one.  And ...\n>\n> > Zakariyah Ali (2):\n> >   completion: hide dotfiles for selected path completion\n> >   completion: hide dotfiles by default for path completion\n> >\n> >  contrib/completion/git-completion.bash | 53 +++++++++++++++-----------\n> >  t/t9902-completion.sh                  | 19 ++++-----\n> >  2 files changed, 40 insertions(+), 32 deletions(-)\n> >\n> >\n> > base-commit: 9b7fa37559a1b95ee32e32858b0d038b4cf583e5\n> > Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2311%2Falibaba0010%2Fcompletion-hide-dotfiles-v3\n> > Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2311/alibaba0010/completion-hide-dotfiles-v3\n> > Pull-Request: https://github.com/git/git/pull/2311\n> >\n> > Range-diff vs v2:\n> >\n> >  1:  056e239e06 = 1:  056e239e06 completion: hide dotfiles for selected path completion\n> >  -:  ---------- > 2:  7482ee4645 completion: hide dotfiles by default for path completion\n>\n> ... I find this range diff very troubling.  If we look at patch 2,\n> it seems that it redoes some part of what is done in patch 1 saying\n> \"oops that was wrong, so let's do it better this time\".  Such a\n> drunken-mans' walk that goes in one direction in an earlier step,\n> only to be corrected to move to a different course, is now how we\n\n\"is not\" :)\n\n> want a new topic to be presented.\n>\n> The end result may be much easier to read, mostly thanks to updated\n> loop in the awk script, so if we really want to pretend this as two\n> patches for \"small pieces are easier to digest\" value, perhaps have\n> [PATCH 1/2] that updates the awk script (without doing anything\n> related to hide-dotfiles theme) to make it easier to read by not\n> having multiple \"print pfx p\" in it, and then build on top of that\n> improved base, have [PATCH 2/2] that adds the support to hide\n> dotfiles, perhaps?\n>\n> Since the initial iteration was quite a while ago, I no longer\n> remember the details of the review I gave, but I recall having hard\n> time telling which callers of the complete-index-file helper hide\n> dotfiles from their output and which callers do not hide them, and\n> how the patch decided to choose which ones should and should not\n> hide.  Has it been improved and if so how?  That is something we\n> expect the cover letter to tell, too.\n>\n> Thanks.\n>\n\n\n-- \nD. Ben Knoble\n"},{"id":"546088","messageId":"xmqqbjd37i4y.fsf@gitster.g","threadId":"65681","inReplyTo":"CALnO6CBuxz_5x808Km0Z4Y4dh-WcZRKpT1fTNMWOF8_7Pjxt1w@mail.gmail.com","subject":"Re: [PATCH v3 0/2] completion: hide dotfiles for selected path completion","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-06-21T20:28:29Z","receivedAt":"2026-06-21T20:28:31Z","isPatch":true,"body":"\"D. Ben Knoble\" <ben.knoble@gmail.com> writes:\n\n> [Small typo correction that may affect how the message is read]\n\nThanks, I spotted another one.\n\n>> ... I find this range diff very troubling.  If we look at patch 2,\n>> it seems that it redoes some part of what is done in patch 1 saying\n>> \"oops that was wrong, so let's do it better this time\".  Such a\n>> drunken-mans' walk that goes in one direction in an earlier step,\n>> only to be corrected to move to a different course, is now how we\n>\n> \"is not\" :)\n\nTrue.\n\n>> want a new topic to be presented.\n>>\n>> The end result may be much easier to read, mostly thanks to updated\n>> loop in the awk script, so if we really want to pretend this as two\n\n\"pretend\" -> \"present\". \n\n>> patches for \"small pieces are easier to digest\" value, perhaps have\n>> [PATCH 1/2] that updates the awk script (without doing anything\n>> related to hide-dotfiles theme) to make it easier to read by not\n>> having multiple \"print pfx p\" in it, and then build on top of that\n>> improved base, have [PATCH 2/2] that adds the support to hide\n>> dotfiles, perhaps?\n"},{"id":"546719","messageId":"xmqqik71t3nr.fsf@gitster.g","threadId":"65681","inReplyTo":"pull.2311.v3.git.git.1781978156.gitgitgadget@gmail.com","subject":"Re: [PATCH v3 0/2] completion: hide dotfiles for selected path completion","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-06-29T21:52:56Z","receivedAt":"2026-06-29T21:52:58Z","isPatch":true,"body":"\"Zakariyah Ali via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> The completion helper for index paths uses git ls-files rather than shell\n> filename completion. As a result, leading-dot paths such as a tracked\n> .gitignore were offered even when the user had not started the path with ..\n\nWill we see a hopefully small and final update (v4) to conclude this\ntopic anytime soom?  No rush, but just wondering...\n"},{"id":"548842","messageId":"xmqq4ihpclo8.fsf@gitster.g","threadId":"65681","inReplyTo":"pull.2311.v3.git.git.1781978156.gitgitgadget@gmail.com","subject":"Re: [PATCH v3 0/2] completion: hide dotfiles for selected path completion","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-07-23T23:48:23Z","receivedAt":"2026-07-23T23:48:25Z","isPatch":true,"body":"\"Zakariyah Ali via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> The completion helper for index paths uses git ls-files rather than shell\n> filename completion. As a result, leading-dot paths such as a tracked\n> .gitignore were offered even when the user had not started the path with ..\n\nI was reviewing the draft of the What's Cooking report and noticed  \nthat this topic is among a handful of stalled efforts going nowhere.\n\nI think we are still waiting for a hopefully small and final update\n(v4) to conclude this topic for close to a month, without any news.\nWill we see an update anytime soon?  If not, let me mark the topic\nto be discarded in my draft of the whats-cooking report.\n\nThanks.\n"}]}