mirror of
https://github.com/git/git.git
synced 2024-11-17 06:25:13 +01:00
bc6146d2ab
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>
56 lines
1.2 KiB
Bash
Executable file
56 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
|