1
0
mirror of https://github.com/git/git.git synced 2024-11-18 06:13:55 +01:00
git/t/t5400-send-pack.sh
Junio C Hamano bc6146d2ab 'build' scripts before installing.
Earlier we renamed git-foo.sh to git-foo while installing, which
was mostly done by inertia than anything else.  This however
made writing tests to use scripts harder.

This patch builds the scripts the same way as we build binaries
from their sources.  As a side effect, you can now specify
non-standard paths you have your Perl binary is in when running
the make.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-08 18:50:33 -07:00

57 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
#
# Copyright (c) 2005 Junio C Hamano
#
test_description='See why rewinding head breaks send-pack
'
. ./test-lib.sh
cnt='1'
test_expect_success setup '
tree=$(git-write-tree) &&
commit=$(echo "Commit #0" | git-commit-tree $tree) &&
zero=$commit &&
parent=$zero &&
for i in $cnt
do
sleep 1 &&
commit=$(echo "Commit #$i" | git-commit-tree $tree -p $parent) &&
parent=$commit || return 1
done &&
echo "$commit" >.git/HEAD &&
git-clone -l ./. victim &&
cd victim &&
git-log &&
cd .. &&
echo $zero >.git/HEAD &&
parent=$zero &&
for i in $cnt
do
sleep 1 &&
commit=$(echo "Rebase #$i" | git-commit-tree $tree -p $parent) &&
parent=$commit || return 1
done &&
echo "$commit" >.git/HEAD &&
echo Rebase &&
git-log'
test_expect_success \
'pushing rewound head should not barf but require --force' '
# should not fail but refuse to update.
git-send-pack ./victim/.git/ master &&
if cmp victim/.git/refs/heads/master .git/refs/heads/master
then
# should have been left as it was!
false
else
true
fi &&
# this should update
git-send-pack --force ./victim/.git/ master &&
cmp victim/.git/refs/heads/master .git/refs/heads/master
'
test_done