3 test_description
='some bundle related tests'
6 test_expect_success
'setup' '
17 test_expect_success
'"verify" needs a worktree' '
18 git bundle create tip.bundle -1 master &&
19 nongit test_must_fail git bundle verify ../tip.bundle 2>err &&
20 test_i18ngrep "need a repository" err
23 test_expect_success
'annotated tags can be excluded by rev-list options' '
24 git bundle create bundle --all --since=7.Apr.2005.15:14:00.-0700 &&
25 git ls-remote bundle > output &&
27 git bundle create bundle --all --since=7.Apr.2005.15:16:00.-0700 &&
28 git ls-remote bundle > output &&
32 test_expect_success
'die if bundle file cannot be created' '
34 test_must_fail git bundle create adir --all
37 test_expect_failure
'bundle --stdin' '
38 echo master | git bundle create stdin-bundle.bdl --stdin &&
39 git ls-remote stdin-bundle.bdl >output &&
43 test_expect_failure
'bundle --stdin <rev-list options>' '
44 echo master | git bundle create hybrid-bundle.bdl --stdin tag &&
45 git ls-remote hybrid-bundle.bdl >output &&
49 test_expect_success
'empty bundle file is rejected' '
51 test_must_fail git fetch empty-bundle
54 # This triggers a bug in older versions where the resulting line (with
55 # --pretty=oneline) was longer than a 1024-char buffer.
56 test_expect_success
'ridiculously long subject in boundary' '
60 printf "%01200d\n" 0 | git commit -F - &&
62 git bundle create long-subject-bundle.bdl HEAD^..HEAD &&
63 git bundle list-heads long-subject-bundle.bdl >heads &&
65 git fetch long-subject-bundle.bdl &&
66 sed -n "/^-/{p;q;}" long-subject-bundle.bdl >boundary &&
67 grep "^-$OID_REGEX " boundary
70 test_expect_success
'prerequisites with an empty commit message' '
74 git commit --allow-empty-message -m "" &&
76 git bundle create bundle HEAD^.. &&
77 git bundle verify bundle
80 test_expect_success
'failed bundle creation does not leave cruft' '
81 # This fails because the bundle would be empty.
82 test_must_fail git bundle create fail.bundle master..master &&
83 test_path_is_missing fail.bundle.lock
86 test_expect_success
'fetch SHA-1 from bundle' '
87 test_create_repo foo &&
88 test_commit -C foo x &&
89 git -C foo bundle create tip.bundle -1 master &&
90 git -C foo rev-parse HEAD >hash &&
92 # Exercise to ensure that fetching a SHA-1 from a bundle works with no
94 git fetch --no-tags foo/tip.bundle "$(cat hash)"