git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Karl Hasselström" <kha@treskal.com>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org
Subject: [StGit PATCH 10/10] Don't write a log entry if there were no changes
Date: Mon, 21 Apr 2008 00:11:18 +0200	[thread overview]
Message-ID: <20080420221118.5837.38770.stgit@yoghurt> (raw)
In-Reply-To: <20080420215625.5837.82896.stgit@yoghurt>

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@treskal.com>

---

 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]))

      parent reply	other threads:[~2008-04-20 22:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-20 22:10 [StGit PATCH 00/10] Updated "stg reset" series Karl Hasselström
2008-04-20 22:10 ` [StGit PATCH 01/10] Prevent most commands from running when there are conflicts Karl Hasselström
2008-04-20 22:10 ` [StGit PATCH 02/10] Add property with a list of all patch names Karl Hasselström
2008-04-20 22:10 ` [StGit PATCH 03/10] Library functions for tree and blob manipulation Karl Hasselström
2008-04-20 22:10 ` [StGit PATCH 04/10] Write to a stack log when stack is modified Karl Hasselström
2008-04-20 22:10 ` [StGit PATCH 05/10] Add utility function for reordering patches Karl Hasselström
2008-04-20 22:10 ` [StGit PATCH 06/10] New command: stg reset Karl Hasselström
2008-04-20 22:11 ` [StGit PATCH 07/10] Log conflicts separately Karl Hasselström
2008-04-20 22:11 ` [StGit PATCH 08/10] Log conflicts separately for all commands Karl Hasselström
2008-04-20 22:11 ` [StGit PATCH 09/10] Add a --hard flag to stg reset Karl Hasselström
2008-04-20 22:11 ` Karl Hasselström [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080420221118.5837.38770.stgit@yoghurt \
    --to=kha@treskal.com \
    --cc=catalin.marinas@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).