2007-08-18 00:56:54 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
test_description='fetching and pushing project with subproject'
|
|
|
|
|
|
|
|
. ./test-lib.sh
|
|
|
|
|
|
|
|
test_expect_success setup '
|
|
|
|
test_tick &&
|
|
|
|
mkdir -p sub && (
|
|
|
|
cd sub &&
|
|
|
|
git init &&
|
|
|
|
>subfile &&
|
2010-10-31 09:46:54 +08:00
|
|
|
git add subfile &&
|
2007-08-18 00:56:54 +08:00
|
|
|
git commit -m "subproject commit #1"
|
|
|
|
) &&
|
2010-10-31 09:46:54 +08:00
|
|
|
>mainfile &&
|
2007-08-18 00:56:54 +08:00
|
|
|
git add sub mainfile &&
|
|
|
|
test_tick &&
|
|
|
|
git commit -m "superproject commit #1"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success clone '
|
2008-05-04 13:37:59 +08:00
|
|
|
git clone "file://$(pwd)/.git" cloned &&
|
2007-08-18 00:56:54 +08:00
|
|
|
(git rev-parse HEAD; git ls-files -s) >expected &&
|
|
|
|
(
|
|
|
|
cd cloned &&
|
|
|
|
(git rev-parse HEAD; git ls-files -s) >../actual
|
|
|
|
) &&
|
2008-03-13 05:36:36 +08:00
|
|
|
test_cmp expected actual
|
2007-08-18 00:56:54 +08:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success advance '
|
|
|
|
echo more >mainfile &&
|
|
|
|
git update-index --force-remove sub &&
|
|
|
|
mv sub/.git sub/.git-disabled &&
|
|
|
|
git add sub/subfile mainfile &&
|
|
|
|
mv sub/.git-disabled sub/.git &&
|
|
|
|
test_tick &&
|
|
|
|
git commit -m "superproject commit #2"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success fetch '
|
|
|
|
(git rev-parse HEAD; git ls-files -s) >expected &&
|
|
|
|
(
|
|
|
|
cd cloned &&
|
|
|
|
git pull &&
|
|
|
|
(git rev-parse HEAD; git ls-files -s) >../actual
|
|
|
|
) &&
|
2008-03-13 05:36:36 +08:00
|
|
|
test_cmp expected actual
|
2007-08-18 00:56:54 +08:00
|
|
|
'
|
|
|
|
|
|
|
|
test_done
|