1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-11-15 06:16:01 +00:00
Files
thefuck/thefuck/rules/git_pull.py
2015-07-21 15:35:39 +02:00

17 lines
476 B
Python

from thefuck import shells, utils
@utils.git_support
def match(command, settings):
return ('pull' in command.script
and 'set-upstream' in command.stderr)
@utils.git_support
def get_new_command(command, settings):
line = command.stderr.split('\n')[-3].strip()
branch = line.split(' ')[-1]
set_upstream = line.replace('<remote>', 'origin')\
.replace('<branch>', branch)
return shells.and_(set_upstream, command.script)