X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/blobdiff_plain/7a6a45b5f1379466bd23b33a7feed47d0b8331b7..de8efe1efc4a495eca0614aa9f6c1910d5838f99:/t/t1800-import.sh diff --git a/t/t1800-import.sh b/t/t1800-import.sh index 1352743..406a6cf 100755 --- a/t/t1800-import.sh +++ b/t/t1800-import.sh @@ -7,7 +7,7 @@ test_expect_success \ 'Initialize the StGIT repository' \ ' cp ../t1800-import/foo.txt . && - git add foo.txt && + stg add foo.txt && git commit -a -m "initial version" && stg init ' @@ -22,6 +22,44 @@ test_expect_success \ ' test_expect_success \ + 'Apply a patch created with "git diff" using -p1' \ + ' + stg import -p1 ../t1800-import/git-diff && + [ $(git cat-file -p $(stg id) \ + | grep -c "tree e96b1fba2160890ff600b675d7140d46b022b155") = 1 ] && + stg delete .. + ' + +test_expect_success \ + 'Apply a patch created with "git diff" using -p0' \ + ' + stg import -p0 ../t1800-import/git-diff-p0 && + [ $(git cat-file -p $(stg id) \ + | grep -c "tree e96b1fba2160890ff600b675d7140d46b022b155") = 1 ] && + stg delete .. + ' + +test_expect_success \ + 'Apply a patch created with "git diff" using -p2' \ + ' + ! stg import -p2 ../t1800-import/git-diff && + [ $(git cat-file -p $(stg id) \ + | grep -c "tree a5850c97490398571d41d6304dd940800550f507") = 1 ] && + stg delete .. + ' + +test_expect_success \ + 'Apply a patch created with "git diff" from a subdirectory' \ + ' + mkdir subdir && cd subdir && + stg import ../../t1800-import/git-diff && + [ $(git cat-file -p $(stg id) \ + | grep -c "tree e96b1fba2160890ff600b675d7140d46b022b155") = 1 ] && + stg delete .. && + cd .. + ' + +test_expect_success \ 'Apply a patch created with GNU diff' \ ' stg import ../t1800-import/gnu-diff && @@ -122,4 +160,16 @@ test_expect_success \ stg delete .. ' +test_expect_success \ + 'apply a series from a tarball' \ + ' + rm -f jabberwocky.txt && touch jabberwocky.txt && + stg add jabberwocky.txt && git commit -m "empty file" jabberwocky.txt && + (cd ../t1800-import; tar -cjf jabberwocky.tar.bz2 patches) && + stg import --series ../t1800-import/jabberwocky.tar.bz2 + [ $(git cat-file -p $(stg id) \ + | grep -c "tree 2c33937252a21f1550c0bf21f1de534b68f69635") = 1 ] && + rm ../t1800-import/jabberwocky.tar.bz2 + ' + test_done