Commit 5bb82db
committed
fix(package): exclude target dir from backups
Ensure that the target directory is excluded from backups when running
`cargo package` by creating a CACHEDIR.TAG file. According to the
CACHEDIR.TAG specification, a tag file in a parent directory excludes
all subdirectories, so tagging the target directory protects the entire
tree including the package/ subdirectory and all build artifacts.
This prevents temporary packaging artifacts from being included in
Time Machine and other backup systems that respect CACHEDIR.TAG.
The fix applies to both build_dir (which typically equals target_dir)
during package creation, and to target_dir when uplifting artifacts
in workspaces where they differ.
Updates the test from the previous commit to verify that target/CACHEDIR.TAG
now exists after running `cargo package`.
Fixes #162381 parent 02a395f commit 5bb82db
2 files changed
+8
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
164 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
165 | 167 | | |
166 | 168 | | |
167 | 169 | | |
| |||
225 | 227 | | |
226 | 228 | | |
227 | 229 | | |
| 230 | + | |
228 | 231 | | |
229 | 232 | | |
230 | 233 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7810 | 7810 | | |
7811 | 7811 | | |
7812 | 7812 | | |
7813 | | - | |
7814 | | - | |
| 7813 | + | |
7815 | 7814 | | |
7816 | 7815 | | |
7817 | 7816 | | |
| |||
7830 | 7829 | | |
7831 | 7830 | | |
7832 | 7831 | | |
7833 | | - | |
| 7832 | + | |
7834 | 7833 | | |
7835 | 7834 | | |
7836 | | - | |
7837 | | - | |
| 7835 | + | |
| 7836 | + | |
7838 | 7837 | | |
7839 | 7838 | | |
7840 | 7839 | | |
0 commit comments