diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-04-08 13:27:23 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-04-08 13:28:53 -0700 |
commit | 16911629aa955fc69405de5c3fc2b818897f3e03 (patch) | |
tree | f5ac3d3a5952b79b39d634b8a80a5b7f697609ee /src/property.lisp | |
parent | eb8298b38d24d9dd73ffc073d064b879d2159dfc (diff) | |
download | consfigurator-16911629aa955fc69405de5c3fc2b818897f3e03.tar.gz |
FILE:HAS-CONTENT: don't return :NO-CHANGE if file mode was changed
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/property.lisp')
-rw-r--r-- | src/property.lisp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/property.lisp b/src/property.lisp index a223ff8..8246af5 100644 --- a/src/property.lisp +++ b/src/property.lisp @@ -527,3 +527,15 @@ changes in properties which will change the file but not the output of `ls (result (progn ,@forms))) (if (and ,before (eql ,before (cksum ,file))) :no-change result)))) + +(defmacro with-change-if-changes-file-content-or-mode ((file) &body forms) + "Execute FORMS and yield :NO-CHANGE if FILE has the same content and mode +afterwards." + (with-gensyms (before) + `(let* ((,before (ls-cksum ,file)) + (result (progn ,@forms))) + (let ((after (ls-cksum ,file))) + (if (and ,before + (string= (car ,before) (car after) :start1 1 :start2 1) + (eql (cadr ,before) (cadr after))) + :no-change result))))) |