alexiszamanidis / vscode-git-worktrees

A VS Code extension that wraps git worktree operations for simplicity and productivity
https://marketplace.visualstudio.com/items?itemName=GitWorktrees.git-worktrees
MIT License
44 stars 5 forks source link

Crash when spaces in the name #22

Closed naytun closed 1 year ago

naytun commented 1 year ago

When I added a new worktree with spaces in the name, it crashed.

alexiszamanidis commented 1 year ago

Hi @naytun,

It seems git doesn't allow you to create a branch with spaces.

image

Since the name of the worktree and branch is the same, I think it would be better not to use spaces and maintain consistency.

I don't want to be hostile or reject you. I just expressed my thoughts.

Please let me know what you think.

naytun commented 1 year ago

Fist of all, I like the simplicity and easy of use of the extension. I understand the cause of this issue. But, as for a new user of this extension it would be better to mentioned that space issue somewhere in the extension (or) warn the user. My suggestion only. Thank you for the reply.

alexiszamanidis commented 1 year ago

I'm glad you liked it.

This is a great idea. I will definitely mention it in the documentation.

Thank you for your contribution!

jonz94 commented 1 year ago

Hi, I also encounter the similar issue when I name the new branch should-work?.

It turns out that there are tons of rules about git branch name format. (Which characters are illegal within a branch name?)

Fortunately, we can use git's built-in check-ref-format command to validate branch name format.

I open a PR to add this feature, hope this will make the experience better 😄

alexiszamanidis commented 1 year ago

Hi @jonz94,

You are back with another excellent contribution.

I tested your validation, and it works great.

Thank you, once again, for your time and contribution.