#!/bin/sh global test_description := ''some bundle related tests'' source ./test-lib.sh test_expect_success 'setup' ' test_commit initial && test_tick && git tag -m tag tag && test_commit second && test_commit third && git tag -d initial && git tag -d second && git tag -d third ' test_expect_success 'annotated tags can be excluded by rev-list options' ' git bundle create bundle --all --since=7.Apr.2005.15:14:00.-0700 && git ls-remote bundle > output && grep tag output && git bundle create bundle --all --since=7.Apr.2005.15:16:00.-0700 && git ls-remote bundle > output && ! grep tag output ' test_expect_success 'die if bundle file cannot be created' ' mkdir adir && test_must_fail git bundle create adir --all ' 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 ' ' echo master | git bundle create hybrid-bundle.bdl --stdin tag && git ls-remote hybrid-bundle.bdl >output && grep master output ' test_expect_success 'empty bundle file is rejected' ' : >empty-bundle && test_must_fail git fetch empty-bundle ' # This triggers a bug in older versions where the resulting line (with # --pretty=oneline) was longer than a 1024-char buffer. test_expect_success 'ridiculously long subject in boundary' ' : >file4 && test_tick && git add file4 && printf "%01200d\n" 0 | git commit -F - && test_commit fifth && git bundle create long-subject-bundle.bdl HEAD^..HEAD && git bundle list-heads long-subject-bundle.bdl >heads && test -s heads && git fetch long-subject-bundle.bdl && sed -n "/^-/{p;q;}" long-subject-bundle.bdl >boundary && grep "^-[0-9a-f]\\{40\\} " boundary ' test_expect_success 'prerequisites with an empty commit message' ' : >file1 && git add file1 && test_tick && git commit --allow-empty-message -m "" && test_commit file2 && git bundle create bundle HEAD^.. && git bundle verify bundle ' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"some bundle related tests">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(SQ )} { (SQ <"\n"> <"\ttest_commit initial &&\n"> <"\ttest_tick &&\n"> <"\tgit tag -m tag tag &&\n"> <"\ttest_commit second &&\n"> <"\ttest_commit third &&\n"> <"\tgit tag -d initial &&\n"> <"\tgit tag -d second &&\n"> <"\tgit tag -d third\n"> ) } ) (C {(test_expect_success)} {(SQ <"annotated tags can be excluded by rev-list options">)} { (SQ <"\n"> <"\tgit bundle create bundle --all --since=7.Apr.2005.15:14:00.-0700 &&\n"> <"\tgit ls-remote bundle > output &&\n"> <"\tgrep tag output &&\n"> <"\tgit bundle create bundle --all --since=7.Apr.2005.15:16:00.-0700 &&\n"> <"\tgit ls-remote bundle > output &&\n"> <"\t! grep tag output\n"> ) } ) (C {(test_expect_success)} {(SQ <"die if bundle file cannot be created">)} {(SQ <"\n"> <"\tmkdir adir &&\n"> <"\ttest_must_fail git bundle create adir --all\n">)} ) (C {(test_expect_failure)} {(SQ <"bundle --stdin">)} { (SQ <"\n"> <"\techo master | git bundle create stdin-bundle.bdl --stdin &&\n"> <"\tgit ls-remote stdin-bundle.bdl >output &&\n"> <"\tgrep master output\n"> ) } ) (C {(test_expect_failure)} {(SQ <"bundle --stdin ">)} { (SQ <"\n"> <"\techo master | git bundle create hybrid-bundle.bdl --stdin tag &&\n"> <"\tgit ls-remote hybrid-bundle.bdl >output &&\n"> <"\tgrep master output\n"> ) } ) (C {(test_expect_success)} {(SQ <"empty bundle file is rejected">)} {(SQ <"\n"> <"\t: >empty-bundle &&\n"> <"\ttest_must_fail git fetch empty-bundle\n">)} ) (C {(test_expect_success)} {(SQ <"ridiculously long subject in boundary">)} { (SQ <"\n"> <"\t: >file4 &&\n"> <"\ttest_tick &&\n"> <"\tgit add file4 &&\n"> <"\tprintf \"%01200d\\n\" 0 | git commit -F - &&\n"> <"\ttest_commit fifth &&\n"> <"\tgit bundle create long-subject-bundle.bdl HEAD^..HEAD &&\n"> <"\tgit bundle list-heads long-subject-bundle.bdl >heads &&\n"> <"\ttest -s heads &&\n"> <"\tgit fetch long-subject-bundle.bdl &&\n"> <"\tsed -n \"/^-/{p;q;}\" long-subject-bundle.bdl >boundary &&\n"> <"\tgrep \"^-[0-9a-f]\\\\{40\\\\} \" boundary\n"> ) } ) (C {(test_expect_success)} {(SQ <"prerequisites with an empty commit message">)} { (SQ <"\n"> <"\t: >file1 &&\n"> <"\tgit add file1 &&\n"> <"\ttest_tick &&\n"> <"\tgit commit --allow-empty-message -m \"\" &&\n"> <"\ttest_commit file2 &&\n"> <"\tgit bundle create bundle HEAD^.. &&\n"> <"\tgit bundle verify bundle\n"> ) } ) (C {(test_done)}) ] )