dolthub / dolt

Dolt – Git for Data
Apache License 2.0
17.41k stars 488 forks source link

Users are able to create branches with a "-" at the start. If you try to delete the branch after that, it looks like dolt is understanding it as an option for dolt_branch #8034

Closed tim-oh-thee closed 3 weeks ago

tim-oh-thee commented 4 weeks ago

The following statements will fail with the final deletion statement. This means the branch is stuck there (as far as I know). call dolt_checkout('-b','-qa'); call dolt_checkout('main'); call dolt_branch('-d','-qa'); SQL Error [1105] [HY000]: error: unknown option `qa'

timsehn commented 4 weeks ago

Thanks for the report. seems reasonable we should wither disallow the pattern or figure out a way to handle it.

tim-oh-thee commented 4 weeks ago

Absolutely!! Figured I’d put it out there for you to decide what to do with it.

Thanks,

Tim

Get Outlook for iOShttps://aka.ms/o0ukef


From: Tim Sehn @.> Sent: Tuesday, June 18, 2024 3:55:53 PM To: dolthub/dolt @.> Cc: Neal, Timothy @.>; Author @.> Subject: Re: [dolthub/dolt] Users are able to create branches with a "-" at the start. If you try to delete the branch after that, it looks like dolt is understanding it as an option for dolt_branch (Issue #8034)

<<< Attention - This mail was delivered from outside! Please open links and attachments only from known senders from whom you expect such mails. If in doubt, please ask the sender. >>>

Thanks for the report. seems reasonable we should wither disallow the pattern or figure out a way to handle it.

— Reply to this email directly, view it on GitHubhttps://github.com/dolthub/dolt/issues/8034#issuecomment-2176852590, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A3LCGAYU6A2MVKKPTLFNUR3ZICGETAVCNFSM6AAAAABJQKPKF6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZWHA2TENJZGA. You are receiving this because you authored the thread.Message ID: @.***>

jycor commented 3 weeks ago

git doesn't allow branch names that start with -, so it seems like we should prevent branches with that name

$ git checkout -b -test
fatal: '-test' is not a valid branch name

$ git checkout -b --test
fatal: '--test' is not a valid branch name

$ git checkout -b \-test
fatal: '-test' is not a valid branch name
jycor commented 3 weeks ago

Did some more digging, and apparently we allow escaping - with --, so

tmp/main> call dolt_branch('-D', '--', '-test');
+--------+
| status |
+--------+
| 0      |
+--------+
1 row in set (0.00 sec)