Commit 96d1225
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 ddf07bd, "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>1 parent 56a4f3c commit 96d1225
2 files changed
Lines changed: 26 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
638 | 638 | | |
639 | 639 | | |
640 | 640 | | |
641 | | - | |
| 641 | + | |
642 | 642 | | |
643 | 643 | | |
644 | 644 | | |
645 | 645 | | |
646 | 646 | | |
647 | 647 | | |
| 648 | + | |
| 649 | + | |
648 | 650 | | |
649 | 651 | | |
650 | | - | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
651 | 657 | | |
652 | 658 | | |
653 | | - | |
| 659 | + | |
654 | 660 | | |
655 | 661 | | |
656 | 662 | | |
657 | 663 | | |
658 | 664 | | |
659 | 665 | | |
| 666 | + | |
| 667 | + | |
660 | 668 | | |
661 | 669 | | |
662 | 670 | | |
| |||
675 | 683 | | |
676 | 684 | | |
677 | 685 | | |
678 | | - | |
679 | | - | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
680 | 690 | | |
681 | 691 | | |
682 | 692 | | |
| |||
721 | 731 | | |
722 | 732 | | |
723 | 733 | | |
724 | | - | |
| 734 | + | |
725 | 735 | | |
| 736 | + | |
| 737 | + | |
726 | 738 | | |
727 | 739 | | |
728 | 740 | | |
729 | 741 | | |
730 | | - | |
| 742 | + | |
731 | 743 | | |
732 | 744 | | |
733 | 745 | | |
| |||
740 | 752 | | |
741 | 753 | | |
742 | 754 | | |
743 | | - | |
| 755 | + | |
744 | 756 | | |
745 | 757 | | |
746 | 758 | | |
| |||
2164 | 2176 | | |
2165 | 2177 | | |
2166 | 2178 | | |
2167 | | - | |
| 2179 | + | |
2168 | 2180 | | |
2169 | 2181 | | |
2170 | 2182 | | |
| |||
2397 | 2409 | | |
2398 | 2410 | | |
2399 | 2411 | | |
2400 | | - | |
| 2412 | + | |
2401 | 2413 | | |
2402 | | - | |
| 2414 | + | |
2403 | 2415 | | |
2404 | 2416 | | |
2405 | 2417 | | |
| |||
3219 | 3231 | | |
3220 | 3232 | | |
3221 | 3233 | | |
3222 | | - | |
| 3234 | + | |
3223 | 3235 | | |
3224 | 3236 | | |
3225 | 3237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2811 | 2811 | | |
2812 | 2812 | | |
2813 | 2813 | | |
2814 | | - | |
2815 | 2814 | | |
2816 | | - | |
2817 | 2815 | | |
2818 | 2816 | | |
2819 | 2817 | | |
| 2818 | + | |
| 2819 | + | |
2820 | 2820 | | |
2821 | 2821 | | |
2822 | | - | |
2823 | 2822 | | |
2824 | | - | |
2825 | 2823 | | |
2826 | 2824 | | |
2827 | 2825 | | |
| |||
2832 | 2830 | | |
2833 | 2831 | | |
2834 | 2832 | | |
2835 | | - | |
2836 | 2833 | | |
2837 | | - | |
2838 | 2834 | | |
2839 | 2835 | | |
2840 | 2836 | | |
| |||
2843 | 2839 | | |
2844 | 2840 | | |
2845 | 2841 | | |
2846 | | - | |
2847 | 2842 | | |
2848 | | - | |
2849 | 2843 | | |
2850 | 2844 | | |
2851 | 2845 | | |
| |||
0 commit comments