{"thread":{"id":"43568","subject":"[PATCH 6/6] Remove more sed invocations from within bash completion.","startedAt":"2006-11-05T11:25:25Z","lastAt":"2006-11-05T11:25:25Z","messageCount":1,"participants":["Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":6},"messages":[{"id":"295579","messageId":"20061105112525.GF20495@spearce.org","threadId":"43568","inReplyTo":null,"subject":"[PATCH 6/6] Remove more sed invocations from within bash completion.","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-11-05T11:25:25Z","receivedAt":"2006-11-05T11:25:25Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"This change removes between 1 and 4 sed invocations per completion\nentered by the user.  In the case of cat-file the 4 invocations per\ncompletion can take a while on Cygwin; running these replacements\ndirectly within bash saves some time for the end user.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n contrib/completion/git-completion.bash |   14 +++++++-------\n 1 files changed, 7 insertions(+), 7 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 74be651..f3be132 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -83,15 +83,15 @@ __git_remotes ()\n \n __git_complete_file ()\n {\n-\tlocal cur=\"${COMP_WORDS[COMP_CWORD]}\"\n+\tlocal pfx ls ref cur=\"${COMP_WORDS[COMP_CWORD]}\"\n \tcase \"$cur\" in\n \t?*:*)\n-\t\tlocal pfx ls ref=\"$(echo \"$cur\" | sed 's,:.*$,,')\"\n-\t\tcur=\"$(echo \"$cur\" | sed 's,^.*:,,')\"\n+\t\tref=\"${cur%%:*}\"\n+\t\tcur=\"${cur#*:}\"\n \t\tcase \"$cur\" in\n \t\t?*/*)\n-\t\t\tpfx=\"$(echo \"$cur\" | sed 's,/[^/]*$,,')\"\n-\t\t\tcur=\"$(echo \"$cur\" | sed 's,^.*/,,')\"\n+\t\t\tpfx=\"${cur%/*}\"\n+\t\t\tcur=\"${cur##*/}\"\n \t\t\tls=\"$ref:$pfx\"\n \t\t\tpfx=\"$pfx/\"\n \t\t\t;;\n@@ -193,7 +193,7 @@ _git_fetch ()\n \t*)\n \t\tcase \"$cur\" in\n \t\t*:*)\n-\t        cur=$(echo \"$cur\" | sed 's/^.*://')\n+\t\t\tcur=\"${cur#*:}\"\n \t\t\tCOMPREPLY=($(compgen -W \"$(__git_refs)\" -- \"$cur\"))\n \t\t\t;;\n \t\t*)\n@@ -287,7 +287,7 @@ _git_push ()\n \t\t\tgit-push)  remote=\"${COMP_WORDS[1]}\" ;;\n \t\t\tgit)       remote=\"${COMP_WORDS[2]}\" ;;\n \t\t\tesac\n-\t        cur=$(echo \"$cur\" | sed 's/^.*://')\n+\t\t\tcur=\"${cur#*:}\"\n \t\t\tCOMPREPLY=($(compgen -W \"$(__git_refs \"$remote\")\" -- \"$cur\"))\n \t\t\t;;\n \t\t*)\n-- \n"}]}