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

revsets don't support # in branch names #498

Open
claytonrcarter opened this issue Aug 11, 2022 · 2 comments
Open

revsets don't support # in branch names #498

claytonrcarter opened this issue Aug 11, 2022 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@claytonrcarter
Copy link
Collaborator

Description of the bug

# is a valid char for branch names, but it doesn't seem to play well with revsets:

⋮ ┃
⋮ ◯ b86a555 1d (mr/1229#crc) refactor: Optimize loop
⋮
◆ 2880760 7m (remote origin/main, ᐅ main) Merge branch 'mr/1322'

❯ git hide -D stack\(mr/1229#crc\)
Parse error for expression 'stack(mr/1229#crc)': parse error: Invalid token at 13

Expected behavior

# should be treated like any other valid char for a branch name. In this case, I would expect stack\(mr/1229#crc\) to expand into all of the commits in the stack containing branch mr/1229#crc

Actual behavior

❯ git hide -D stack\(mr/1229#crc\)
Parse error for expression 'stack(mr/1229#crc)': parse error: Invalid token at 13

Version of rustc

rustc 1.61.0 (fe5b13d68 2022-05-18)

Automated bug report

n/a

Version of git-branchless

git-branchless 0.4.0

Version of git

git version 2.32.0

@claytonrcarter claytonrcarter added the bug Something isn't working label Aug 11, 2022
@arxanas
Copy link
Owner

arxanas commented Aug 11, 2022

Thanks for reporting. I guess I didn't imagine people using # in branch names since it usually has special meaning in the shell.

As a workaround, can you add an extra layer of quotes, like 'stack("mr#123")'?

The fix should be a simple adjustment to grammar.lalrpop for the Name symbol.

@arxanas arxanas added the good first issue Good for newcomers label Aug 11, 2022
@claytonrcarter
Copy link
Collaborator Author

As a workaround, can you add an extra layer of quotes, like 'stack("mr#123")'?

Thanks, that's what I needed. This also helps w/ another case I just ran into while trying to use the (admittedly not fair to the parser) :/pattern git revision format. This doesn't work: descendants(:/^(?!fix)) but this works perfectly descendants(":/^(?!fix)").

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants