Not good. I think the sanest thing to do is avoid caching the merge
strategy list entirely. Listing merge strategies takes about 100 ms
here, which is short enough not to be annoying.
Right, if this happened to me I would not be too surprised. A similar
problem occurs when someone installs a new git subcommand in the
middle of a session. Starting a new session fixes the completion, but
should the completion script do something to help people before then?
It could provide a shell function with a slightly friendlier name than
"__git_compute_porcelain_commands" for the user to invoke explicitly.
It could retry "git help -a" each time completion was needed if it
gave no results last time (i.e. use "${__git_all_commands:=" instead
of "${__git_all_commands="). This would help with the missing git
problem (which seems unusual), but not the missing git-svn.
Maybe it could detect signs of user frustration (repeated attempts to
complete the same thing?) and add to the frustration by silently
fixing the cache.
-- %< --
Subject: completion: do not cache merge strategy list
If "git merge -s help" fails the first time we try it (e.g. if you're
not in a git directory), git merge -s <TAB><TAB> never completes
correctly within the same session.
Reported-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
contrib/completion/git-completion.bash | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 748d4f9..634941f 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -332,7 +332,7 @@ __git_list_merge_strategies ()
__git_compute_merge_strategies ()
{
- : ${__git_merge_strategies=$(__git_list_merge_strategies)}
+ __git_merge_strategies=$(__git_list_merge_strategies)
}
__git_complete_file ()
--
1.6.5.2
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html