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

[Bug]: file names with leading - are interpreted as program options #184

Closed
229c9cf0 opened this issue Feb 10, 2022 · 0 comments
Closed

Comments

@229c9cf0
Copy link

Describe the bug

File names starting with a dash - (a.k.a. hyphen-minus) are interpreted as program options unless a double-dash -- is used to separate them from file names. Currently, it seems file names are simply appended without this separator.

Whenever an explicit file list is passed to git, this leads to a failure of that invocation. (E.g. when manually staging a file by clicking the + next to it in the source view.) Instead, the git usage message is returned as a red notification bubble.

While I don't see any obvious exploits resulting from this, I haven't bothered to dig deeper. It's probably a good idea to fix this soon.

Relevant errors (if available)

error: unknown switch `((some part of the filename))'
usage: git add [<options>] [--] <pathspec>...

    -n, --dry-run         dry run
[...]

Steps to reproduce

  1. Create a file with a hyphen at the start of its name, e.g. -INBOX- (names like that are useful because they sort to the very top)
  2. Open the plugin's Source Control View
  3. Click the + next to the file under "Changes" to stage the changes.

Expected Behavior

The file should be staged normally.

Addition context

This should be quite easy to fix by adding -- into all template strings in front of the place where file names are appended / interpolated.

Operating system

Windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant