Use `rsync -aHAX --delete`
Use `rsync -aHAX --delete`

When creating/restoring cache, the user wants the created files and dir
to *replace* existing ones. This also implies deleting leftover files.

To be clearer, let's take an example with a JS / TypeScript project:
- A project needs to install some "typings" named `footypes` in
  `node_modules`.
- `footypes` becomes deprecated and should be replaced by `footypes2`.
  The developer then replaces `footypes` with `footypes2` in his
  `package.json`.
- On next builds, old cache is restored (including
  `node_modules/footypes`). Then `footypes2` is also installed in
  `node_modules`.
- Builds now fail because there are conflicting typings for library
  `foo`: both `footypes` and `footypes2` are present.

With the `--delete` flag added to `rsync`, when creating new caches,
files that are not present in source dir are deleted from target dir.

Drillster/drone-volume-cache