[StGit PATCH 09/14] 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 920c261..3aec6e7 100644
--- a/stgit/lib/log.py
+++ b/stgit/lib/log.py
@@ -164,6 +164,9 @@ def log_entry(stack, msg):
         out.warn(str(e), 'No log entry written.')
         return
     full_log_tree, short_log_tree = log_entry_trees(stack.repository, stack)
+    if len(last_log) == 1 and full_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 = short_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