#762: handle single quotes in git_branch_exists
* handle single quotes in git_branch_exists * Fix line length * Fix missing quotes from test
This commit is contained in:
@@ -7,14 +7,15 @@ from thefuck.utils import eager
|
||||
@git_support
|
||||
def match(command):
|
||||
return ("fatal: A branch named '" in command.output
|
||||
and " already exists." in command.output)
|
||||
and "' already exists." in command.output)
|
||||
|
||||
|
||||
@git_support
|
||||
@eager
|
||||
def get_new_command(command):
|
||||
branch_name = re.findall(
|
||||
r"fatal: A branch named '([^']*)' already exists.", command.output)[0]
|
||||
r"fatal: A branch named '(.+)' already exists.", command.output)[0]
|
||||
branch_name = branch_name.replace("'", r"\'")
|
||||
new_command_templates = [['git branch -d {0}', 'git branch {0}'],
|
||||
['git branch -d {0}', 'git checkout -b {0}'],
|
||||
['git branch -D {0}', 'git branch {0}'],
|
||||
|
||||
Reference in New Issue
Block a user