From: Karl Hasselström Date: Sun, 29 Jun 2008 22:47:50 +0000 (+0200) Subject: Merge branch 'stable' into stable-master-merge X-Git-Tag: v0.15-rc1~204 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/a05954efcf4fce744252ce2e1a650b78fa5788d6?hp=354d203152c0fda8e0221aff9fdfa9b18d53e83d Merge branch 'stable' into stable-master-merge --- 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 new file mode 100755 index 0000000..6af45fe --- /dev/null +++ b/t/t1501-sink.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +test_description='Test "stg sink"' + +. ./test-lib.sh + +test_expect_success 'Initialize StGit stack' ' + echo 000 >> x && + git add x && + git commit -m initial && + echo 000 >> y && + git add y && + git commit -m y && + stg init && + stg uncommit && + stg pop +' + +test_expect_success 'sink without applied patches' ' + ! stg sink +' + +test_expect_success 'sink a specific patch without applied patches' ' + stg sink y && + test $(echo $(stg applied)) = "y" +' + +test_done