Skip to content

Commit

Permalink
fix: Fix apply --verbose when diff.command is set
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Apr 9, 2022
1 parent 0ed7772 commit 58c458c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/chezmoi/externaldiffsystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ func (s *ExternalDiffSystem) WriteFile(filename AbsPath, data []byte, perm fs.Fi
if err := os.WriteFile(targetAbsPath.String(), data, perm); err != nil {
return err
}
return s.runDiffCommand(filename, targetAbsPath)
if err := s.runDiffCommand(filename, targetAbsPath); err != nil {
return err
}
return s.system.WriteFile(filename, data, perm)
}

// WriteSymlink implements System.WriteSymlink.
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/testdata/scripts/diffcommand_unix.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ stdout ^arg\s+${HOME@R}/\.file\s+${WORK@R}/.*/\.file$
# test that chezmoi apply --verbose uses diff.command
chezmoi apply --verbose
stdout ^arg\s+${HOME@R}/\.file\s+${WORK@R}/.*/\.file$
exists $HOME/.file

chhome home3/user

Expand Down

0 comments on commit 58c458c

Please sign in to comment.