[PATCH] Added hook in git-receive-pack
[git.git] / t / t5400-send-pack.sh
blob19a8f122c75bc14e3bf421a5aeee0f2bd3ff7e83
1 #!/bin/sh
3 # Copyright (c) 2005 Junio C Hamano
6 test_description='See why rewinding head breaks send-pack
9 . ./test-lib.sh
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
19 sleep 1 &&
20 commit=$(echo "Commit #$i" | git-commit-tree $tree -p $parent) &&
21 parent=$commit || exit
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
32 sleep 1 &&
33 commit=$(echo "Rebase #$i" | git-commit-tree $tree -p $parent) &&
34 parent=$commit || exit
35 done &&
36 echo "$commit" >.git/HEAD &&
37 echo Rebase &&
38 git log'
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