diff --git a/tests/specific/test_git.py b/tests/specific/test_git.py index ab1b57b..a171210 100644 --- a/tests/specific/test_git.py +++ b/tests/specific/test_git.py @@ -6,7 +6,11 @@ from thefuck.types import Command @pytest.mark.parametrize('called, command, output', [ ('git co', 'git checkout', "19:22:36.299340 git.c:282 trace: alias expansion: co => 'checkout'"), ('git com file', 'git commit --verbose file', - "19:23:25.470911 git.c:282 trace: alias expansion: com => 'commit' '--verbose'")]) + "19:23:25.470911 git.c:282 trace: alias expansion: com => 'commit' '--verbose'"), + ('git com -m "Initial commit"', 'git commit -m "Initial commit"', + "19:22:36.299340 git.c:282 trace: alias expansion: com => 'commit'"), + ('git br -d some_branch', 'git branch -d some_branch', + "19:22:36.299340 git.c:282 trace: alias expansion: br => 'branch'")]) def test_git_support(called, command, output): @git_support def fn(command): diff --git a/thefuck/specific/git.py b/thefuck/specific/git.py index b2c107c..c8f11bd 100644 --- a/thefuck/specific/git.py +++ b/thefuck/specific/git.py @@ -25,7 +25,7 @@ def git_support(fn, command): # eg. 'git commit' expansion = ' '.join(shell.quote(part) for part in shell.split_command(search.group(2))) - new_script = command.script.replace(alias, expansion) + new_script = re.sub(r"\b{}\b".format(alias), expansion, command.script) command = command.update(script=new_script)