From 8ee4f2a84d53c2ff7be4848f4e2e4951fe3ad97d Mon Sep 17 00:00:00 2001 Message-Id: <8ee4f2a84d53c2ff7be4848f4e2e4951fe3ad97d.1715171430.git.mdw@distorted.org.uk> From: Mark Wooding Date: Sat, 6 Oct 2007 10:17:30 +0200 Subject: [PATCH] New test: "stg pop --keep" MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Organization: Straylight/Edgeware From: Karl Hasselström Signed-off-by: Karl Hasselström --- t/t1204-pop-keep.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 t/t1204-pop-keep.sh diff --git a/t/t1204-pop-keep.sh b/t/t1204-pop-keep.sh new file mode 100755 index 0000000..40cd2a2 --- /dev/null +++ b/t/t1204-pop-keep.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +test_description='Test "stg pop -keep"' +. ./test-lib.sh +stg init + +test_expect_success 'Create a few patches' ' + for i in 0 1 2; do + stg new p$i -m p$i && + echo "patch$i" >> patch$i.txt && + stg add patch$i.txt && + stg refresh + done && + [ "$(echo $(stg applied))" = "p0 p1 p2" ] && + [ "$(echo $(stg unapplied))" = "" ] +' + +test_expect_success 'Make some non-conflicting local changes' ' + echo "local" >> patch0.txt +' + +test_expect_success 'Pop two patches, keeping local changes' ' + stg pop -n 2 --keep && + [ "$(echo $(stg applied))" = "p0" ] && + [ "$(echo $(stg unapplied))" = "p1 p2" ] && + [ "$(echo $(ls patch?.txt))" = "patch0.txt" ] && + [ "$(echo $(cat patch0.txt))" = "patch0 local" ] +' + +test_expect_success 'Reset and push patches again' ' + git reset --hard && + stg push -a +' + +test_expect_success 'Pop a patch without local changes' ' + stg pop --keep && + [ "$(echo $(stg applied))" = "p0 p1" ] && + [ "$(echo $(stg unapplied))" = "p2" ] && + [ "$(echo $(ls patch?.txt))" = "patch0.txt patch1.txt" ] +' + +test_done -- [mdw]