From fddd42f52f3ca39a9aeadbd2a3ba83ce86f2f14c Mon Sep 17 00:00:00 2001 From: John Rommel Estropia Date: Thu, 19 Mar 2015 00:21:35 +0900 Subject: [PATCH] don't warn about uncommitted changes when there aren't any --- HardcoreData/AsynchronousDataTransaction.swift | 4 ++-- HardcoreData/SynchronousDataTransaction.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/HardcoreData/AsynchronousDataTransaction.swift b/HardcoreData/AsynchronousDataTransaction.swift index a3e605e..423b687 100644 --- a/HardcoreData/AsynchronousDataTransaction.swift +++ b/HardcoreData/AsynchronousDataTransaction.swift @@ -152,7 +152,7 @@ public final class AsynchronousDataTransaction: BaseDataTransaction { self.transactionQueue.async { self.closure(transaction: self) - if !self.isCommitted { + if !self.isCommitted && self.hasChanges { HardcoreData.log(.Warning, message: "The closure for the <\(self.dynamicType)> completed without being committed. All changes made within the transaction were discarded.") } @@ -164,7 +164,7 @@ public final class AsynchronousDataTransaction: BaseDataTransaction { self.transactionQueue.sync { self.closure(transaction: self) - if !self.isCommitted { + if !self.isCommitted && self.hasChanges { HardcoreData.log(.Warning, message: "The closure for the <\(self.dynamicType)> completed without being committed. All changes made within the transaction were discarded.") } diff --git a/HardcoreData/SynchronousDataTransaction.swift b/HardcoreData/SynchronousDataTransaction.swift index 02bde8d..c293f9e 100644 --- a/HardcoreData/SynchronousDataTransaction.swift +++ b/HardcoreData/SynchronousDataTransaction.swift @@ -103,7 +103,7 @@ public final class SynchronousDataTransaction: BaseDataTransaction { self.transactionQueue.sync { self.closure(transaction: self) - if !self.isCommitted { + if !self.isCommitted && self.hasChanges { HardcoreData.log(.Warning, message: "The closure for the <\(self.dynamicType)> completed without being committed. All changes made within the transaction were discarded.") }