From 919e91fd13333f284c798b909c68ef0dd6891064 Mon Sep 17 00:00:00 2001 From: "Dustin J. Mitchell" Date: Sun, 6 Mar 2022 22:17:59 +0000 Subject: [PATCH] don't automatically update modified when updating it explicitly --- taskchampion/src/task/task.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/taskchampion/src/task/task.rs b/taskchampion/src/task/task.rs index d5517f5b4..cd8a12f85 100644 --- a/taskchampion/src/task/task.rs +++ b/taskchampion/src/task/task.rs @@ -425,7 +425,7 @@ impl<'r> TaskMut<'r> { // -- utility functions - fn lastmod(&mut self) -> anyhow::Result<()> { + fn update_modified(&mut self) -> anyhow::Result<()> { if !self.updated_modified { let now = format!("{}", Utc::now().timestamp()); trace!("task {}: set property modified={:?}", self.task.uuid, now); @@ -443,7 +443,10 @@ impl<'r> TaskMut<'r> { value: Option, ) -> anyhow::Result<()> { let property = property.into(); - self.lastmod()?; + // updated the modified timestamp unless we are setting it explicitly + if &property != "modified" { + self.update_modified()?; + } if let Some(ref v) = value { trace!("task {}: set property {}={:?}", self.task.uuid, property, v);