mirror of
https://github.com/git/git.git
synced 2024-10-30 22:07:53 +01:00
3a81f33c52
In particular, the url passed to git-clone has an extra '/' given after the 'file://' schema prefix, thus: git clone --reference=original "file:///$(pwd)/original one Once the prefix is removed, the remainder of the url looks something like "//home/ramsay/git/t/...", which is then interpreted as an network path. This then results in a "Permission denied" error, like so: ramsay $ ls //home ls: cannot access //home: No such host or network path ramsay $ ls //home/ramsay ls: cannot access //home/ramsay: Permission denied ramsay $ In order to fix the problem, we simply remove the extraneous '/' character from the url. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
66 lines
1.3 KiB
Bash
Executable file
66 lines
1.3 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='fetch/push involving alternates'
|
|
. ./test-lib.sh
|
|
|
|
count_objects () {
|
|
loose=0 inpack=0
|
|
eval "$(
|
|
git count-objects -v |
|
|
sed -n -e 's/^count: \(.*\)/loose=\1/p' \
|
|
-e 's/^in-pack: \(.*\)/inpack=\1/p'
|
|
)" &&
|
|
echo $(( $loose + $inpack ))
|
|
}
|
|
|
|
|
|
test_expect_success setup '
|
|
(
|
|
git init original &&
|
|
cd original &&
|
|
i=0 &&
|
|
while test $i -le 100
|
|
do
|
|
echo "$i" >count &&
|
|
git add count &&
|
|
git commit -m "$i" || exit
|
|
i=$(($i + 1))
|
|
done
|
|
) &&
|
|
(
|
|
git clone --reference=original "file://$(pwd)/original" one &&
|
|
cd one &&
|
|
echo Z >count &&
|
|
git add count &&
|
|
git commit -m Z &&
|
|
count_objects >../one.count
|
|
) &&
|
|
A=$(pwd)/original/.git/objects &&
|
|
git init receiver &&
|
|
echo "$A" >receiver/.git/objects/info/alternates &&
|
|
git init fetcher &&
|
|
echo "$A" >fetcher/.git/objects/info/alternates
|
|
'
|
|
|
|
test_expect_success 'pushing into a repository with the same alternate' '
|
|
(
|
|
cd one &&
|
|
git push ../receiver master:refs/heads/it
|
|
) &&
|
|
(
|
|
cd receiver &&
|
|
count_objects >../receiver.count
|
|
) &&
|
|
test_cmp one.count receiver.count
|
|
'
|
|
|
|
test_expect_success 'fetching from a repository with the same alternate' '
|
|
(
|
|
cd fetcher &&
|
|
git fetch ../one master:refs/heads/it &&
|
|
count_objects >../fetcher.count
|
|
) &&
|
|
test_cmp one.count fetcher.count
|
|
'
|
|
|
|
test_done
|