mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-10-31 07:04:12 +00:00 
			
		
		
		
	Add git_tag_force rule
This adds `--force` to `git tag` when needed. For example:
    $ git tag alert
    fatal: tag 'alert' already exists
    $ fuck
    git tag --force alert [enter/↑/↓/ctrl+c]
    Updated tag 'alert' (was dec6956)
    $
			
			
This commit is contained in:
		
							
								
								
									
										18
									
								
								tests/rules/test_git_tag_force.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								tests/rules/test_git_tag_force.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | ||||
| import pytest | ||||
| from thefuck.rules.git_tag_force import match, get_new_command | ||||
| from tests.utils import Command | ||||
|  | ||||
|  | ||||
| @pytest.fixture | ||||
| def stderr(): | ||||
|     return '''fatal: tag 'alert' already exists''' | ||||
|  | ||||
|  | ||||
| def test_match(stderr): | ||||
|     assert match(Command('git tag alert', stderr=stderr)) | ||||
|     assert not match(Command('git tag alert')) | ||||
|  | ||||
|  | ||||
| def test_get_new_command(stderr): | ||||
|     assert get_new_command(Command('git tag alert', stderr=stderr)) \ | ||||
|            == "git tag --force alert" | ||||
		Reference in New Issue
	
	Block a user