1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-03 09:56:15 +02:00
git/t/t5504-fetch-receive-strict.sh
Jeff King 74eb32d3a4 receive-pack: drop "n/a" on unpacker errors
The output from git push currently looks like this:

  $ git push dest HEAD
  fatal: [some message from index-pack]
  error: unpack failed: index-pack abnormal exit
  To dest
   ! [remote rejected] HEAD -> master (n/a (unpacker error))

That n/a is meant to be "the per-ref status is not
available" but the nested parentheses just make it look
ugly. Let's turn the final line into just:

   ! [remote rejected] HEAD -> master (unpacker error)

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-21 09:50:13 -07:00

119 lines
2.5 KiB
Bash
Executable File

#!/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 &&
test_must_fail git fetch ../.git master
)
'
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 &&
test_must_fail git fetch ../.git master
)
'
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
)
'
cat >exp <<EOF
To dst
! refs/heads/master:refs/heads/test [remote rejected] (missing necessary objects)
EOF
test_expect_success 'push without strict' '
rm -rf dst &&
git init dst &&
(
cd dst &&
git config fetch.fsckobjects false &&
git config transfer.fsckobjects false
) &&
test_must_fail git push --porcelain dst master:refs/heads/test >act &&
test_cmp exp act
'
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
) &&
test_must_fail git push --porcelain dst master:refs/heads/test >act &&
test_cmp exp act
'
cat >exp <<EOF
To dst
! refs/heads/master:refs/heads/test [remote rejected] (unpacker error)
EOF
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
) &&
test_must_fail git push --porcelain dst master:refs/heads/test >act &&
test_cmp exp act
'
test_expect_success 'push with transfer.fsckobjects' '
rm -rf dst &&
git init dst &&
(
cd dst &&
git config transfer.fsckobjects true
) &&
test_must_fail git push --porcelain dst master:refs/heads/test >act &&
test_cmp exp act
'
test_done