From f837ca5e48bcd894b907e6426bbde06742f9378e Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Mon, 4 Aug 2008 15:21:16 +0200 Subject: [PATCH] Add some tests of refreshing removed files 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/t2702-refresh-rm.sh | 101 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100755 t/t2702-refresh-rm.sh diff --git a/t/t2702-refresh-rm.sh b/t/t2702-refresh-rm.sh new file mode 100755 index 0000000..896ebf3 --- /dev/null +++ b/t/t2702-refresh-rm.sh @@ -0,0 +1,101 @@ +#!/bin/sh + +test_description='"stg refresh" with removed files' + +. ./test-lib.sh + +# Ignore our own temp files. +cat >> .git/info/exclude < /dev/null + git reset --hard > /dev/null +} + +test_expect_success 'Initialize StGit stack' ' + stg init && + echo x > x.txt && + echo y > y.txt && + git add x.txt y.txt && + git commit -m "Add some files" +' + +cat > expected0.txt < expected1.txt +test_expect_success 'git-rm a file' ' + stg new -m p0 && + git rm y.txt && + stg status > status0.txt && + test_cmp expected0.txt status0.txt && + stg refresh && + stg status > status1.txt && + test_cmp expected1.txt status1.txt && + stg files | sort > files.txt && + test_cmp expected0.txt files.txt +' + +reset + +cat > expected0.txt < expected1.txt +test_expect_success 'git-rm a file together with other changes' ' + stg new -m p1 && + echo x2 >> x.txt && + git rm y.txt && + stg status > status0.txt && + test_cmp expected0.txt status0.txt && + stg refresh && + stg status > status1.txt && + test_cmp expected1.txt status1.txt && + stg files | sort > files.txt && + test_cmp expected0.txt files.txt +' + +reset + +cat > expected0.txt < expected1.txt +test_expect_success 'rm a file' ' + stg new -m p2 && + rm y.txt && + stg status > status0.txt && + test_cmp expected0.txt status0.txt && + stg refresh && + stg status > status1.txt && + test_cmp expected1.txt status1.txt && + stg files | sort > files.txt && + test_cmp expected0.txt files.txt +' + +reset + +cat > expected0.txt < expected1.txt +test_expect_success 'rm a file together with other changes' ' + stg new -m p3 && + echo x2 >> x.txt && + rm y.txt && + stg status > status0.txt && + test_cmp expected0.txt status0.txt && + stg refresh && + stg status > status1.txt && + test_cmp expected1.txt status1.txt && + stg files | sort > files.txt && + test_cmp expected0.txt files.txt +' + +test_done -- [mdw]