git_push: Escape single quote in branch names (#760)
Parameterize test output fixture. Check for 'push' in command.script_parts than anywhere in command.script.
This commit is contained in:
committed by
Joseph Frazier
parent
a696461cd3
commit
b62bb90a0d
@@ -5,7 +5,7 @@ from thefuck.specific.git import git_support
|
||||
|
||||
@git_support
|
||||
def match(command):
|
||||
return ('push' in command.script
|
||||
return ('push' in command.script_parts
|
||||
and 'set-upstream' in command.output)
|
||||
|
||||
|
||||
@@ -39,6 +39,6 @@ def get_new_command(command):
|
||||
while len(command_parts) > push_idx and command_parts[len(command_parts) - 1][0] != '-':
|
||||
command_parts.pop(len(command_parts) - 1)
|
||||
|
||||
arguments = re.findall(r'git push (.*)', command.output)[0].strip()
|
||||
arguments = re.findall(r'git push (.*)', command.output)[0].replace("'", r"\'").strip()
|
||||
return replace_argument(" ".join(command_parts), 'push',
|
||||
'push {}'.format(arguments))
|
||||
|
||||
Reference in New Issue
Block a user