Skip to content
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

git_branch_exists can't cope with branches containing single quotes #762

Closed
djh82 opened this issue Jan 3, 2018 · 0 comments · Fixed by #763
Closed

git_branch_exists can't cope with branches containing single quotes #762

djh82 opened this issue Jan 3, 2018 · 0 comments · Fixed by #763

Comments

@djh82
Copy link
Contributor

djh82 commented Jan 3, 2018

I actually came across this while tidying up test branches after fixing #760.

users-MBP:thefuck user$ git checkout -b "let's"
fatal: A branch named 'let's' already exists.
users-MBP:thefuck user$ fuck
Traceback (most recent call last):
  File "/usr/local/bin/thefuck", line 12, in <module>
    sys.exit(main())
  File "/Users/user/git_repo/thefuck/thefuck/entrypoints/main.py", line 25, in main
    fix_command(known_args)
  File "/Users/user/git_repo/thefuck/thefuck/entrypoints/fix_command.py", line 42, in fix_command
    selected_command = select_command(corrected_commands)
  File "/Users/user/git_repo/thefuck/thefuck/ui.py", line 71, in select_command
    selector = CommandSelector(corrected_commands)
  File "/Users/user/git_repo/thefuck/thefuck/ui.py", line 34, in __init__
    self._commands = [next(self._commands_gen)]
  File "/Users/user/git_repo/thefuck/thefuck/corrector.py", line 60, in organize_commands
    first_command = next(corrected_commands)
  File "/Users/user/git_repo/thefuck/thefuck/corrector.py", line 91, in <genexpr>
    for corrected in rule.get_corrected_commands(command))
  File "/Users/user/git_repo/thefuck/thefuck/types.py", line 189, in get_corrected_commands
    new_commands = self.get_new_command(command)
  File "<decorator-gen-83>", line 2, in get_new_command
  File "/Users/user/git_repo/thefuck/thefuck/specific/git.py", line 32, in git_support
    return fn(command)
  File "<decorator-gen-82>", line 2, in get_new_command
  File "/Users/user/git_repo/thefuck/thefuck/utils.py", line 136, in eager
    return list(fn(*args, **kwargs))
  File "/Users/user/git_repo/thefuck/thefuck/rules/git_branch_exists.py", line 17, in get_new_command
    r"fatal: A branch named '([^']*)' already exists.", command.output)[0]
IndexError: list index out of range
scorphus pushed a commit that referenced this issue Jan 5, 2018
* handle single quotes in git_branch_exists

* Fix line length

* Fix missing quotes from test
riley-martine pushed a commit to riley-martine/thefuck that referenced this issue Dec 7, 2023
* handle single quotes in git_branch_exists

* Fix line length

* Fix missing quotes from test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant