mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-31 02:01:13 +00:00
git_push: Handle command containing force argument (#818)
This commit is contained in:
parent
a6bb41e802
commit
534782414f
@ -66,6 +66,10 @@ def test_not_match(output, script, branch_name):
|
|||||||
('git -c test=test push --quiet origin', 'master',
|
('git -c test=test push --quiet origin', 'master',
|
||||||
'git -c test=test push --set-upstream origin master --quiet'),
|
'git -c test=test push --set-upstream origin master --quiet'),
|
||||||
('git push', "test's",
|
('git push', "test's",
|
||||||
"git push --set-upstream origin test\\'s")])
|
"git push --set-upstream origin test\\'s"),
|
||||||
|
('git push --force', 'master',
|
||||||
|
'git push --set-upstream origin master --force'),
|
||||||
|
('git push --force-with-lease', 'master',
|
||||||
|
'git push --set-upstream origin master --force-with-lease')])
|
||||||
def test_get_new_command(output, script, branch_name, new_command):
|
def test_get_new_command(output, script, branch_name, new_command):
|
||||||
assert get_new_command(Command(script, output)) == new_command
|
assert get_new_command(Command(script, output)) == new_command
|
||||||
|
@ -39,6 +39,6 @@ def get_new_command(command):
|
|||||||
while len(command_parts) > push_idx and command_parts[len(command_parts) - 1][0] != '-':
|
while len(command_parts) > push_idx and command_parts[len(command_parts) - 1][0] != '-':
|
||||||
command_parts.pop(len(command_parts) - 1)
|
command_parts.pop(len(command_parts) - 1)
|
||||||
|
|
||||||
arguments = re.findall(r'git push (.*)', command.output)[0].replace("'", r"\'").strip()
|
arguments = re.findall(r'git push (.*)', command.output)[-1].replace("'", r"\'").strip()
|
||||||
return replace_argument(" ".join(command_parts), 'push',
|
return replace_argument(" ".join(command_parts), 'push',
|
||||||
'push {}'.format(arguments))
|
'push {}'.format(arguments))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user