{"thread":{"id":"43687","subject":"[PATCH 1/4] Support --strategy=x completion in addition to --strategy x.","startedAt":"2006-11-27T20:10:42Z","lastAt":"2006-11-27T20:10:42Z","messageCount":1,"participants":["Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"296688","messageId":"20061127201041.GA7308@spearce.org","threadId":"43687","inReplyTo":null,"subject":"[PATCH 1/4] Support --strategy=x completion in addition to --strategy x.","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-11-27T20:10:42Z","receivedAt":"2006-11-27T20:10:42Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Because git-merge and git-rebase both accept -s, --strategy or --strategy=\nwe should recognize all three formats in the bash completion functions and\nissue back all merge strategies on demand.\n\nI also moved the prior word testing to be before the current word testing,\nas the current word cannot be completed with -- if the prior word was an\noption which requires a parameter, such as -s or --strategy.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n contrib/completion/git-completion.bash |   30 ++++++++++++++++++++----------\n 1 files changed, 20 insertions(+), 10 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex a957165..e53f040 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -455,18 +455,23 @@ _git_log ()\n _git_merge ()\n {\n \tlocal cur=\"${COMP_WORDS[COMP_CWORD]}\"\n+\tcase \"${COMP_WORDS[COMP_CWORD-1]}\" in\n+\t-s|--strategy)\n+\t\tCOMPREPLY=($(compgen -W \"$(__git_merge_strategies)\" -- \"$cur\"))\n+\t\treturn\n+\tesac\n \tcase \"$cur\" in\n+\t--strategy=*)\n+\t\tCOMPREPLY=($(compgen -W \"$(__git_merge_strategies)\" \\\n+\t\t\t-- \"${cur##--strategy=}\"))\n+\t\treturn\n+\t\t;;\n \t--*)\n \t\tCOMPREPLY=($(compgen -W \"\n \t\t\t--no-commit --no-summary --squash --strategy\n \t\t\t\" -- \"$cur\"))\n \t\treturn\n \tesac\n-\tcase \"${COMP_WORDS[COMP_CWORD-1]}\" in\n-\t-s|--strategy)\n-\t\tCOMPREPLY=($(compgen -W \"$(__git_merge_strategies)\" -- \"$cur\"))\n-\t\treturn\n-\tesac\n \tCOMPREPLY=($(compgen -W \"$(__git_refs)\" -- \"$cur\"))\n }\n \n@@ -543,18 +548,23 @@ _git_rebase ()\n \t\t\t\" -- \"$cur\"))\n \t\treturn\n \tfi\n+\tcase \"${COMP_WORDS[COMP_CWORD-1]}\" in\n+\t-s|--strategy)\n+\t\tCOMPREPLY=($(compgen -W \"$(__git_merge_strategies)\" -- \"$cur\"))\n+\t\treturn\n+\tesac\n \tcase \"$cur\" in\n+\t--strategy=*)\n+\t\tCOMPREPLY=($(compgen -W \"$(__git_merge_strategies)\" \\\n+\t\t\t-- \"${cur##--strategy=}\"))\n+\t\treturn\n+\t\t;;\n \t--*)\n \t\tCOMPREPLY=($(compgen -W \"\n \t\t\t--onto --merge --strategy\n \t\t\t\" -- \"$cur\"))\n \t\treturn\n \tesac\n-\tcase \"${COMP_WORDS[COMP_CWORD-1]}\" in\n-\t-s|--strategy)\n-\t\tCOMPREPLY=($(compgen -W \"$(__git_merge_strategies)\" -- \"$cur\"))\n-\t\treturn\n-\tesac\n \tCOMPREPLY=($(compgen -W \"$(__git_refs)\" -- \"$cur\"))\n }\n \n-- \n1.4.4.1.ge3fb\n"}]}