From: "Karl Hasselström" <kha@treskal.com>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: "David Kågedal" <davidk@lysator.liu.se>, git@vger.kernel.org
Subject: [PATCH] Transaction.push_patch(): Set self.head only when we have a merge conflict
Date: Tue, 19 May 2009 12:07:26 +0200 [thread overview]
Message-ID: <20090519100635.2943.31546.stgit@october.hq.vtech> (raw)
Setting self.head when we don't have a merge conflict is a harmless
no-op---as long as we set it to the commit that was going to be the
stack top anyway---so this patch should not change the behavior. But
it's not really nice to do it unconditionally, especially considering
that we want people to be able to understand what the code does ...
Also add a comment that explains why we set it, since the logic is
rather more hairy than I'd like.
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
This patch came out of a discussion I just had with David regarding
his --set-tree patch.
stgit/lib/transaction.py | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/stgit/lib/transaction.py b/stgit/lib/transaction.py
index 4148ff3..5c662bb 100644
--- a/stgit/lib/transaction.py
+++ b/stgit/lib/transaction.py
@@ -342,7 +342,13 @@ class StackTransaction(object):
if any(getattr(cd, a) != getattr(orig_cd, a) for a in
['parent', 'tree', 'author', 'message']):
comm = self.__stack.repository.commit(cd)
- self.head = comm
+ if merge_conflict:
+ # When we produce a conflict, we'll run the update()
+ # function defined below _after_ having done the
+ # checkout in run(). To make sure that we check out
+ # the real stack top (as it will look after update()
+ # has been run), set it hard here.
+ self.head = comm
else:
comm = None
s = ' (unmodified)'
reply other threads:[~2009-05-19 10:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20090519100635.2943.31546.stgit@october.hq.vtech \
--to=kha@treskal.com \
--cc=catalin.marinas@gmail.com \
--cc=davidk@lysator.liu.se \
--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).