{{ message }}
Commit a1b5573
authored
fix: rename same-file detection via path canonicalization (#557)
The rename command and tx engine file.rename used raw PathBuf
comparison to detect same-file renames. Paths like file.md and
./file.md produce different PathBuf values but resolve to the same
file. Without canonicalization, a rename with write policy transforms
(e.g. --ensure-final-newline) would write the transformed content to
the destination, then delete the source, destroying the file.
Now compares canonicalized paths in both validate_rename_paths() and
the tx engine FileRename handler.
Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>1 parent da76cc5 commit a1b5573
4 files changed
Lines changed: 95 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
61 | 66 | | |
62 | 67 | | |
63 | 68 | | |
| |||
500 | 505 | | |
501 | 506 | | |
502 | 507 | | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
503 | 531 | | |
504 | 532 | | |
505 | 533 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1215 | 1215 | | |
1216 | 1216 | | |
1217 | 1217 | | |
1218 | | - | |
1219 | | - | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
1220 | 1225 | | |
1221 | 1226 | | |
1222 | 1227 | | |
| |||

0 commit comments