{"thread":{"id":"12521","subject":"[PATCH] bash: fix long option with argument double completion","startedAt":"2008-03-05T19:07:49Z","lastAt":"2008-03-05T19:07:49Z","messageCount":1,"participants":["SZEDER Gábor"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"71105","messageId":"1204744069-27217-1-git-send-email-szeder@ira.uka.de","threadId":"12521","inReplyTo":null,"subject":"[PATCH] bash: fix long option with argument double completion","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2008-03-05T19:07:49Z","receivedAt":"2008-03-05T19:07:49Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"Pressing TAB right after 'git command --long-option=' results in\n'git command --long-option=--long-option=' when the long option requires\nan argument, but we don't provide completion for its arguments (e.g.\ncommit --author=, apply --exclude=).  This patch detects these long\noptions and provides empty completion array for them.\n\nSigned-off-by: SZEDER Gábor <szeder@ira.uka.de>\n---\n contrib/completion/git-completion.bash |   22 +++++++++++++++-------\n 1 files changed, 15 insertions(+), 7 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex d890f16..18b4001 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -113,13 +113,21 @@ __gitcomp ()\n \tif [ $# -gt 2 ]; then\n \t\tcur=\"$3\"\n \tfi\n-\tfor c in $1; do\n-\t\tcase \"$c$4\" in\n-\t\t--*=*) all=\"$all$c$4$s\" ;;\n-\t\t*.)    all=\"$all$c$4$s\" ;;\n-\t\t*)     all=\"$all$c$4 $s\" ;;\n-\t\tesac\n-\tdone\n+\tcase \"$cur\" in\n+\t--*=)\n+\t\tCOMPREPLY=()\n+\t\treturn\n+\t\t;;\n+\t*)\n+\t\tfor c in $1; do\n+\t\t\tcase \"$c$4\" in\n+\t\t\t--*=*) all=\"$all$c$4$s\" ;;\n+\t\t\t*.)    all=\"$all$c$4$s\" ;;\n+\t\t\t*)     all=\"$all$c$4 $s\" ;;\n+\t\t\tesac\n+\t\tdone\n+\t\t;;\n+\tesac\n \tIFS=$s\n \tCOMPREPLY=($(compgen -P \"$2\" -W \"$all\" -- \"$cur\"))\n \treturn\n-- \n1.5.4.3\n\n"}]}