aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUsman Akinyemi <usmanakinyemi202@gmail.com>2025-02-15 21:20:51 +0530
committerJunio C Hamano <gitster@pobox.com>2025-02-18 09:05:13 -0800
commit15ff206863a77e3396f5a1e1ed4910b7b70c9f8d (patch)
tree0b6c185efb4b0e5c66a0b97e680b6c35f5b50ae0
parentversion: extend get_uname_info() to hide system details (diff)
downloadgit-15ff206863a77e3396f5a1e1ed4910b7b70c9f8d.tar.gz
git-15ff206863a77e3396f5a1e1ed4910b7b70c9f8d.zip
t5701: add setup test to remove side-effect dependency
Currently, the "test capability advertisement" test creates some files with expected content which are used by other tests below it. To remove that side-effect from this test, let's split up part of it into a "setup"-type test which creates the files with expected content which gets reused by multiple tests. This will be useful in a following commit. Mentored-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rwxr-xr-xt/t5701-git-serve.sh12
1 files changed, 9 insertions, 3 deletions
diff --git a/t/t5701-git-serve.sh b/t/t5701-git-serve.sh
index de904c1655..4c24a188b9 100755
--- a/t/t5701-git-serve.sh
+++ b/t/t5701-git-serve.sh
@@ -7,22 +7,28 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
-test_expect_success 'test capability advertisement' '
+test_expect_success 'setup to generate files with expected content' '
+ printf "agent=git/%s\n" "$(git version | cut -d" " -f3)" >agent_capability &&
+
test_oid_cache <<-EOF &&
wrong_algo sha1:sha256
wrong_algo sha256:sha1
EOF
+
cat >expect.base <<-EOF &&
version 2
- agent=git/$(git version | cut -d" " -f3)
+ $(cat agent_capability)
ls-refs=unborn
fetch=shallow wait-for-done
server-option
object-format=$(test_oid algo)
EOF
- cat >expect.trailer <<-EOF &&
+ cat >expect.trailer <<-EOF
0000
EOF
+'
+
+test_expect_success 'test capability advertisement' '
cat expect.base expect.trailer >expect &&
GIT_TEST_SIDEBAND_ALL=0 test-tool serve-v2 \