1
0
mirror of https://github.com/nvbn/thefuck.git synced 2024-10-05 18:31:10 +01:00

Merge pull request #304 from mcarton/fix-git_diff_staged

Fix the `git_diff_staged` rule
This commit is contained in:
Vladimir Iakovlev 2015-07-21 16:12:19 +03:00
commit f165523247
2 changed files with 6 additions and 3 deletions

View File

@ -3,7 +3,9 @@ from thefuck.rules.git_diff_staged import match, get_new_command
from tests.utils import Command
@pytest.mark.parametrize('command', [Command(script='git diff')])
@pytest.mark.parametrize('command', [
Command(script='git diff foo'),
Command(script='git diff')])
def test_match(command):
assert match(command, None)
@ -18,6 +20,7 @@ def test_not_match(command):
@pytest.mark.parametrize('command, new_command', [
(Command('git diff'), 'git diff --staged')])
(Command('git diff'), 'git diff --staged'),
(Command('git diff foo'), 'git diff --staged foo')])
def test_get_new_command(command, new_command):
assert get_new_command(command, None) == new_command

View File

@ -10,4 +10,4 @@ def match(command, settings):
@utils.git_support
def get_new_command(command, settings):
return '{} --staged'.format(command.script)
return command.script.replace(' diff', ' diff --staged')