X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/blobdiff_plain/fb336055610b2b028e59d4be21a971bd821f1baa..533d85c2f663a7e89816b23c627a118866ab00fb:/t/t1800-import.sh diff --git a/t/t1800-import.sh b/t/t1800-import.sh index 8c8c9a0..ecaa593 100755 --- a/t/t1800-import.sh +++ b/t/t1800-import.sh @@ -22,6 +22,17 @@ test_expect_success \ ' 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 && @@ -80,4 +91,58 @@ test_expect_success \ stg delete .. ' +test_expect_success \ + 'Apply a bzip2 patch created with "git diff"' \ + ' + bzip2 -c ../t1800-import/git-diff >../t1800-import/bzip2-git-diff && + stg import ../t1800-import/bzip2-git-diff && + [ $(git cat-file -p $(stg id) \ + | grep -c "tree e96b1fba2160890ff600b675d7140d46b022b155") = 1 ] && + rm ../t1800-import/bzip2-git-diff && + stg delete .. + ' +test_expect_success \ + 'Apply a bzip2 patch with a .bz2 suffix' \ + ' + bzip2 -c ../t1800-import/git-diff >../t1800-import/git-diff.bz2 && + stg import ../t1800-import/git-diff.bz2 && + [ $(git cat-file -p $(stg id) \ + | grep -c "tree e96b1fba2160890ff600b675d7140d46b022b155") = 1 ] && + rm ../t1800-import/git-diff.bz2 && + stg delete .. + ' + +test_expect_success \ + 'Apply a gzip patch created with GNU diff' \ + ' + gzip -c ../t1800-import/gnu-diff >../t1800-import/gzip-gnu-diff && + stg import ../t1800-import/gzip-gnu-diff && + [ $(git cat-file -p $(stg id) \ + | grep -c "tree e96b1fba2160890ff600b675d7140d46b022b155") = 1 ] && + rm ../t1800-import/gzip-gnu-diff && + stg delete .. + ' +test_expect_success \ + 'Apply a gzip patch with a .gz suffix' \ + ' + gzip -c ../t1800-import/gnu-diff >../t1800-import/gnu-diff.gz && + stg import ../t1800-import/gnu-diff.gz && + [ $(git cat-file -p $(stg id) \ + | grep -c "tree e96b1fba2160890ff600b675d7140d46b022b155") = 1 ] && + rm ../t1800-import/gnu-diff.gz && + stg delete .. + ' + +test_expect_success \ + 'apply a series from a tarball' \ + ' + rm -f jabberwocky.txt && touch jabberwocky.txt && + git 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