Skip to content

git: quote filenames at remind_to_track#3315

Merged
efiop merged 1 commit into
masterfrom
unknown repository
Mar 23, 2020
Merged

git: quote filenames at remind_to_track#3315
efiop merged 1 commit into
masterfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Feb 12, 2020

Fix #3303

Comment thread tests/unit/scm/test_scm.py Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember windows cmdline being weird about single-quotes and having to use double-quotes. Also IIRC windows cmd always does completion with double-quotes. Searching around (e.g. https://ss64.com/nt/syntax-esc.html) I also see double quotes used and not single-quotes. Let's switch to double-quotes too, it will be compatible with both win and *nix.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well *nix will shell-expand things in double quotes:

$ export foo=bar
$ echo spam > \$foo
$ cat "$foo"  # double quotes :(
cat: bar: No such file or directory

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also @efiop this PR uses shlex.quote which avoids this

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@casperdcl Yep, there is also mslex which properly quotes things for windows, but it doesn't have a conda package. I'm wondering if it is easier to just make dvc automatically git add things at this point. Easier for both us on implementation and for users in terms of UX.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes not sure if I've mentioned this somewhere before but simply adding --git to any dvc command to auto-exec the obvious would be nice

@efiop
Copy link
Copy Markdown
Contributor

efiop commented Mar 23, 2020

Merging as is, we'll see about mslex in the future, for now this will cover 90% (or more) of use cases.

@efiop efiop merged commit ee26afe into treeverse:master Mar 23, 2020
@ghost ghost deleted the fix-3303 branch March 28, 2020 01:51
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

Successfully merging this pull request may close these issues.

dvc add print not quote-wrapped file-paths if they contain spaces

3 participants