mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-10-31 07:04:12 +00:00 
			
		
		
		
	Fix the git_diff_staged rule
				
					
				
			The problem was: ``` % git add foo % git diff foo % fuck git diff foo --staged [enter/ctrl+c] fatal: bad flag '--staged' used after filename ```
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user