summaryrefslogtreecommitdiff
path: root/contrib/persistent-https
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2026-08-13 12:12:34 -0700
committerJunio C Hamano <gitster@pobox.com>2026-08-13 12:13:56 -0700
commit05e2ab1f31dd79ab6e17fc8f69a640ac8d0169d5 (patch)
tree366c3f040b1f0a35379c26b259173bec0562d8ae /contrib/persistent-https
parent3fe92099860aabc8af341334562ff7cdb5e3a9a3 (diff)
completion: 'git checkout' completes untracked paths as a last resort
We taught 'git checkout' to first try to complete revisions (unless '--' is present on the command line) and, failing that, to complete tracked paths. If this yields nothing, it lets the Bash default, which offers paths in $PWD, kick in. Teach it to complete untracked paths before giving up and letting the Bash default kick in. With this change, $ git -C another-directory checkout un<TAB> finds the 'untracked' file in another-directory and offers it as a completion candidate. Note that this is of somewhat dubious value, as an untracked path by definition does not exist in the index, so checking it out from the index would not work well. Even when used to check out the path from a different branch, it is still of dubious value because it is unlikely that a path tracked in another branch is lying untracked in the working tree, as switching from a branch with the path to a branch without it will normally remove the file in the working tree. A better behavior probably is to detect the tree-ish argument on the command line and offer paths with the given prefix as candidates, but there is no __git_complete_from_tree() helper readily usable, so mark this as #leftoverbits to wait for another day. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/persistent-https')
0 files changed, 0 insertions, 0 deletions