Johannes Schindelin | c9a42c4 | 2009-01-02 19:08:46 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='some bundle related tests' |
| 4 | . ./test-lib.sh |
| 5 | |
| 6 | test_expect_success 'setup' ' |
Thomas Rast | 8a557bb | 2012-02-23 10:42:23 +0100 | [diff] [blame] | 7 | test_commit initial && |
Johannes Schindelin | c9a42c4 | 2009-01-02 19:08:46 +0100 | [diff] [blame] | 8 | test_tick && |
| 9 | git tag -m tag tag && |
Thomas Rast | 8a557bb | 2012-02-23 10:42:23 +0100 | [diff] [blame] | 10 | test_commit second && |
| 11 | test_commit third && |
| 12 | git tag -d initial && |
| 13 | git tag -d second && |
| 14 | git tag -d third |
Johannes Schindelin | c9a42c4 | 2009-01-02 19:08:46 +0100 | [diff] [blame] | 15 | ' |
| 16 | |
Lukas Fleischer | 2c8544a | 2014-08-02 10:39:06 +0200 | [diff] [blame] | 17 | test_expect_success 'annotated tags can be excluded by rev-list options' ' |
| 18 | git bundle create bundle --all --since=7.Apr.2005.15:14:00.-0700 && |
| 19 | git ls-remote bundle > output && |
| 20 | grep tag output && |
Johannes Schindelin | c9a42c4 | 2009-01-02 19:08:46 +0100 | [diff] [blame] | 21 | git bundle create bundle --all --since=7.Apr.2005.15:16:00.-0700 && |
| 22 | git ls-remote bundle > output && |
| 23 | ! grep tag output |
Johannes Schindelin | c9a42c4 | 2009-01-02 19:08:46 +0100 | [diff] [blame] | 24 | ' |
| 25 | |
Csaba Henk | 0f5cdf6 | 2010-08-27 20:31:47 +0000 | [diff] [blame] | 26 | test_expect_success 'die if bundle file cannot be created' ' |
Csaba Henk | 0f5cdf6 | 2010-08-27 20:31:47 +0000 | [diff] [blame] | 27 | mkdir adir && |
| 28 | test_must_fail git bundle create adir --all |
Csaba Henk | 0f5cdf6 | 2010-08-27 20:31:47 +0000 | [diff] [blame] | 29 | ' |
| 30 | |
Jonathan Nieder | f62e0a3 | 2010-04-19 03:03:03 -0500 | [diff] [blame] | 31 | test_expect_failure 'bundle --stdin' ' |
Jonathan Nieder | f62e0a3 | 2010-04-19 03:03:03 -0500 | [diff] [blame] | 32 | echo master | git bundle create stdin-bundle.bdl --stdin && |
| 33 | git ls-remote stdin-bundle.bdl >output && |
| 34 | grep master output |
Jonathan Nieder | f62e0a3 | 2010-04-19 03:03:03 -0500 | [diff] [blame] | 35 | ' |
| 36 | |
| 37 | test_expect_failure 'bundle --stdin <rev-list options>' ' |
Jonathan Nieder | f62e0a3 | 2010-04-19 03:03:03 -0500 | [diff] [blame] | 38 | echo master | git bundle create hybrid-bundle.bdl --stdin tag && |
| 39 | git ls-remote hybrid-bundle.bdl >output && |
| 40 | grep master output |
Jonathan Nieder | f62e0a3 | 2010-04-19 03:03:03 -0500 | [diff] [blame] | 41 | ' |
| 42 | |
Brian Harring | 54440e1 | 2012-01-03 05:46:03 -0800 | [diff] [blame] | 43 | test_expect_success 'empty bundle file is rejected' ' |
Thomas Rast | 8a557bb | 2012-02-23 10:42:23 +0100 | [diff] [blame] | 44 | : >empty-bundle && |
| 45 | test_must_fail git fetch empty-bundle |
Brian Harring | 54440e1 | 2012-01-03 05:46:03 -0800 | [diff] [blame] | 46 | ' |
| 47 | |
Thomas Rast | bc2fed4 | 2012-02-22 20:34:23 +0100 | [diff] [blame] | 48 | # This triggers a bug in older versions where the resulting line (with |
| 49 | # --pretty=oneline) was longer than a 1024-char buffer. |
| 50 | test_expect_success 'ridiculously long subject in boundary' ' |
| 51 | : >file4 && |
| 52 | test_tick && |
| 53 | git add file4 && |
| 54 | printf "%01200d\n" 0 | git commit -F - && |
| 55 | test_commit fifth && |
| 56 | git bundle create long-subject-bundle.bdl HEAD^..HEAD && |
| 57 | git bundle list-heads long-subject-bundle.bdl >heads && |
| 58 | test -s heads && |
| 59 | git fetch long-subject-bundle.bdl && |
Thomas Rast | 0dbe659 | 2012-03-06 15:50:37 +0100 | [diff] [blame] | 60 | sed -n "/^-/{p;q;}" long-subject-bundle.bdl >boundary && |
| 61 | grep "^-[0-9a-f]\\{40\\} " boundary |
Thomas Rast | bc2fed4 | 2012-02-22 20:34:23 +0100 | [diff] [blame] | 62 | ' |
| 63 | |
Lukas Fleischer | 5446e33 | 2013-04-07 13:53:15 +0200 | [diff] [blame] | 64 | test_expect_success 'prerequisites with an empty commit message' ' |
| 65 | : >file1 && |
| 66 | git add file1 && |
| 67 | test_tick && |
| 68 | git commit --allow-empty-message -m "" && |
| 69 | test_commit file2 && |
| 70 | git bundle create bundle HEAD^.. && |
| 71 | git bundle verify bundle |
| 72 | ' |
| 73 | |
Johannes Schindelin | c9a42c4 | 2009-01-02 19:08:46 +0100 | [diff] [blame] | 74 | test_done |