From 8c21d820e9ddaf7ddcb0c882f27bec017e28984f Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Wed, 22 Dec 2021 10:59:41 +0000 Subject: [PATCH 1/4] t5540: require REFFILES The dumb HTTP protocol exposes ref storage details as part of the protocol, so it only works with the FILES refstorage backend Signed-off-by: Han-Wen Nienhuys Signed-off-by: Junio C Hamano --- t/t5540-http-push-webdav.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/t/t5540-http-push-webdav.sh b/t/t5540-http-push-webdav.sh index 8b68bb38a4..b0dbacf0b9 100755 --- a/t/t5540-http-push-webdav.sh +++ b/t/t5540-http-push-webdav.sh @@ -18,6 +18,12 @@ then test_done fi +if test_have_prereq !REFFILES +then + skip_all='skipping test; dumb HTTP protocol not supported with reftable.' + test_done +fi + LIB_HTTPD_DAV=t . "$TEST_DIRECTORY"/lib-httpd.sh ROOT_PATH="$PWD" From 7b6853a826affa2cec885e48b86f7730efb737d6 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Wed, 22 Dec 2021 10:59:42 +0000 Subject: [PATCH 2/4] t5550: require REFFILES The dumb HTTP protocol exposes ref storage details as part of the protocol, so it only works with the FILES refstorage backend Signed-off-by: Han-Wen Nienhuys Signed-off-by: Junio C Hamano --- t/t5550-http-fetch-dumb.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/t/t5550-http-fetch-dumb.sh b/t/t5550-http-fetch-dumb.sh index 6d9142afc3..259203926a 100755 --- a/t/t5550-http-fetch-dumb.sh +++ b/t/t5550-http-fetch-dumb.sh @@ -5,6 +5,13 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME . ./test-lib.sh + +if test_have_prereq !REFFILES +then + skip_all='skipping test; dumb HTTP protocol not supported with reftable.' + test_done +fi + . "$TEST_DIRECTORY"/lib-httpd.sh start_httpd From be49349c72d455217f3d7fd2b7760ef51561ccf5 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Wed, 22 Dec 2021 10:59:43 +0000 Subject: [PATCH 3/4] t7004: create separate tags for different tests Reftable intentionally keeps reflog data for deleted refs. This breaks tests that delete and recreate "refs/tags/tag_with_reflog" as traces of the deletion are left in reflog. To resolve this, use a differently named ref for each test case. Signed-off-by: Han-Wen Nienhuys Signed-off-by: Junio C Hamano --- t/t7004-tag.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index 082be85dff..301d119048 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -94,10 +94,10 @@ test_expect_success 'creating a tag with --create-reflog should create reflog' ' git log -1 \ --format="format:tag: tagging %h (%s, %cd)%n" \ --date=format:%Y-%m-%d >expected && - test_when_finished "git tag -d tag_with_reflog" && - git tag --create-reflog tag_with_reflog && - git reflog exists refs/tags/tag_with_reflog && - sed -e "s/^.* //" .git/logs/refs/tags/tag_with_reflog >actual && + test_when_finished "git tag -d tag_with_reflog1" && + git tag --create-reflog tag_with_reflog1 && + git reflog exists refs/tags/tag_with_reflog1 && + sed -e "s/^.* //" .git/logs/refs/tags/tag_with_reflog1 >actual && test_cmp expected actual ' @@ -105,10 +105,10 @@ test_expect_success 'annotated tag with --create-reflog has correct message' ' git log -1 \ --format="format:tag: tagging %h (%s, %cd)%n" \ --date=format:%Y-%m-%d >expected && - test_when_finished "git tag -d tag_with_reflog" && - git tag -m "annotated tag" --create-reflog tag_with_reflog && - git reflog exists refs/tags/tag_with_reflog && - sed -e "s/^.* //" .git/logs/refs/tags/tag_with_reflog >actual && + test_when_finished "git tag -d tag_with_reflog2" && + git tag -m "annotated tag" --create-reflog tag_with_reflog2 && + git reflog exists refs/tags/tag_with_reflog2 && + sed -e "s/^.* //" .git/logs/refs/tags/tag_with_reflog2 >actual && test_cmp expected actual ' @@ -118,10 +118,10 @@ test_expect_success '--create-reflog does not create reflog on failure' ' ' test_expect_success 'option core.logAllRefUpdates=always creates reflog' ' - test_when_finished "git tag -d tag_with_reflog" && + test_when_finished "git tag -d tag_with_reflog3" && test_config core.logAllRefUpdates always && - git tag tag_with_reflog && - git reflog exists refs/tags/tag_with_reflog + git tag tag_with_reflog3 && + git reflog exists refs/tags/tag_with_reflog3 ' test_expect_success 'listing all tags if one exists should succeed' ' From ed8d1d42d0ffc221340557614aa33bf8d3aba65f Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Wed, 22 Dec 2021 10:59:44 +0000 Subject: [PATCH 4/4] t7004: use "test-tool ref-store" for reflog inspection This makes the test work with reftable. Signed-off-by: Han-Wen Nienhuys Signed-off-by: Junio C Hamano --- t/t7004-tag.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index 301d119048..bc8a221b2c 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -97,7 +97,7 @@ test_expect_success 'creating a tag with --create-reflog should create reflog' ' test_when_finished "git tag -d tag_with_reflog1" && git tag --create-reflog tag_with_reflog1 && git reflog exists refs/tags/tag_with_reflog1 && - sed -e "s/^.* //" .git/logs/refs/tags/tag_with_reflog1 >actual && + test-tool ref-store main for-each-reflog-ent refs/tags/tag_with_reflog1 | sed -e "s/^.* //" >actual && test_cmp expected actual ' @@ -108,7 +108,7 @@ test_expect_success 'annotated tag with --create-reflog has correct message' ' test_when_finished "git tag -d tag_with_reflog2" && git tag -m "annotated tag" --create-reflog tag_with_reflog2 && git reflog exists refs/tags/tag_with_reflog2 && - sed -e "s/^.* //" .git/logs/refs/tags/tag_with_reflog2 >actual && + test-tool ref-store main for-each-reflog-ent refs/tags/tag_with_reflog2 | sed -e "s/^.* //" >actual && test_cmp expected actual '