Git fork
at reftables-rust 58 lines 1.5 kB view raw
1#!/bin/sh 2 3test_description='Test reftable backend consistency check' 4 5GIT_TEST_DEFAULT_REF_FORMAT=reftable 6export GIT_TEST_DEFAULT_REF_FORMAT 7 8. ./test-lib.sh 9 10test_expect_success "no errors reported on a well formed repository" ' 11 test_when_finished "rm -rf repo" && 12 git init repo && 13 ( 14 cd repo && 15 git commit --allow-empty -m initial && 16 17 for i in $(test_seq 20) 18 do 19 git update-ref refs/heads/branch-$i HEAD || return 1 20 done && 21 22 # The repository should end up with multiple tables. 23 test_line_count ">" 1 .git/reftable/tables.list && 24 25 git refs verify 2>err && 26 test_must_be_empty err 27 ) 28' 29 30for TABLE_NAME in "foo-bar-e4d12d59.ref" \ 31 "0x00000000zzzz-0x00000000zzzz-e4d12d59.ref" \ 32 "0x000000000001-0x000000000002-e4d12d59.abc" \ 33 "0x000000000001-0x000000000002-e4d12d59.refabc"; do 34 test_expect_success "table name $TABLE_NAME should be checked" ' 35 test_when_finished "rm -rf repo" && 36 git init repo && 37 ( 38 cd repo && 39 git commit --allow-empty -m initial && 40 41 git refs verify 2>err && 42 test_must_be_empty err && 43 44 EXISTING_TABLE=$(head -n1 .git/reftable/tables.list) && 45 mv ".git/reftable/$EXISTING_TABLE" ".git/reftable/$TABLE_NAME" && 46 sed "s/${EXISTING_TABLE}/${TABLE_NAME}/g" .git/reftable/tables.list > tables.list && 47 mv tables.list .git/reftable/tables.list && 48 49 git refs verify 2>err && 50 cat >expect <<-EOF && 51 warning: ${TABLE_NAME}: badReftableTableName: invalid reftable table name 52 EOF 53 test_cmp expect err 54 ) 55 ' 56done 57 58test_done