docker/docker — pull request #8230 by duglin (2014-09-25 11:30:08+00:00)
Title: add wildcard support to copy/add

For issue #6820 - adding support for specifying wildcards in the src of ADD and COPY

Not a lot of new code here. Most of this is just allowing calcCopyInfo() to be recursive so that as we expand the wildcards we can let it add new CopyInfo's structs to the list of resources to be copied. However, during this process I did clean-up some of the code in there - just a little.

Note that I tried to make it similar to the command line's cp command w.r.t. multiple vs single src copies. In particular, when you copy a single src the target can be either a dir or a filename. But in the case of multiple src's it must be a dir. Well, the determination of whether its a single vs multiple is done _after_ the wildcard expansion so that if "abc*" only maps to a single file then target doesn't need to be a dir in the case of "COPY abc* ...".

Additionally, w.r.t. cache checking, "COPY abc* ... " and "COPY abc ..." will map to the same cache entry, assuming "abc*" only finds "abc".

Signed-off-by: Doug Davis