Remove overriding of __git_index_file_list_filter since that method is no longer used in git-completion.bash. Overriding that method was needed before to get git-completion.bash to append a '/' to the end of directories; this does not seem to be needed anymore since that script no longer provides completions of directories/files. Also add -d/--debug flag support to help troubleshoot the script. Signed-off-by: Marc Khouzam <marc.khouzam@xxxxxxxxx> --- I thought this would help when for people that experience issues with the script. Thanks! Marc contrib/completion/git-completion.tcsh | 50 +++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/contrib/completion/git-completion.tcsh b/contrib/completion/git-completion.tcsh index 6104a42..fd0b906 100644 --- a/contrib/completion/git-completion.tcsh +++ b/contrib/completion/git-completion.tcsh @@ -1,6 +1,6 @@ # tcsh completion support for core Git. # -# Copyright (C) 2012 Marc Khouzam <marc.khouzam@xxxxxxxxx> +# Copyright (C) 2012, 2015 Marc Khouzam <marc.khouzam@xxxxxxxxx> # Distributed under the GNU General Public License, version 2.0. # # When sourced, this script will generate a new script that uses @@ -22,6 +22,25 @@ # add the following line to your .tcshrc/.cshrc: # set autolist=ambiguous # It will tell tcsh to list the possible completion choices. +# +# To debug this script one can use the -d flag by running the +# generated final script directly. For example, to see the completions +# generated when pressing <tab> for the command line: +# git co +# one should run: +# bash ~/.git-completion.tcsh.bash -d git 'git co' +# and will obtain: +# ===================================== +# git-completion.bash returned: +# commit config +# ===================================== +# Completions including tcsh additions: +# commit config +# ===================================== +# Final completions returned: +# commit +# config +# set __git_tcsh_completion_version = `\echo ${tcsh} | \sed 's/\./ /g'` if ( ${__git_tcsh_completion_version[1]} < 6 || \ @@ -48,20 +67,17 @@ cat << EOF > ${__git_tcsh_completion_script} # Do not modify it directly. Instead, modify git-completion.tcsh # and source it again. +# Allow for debug printouts when running the script by hand +if [ "\$1" == "-d" ] || [ "\$1" == "--debug" ]; then + __git_tcsh_debug=true + shift +fi + source ${__git_tcsh_completion_original_script} # Remove the colon as a completion separator because tcsh cannot handle it COMP_WORDBREAKS=\${COMP_WORDBREAKS//:} -# For file completion, tcsh needs the '/' to be appended to directories. -# By default, the bash script does not do that. -# We can achieve this by using the below compatibility -# method of the git-completion.bash script. -__git_index_file_list_filter () -{ - __git_index_file_list_filter_compat -} - # Set COMP_WORDS in a way that can be handled by the bash script. COMP_WORDS=(\$2) @@ -83,6 +99,12 @@ fi # Call _git() or _gitk() of the bash script, based on the first argument _\${1} +if [ "\$__git_tcsh_debug" == "true" ]; then + echo ===================================== + echo git-completion.bash returned: + echo "\${COMPREPLY[@]}" +fi + IFS=\$'\n' if [ \${#COMPREPLY[*]} -eq 0 ]; then # No completions suggested. In this case, we want tcsh to perform @@ -108,6 +130,14 @@ if [ \${#COMPREPLY[*]} -eq 0 ]; then fi fi +if [ "\$__git_tcsh_debug" == "true" ]; then + echo ===================================== + echo Completions including tcsh additions: + echo "\${COMPREPLY[@]}" + echo ===================================== + echo Final completions returned: +fi + # tcsh does not automatically remove duplicates, so we do it ourselves echo "\${COMPREPLY[*]}" | sort | uniq -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html