All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Marc Khouzam <marc.khouzam@gmail.com>
Cc: git@vger.kernel.org, "SZEDER Gábor" <szeder@ira.uka.de>
Subject: Re: [PATCH] Completion: Cleanup tcsh script and add debug flag
Date: Fri, 29 May 2015 12:37:18 -0700	[thread overview]
Message-ID: <xmqqd21jch01.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CAFj1UpGpGS-C2EWif4sk_ijq8PjpM1UY09+vLwbjX17idZdkfA@mail.gmail.com> (Marc Khouzam's message of "Thu, 23 Apr 2015 21:07:28 -0400")

Marc Khouzam <marc.khouzam@gmail.com> writes:

> 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@gmail.com>
> ---
>
> I thought this would help when for people that experience issues with
> the script.

Thanks; unfortunately what I received suffers from serious
whitespace damages.  All the tabs in preimage seem to have been
corrupted into runs of whitespaces, and I suspect the same for tabs
in the new lines, too.

>
> 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@gmail.com>
> +# Copyright (C) 2012, 2015 Marc Khouzam <marc.khouzam@gmail.com>
>  # 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

      reply	other threads:[~2015-05-29 19:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-24  1:07 [PATCH] Completion: Cleanup tcsh script and add debug flag Marc Khouzam
2015-05-29 19:37 ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqd21jch01.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=marc.khouzam@gmail.com \
    --cc=szeder@ira.uka.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.