Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
respect --whitelist options when doing a full vendor cycle
Commit b1caa00 added a `--whitelist` flag to allow ignoring paths in the vendor directory when cleaning up unused packages/files. However, 4b11a0f added an optimization to clean the whole vendor directory when doing a full vendor cycle. Unfortunately, that change did not take the `--whitelist` option into account, resulting in whitelisted packages/files to be deleted when doing a full vendor cycle. This patch checks if a whitelist option is set when doing a full vendor cycle, and if so, ignores the specified paths when cleaning. Using the "v18.06.0-ce" branch on github.com/docker/engine, which has a custom `archive/tar` package in the vendor directory; $ git checkout v18.06.0-ce $ vndr --whitelist 'archive/tar/.*' 2020/01/20 18:50:51 Collecting initial packages 2020/01/20 18:50:52 Download dependencies 2020/01/20 18:50:55 Starting whole vndr cycle because no package specified 2020/01/20 18:50:55 Ignoring paths matching "archive/tar/.*" ... 020/01/20 18:53:46 Finished clone github.com/aws/aws-sdk-go 2020/01/20 18:53:46 Finished clone github.com/hashicorp/consul 2020/01/20 18:53:46 Dependencies downloaded. Download time: 2m50.469326342s 2020/01/20 18:53:46 Collecting all dependencies 2020/01/20 18:53:57 Clean vendor dir from unused packages 2020/01/20 18:53:57 Ignoring paths matching "archive/tar/.*" 2020/01/20 18:53:59 Success 2020/01/20 18:53:59 Running time: 3m7.731082301s After vendoring completed, verify that the `archive/tar` directory was kept: ls vendor/archive/tar LICENSE README.md common.go format.go reader.go stat_actime1.go stat_actime2.go stat_unix.go strconv.go writer.go Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
- Loading branch information