2011-09-05 03:19:36 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
test_description='fetch/receive strict mode'
|
|
|
|
. ./test-lib.sh
|
|
|
|
|
|
|
|
test_expect_success setup '
|
|
|
|
echo hello >greetings &&
|
|
|
|
git add greetings &&
|
|
|
|
git commit -m greetings &&
|
|
|
|
|
|
|
|
S=$(git rev-parse :greetings | sed -e "s|^..|&/|") &&
|
|
|
|
X=$(echo bye | git hash-object -w --stdin | sed -e "s|^..|&/|") &&
|
|
|
|
mv -f .git/objects/$X .git/objects/$S &&
|
|
|
|
|
|
|
|
test_must_fail git fsck
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'fetch without strict' '
|
|
|
|
rm -rf dst &&
|
|
|
|
git init dst &&
|
|
|
|
(
|
|
|
|
cd dst &&
|
|
|
|
git config fetch.fsckobjects false &&
|
|
|
|
git config transfer.fsckobjects false &&
|
2011-10-05 21:36:20 +02:00
|
|
|
test_must_fail git fetch ../.git master
|
2011-09-05 03:19:36 +02:00
|
|
|
)
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'fetch with !fetch.fsckobjects' '
|
|
|
|
rm -rf dst &&
|
|
|
|
git init dst &&
|
|
|
|
(
|
|
|
|
cd dst &&
|
|
|
|
git config fetch.fsckobjects false &&
|
|
|
|
git config transfer.fsckobjects true &&
|
2011-10-05 21:36:20 +02:00
|
|
|
test_must_fail git fetch ../.git master
|
2011-09-05 03:19:36 +02:00
|
|
|
)
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'fetch with fetch.fsckobjects' '
|
|
|
|
rm -rf dst &&
|
|
|
|
git init dst &&
|
|
|
|
(
|
|
|
|
cd dst &&
|
|
|
|
git config fetch.fsckobjects true &&
|
|
|
|
git config transfer.fsckobjects false &&
|
|
|
|
test_must_fail git fetch ../.git master
|
|
|
|
)
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'fetch with transfer.fsckobjects' '
|
|
|
|
rm -rf dst &&
|
|
|
|
git init dst &&
|
|
|
|
(
|
|
|
|
cd dst &&
|
|
|
|
git config transfer.fsckobjects true &&
|
|
|
|
test_must_fail git fetch ../.git master
|
|
|
|
)
|
|
|
|
'
|
|
|
|
|
2012-02-13 21:17:12 +01:00
|
|
|
cat >exp <<EOF
|
|
|
|
To dst
|
|
|
|
! refs/heads/master:refs/heads/test [remote rejected] (missing necessary objects)
|
|
|
|
EOF
|
|
|
|
|
2011-09-05 03:19:36 +02:00
|
|
|
test_expect_success 'push without strict' '
|
|
|
|
rm -rf dst &&
|
|
|
|
git init dst &&
|
|
|
|
(
|
|
|
|
cd dst &&
|
|
|
|
git config fetch.fsckobjects false &&
|
|
|
|
git config transfer.fsckobjects false
|
|
|
|
) &&
|
2012-02-13 21:17:12 +01:00
|
|
|
test_must_fail git push --porcelain dst master:refs/heads/test >act &&
|
|
|
|
test_cmp exp act
|
2011-09-05 03:19:36 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'push with !receive.fsckobjects' '
|
|
|
|
rm -rf dst &&
|
|
|
|
git init dst &&
|
|
|
|
(
|
|
|
|
cd dst &&
|
|
|
|
git config receive.fsckobjects false &&
|
|
|
|
git config transfer.fsckobjects true
|
|
|
|
) &&
|
2012-02-13 21:17:12 +01:00
|
|
|
test_must_fail git push --porcelain dst master:refs/heads/test >act &&
|
|
|
|
test_cmp exp act
|
2011-09-05 03:19:36 +02:00
|
|
|
'
|
|
|
|
|
2012-02-13 21:17:12 +01:00
|
|
|
cat >exp <<EOF
|
|
|
|
To dst
|
2012-09-21 07:38:46 +02:00
|
|
|
! refs/heads/master:refs/heads/test [remote rejected] (unpacker error)
|
2012-02-13 21:17:12 +01:00
|
|
|
EOF
|
|
|
|
|
2011-09-05 03:19:36 +02:00
|
|
|
test_expect_success 'push with receive.fsckobjects' '
|
|
|
|
rm -rf dst &&
|
|
|
|
git init dst &&
|
|
|
|
(
|
|
|
|
cd dst &&
|
|
|
|
git config receive.fsckobjects true &&
|
|
|
|
git config transfer.fsckobjects false
|
|
|
|
) &&
|
2012-02-13 21:17:12 +01:00
|
|
|
test_must_fail git push --porcelain dst master:refs/heads/test >act &&
|
|
|
|
test_cmp exp act
|
2011-09-05 03:19:36 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'push with transfer.fsckobjects' '
|
|
|
|
rm -rf dst &&
|
|
|
|
git init dst &&
|
|
|
|
(
|
|
|
|
cd dst &&
|
|
|
|
git config transfer.fsckobjects true
|
|
|
|
) &&
|
2012-02-13 21:17:12 +01:00
|
|
|
test_must_fail git push --porcelain dst master:refs/heads/test >act &&
|
|
|
|
test_cmp exp act
|
2011-09-05 03:19:36 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_done
|