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 -5
View File
@@ -115,7 +115,7 @@ func (s *ExternalDiffSystem) Mkdir(name AbsPath, perm fs.FileMode) error {
if err := os.MkdirAll(targetAbsPath.String(), perm); err != nil {
return err
}
if err := s.RunDiffCommand(devNullAbsPath, targetAbsPath); err != nil {
if err := s.RunDiffCommand(DevNullAbsPath, targetAbsPath); err != nil {
return err
}
}
@@ -151,7 +151,7 @@ func (s *ExternalDiffSystem) Remove(name AbsPath) error {
case err != nil:
return err
case s.filter.IncludeFileInfo(fileInfo):
if err := s.RunDiffCommand(name, devNullAbsPath); err != nil {
if err := s.RunDiffCommand(name, DevNullAbsPath); err != nil {
return err
}
}
@@ -168,7 +168,7 @@ func (s *ExternalDiffSystem) RemoveAll(name AbsPath) error {
case err != nil:
return err
case s.filter.IncludeFileInfo(fileInfo):
if err := s.RunDiffCommand(name, devNullAbsPath); err != nil {
if err := s.RunDiffCommand(name, DevNullAbsPath); err != nil {
return err
}
}
@@ -304,7 +304,7 @@ func (s *ExternalDiffSystem) RunScript(scriptName RelPath, dir AbsPath, data []b
if err := os.WriteFile(targetAbsPath.String(), toData, 0o700); err != nil {
return err
}
if err := s.RunDiffCommand(devNullAbsPath, targetAbsPath); err != nil {
if err := s.RunDiffCommand(DevNullAbsPath, targetAbsPath); err != nil {
return err
}
}
@@ -340,7 +340,7 @@ func (s *ExternalDiffSystem) WriteFile(filename AbsPath, data []byte, perm fs.Fi
fromAbsPath := filename
switch fileInfo, err := os.Lstat(fromAbsPath.String()); {
case errors.Is(err, fs.ErrNotExist):
fromAbsPath = devNullAbsPath
fromAbsPath = DevNullAbsPath
case err != nil:
return err
case s.textConvFunc != nil: