Can't `forget` a branch with an illegal character
Description
jj permits creating branches with names that cannot be exported to git. These branches can be renamed using jj branch rename, but they cannot be removed using jj branch forget.
(I consider this is a pretty minor/low-priority bug, because rename is suggested by the error message and it works fine.)
Steps to Reproduce the Problem
- Create a branch with an illegal punctuation mark, e.g.
foo: - Attempt to
forgetthe branch
Expected Behavior
Either branch creation fails, or the branch forget call succeeds.
Actual Behavior
jj prints an Invalid string pattern error:
❯ jj branch create foo:
Failed to export some branches:
foo:: Failed to set: A reference must be a valid tag name as well: A ref must not contain invalid bytes or ascii control characters: ":"
Hint: Git doesn't allow a branch name that looks like a parent directory of
another (e.g. `foo` and `foo/bar`). Try to rename the branches that failed to
export or their "parent" branches.
❯ jj branch forget 'foo:'
error: invalid value 'foo:' for '[NAMES]...': Invalid string pattern kind "foo"
For more information, try '--help'.
Specifications
- Platform: Mac OS Sonama 14.3.1, Apple Silicon
- Version: built from the
advanceable-branchesbranch
❯ jj branch forget 'foo:' error: invalid value 'foo:' for '[NAMES]...': Invalid string pattern kind "foo"
You'll need to prefix it as exact:foo: because NAME is is a pattern.
I agree that the error message is unclear, btw.
What does "NAME is a pattern" mean?
https://martinvonz.github.io/jj/v0.14.0/revsets/#string-patterns
(note: the default in jj branch subcommands is exact match)
Ah, okay, thanks.