aboutsummaryrefslogtreecommitdiff
path: root/src/property.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-06-23 16:56:19 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-06-24 10:37:57 -0700
commitc45e0395c8573b81800b5a4a50ef73d760e28d2c (patch)
tree54e7f5b2507c89a2bd04c0c0ee53c6095be94f0c /src/property.lisp
parent700f403cbc5058d4765cfa421d14fcaea17fd443 (diff)
downloadconsfigurator-c45e0395c8573b81800b5a4a50ef73d760e28d2c.tar.gz
don't ls & cksum file again if result is already :NO-CHANGE
No functional change. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/property.lisp')
-rw-r--r--src/property.lisp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/property.lisp b/src/property.lisp
index ebdfadb..3f0b962 100644
--- a/src/property.lisp
+++ b/src/property.lisp
@@ -595,7 +595,8 @@ changes in properties which will change the file but not the output of `ls
(with-gensyms (before)
`(let* ((,before (ls-cksum ,file))
(result (progn ,@forms)))
- (if (and ,before (equal ,before (ls-cksum ,file)))
+ (if (or (eql result :no-change)
+ (and ,before (equal ,before (ls-cksum ,file))))
:no-change result))))
(defmacro with-change-if-changes-file-content ((file) &body forms)
@@ -603,7 +604,8 @@ changes in properties which will change the file but not the output of `ls
(with-gensyms (before)
`(let* ((,before (ignore-errors (cksum ,file)))
(result (progn ,@forms)))
- (if (and ,before (eql ,before (cksum ,file)))
+ (if (or (eql result :no-change)
+ (and ,before (eql ,before (cksum ,file))))
:no-change result))))
(defmacro with-change-if-changes-file-content-or-mode ((file) &body forms)
@@ -612,8 +614,10 @@ 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)))))
+ (if (equal result :no-change)
+ :no-change
+ (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))))))