]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t5504: modernize test by moving heredocs into test bodies
authorPatrick Steinhardt <ps@pks.im>
Mon, 3 Feb 2025 06:29:31 +0000 (07:29 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 3 Feb 2025 23:24:55 +0000 (15:24 -0800)
We have several heredocs in t5504 located outside of any particular test
bodies. Move these into the test bodies to match our modern coding
style.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5504-fetch-receive-strict.sh

index e273ab29c7f88f97a091bf57e90e235fd4f68f29..58074506c599b1744009b3d4a32bde19ebe4e768 100755 (executable)
@@ -64,12 +64,6 @@ test_expect_success 'fetch with transfer.fsckobjects' '
        )
 '
 
-cat >exp <<EOF
-To dst
-!      refs/heads/main:refs/heads/test [remote rejected] (missing necessary objects)
-Done
-EOF
-
 test_expect_success 'push without strict' '
        rm -rf dst &&
        git init dst &&
@@ -78,6 +72,11 @@ test_expect_success 'push without strict' '
                git config fetch.fsckobjects false &&
                git config transfer.fsckobjects false
        ) &&
+       cat >exp <<-\EOF &&
+       To dst
+       !       refs/heads/main:refs/heads/test [remote rejected] (missing necessary objects)
+       Done
+       EOF
        test_must_fail git push --porcelain dst main:refs/heads/test >act &&
        test_cmp exp act
 '
@@ -94,11 +93,6 @@ test_expect_success 'push with !receive.fsckobjects' '
        test_cmp exp act
 '
 
-cat >exp <<EOF
-To dst
-!      refs/heads/main:refs/heads/test [remote rejected] (unpacker error)
-EOF
-
 test_expect_success 'push with receive.fsckobjects' '
        rm -rf dst &&
        git init dst &&
@@ -107,6 +101,10 @@ test_expect_success 'push with receive.fsckobjects' '
                git config receive.fsckobjects true &&
                git config transfer.fsckobjects false
        ) &&
+       cat >exp <<-\EOF &&
+       To dst
+       !       refs/heads/main:refs/heads/test [remote rejected] (unpacker error)
+       EOF
        test_must_fail git push --porcelain dst main:refs/heads/test >act &&
        test_cmp exp act
 '
@@ -129,15 +127,14 @@ test_expect_success 'repair the "corrupt or missing" object' '
        git fsck
 '
 
-cat >bogus-commit <<EOF
-tree $EMPTY_TREE
-author Bugs Bunny 1234567890 +0000
-committer Bugs Bunny <bugs@bun.ni> 1234567890 +0000
-
-This commit object intentionally broken
-EOF
-
 test_expect_success 'setup bogus commit' '
+       cat >bogus-commit <<-EOF &&
+       tree $EMPTY_TREE
+       author Bugs Bunny 1234567890 +0000
+       committer Bugs Bunny <bugs@bun.ni> 1234567890 +0000
+
+       This commit object intentionally broken
+       EOF
        commit="$(git hash-object --literally -t commit -w --stdin <bogus-commit)"
 '