From: "Karl Hasselström" <kha@treskal.com>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org, Erik Sandberg <mandolaerik@gmail.com>
Subject: [StGit PATCH 2/2] Fix "stg sink" with no applied patches (bug 11887)
Date: Mon, 30 Jun 2008 00:45:47 +0200 [thread overview]
Message-ID: <20080629224547.9267.92299.stgit@yoghurt> (raw)
In-Reply-To: <20080629224440.9267.3591.stgit@yoghurt>
There were two separate things to fix: bail out if we need a current
patch and there isn't one (because there are no applied patches), and
make sure we don't try to pop patches that don't exist.
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
stgit/commands/sink.py | 8 ++++++--
t/t1501-sink.sh | 2 +-
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/stgit/commands/sink.py b/stgit/commands/sink.py
index 2167d87..d8f79b4 100644
--- a/stgit/commands/sink.py
+++ b/stgit/commands/sink.py
@@ -58,9 +58,13 @@ def func(parser, options, args):
if len(args) > 0:
patches = parse_patches(args, all)
else:
- patches = [ crt_series.get_current() ]
+ current = crt_series.get_current()
+ if not current:
+ raise CmdException('No patch applied')
+ patches = [current]
- crt_series.pop_patch(options.to or oldapplied[0])
+ if oldapplied:
+ crt_series.pop_patch(options.to or oldapplied[0])
push_patches(crt_series, patches)
if not options.nopush:
diff --git a/t/t1501-sink.sh b/t/t1501-sink.sh
index 3872c4b..6af45fe 100755
--- a/t/t1501-sink.sh
+++ b/t/t1501-sink.sh
@@ -20,7 +20,7 @@ test_expect_success 'sink without applied patches' '
! stg sink
'
-test_expect_failure 'sink a specific patch without applied patches' '
+test_expect_success 'sink a specific patch without applied patches' '
stg sink y &&
test $(echo $(stg applied)) = "y"
'
prev parent reply other threads:[~2008-06-29 22:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-29 22:45 [StGit PATCH 0/2] Test+fix for bug 11887 (stg sink) Karl Hasselström
2008-06-29 22:45 ` [StGit PATCH 1/2] Try "stg sink" without applied patches Karl Hasselström
2008-06-30 7:53 ` Sverre Rabbelier
2008-06-30 8:44 ` Karl Hasselström
2008-06-29 22:45 ` 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=20080629224547.9267.92299.stgit@yoghurt \
--to=kha@treskal.com \
--cc=catalin.marinas@gmail.com \
--cc=git@vger.kernel.org \
--cc=mandolaerik@gmail.com \
/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).