]>
Commit | Line | Data |
---|---|---|
bdf25142 LT |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2005 Junio C Hamano | |
4 | # | |
5 | ||
6 | test_description='See why rewinding head breaks send-pack | |
7 | ||
8 | ' | |
9 | . ./test-lib.sh | |
10 | ||
18e410f1 JS |
11 | touch cpio-test |
12 | test_expect_success 'working cpio' 'echo cpio-test | cpio -o > /dev/null' | |
13 | ||
bdf25142 LT |
14 | cnt='1' |
15 | test_expect_success setup ' | |
16 | tree=$(git-write-tree) && | |
17 | commit=$(echo "Commit #0" | git-commit-tree $tree) && | |
18 | zero=$commit && | |
19 | parent=$zero && | |
20 | for i in $cnt | |
21 | do | |
22 | sleep 1 && | |
23 | commit=$(echo "Commit #$i" | git-commit-tree $tree -p $parent) && | |
4d9d62fa | 24 | parent=$commit || return 1 |
bdf25142 | 25 | done && |
8098a178 | 26 | git-update-ref HEAD "$commit" && |
bc6146d2 | 27 | git-clone -l ./. victim && |
bdf25142 | 28 | cd victim && |
bc6146d2 | 29 | git-log && |
bdf25142 | 30 | cd .. && |
8098a178 | 31 | git-update-ref HEAD "$zero" && |
bdf25142 LT |
32 | parent=$zero && |
33 | for i in $cnt | |
34 | do | |
35 | sleep 1 && | |
36 | commit=$(echo "Rebase #$i" | git-commit-tree $tree -p $parent) && | |
4d9d62fa | 37 | parent=$commit || return 1 |
bdf25142 | 38 | done && |
8098a178 | 39 | git-update-ref HEAD "$commit" && |
bdf25142 | 40 | echo Rebase && |
bc6146d2 | 41 | git-log' |
bdf25142 LT |
42 | |
43 | test_expect_success \ | |
44 | 'pushing rewound head should not barf but require --force' ' | |
45 | # should not fail but refuse to update. | |
46 | git-send-pack ./victim/.git/ master && | |
47 | if cmp victim/.git/refs/heads/master .git/refs/heads/master | |
48 | then | |
49 | # should have been left as it was! | |
50 | false | |
51 | else | |
52 | true | |
53 | fi && | |
54 | # this should update | |
55 | git-send-pack --force ./victim/.git/ master && | |
56 | cmp victim/.git/refs/heads/master .git/refs/heads/master | |
57 | ' | |
da7bc9b0 PR |
58 | |
59 | test_done |