{"thread":{"id":"14441","subject":"[PATCH] bash completion: Append space after file names have been completed","startedAt":"2008-07-14T00:22:03Z","lastAt":"2008-07-14T00:22:03Z","messageCount":1,"participants":["Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"83201","messageId":"20080714002203.GA13749@spearce.org","threadId":"14441","inReplyTo":null,"subject":"[PATCH] bash completion: Append space after file names have been completed","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-07-14T00:22:03Z","receivedAt":"2008-07-14T00:22:03Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"When completing `git show origin/maint:Makef<tab>` we should add a\nspace after the filename has been completed, so that the user can\nimmediately begin the next argument.\n\nI also added a special case for the symlink variant so we treat it\njust like a normal blob, as there are no items below it in the Git\ntree structure.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n contrib/completion/git-completion.bash |   10 +++++++++-\n 1 files changed, 9 insertions(+), 1 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 9a1c66a..790d1c6 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -294,9 +294,17 @@ __git_complete_file ()\n \t\t\tls=\"$ref\"\n \t\t\t;;\n \t    esac\n+\t\tlocal IFS=$'\\n'\n \t\tCOMPREPLY=($(compgen -P \"$pfx\" \\\n \t\t\t-W \"$(git --git-dir=\"$(__gitdir)\" ls-tree \"$ls\" \\\n-\t\t\t\t| sed '/^100... blob /s,^.*\t,,\n+\t\t\t\t| sed '/^100... blob /{\n+\t\t\t\t           s,^.*\t,,\n+\t\t\t\t           s,$, ,\n+\t\t\t\t       }\n+\t\t\t\t       /^120000 blob /{\n+\t\t\t\t           s,^.*\t,,\n+\t\t\t\t           s,$, ,\n+\t\t\t\t       }\n \t\t\t\t       /^040000 tree /{\n \t\t\t\t           s,^.*\t,,\n \t\t\t\t           s,$,/,\n-- \n1.5.6.2.393.g45096\n"}]}