fix: Pass /dev/null to diff command for missing files in apply --interactive

This commit is contained in:
dualfroz committed 2026-10-11 10:21:53 +02:00
1 parent ee28f348f2
commit 4e184024be
5 files changed
+38 -8

No files matched your search

+5 -1
View File
@@ -1197,9 +1197,13 @@ func (c *Config) defaultPreApplyFunc(
case err != nil:
return err
case choice == "diff":
destAbsPath := c.DestDirAbsPath.Join(targetRelPath)
if actualEntryState.Type == chezmoi.EntryStateTypeRemove {
destAbsPath = chezmoi.DevNullAbsPath
}
if err := c.diffFile(
targetRelPath,
c.DestDirAbsPath.Join(targetRelPath), actualContents, actualEntryState.Mode,
destAbsPath, actualContents, actualEntryState.Mode,
chezmoi.EmptyAbsPath, targetContents, targetEntryState.Mode,
); err != nil {
return err