[StGit PATCH 10/10] Don't write a log entry if there were no changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some commands end up calling log_entry() without verifying that they
did in fact change anything. (One example of this is a conflicting
push, which will log two entries, everything else and the conflicting
push, with the "everything else" part being empty if there was only
one patch to push.) So before appending to the log, make sure that the
entry we're appending isn't a no-op.

Signed-off-by: Karl Hasselström <kha@xxxxxxxxxxx>

---

 stgit/lib/log.py |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)


diff --git a/stgit/lib/log.py b/stgit/lib/log.py
index 9904941..a18c80e 100644
--- a/stgit/lib/log.py
+++ b/stgit/lib/log.py
@@ -49,6 +49,9 @@ def log_entry(stack, msg):
         out.warn(str(e), 'No log entry written.')
         return
     log_tree = log_entry_tree(stack.repository, stack)
+    if len(last_log) == 1 and log_tree == last_log[0].full_log.data.tree:
+        # No changes, so there's no point writing a new log entry.
+        return
     stack_log = stack.repository.commit(
         git.Commitdata(tree = log_tree, message = msg,
                        parents = [ll.stack_log for ll in last_log]))

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux