-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Rule for branch dash 0 #942
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cb0ca84
fix fuckup `branch 0v` by...
ProfessorTom 18227fd
Merge branch 'master' into rule_for_branch_dash_0
ProfessorTom d42e45f
use quotes consistently
ProfessorTom 8151723
provide new solution implementation based on feedback on PR
ProfessorTom 9005aff
rename files to more accurately reflect their more generic contents
ProfessorTom f66cc07
update import statement to match new file name
ProfessorTom e1f0ff4
update command name in README.md
ProfessorTom a72845b
separate out matching tests so the pattern is clear for those who add…
ProfessorTom File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import pytest | ||
| from thefuck.rules.git_branch_0v_to_dash_v import match, get_new_command | ||
| from thefuck.types import Command | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def output(): | ||
| return "" | ||
|
|
||
|
|
||
| def test_match(output): | ||
| assert match(Command('git branch 0v', output)) | ||
ProfessorTom marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| assert not match(Command('git branch -v', '')) | ||
| assert not match(Command('ls', output)) | ||
|
|
||
|
|
||
| def test_get_new_command(output): | ||
| assert get_new_command(Command('git branch 0v', output))\ | ||
| == "git branch -D 0v && git branch -v" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| from thefuck.shells import shell | ||
| from thefuck.specific.git import git_support | ||
|
|
||
|
|
||
| @git_support | ||
| def match(command): | ||
| return (command.script_parts | ||
| and command.script_parts[1:] == 'branch 0v'.split()) | ||
ProfessorTom marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| @git_support | ||
| def get_new_command(command): | ||
| return shell.and_('git branch -D 0v', 'git branch -v') | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.