[PATCH 1/2] t5704 (bundle): rewrite for larger coverage
From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:52:39
Subsystem:
the rest · Maintainer:
Linus Torvalds
Rewrite the git-bundle testsuite to exercise more of its functionality. Signed-off-by: Ramkumar Ramachandra <redacted> --- t/t5704-bundle.sh | 95 ++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 69 insertions(+), 26 deletions(-)
diff --git a/t/t5704-bundle.sh b/t/t5704-bundle.sh
index 728ccd8..09ff4f1 100755
--- a/t/t5704-bundle.sh
+++ b/t/t5704-bundle.sh@@ -1,56 +1,99 @@ #!/bin/sh -test_description='some bundle related tests' +test_description='Test git-bundle' . ./test-lib.sh test_expect_success 'setup' ' + git config core.logAllRefUpdates false && + test_commit initial && + git checkout -b branch && + test_commit second && + test_commit third && + git checkout master && + test_commit fourth file +' - : > file && - git add file && - test_tick && - git commit -m initial && - test_tick && - git tag -m tag tag && - : > file2 && - git add file2 && - : > file3 && - test_tick && - git commit -m second && - git add file3 && - test_tick && - git commit -m third +test_expect_success 'create succeeds' ' + git bundle create bundle second third && + cat >expect <<-\EOF && + OBJID refs/tags/third + OBJID refs/tags/second + EOF + { + git ls-remote bundle | + sed "s/$_x40/OBJID/g" + } >actual && + test_cmp expect actual +' +test_expect_success 'verify succeeds' ' + git bundle create bundle second third && + git bundle verify bundle ' -test_expect_success 'tags can be excluded by rev-list options' ' +test_expect_success 'list-heads succeeds' ' + git bundle create bundle second third && + cat >expect <<-\EOF && + OBJID refs/tags/second + OBJID refs/tags/third + EOF + { + git bundle list-heads bundle | + sed "s/$_x40/OBJID/g" + } >actual && + test_cmp expect actual +' - git bundle create bundle --all --since=7.Apr.2005.15:16:00.-0700 && - git ls-remote bundle > output && - ! grep tag output +test_expect_success 'create dies on invalid bundle filename' ' + mkdir adir && + test_expect_code 128 git bundle create adir --all +' +test_expect_success 'disallow stray command-line options' ' + test_must_fail git bundle create --junk bundle second third ' -test_expect_success 'die if bundle file cannot be created' ' +test_expect_failure 'disallow stray command-line arguments' ' + git bundle create bundle second third && + test_must_fail git bundle verify bundle junk +' - mkdir adir && - test_must_fail git bundle create adir --all +test_expect_success 'create accepts rev-list options to narrow refs' ' + git bundle create bundle --all -- file && + cat >expect <<-\EOF && + OBJID HEAD + OBJID refs/tags/fourth + OBJID refs/heads/master + EOF + { + git ls-remote bundle | + sed "s/$_x40/OBJID/g" + } >actual && + test_cmp expect actual +' +test_expect_success 'unbundle succeeds' ' + saved=$(git rev-parse third) && + git bundle create bundle second third fourth && + git tag -d second third fourth && + git branch -D branch && + git reset --hard initial && + git prune && + test_must_fail git reset --hard $saved && + git bundle unbundle bundle && + git reset --hard $saved ' test_expect_failure 'bundle --stdin' ' - echo master | git bundle create stdin-bundle.bdl --stdin && git ls-remote stdin-bundle.bdl >output && grep master output - ' test_expect_failure 'bundle --stdin <rev-list options>' ' - echo master | git bundle create hybrid-bundle.bdl --stdin tag && git ls-remote hybrid-bundle.bdl >output && grep master output - ' test_done
--
1.7.4.1