From 0408c6b412a6b6f5fa7d1c33424ef00ad8c93533 Mon Sep 17 00:00:00 2001 From: Jacob Keller Date: Thu, 28 May 2020 11:10:40 -0700 Subject: [PATCH] completion: replace overloaded track term for __git_complete_refs The __git_complete_refs uses the "--track" option to specify when to enable listing of unique remote branches which are used by the DWIM logic of git checkout and git switch. Using the term '--track' here is confusing because the git commands themselves have '--track' as an argument. Additionally, the completion logic for _git_switch also checks for --track. Keeping the meaning of track_opt and --track for __git_complete_refs straight from the --track git switch and git checkout option is difficult when reading this code. Use the option '--dwim' instead, indicating this is about enabling or disabling logic related to DWIM mode. Also rename the local variable track_opt to dwim_opt to further reduce the confusion when reading the completion code for _git_switch. Because it is plausible for users to have developed their own completions which rely on __git_complete_ref, keep --track as a synonym for --dwim, even though we no longer use it in any of the core git completion logic. Add a comment explaining why it remains as an alternative spelling for --dwim. Signed-off-by: Jacob Keller Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 28 ++++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index c21786f2fd0026..6b44d369984783 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -749,7 +749,7 @@ __git_refs () # Usage: __git_complete_refs [