gitbutler icon indicating copy to clipboard operation
gitbutler copied to clipboard

filenames with dashes interpreted as ranges

Open schacon opened this issue 1 month ago • 1 comments

Problem: Can't use filenames directly in but rub - they're parsed as range syntax.

Reproduction:

$ but rub test-simple.md my-branch
Error: Start of range 'test' must match exactly one item

$ but rub "test-simple.md" my-branch
Error: Start of range 'test' must match exactly one item  # Even quoted!

$ but rub ./test-simple.md my-branch
Error: Start of range './test' must match exactly one item  # Path doesn't help!

This is clearly a bug, but we should also be able to do things like:

You can either rub the file identifier that you see next to each file, or all or part of the file path. For example, in this case to identify the app/models/bookmark.rb file, you can do any of:

xw app/models/ bookmark app/models/bookmark.rb

$ but rub app/models/ my-branch
$ but rub *.rb my-branch
$ but rub bookmark my-branch

schacon avatar Nov 07 '25 13:11 schacon

I could also validate that clap isn't doing this, instead it's here:

https://github.com/gitbutlerapp/gitbutler/blob/15a089a1673d2451741d33ca173aecc135abb0c9/crates/but/src/rub/mod.rs#L227

Byron avatar Nov 07 '25 13:11 Byron