]> git.ipfire.org Git - thirdparty/git.git/blob - t/t5400-send-pack.sh
Merge from gitk
[thirdparty/git.git] / t / t5400-send-pack.sh
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
11 cnt='1'
12 test_expect_success setup '
13 tree=$(git-write-tree) &&
14 commit=$(echo "Commit #0" | git-commit-tree $tree) &&
15 zero=$commit &&
16 parent=$zero &&
17 for i in $cnt
18 do
19 sleep 1 &&
20 commit=$(echo "Commit #$i" | git-commit-tree $tree -p $parent) &&
21 parent=$commit || return 1
22 done &&
23 echo "$commit" >.git/HEAD &&
24 git clone -l ./. victim &&
25 cd victim &&
26 git log &&
27 cd .. &&
28 echo $zero >.git/HEAD &&
29 parent=$zero &&
30 for i in $cnt
31 do
32 sleep 1 &&
33 commit=$(echo "Rebase #$i" | git-commit-tree $tree -p $parent) &&
34 parent=$commit || return 1
35 done &&
36 echo "$commit" >.git/HEAD &&
37 echo Rebase &&
38 git log'
39
40 test_expect_success \
41 'pushing rewound head should not barf but require --force' '
42 # should not fail but refuse to update.
43 git-send-pack ./victim/.git/ master &&
44 if cmp victim/.git/refs/heads/master .git/refs/heads/master
45 then
46 # should have been left as it was!
47 false
48 else
49 true
50 fi &&
51 # this should update
52 git-send-pack --force ./victim/.git/ master &&
53 cmp victim/.git/refs/heads/master .git/refs/heads/master
54 '
55
56 test_done