-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Bad checking of the --pattern
argument
#3982
Comments
@troydai can speak to more detail, but you can use the |
add to S165. |
Hi @elibarzilay, thanks a lot for your feedback. Have you tried --dryrun flag to see the summary of target files? |
@juhee0202: first, a I see in your PR that you added some text and some examples, but IMO it's still not answering many of these important questions? (Extended note: the reason dryrun is insufficient: when you write some script to do something, you want to know that it will continue to behave as it should in the future. So a dry run on some patterns with some current state of my storage will not be sufficient.) |
First of all, the
--pattern
argument description is giving very littleinformation: "used for files globbing"?? I had to try it out to see
how it's used.
Second, the way that it's implemented is probably going to be surprising
for most people. I'm guessing that almost everyone would expect a
pattern like
x*
to match all files that begin withx
, but it lookslike the pattern is actually matched against the full path that is
copied, and therefore a pattern like
x*
will either copy a wholetoplevel directory that starts with
x
or nothing at all if there isnone.
Related to this, it should be clear exactly what gets matched. In an
attempt to avoid bogus matches in a list that iterates over a list of
globs, I prepended
*/
to each one (yes, that was a mistake) whichresulted in skipping a toplevel
index.html
file, and this isregardless of specifying a full path as my
--source
orcd
ing intothe directory and using a
--source .
. So I'm guessing that thispattern is matched against the full path without the prefix
--source
directory (which is the same as the full container +
/
+ blob namewithout the part that is specified in
--destination
). Summarizingthis in a short CLI description is going to be difficult, but it is
very needed.
Yet another bit that must be documented is the fact that
*
matchesany character, including
/
. It would have been much better tohave
*
not match/
s, and instead add a**
pattern for that.Given that there are probably scripts that rely on this behavior of
--pattern
(at least the script that I wrote does so), a way to resolvethis would be to add some new
--file-pattern
that gets matched onlyagainst the basename of files, and not against any directories. Maybe
also another
--path-pattern
flag with*
not matching/
s, and**
that does.
The text was updated successfully, but these errors were encountered: