bundle verify: error out if called without an object database
[git/git.git] / t / t5607-clone-bundle.sh
CommitLineData
c9a42c4a
JS
1#!/bin/sh
2
3test_description='some bundle related tests'
4. ./test-lib.sh
5
6test_expect_success 'setup' '
8a557bb7 7 test_commit initial &&
c9a42c4a
JS
8 test_tick &&
9 git tag -m tag tag &&
8a557bb7
TR
10 test_commit second &&
11 test_commit third &&
12 git tag -d initial &&
13 git tag -d second &&
14 git tag -d third
c9a42c4a
JS
15'
16
3bbbe467
JS
17test_expect_success '"verify" needs a worktree' '
18 git bundle create tip.bundle -1 master &&
19 test_must_fail nongit git bundle verify ../tip.bundle 2>err &&
20 test_i18ngrep "need a repository" err
21'
22
2c8544ab
LF
23test_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 &&
26 grep tag output &&
c9a42c4a
JS
27 git bundle create bundle --all --since=7.Apr.2005.15:16:00.-0700 &&
28 git ls-remote bundle > output &&
29 ! grep tag output
c9a42c4a
JS
30'
31
0f5cdf65 32test_expect_success 'die if bundle file cannot be created' '
0f5cdf65
CH
33 mkdir adir &&
34 test_must_fail git bundle create adir --all
0f5cdf65
CH
35'
36
f62e0a39 37test_expect_failure 'bundle --stdin' '
f62e0a39
JN
38 echo master | git bundle create stdin-bundle.bdl --stdin &&
39 git ls-remote stdin-bundle.bdl >output &&
40 grep master output
f62e0a39
JN
41'
42
43test_expect_failure 'bundle --stdin <rev-list options>' '
f62e0a39
JN
44 echo master | git bundle create hybrid-bundle.bdl --stdin tag &&
45 git ls-remote hybrid-bundle.bdl >output &&
46 grep master output
f62e0a39
JN
47'
48
54440e15 49test_expect_success 'empty bundle file is rejected' '
8a557bb7
TR
50 : >empty-bundle &&
51 test_must_fail git fetch empty-bundle
54440e15
BH
52'
53
bc2fed49
TR
54# This triggers a bug in older versions where the resulting line (with
55# --pretty=oneline) was longer than a 1024-char buffer.
56test_expect_success 'ridiculously long subject in boundary' '
57 : >file4 &&
58 test_tick &&
59 git add file4 &&
60 printf "%01200d\n" 0 | git commit -F - &&
61 test_commit fifth &&
62 git bundle create long-subject-bundle.bdl HEAD^..HEAD &&
63 git bundle list-heads long-subject-bundle.bdl >heads &&
64 test -s heads &&
65 git fetch long-subject-bundle.bdl &&
0dbe6592
TR
66 sed -n "/^-/{p;q;}" long-subject-bundle.bdl >boundary &&
67 grep "^-[0-9a-f]\\{40\\} " boundary
bc2fed49
TR
68'
69
5446e33f
LF
70test_expect_success 'prerequisites with an empty commit message' '
71 : >file1 &&
72 git add file1 &&
73 test_tick &&
74 git commit --allow-empty-message -m "" &&
75 test_commit file2 &&
76 git bundle create bundle HEAD^.. &&
77 git bundle verify bundle
78'
79
2c8ee1f5
JK
80test_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
84'
85
c9a42c4a 86test_done