Commit d85d761
authored
fix(package): check dirtiness of symlinks source files (#14981)
### What does this PR try to resolve?
This adds a special case for checking source files are symlinks
and have been modified when under a VCS control
This is required because those paths may link to a file outside the
current package root, but still under the git workdir, affecting the
final packaged `.crate` file.
### How should we test and review this PR?
Pretty similar to #14966, as a part of #14967.
This may have potential performance issue. If a package contains
thousands of symlinks, Cargo will fire `git status` for each of them.
Not sure if we want to do anything proactively now.
The introduction of the `PathEntry` struct gives us more room for
storing file metadata to satisfiy use cases in the future. For
instances,
* Knowing a source file is a symlink and resolving it when packaging on
Windows
* #5664
* #14965
* Knowing more about a file's metadata (e.g. permission bits from Git)
* #4413
* #8006
* Provide richer information for `cargo package --list`, for example
JSON output mode
* #11666
* #13331
* #13953File tree
4 files changed
+87
-32
lines changed- crates/cargo-util/src
- src/cargo
- ops/cargo_package
- sources
- tests/testsuite
4 files changed
+87
-32
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
710 | 710 | | |
711 | 711 | | |
712 | 712 | | |
713 | | - | |
714 | | - | |
715 | | - | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
716 | 716 | | |
717 | 717 | | |
718 | 718 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
| 189 | + | |
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
222 | | - | |
223 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
224 | 228 | | |
225 | 229 | | |
226 | 230 | | |
227 | 231 | | |
228 | | - | |
229 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
230 | 238 | | |
231 | | - | |
| 239 | + | |
232 | 240 | | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
252 | 260 | | |
253 | 261 | | |
254 | | - | |
| 262 | + | |
255 | 263 | | |
256 | 264 | | |
257 | 265 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
448 | 448 | | |
449 | 449 | | |
450 | 450 | | |
| 451 | + | |
| 452 | + | |
451 | 453 | | |
452 | 454 | | |
453 | 455 | | |
| |||
469 | 471 | | |
470 | 472 | | |
471 | 473 | | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
472 | 478 | | |
473 | 479 | | |
474 | 480 | | |
475 | 481 | | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
476 | 489 | | |
477 | 490 | | |
478 | 491 | | |
| |||
826 | 839 | | |
827 | 840 | | |
828 | 841 | | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
829 | 845 | | |
830 | 846 | | |
831 | 847 | | |
| |||
847 | 863 | | |
848 | 864 | | |
849 | 865 | | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
850 | 870 | | |
851 | 871 | | |
852 | 872 | | |
| |||
876 | 896 | | |
877 | 897 | | |
878 | 898 | | |
| 899 | + | |
| 900 | + | |
879 | 901 | | |
880 | 902 | | |
881 | 903 | | |
882 | 904 | | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
883 | 920 | | |
884 | 921 | | |
885 | 922 | | |
| |||
890 | 927 | | |
891 | 928 | | |
892 | 929 | | |
| 930 | + | |
| 931 | + | |
893 | 932 | | |
894 | 933 | | |
895 | 934 | | |
| |||
907 | 946 | | |
908 | 947 | | |
909 | 948 | | |
| 949 | + | |
910 | 950 | | |
911 | 951 | | |
912 | 952 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1339 | 1339 | | |
1340 | 1340 | | |
1341 | 1341 | | |
| 1342 | + | |
1342 | 1343 | | |
1343 | 1344 | | |
1344 | 1345 | | |
1345 | 1346 | | |
| 1347 | + | |
1346 | 1348 | | |
1347 | 1349 | | |
1348 | 1350 | | |
| |||
1352 | 1354 | | |
1353 | 1355 | | |
1354 | 1356 | | |
| 1357 | + | |
1355 | 1358 | | |
1356 | 1359 | | |
1357 | 1360 | | |
| |||
1375 | 1378 | | |
1376 | 1379 | | |
1377 | 1380 | | |
1378 | | - | |
| 1381 | + | |
1379 | 1382 | | |
1380 | 1383 | | |
1381 | 1384 | | |
| 1385 | + | |
| 1386 | + | |
1382 | 1387 | | |
1383 | 1388 | | |
1384 | 1389 | | |
| |||
1388 | 1393 | | |
1389 | 1394 | | |
1390 | 1395 | | |
1391 | | - | |
| 1396 | + | |
1392 | 1397 | | |
1393 | 1398 | | |
1394 | 1399 | | |
| |||
1411 | 1416 | | |
1412 | 1417 | | |
1413 | 1418 | | |
| 1419 | + | |
1414 | 1420 | | |
1415 | 1421 | | |
1416 | 1422 | | |
1417 | 1423 | | |
1418 | 1424 | | |
1419 | 1425 | | |
1420 | 1426 | | |
| 1427 | + | |
1421 | 1428 | | |
1422 | 1429 | | |
1423 | 1430 | | |
| |||
0 commit comments