Group reffiles tests
cover Group reffiles tests
This series groups REFFILES specific tests together. These tests are currently grouped together across the test suite based on functionality. However, since they exercise low-level behavior specific to the refs backend being used (in these cases, the ref-files backend), group them together based on which refs backend they test. This way, in the near future when the reftables backend gets upstreamed we can add tests that exercise the reftables backend close by in the t06xx area.
These patches also remove the REFFILES prerequisite, since all the tests in t06xx are reffiles specific. In the near future, once the reftable backend is upstreamed, all the tests in t06xx will be forced to run with the reffiles backend.
John Cai (12):
t3210: move to t0602
remove REFFILES prerequisite
t1414: convert test to use Git commands instead of writing refs
manually
t1404: move reffiles specific tests to t0600
t1405: move reffiles specific tests to t0600
t1406: move reffiles specific tests to t0600
t1410: move reffiles specific tests to t0600
t1415: move reffiles specific tests to t0600
t1503: move reffiles specific tests to t0600
t3903: move reffiles specific tests to t0600
t4202: move reffiles specific tests to t0600
t5312: move reffiles specific tests to t0600
t/t0600-reffiles-backend.sh | 604 ++++++++++++++++++
...ck-refs.sh => t0602-reffiles-pack-refs.sh} | 0
t/t1404-update-ref-errors.sh | 378 -----------
t/t1405-main-ref-store.sh | 10 +-
t/t1407-worktree-ref-store.sh | 37 --
t/t1410-reflog.sh | 42 --
t/t1414-reflog-walk.sh | 11 +-
t/t1415-worktree-refs.sh | 11 -
t/t1503-rev-parse-verify.sh | 5 -
t/t2017-checkout-orphan.sh | 2 +-
t/t3903-stash.sh | 43 --
t/t4202-log.sh | 17 -
t/t5312-prune-corruption.sh | 26 -
t/test-lib-functions.sh | 16 +
14 files changed, 628 insertions(+), 574 deletions(-)
create mode 100755 t/t0600-reffiles-backend.sh
rename t/{t3210-pack-refs.sh => t0602-reffiles-pack-refs.sh} (100%)base-commit: 186b115d3062e6230ee296d1ddaa0c4b72a464b5
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1647%2Fjohn-cai%2Fjc%2Fgroup-reffiles-tests-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1647/john-cai/jc/group-reffiles-tests-v1
Pull-Request: https://github.com/git/git/pull/1647
Signature · 1 line
gitgitgadget
PATCH 1/12 t3210: move to t0602
From: John Cai <[email protected]>
Move t3210 to t0602, since these tests are reffiles specific in that they modify loose refs manually. This is part of the effort to categorize these tests together based on the ref backend they test. When we upstream the reftable backend, we can add more tests to t06xx. This way, all tests that test specific ref backend behavior will be grouped together.
---
t/{t3210-pack-refs.sh => t0602-reffiles-pack-refs.sh} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename t/{t3210-pack-refs.sh => t0602-reffiles-pack-refs.sh} (100%)t/t0602-reffiles-pack-refs.sh renamed from t/t3210-pack-refs.sh +0 -0
Signature · 1 line
gitgitgadget
PATCH 2/12 remove REFFILES prerequisite
In reply to John Cai via GitGitGadgetFrom: John Cai <[email protected]>
These tests are compatible with the reftable backend and thus do not need the REFFILES prerequisite.
--- t/t1405-main-ref-store.sh | 2 +- t/t2017-checkout-orphan.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
t/t1405-main-ref-store.sh +1 -1
@@ -112,7 +112,7 @@ test_expect_success 'delete_reflog(HEAD)' ' test_must_fail git reflog exists HEAD ' -test_expect_success REFFILES 'create-reflog(HEAD)' ' +test_expect_success 'create-reflog(HEAD)' ' $RUN create-reflog HEAD && git reflog exists HEAD '
t/t2017-checkout-orphan.sh +1 -1
@@ -86,7 +86,7 @@ test_expect_success '--orphan makes reflog by default' ' git rev-parse --verify delta@{0} ' -test_expect_success REFFILES '--orphan does not make reflog when core.logAllRefUpdates = false' ' +test_expect_success '--orphan does not make reflog when core.logAllRefUpdates = false' ' git checkout main && git config core.logAllRefUpdates false && git checkout --orphan epsilon &&
Signature · 1 line
gitgitgadget
PATCH 3/12 t1414: convert test to use Git commands instead of writing refs manually
In reply to John Cai via GitGitGadgetFrom: John Cai <[email protected]>
This test can be re-written to use Git commands rather than writing a manual ref in the reflog. This way this test no longer needs the REFFILES prerequisite.
--- t/t1414-reflog-walk.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
t/t1414-reflog-walk.sh +6 -5
@@ -121,13 +121,14 @@ test_expect_success 'min/max age uses entry date to limit' ' # Create a situation where the reflog and ref database disagree about the latest # state of HEAD. -test_expect_success REFFILES 'walk prefers reflog to ref tip' ' +test_expect_success 'walk prefers reflog to ref tip' ' + test_commit A && + test_commit B && + git reflog delete HEAD@{0} && head=$(git rev-parse HEAD) && - one=$(git rev-parse one) && - ident="$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE" && - echo "$head $one $ident broken reflog entry" >>.git/logs/HEAD && + A=$(git rev-parse A) && - echo $one >expect && + echo $A >expect && git log -g --format=%H -1 >actual && test_cmp expect actual '
Signature · 1 line
gitgitgadget
PATCH 4/12 t1404: move reffiles specific tests to t0600
In reply to John Cai via GitGitGadgetFrom: John Cai <[email protected]>
These tests modify loose refs manually and are specific to the reffiles backend. Move these to t0600 to be part of a test suite of reffiles specific tests.
--- t/t0600-reffiles-backend.sh | 398 +++++++++++++++++++++++++++++++++++ t/t1404-update-ref-errors.sh | 378 --------------------------------- 2 files changed, 398 insertions(+), 378 deletions(-) create mode 100755 t/t0600-reffiles-backend.sh
t/t0600-reffiles-backend.sh new file +398 -0
@@ -0,0 +1,398 @@ +#!/bin/sh + +test_description='Test reffiles backend' + +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME + +TEST_PASSES_SANITIZE_LEAK=true +. ./test-lib.sh + +# Test adding and deleting D/F-conflicting references in a single +# transaction. +df_test() { + prefix="$1" + pack=: symadd=false symdel=false add_del=false addref= delref= + shift + while test $# -gt 0 + do + case "$1" in + --pack) + pack="git pack-refs --all" + shift + ;; + --sym-add) + # Perform the add via a symbolic reference + symadd=true + shift + ;; + --sym-del) + # Perform the del via a symbolic reference + symdel=true + shift + ;; + --del-add) + # Delete first reference then add second + add_del=false + delref="$prefix/r/$2" + addref="$prefix/r/$3" + shift 3 + ;; + --add-del) + # Add first reference then delete second + add_del=true + addref="$prefix/r/$2" + delref="$prefix/r/$3" + shift 3 + ;; + *) + echo 1>&2 "Extra args to df_test: $*" + return 1 + ;; + esac + done + git update-ref "$delref" $C && + if $symadd + then + addname="$prefix/s/symadd" && + git symbolic-ref "$addname" "$addref" + else + addname="$addref" + fi && + if $symdel + then + delname="$prefix/s/symdel" && + git symbolic-ref "$delname" "$delref" + else + delname="$delref" + fi && + cat >expected-err <<-EOF && + fatal: cannot lock ref $SQ$addname$SQ: $SQ$delref$SQ exists; cannot create $SQ$addref$SQ + EOF + $pack && + if $add_del + then + printf "%s\n" "create $addname $D" "delete $delname" + else + printf "%s\n" "delete $delname" "create $addname $D" + fi >commands && + test_must_fail git update-ref --stdin <commands 2>output.err && + test_cmp expected-err output.err && + printf "%s\n" "$C $delref" >expected-refs && + git for-each-ref --format="%(objectname) %(refname)" $prefix/r >actual-refs && + test_cmp expected-refs actual-refs +} + +test_expect_success 'setup' ' + git commit --allow-empty -m Initial && + C=$(git rev-parse HEAD) && + git commit --allow-empty -m Second && + D=$(git rev-parse HEAD) && + git commit --allow-empty -m Third && + E=$(git rev-parse HEAD) +' + +test_expect_success 'empty directory should not fool rev-parse' ' + prefix=refs/e-rev-parse && + git update-ref $prefix/foo $C && + git pack-refs --all && + mkdir -p .git/$prefix/foo/bar/baz && + echo "$C" >expected && + git rev-parse $prefix/foo >actual && + test_cmp expected actual +' + +test_expect_success 'empty directory should not fool for-each-ref' ' + prefix=refs/e-for-each-ref && + git update-ref $prefix/foo $C && + git for-each-ref $prefix >expected && + git pack-refs --all && + mkdir -p .git/$prefix/foo/bar/baz && + git for-each-ref $prefix >actual && + test_cmp expected actual +' + +test_expect_success 'empty directory should not fool create' ' + prefix=refs/e-create && + mkdir -p .git/$prefix/foo/bar/baz && + printf "create %s $C\n" $prefix/foo | + git update-ref --stdin +' + +test_expect_success 'empty directory should not fool verify' ' + prefix=refs/e-verify && + git update-ref $prefix/foo $C && + git pack-refs --all && + mkdir -p .git/$prefix/foo/bar/baz && + printf "verify %s $C\n" $prefix/foo | + git update-ref --stdin +' + +test_expect_success 'empty directory should not fool 1-arg update' ' + prefix=refs/e-update-1 && + git update-ref $prefix/foo $C && + git pack-refs --all && + mkdir -p .git/$prefix/foo/bar/baz && + printf "update %s $D\n" $prefix/foo | + git update-ref --stdin +' + +test_expect_success 'empty directory should not fool 2-arg update' ' + prefix=refs/e-update-2 && + git update-ref $prefix/foo $C && + git pack-refs --all && + mkdir -p .git/$prefix/foo/bar/baz && + printf "update %s $D $C\n" $prefix/foo | + git update-ref --stdin +' + +test_expect_success 'empty directory should not fool 0-arg delete' ' + prefix=refs/e-delete-0 && + git update-ref $prefix/foo $C && + git pack-refs --all && + mkdir -p .git/$prefix/foo/bar/baz && + printf "delete %s\n" $prefix/foo | + git update-ref --stdin +' + +test_expect_success 'empty directory should not fool 1-arg delete' ' + prefix=refs/e-delete-1 && + git update-ref $prefix/foo $C && + git pack-refs --all && + mkdir -p .git/$prefix/foo/bar/baz && + printf "delete %s $C\n" $prefix/foo | + git update-ref --stdin +' + +test_expect_success 'D/F conflict prevents add long + delete short' ' + df_test refs/df-al-ds --add-del foo/bar foo +' + +test_expect_success 'D/F conflict prevents add short + delete long' ' + df_test refs/df-as-dl --add-del foo foo/bar +' + +test_expect_success 'D/F conflict prevents delete long + add short' ' + df_test refs/df-dl-as --del-add foo/bar foo +' + +test_expect_success 'D/F conflict prevents delete short + add long' ' + df_test refs/df-ds-al --del-add foo foo/bar +' + +test_expect_success 'D/F conflict prevents add long + delete short packed' ' + df_test refs/df-al-dsp --pack --add-del foo/bar foo +' + +test_expect_success 'D/F conflict prevents add short + delete long packed' ' + df_test refs/df-as-dlp --pack --add-del foo foo/bar +' + +test_expect_success 'D/F conflict prevents delete long packed + add short' ' + df_test refs/df-dlp-as --pack --del-add foo/bar foo +' + +test_expect_success 'D/F conflict prevents delete short packed + add long' ' + df_test refs/df-dsp-al --pack --del-add foo foo/bar +' + +# Try some combinations involving symbolic refs... + +test_expect_success 'D/F conflict prevents indirect add long + delete short' ' + df_test refs/df-ial-ds --sym-add --add-del foo/bar foo +' + +test_expect_success 'D/F conflict prevents indirect add long + indirect delete short' ' + df_test refs/df-ial-ids --sym-add --sym-del --add-del foo/bar foo +' + +test_expect_success 'D/F conflict prevents indirect add short + indirect delete long' ' + df_test refs/df-ias-idl --sym-add --sym-del --add-del foo foo/bar +' + +test_expect_success 'D/F conflict prevents indirect delete long + indirect add short' ' + df_test refs/df-idl-ias --sym-add --sym-del --del-add foo/bar foo +' + +test_expect_success 'D/F conflict prevents indirect add long + delete short packed' ' + df_test refs/df-ial-dsp --sym-add --pack --add-del foo/bar foo +' + +test_expect_success 'D/F conflict prevents indirect add long + indirect delete short packed' ' + df_test refs/df-ial-idsp --sym-add --sym-del --pack --add-del foo/bar foo +' + +test_expect_success 'D/F conflict prevents add long + indirect delete short packed' ' + df_test refs/df-al-idsp --sym-del --pack --add-del foo/bar foo +' + +test_expect_success 'D/F conflict prevents indirect delete long packed + indirect add short' ' + df_test refs/df-idlp-ias --sym-add --sym-del --pack --del-add foo/bar foo +' + +test_expect_success 'non-empty directory blocks create' ' + prefix=refs/ne-create && + mkdir -p .git/$prefix/foo/bar && + : >.git/$prefix/foo/bar/baz.lock && + test_when_finished "rm -f .git/$prefix/foo/bar/baz.lock" && + cat >expected <<-EOF && + fatal: cannot lock ref $SQ$prefix/foo$SQ: there is a non-empty directory $SQ.git/$prefix/foo$SQ blocking reference $SQ$prefix/foo$SQ + EOF + printf "%s\n" "update $prefix/foo $C" | + test_must_fail git update-ref --stdin 2>output.err && + test_cmp expected output.err && + cat >expected <<-EOF && + fatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ + EOF + printf "%s\n" "update $prefix/foo $D $C" | + test_must_fail git update-ref --stdin 2>output.err && + test_cmp expected output.err +' + +test_expect_success 'broken reference blocks create' ' + prefix=refs/broken-create && + mkdir -p .git/$prefix && + echo "gobbledigook" >.git/$prefix/foo && + test_when_finished "rm -f .git/$prefix/foo" && + cat >expected <<-EOF && + fatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken + EOF + printf "%s\n" "update $prefix/foo $C" | + test_must_fail git update-ref --stdin 2>output.err && + test_cmp expected output.err && + cat >expected <<-EOF && + fatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken + EOF + printf "%s\n" "update $prefix/foo $D $C" | + test_must_fail git update-ref --stdin 2>output.err && + test_cmp expected output.err +' + +test_expect_success 'non-empty directory blocks indirect create' ' + prefix=refs/ne-indirect-create && + git symbolic-ref $prefix/symref $prefix/foo && + mkdir -p .git/$prefix/foo/bar && + : >.git/$prefix/foo/bar/baz.lock && + test_when_finished "rm -f .git/$prefix/foo/bar/baz.lock" && + cat >expected <<-EOF && + fatal: cannot lock ref $SQ$prefix/symref$SQ: there is a non-empty directory $SQ.git/$prefix/foo$SQ blocking reference $SQ$prefix/foo$SQ + EOF + printf "%s\n" "update $prefix/symref $C" | + test_must_fail git update-ref --stdin 2>output.err && + test_cmp expected output.err && + cat >expected <<-EOF && + fatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ + EOF + printf "%s\n" "update $prefix/symref $D $C" | + test_must_fail git update-ref --stdin 2>output.err && + test_cmp expected output.err +' + +test_expect_success 'broken reference blocks indirect create' ' + prefix=refs/broken-indirect-create && + git symbolic-ref $prefix/symref $prefix/foo && + echo "gobbledigook" >.git/$prefix/foo && + test_when_finished "rm -f .git/$prefix/foo" && + cat >expected <<-EOF && + fatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken + EOF + printf "%s\n" "update $prefix/symref $C" | + test_must_fail git update-ref --stdin 2>output.err && + test_cmp expected output.err && + cat >expected <<-EOF && + fatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken + EOF + printf "%s\n" "update $prefix/symref $D $C" | + test_must_fail git update-ref --stdin 2>output.err && + test_cmp expected output.err +' + +test_expect_success 'no bogus intermediate values during delete' ' + prefix=refs/slow-transaction && + # Set up a reference with differing loose and packed versions: + git update-ref $prefix/foo $C && + git pack-refs --all && + git update-ref $prefix/foo $D && + # Now try to update the reference, but hold the `packed-refs` lock + # for a while to see what happens while the process is blocked: + : >.git/packed-refs.lock && + test_when_finished "rm -f .git/packed-refs.lock" && + { + # Note: the following command is intentionally run in the + # background. We increase the timeout so that `update-ref` + # attempts to acquire the `packed-refs` lock for much longer + # than it takes for us to do the check then delete it: + git -c core.packedrefstimeout=30000 update-ref -d $prefix/foo & + } && + pid2=$! && + # Give update-ref plenty of time to get to the point where it tries + # to lock packed-refs: + sleep 1 && + # Make sure that update-ref did not complete despite the lock: + kill -0 $pid2 && + # Verify that the reference still has its old value: + sha1=$(git rev-parse --verify --quiet $prefix/foo || echo undefined) && + case "$sha1" in + $D) + # This is what we hope for; it means that nothing + # user-visible has changed yet. + : ;; + undefined) + # This is not correct; it means the deletion has happened + # already even though update-ref should not have been + # able to acquire the lock yet. + echo "$prefix/foo deleted prematurely" && + break + ;; + $C) + # This value should never be seen. Probably the loose + # reference has been deleted but the packed reference + # is still there: + echo "$prefix/foo incorrectly observed to be C" && + break + ;; + *) + # WTF? + echo "unexpected value observed for $prefix/foo: $sha1" && + break + ;; + esac >out && + rm -f .git/packed-refs.lock && + wait $pid2 && + test_must_be_empty out && + test_must_fail git rev-parse --verify --quiet $prefix/foo +' + +test_expect_success 'delete fails cleanly if packed-refs file is locked' ' + prefix=refs/locked-packed-refs && + # Set up a reference with differing loose and packed versions: + git update-ref $prefix/foo $C && + git pack-refs --all && + git update-ref $prefix/foo $D && + git for-each-ref $prefix >unchanged && + # Now try to delete it while the `packed-refs` lock is held: + : >.git/packed-refs.lock && + test_when_finished "rm -f .git/packed-refs.lock" && + test_must_fail git update-ref -d $prefix/foo >out 2>err && + git for-each-ref $prefix >actual && + test_grep "Unable to create $SQ.*packed-refs.lock$SQ: " err && + test_cmp unchanged actual +' + +test_expect_success 'delete fails cleanly if packed-refs.new write fails' ' + # Setup and expectations are similar to the test above. + prefix=refs/failed-packed-refs && + git update-ref $prefix/foo $C && + git pack-refs --all && + git update-ref $prefix/foo $D && + git for-each-ref $prefix >unchanged && + # This should not happen in practice, but it is an easy way to get a + # reliable error (we open with create_tempfile(), which uses O_EXCL). + : >.git/packed-refs.new && + test_when_finished "rm -f .git/packed-refs.new" && + test_must_fail git update-ref -d $prefix/foo && + git for-each-ref $prefix >actual && + test_cmp unchanged actual +' + +test_done
t/t1404-update-ref-errors.sh +0 -378
394 lines not on this page · raw message
Signature · 1 line
gitgitgadget
PATCH 5/12 t1405: move reffiles specific tests to t0600
In reply to John Cai via GitGitGadgetFrom: John Cai <[email protected]>
Move this test to t0600 with other reffiles specific tests since it is reffiles specific in that it looks into the loose refs directory for an assertion.
--- t/t0600-reffiles-backend.sh | 8 ++++++++ t/t1405-main-ref-store.sh | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-)
t/t0600-reffiles-backend.sh +8 -0
@@ -92,6 +92,14 @@ test_expect_success 'setup' ' E=$(git rev-parse HEAD) ' +test_expect_success 'pack_refs(PACK_REFS_ALL | PACK_REFS_PRUNE)' ' + N=`find .git/refs -type f | wc -l` && + test "$N" != 0 && + test-tool ref-store main pack-refs PACK_REFS_PRUNE,PACK_REFS_ALL && + N=`find .git/refs -type f` && + test -z "$N" +' + test_expect_success 'empty directory should not fool rev-parse' ' prefix=refs/e-rev-parse && git update-ref $prefix/foo $C &&
t/t1405-main-ref-store.sh +0 -8
@@ -15,14 +15,6 @@ test_expect_success 'setup' ' test_commit one ' -test_expect_success REFFILES 'pack_refs(PACK_REFS_ALL | PACK_REFS_PRUNE)' ' - N=`find .git/refs -type f | wc -l` && - test "$N" != 0 && - $RUN pack-refs PACK_REFS_PRUNE,PACK_REFS_ALL && - N=`find .git/refs -type f` && - test -z "$N" -' - test_expect_success 'create_symref(FOO, refs/heads/main)' ' $RUN create-symref FOO refs/heads/main nothing && echo refs/heads/main >expected &&
Signature · 1 line
gitgitgadget
PATCH 6/12 t1406: move reffiles specific tests to t0600
In reply to John Cai via GitGitGadgetFrom: John Cai <[email protected]>
Move this test to t0600 with the rest of the tests that are specific to reffiles. This test reaches into reflog directories manually, and so are specific to reffiles.
--- t/t0600-reffiles-backend.sh | 48 +++++++++++++++++++++++++++++++++++ t/t1407-worktree-ref-store.sh | 37 --------------------------- 2 files changed, 48 insertions(+), 37 deletions(-)
t/t0600-reffiles-backend.sh +48 -0
@@ -403,4 +403,52 @@ test_expect_success 'delete fails cleanly if packed-refs.new write fails' ' test_cmp unchanged actual ' +RWT="test-tool ref-store worktree:wt" +RMAIN="test-tool ref-store worktree:main" + +test_expect_success 'setup worktree' ' + test_commit first && + git worktree add -b wt-main wt && + ( + cd wt && + test_commit second + ) +' + +# Some refs (refs/bisect/*, pseudorefs) are kept per worktree, so they should +# only appear in the for-each-reflog output if it is called from the correct +# worktree, which is exercised in this test. This test is poorly written for +# mulitple reasons: 1) it creates invalidly formatted log entres. 2) it uses +# direct FS access for creating the reflogs. 3) PSEUDO-WT and refs/bisect/random +# do not create reflogs by default, so it is not testing a realistic scenario. +test_expect_success 'for_each_reflog()' ' + echo $ZERO_OID > .git/logs/PSEUDO-MAIN && + mkdir -p .git/logs/refs/bisect && + echo $ZERO_OID > .git/logs/refs/bisect/random && + + echo $ZERO_OID > .git/worktrees/wt/logs/PSEUDO-WT && + mkdir -p .git/worktrees/wt/logs/refs/bisect && + echo $ZERO_OID > .git/worktrees/wt/logs/refs/bisect/wt-random && + + $RWT for-each-reflog | cut -d" " -f 2- | sort >actual && + cat >expected <<-\EOF && + HEAD 0x1 + PSEUDO-WT 0x0 + refs/bisect/wt-random 0x0 + refs/heads/main 0x0 + refs/heads/wt-main 0x0 + EOF + test_cmp expected actual && + + $RMAIN for-each-reflog | cut -d" " -f 2- | sort >actual && + cat >expected <<-\EOF && + HEAD 0x1 + PSEUDO-MAIN 0x0 + refs/bisect/random 0x0 + refs/heads/main 0x0 + refs/heads/wt-main 0x0 + EOF + test_cmp expected actual +' + test_done
t/t1407-worktree-ref-store.sh +0 -37
@@ -53,41 +53,4 @@ test_expect_success 'create_symref(FOO, refs/heads/main)' ' test_cmp expected actual ' -# Some refs (refs/bisect/*, pseudorefs) are kept per worktree, so they should -# only appear in the for-each-reflog output if it is called from the correct -# worktree, which is exercised in this test. This test is poorly written (and -# therefore marked REFFILES) for mulitple reasons: 1) it creates invalidly -# formatted log entres. 2) it uses direct FS access for creating the reflogs. 3) -# PSEUDO-WT and refs/bisect/random do not create reflogs by default, so it is -# not testing a realistic scenario. -test_expect_success REFFILES 'for_each_reflog()' ' - echo $ZERO_OID > .git/logs/PSEUDO-MAIN && - mkdir -p .git/logs/refs/bisect && - echo $ZERO_OID > .git/logs/refs/bisect/random && - - echo $ZERO_OID > .git/worktrees/wt/logs/PSEUDO-WT && - mkdir -p .git/worktrees/wt/logs/refs/bisect && - echo $ZERO_OID > .git/worktrees/wt/logs/refs/bisect/wt-random && - - $RWT for-each-reflog | cut -d" " -f 2- | sort >actual && - cat >expected <<-\EOF && - HEAD 0x1 - PSEUDO-WT 0x0 - refs/bisect/wt-random 0x0 - refs/heads/main 0x0 - refs/heads/wt-main 0x0 - EOF - test_cmp expected actual && - - $RMAIN for-each-reflog | cut -d" " -f 2- | sort >actual && - cat >expected <<-\EOF && - HEAD 0x1 - PSEUDO-MAIN 0x0 - refs/bisect/random 0x0 - refs/heads/main 0x0 - refs/heads/wt-main 0x0 - EOF - test_cmp expected actual -' - test_done
Signature · 1 line
gitgitgadget
PATCH 7/12 t1410: move reffiles specific tests to t0600
In reply to John Cai via GitGitGadgetFrom: John Cai <[email protected]>
Move these tests to t0600 with other reffiles specific tests since they do things like take a lock on an individual ref, and write directly into the reflog refs
--- t/t0600-reffiles-backend.sh | 51 +++++++++++++++++++++++++++++++++++++ t/t1410-reflog.sh | 42 ------------------------------ 2 files changed, 51 insertions(+), 42 deletions(-)
t/t0600-reffiles-backend.sh +51 -0
@@ -451,4 +451,55 @@ test_expect_success 'for_each_reflog()' ' test_cmp expected actual ' +# Triggering the bug detected by this test requires a newline to fall +# exactly BUFSIZ-1 bytes from the end of the file. We don't know +# what that value is, since it's platform dependent. However, if +# we choose some value N, we also catch any D which divides N evenly +# (since we will read backwards in chunks of D). So we choose 8K, +# which catches glibc (with an 8K BUFSIZ) and *BSD (1K). +# +# Each line is 114 characters, so we need 75 to still have a few before the +# last 8K. The 89-character padding on the final entry lines up our +# newline exactly. +test_expect_success SHA1 'parsing reverse reflogs at BUFSIZ boundaries' ' + git checkout -b reflogskip && + zf=$(test_oid zero_2) && + ident="abc <xyz> 0000000001 +0000" && + for i in $(test_seq 1 75); do + printf "$zf%02d $zf%02d %s\t" $i $(($i+1)) "$ident" && + if test $i = 75; then + for j in $(test_seq 1 89); do + printf X || return 1 + done + else + printf X + fi && + printf "\n" || return 1 + done >.git/logs/refs/heads/reflogskip && + git rev-parse reflogskip@{73} >actual && + echo ${zf}03 >expect && + test_cmp expect actual +' + +# This test takes a lock on an individual ref; this is not supported in +# reftable. +test_expect_success 'reflog expire operates on symref not referrent' ' + git branch --create-reflog the_symref && + git branch --create-reflog referrent && + git update-ref referrent HEAD && + git symbolic-ref refs/heads/the_symref refs/heads/referrent && + test_when_finished "rm -f .git/refs/heads/referrent.lock" && + touch .git/refs/heads/referrent.lock && + git reflog expire --expire=all the_symref +' + +test_expect_success 'empty reflog' ' + test_when_finished "rm -rf empty" && + git init empty && + test_commit -C empty A && + >empty/.git/logs/refs/heads/foo && + git -C empty reflog expire --all 2>err && + test_must_be_empty err +' + test_done
t/t1410-reflog.sh +0 -42
54 lines not on this page · raw message
Signature · 1 line
gitgitgadget
PATCH 8/12 t1415: move reffiles specific tests to t0600
In reply to John Cai via GitGitGadgetFrom: John Cai <[email protected]>
Move this test into t0600 with other reffiles specific tests since it checks for individua loose refs and thus is specific to the reffiles backend.
--- t/t0600-reffiles-backend.sh | 20 ++++++++++++++++++++ t/t1415-worktree-refs.sh | 11 ----------- 2 files changed, 20 insertions(+), 11 deletions(-)
t/t0600-reffiles-backend.sh +20 -0
@@ -502,4 +502,24 @@ test_expect_success 'empty reflog' ' test_must_be_empty err ' +# The 'packed-refs' file is stored directly in .git/. This means it is global +# to the repository, and can only contain refs that are shared across all +# worktrees. +test_expect_success 'refs/worktree must not be packed' ' + test_commit initial && + test_commit wt1 && + test_commit wt2 && + git worktree add wt1 wt1 && + git worktree add wt2 wt2 && + git checkout initial && + git update-ref refs/worktree/foo HEAD && + git -C wt1 update-ref refs/worktree/foo HEAD && + git -C wt2 update-ref refs/worktree/foo HEAD && + git pack-refs --all && + test_path_is_missing .git/refs/tags/wt1 && + test_path_is_file .git/refs/worktree/foo && + test_path_is_file .git/worktrees/wt1/refs/worktree/foo && + test_path_is_file .git/worktrees/wt2/refs/worktree/foo +' + test_done
t/t1415-worktree-refs.sh +0 -11
@@ -17,17 +17,6 @@ test_expect_success 'setup' ' git -C wt2 update-ref refs/worktree/foo HEAD ' -# The 'packed-refs' file is stored directly in .git/. This means it is global -# to the repository, and can only contain refs that are shared across all -# worktrees. -test_expect_success REFFILES 'refs/worktree must not be packed' ' - git pack-refs --all && - test_path_is_missing .git/refs/tags/wt1 && - test_path_is_file .git/refs/worktree/foo && - test_path_is_file .git/worktrees/wt1/refs/worktree/foo && - test_path_is_file .git/worktrees/wt2/refs/worktree/foo -' - test_expect_success 'refs/worktree are per-worktree' ' test_cmp_rev worktree/foo initial && ( cd wt1 && test_cmp_rev worktree/foo wt1 ) &&
Signature · 1 line
gitgitgadget
PATCH 9/12 t1503: move reffiles specific tests to t0600
In reply to John Cai via GitGitGadgetFrom: John Cai <[email protected]>
Move this test to t0600 with other reffiles specific tests since it checks for loose refs and is specific to the reffiles backend.
--- t/t0600-reffiles-backend.sh | 5 +++++ t/t1503-rev-parse-verify.sh | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-)
t/t0600-reffiles-backend.sh +5 -0
@@ -522,4 +522,9 @@ test_expect_success 'refs/worktree must not be packed' ' test_path_is_file .git/worktrees/wt2/refs/worktree/foo ' +test_expect_success SYMLINKS 'ref resolution not confused by broken symlinks' ' + ln -s does-not-exist .git/refs/heads/broken && + test_must_fail git rev-parse --verify broken +' + test_done
t/t1503-rev-parse-verify.sh +0 -5
@@ -144,11 +144,6 @@ test_expect_success 'main@{n} for various n' ' test_must_fail git rev-parse --verify main@{$Np1} ' -test_expect_success SYMLINKS,REFFILES 'ref resolution not confused by broken symlinks' ' - ln -s does-not-exist .git/refs/heads/broken && - test_must_fail git rev-parse --verify broken -' - test_expect_success 'options can appear after --verify' ' git rev-parse --verify HEAD >expect && git rev-parse --verify -q HEAD >actual &&
Signature · 1 line
gitgitgadget
PATCH 10/12 t3903: move reffiles specific tests to t0600
In reply to John Cai via GitGitGadgetFrom: John Cai <[email protected]>
Move this test into t0600 with other reffiles specific tests since it modifies reflog refs manually and thus is specific to the reffiles backend.
This change also consolidates setup_stash() into test-lib-functions.sh
--- t/t0600-reffiles-backend.sh | 27 +++++++++++++++++++++++ t/t3903-stash.sh | 43 ------------------------------------- t/test-lib-functions.sh | 16 ++++++++++++++ 3 files changed, 43 insertions(+), 43 deletions(-)
t/t0600-reffiles-backend.sh +27 -0
@@ -527,4 +527,31 @@ test_expect_success SYMLINKS 'ref resolution not confused by broken symlinks' ' test_must_fail git rev-parse --verify broken ' +test_expect_success 'drop stash reflog updates refs/stash with rewrite' ' + git init repo && + ( + cd repo && + setup_stash + ) && + echo 9 >repo/file && + + old_oid="$(git -C repo rev-parse stash@{0})" && + git -C repo stash && + new_oid="$(git -C repo rev-parse stash@{0})" && + + cat >expect <<-EOF && + $(test_oid zero) $old_oid + $old_oid $new_oid + EOF + cut -d" " -f1-2 repo/.git/logs/refs/stash >actual && + test_cmp expect actual && + + git -C repo stash drop stash@{1} && + cut -d" " -f1-2 repo/.git/logs/refs/stash >actual && + cat >expect <<-EOF && + $(test_oid zero) $new_oid + EOF + test_cmp expect actual +' + test_done
t/t3903-stash.sh +0 -43
55 lines not on this page · raw message
t/test-lib-functions.sh +16 -0
@@ -1958,3 +1958,19 @@ test_trailing_hash () { test-tool hexdump | sed "s/ //g" } + +# Stash some changes +setup_stash() { echo 1 >file && + git add file && + echo unrelated >other-file && + git add other-file && + test_tick && + git commit -m initial && + echo 2 >file && + git add file && + echo 3 >file && + test_tick && + git stash && + git diff-files --quiet && + git diff-index --cached --quiet HEAD +}
Signature · 1 line
gitgitgadget
PATCH 11/12 t4202: move reffiles specific tests to t0600
In reply to John Cai via GitGitGadgetFrom: John Cai <[email protected]>
Move two tests into t0600 since they write loose reflog refs manually and thus are specific to the reffiles backend.
--- t/t0600-reffiles-backend.sh | 17 +++++++++++++++++ t/t4202-log.sh | 17 ----------------- 2 files changed, 17 insertions(+), 17 deletions(-)
t/t0600-reffiles-backend.sh +17 -0
@@ -554,4 +554,21 @@ test_expect_success 'drop stash reflog updates refs/stash with rewrite' ' test_cmp expect actual ' +test_expect_success 'log diagnoses bogus HEAD hash' ' + git init empty && + test_when_finished "rm -rf empty" && + echo 1234abcd >empty/.git/refs/heads/main && + test_must_fail git -C empty log 2>stderr && + test_grep broken stderr +' + +test_expect_success 'log diagnoses bogus HEAD symref' ' + git init empty && + test-tool -C empty ref-store main create-symref HEAD refs/heads/invalid.lock && + test_must_fail git -C empty log 2>stderr && + test_grep broken stderr && + test_must_fail git -C empty log --default totally-bogus 2>stderr && + test_grep broken stderr +' + test_done
t/t4202-log.sh +0 -17
@@ -2255,23 +2255,6 @@ test_expect_success 'log on empty repo fails' ' test_grep does.not.have.any.commits stderr ' -test_expect_success REFFILES 'log diagnoses bogus HEAD hash' ' - git init empty && - test_when_finished "rm -rf empty" && - echo 1234abcd >empty/.git/refs/heads/main && - test_must_fail git -C empty log 2>stderr && - test_grep broken stderr -' - -test_expect_success REFFILES 'log diagnoses bogus HEAD symref' ' - git init empty && - test-tool -C empty ref-store main create-symref HEAD refs/heads/invalid.lock && - test_must_fail git -C empty log 2>stderr && - test_grep broken stderr && - test_must_fail git -C empty log --default totally-bogus 2>stderr && - test_grep broken stderr -' - test_expect_success 'log does not default to HEAD when rev input is given' ' git log --branches=does-not-exist >actual && test_must_be_empty actual
Signature · 1 line
gitgitgadget
PATCH 12/12 t5312: move reffiles specific tests to t0600
In reply to John Cai via GitGitGadgetFrom: John Cai <[email protected]>
Move a few tests into t0600 since they specifically test the packed-refs file and thus are specific to the reffiles backend.
--- t/t0600-reffiles-backend.sh | 30 ++++++++++++++++++++++++++++++ t/t5312-prune-corruption.sh | 26 -------------------------- 2 files changed, 30 insertions(+), 26 deletions(-)
t/t0600-reffiles-backend.sh +30 -0
@@ -571,4 +571,34 @@ test_expect_success 'log diagnoses bogus HEAD symref' ' test_grep broken stderr ' +# we do not want to count on running pack-refs to +# actually pack it, as it is perfectly reasonable to +# skip processing a broken ref +test_expect_success 'create packed-refs file with broken ref' ' + test_tick && git commit --allow-empty -m one && + recoverable=$(git rev-parse HEAD) && + test_tick && git commit --allow-empty -m two && + missing=$(git rev-parse HEAD) && + rm -f .git/refs/heads/main && + cat >.git/packed-refs <<-EOF && + $missing refs/heads/main + $recoverable refs/heads/other + EOF + echo $missing >expect && + git rev-parse refs/heads/main >actual && + test_cmp expect actual +' + +test_expect_success 'pack-refs does not silently delete broken packed ref' ' + git pack-refs --all --prune && + git rev-parse refs/heads/main >actual && + test_cmp expect actual +' + +test_expect_success 'pack-refs does not drop broken refs during deletion' ' + git update-ref -d refs/heads/other && + git rev-parse refs/heads/main >actual && + test_cmp expect actual +' + test_done
t/t5312-prune-corruption.sh +0 -26
@@ -111,30 +111,4 @@ test_expect_success 'pack-refs does not silently delete broken loose ref' ' test_cmp expect actual ' -# we do not want to count on running pack-refs to -# actually pack it, as it is perfectly reasonable to -# skip processing a broken ref -test_expect_success REFFILES 'create packed-refs file with broken ref' ' - rm -f .git/refs/heads/main && - cat >.git/packed-refs <<-EOF && - $missing refs/heads/main - $recoverable refs/heads/other - EOF - echo $missing >expect && - git rev-parse refs/heads/main >actual && - test_cmp expect actual -' - -test_expect_success REFFILES 'pack-refs does not silently delete broken packed ref' ' - git pack-refs --all --prune && - git rev-parse refs/heads/main >actual && - test_cmp expect actual -' - -test_expect_success REFFILES 'pack-refs does not drop broken refs during deletion' ' - git update-ref -d refs/heads/other && - git rev-parse refs/heads/main >actual && - test_cmp expect actual -' - test_done
Signature · 1 line
gitgitgadget
Re: [PATCH 01/12] t3210: move to t0602
In reply to John Cai via GitGitGadgetQuoted 8 lines · John Cai via GitGitGadget
From: John Cai <[email protected]>
Move t3210 to t0602, since these tests are reffiles specific in that they modify loose refs manually. This is part of the effort to categorize these tests together based on the ref backend they test. When we upstream the reftable backend, we can add more tests to t06xx. This way, all tests that test specific ref backend behavior will be grouped together.
So, ... is the idea to have (1) majority of ref tests, against which all backends ought to behave the same way, will be written in backend agnostic way (e.g., we have seen some patches to stop touching the filesystem .git/refs/ hierarchy manually), and (2) some backend specific tests will be grouped in a small number of test script files for each backend and they all will use t6xx numbrs?
OK. Sounds like a good plan to me.
Quoted 10 lines
Signed-off-by John Cai <[email protected]>--- t/{t3210-pack-refs.sh => t0602-reffiles-pack-refs.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename t/{t3210-pack-refs.sh => t0602-reffiles-pack-refs.sh} (100%)t/t0602-reffiles-pack-refs.sh renamed from t/t3210-pack-refs.sh +0
-0
Re: [PATCH 02/12] remove REFFILES prerequisite
In reply to John Cai via GitGitGadgetQuoted 4 lines · John Cai via GitGitGadget
From: John Cai <[email protected]>
These tests are compatible with the reftable backend and thus do not need the REFFILES prerequisite.
May want to give a bit more backstory here? After all, 53af25e4 (t1405: mark test that checks existence as REFFILES, 2022-01-31) and 53af25e4 (t1405: mark test that checks existence as REFFILES, 2022-01-31) marked these tests to require REFFILES and they explain the reason for doing so was exactly because the reftable backend did not have the notion of "the reflog for this ref exists" that is independent from "the reflog for this ref exists and has one or more reflog records". If your work on the reftable backend during the past few years added support for "already exists, but there is no entry yet" state for reflogs, that would be great, but it would make sense to explain why they suddenly have become "compatible with the reftable backend".
Thanks.
Quoted 33 lines
Signed-off-by John Cai <[email protected]>--- t/t1405-main-ref-store.sh | 2 +- t/t2017-checkout-orphan.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)t/t1405-main-ref-store.sh +1
-1@@ -112,7 +112,7 @@ test_expect_success 'delete_reflog(HEAD)' ' test_must_fail git reflog exists HEAD ' -test_expect_success REFFILES 'create-reflog(HEAD)' ' +test_expect_success 'create-reflog(HEAD)' ' $RUN create-reflog HEAD && git reflog exists HEAD 't/t2017-checkout-orphan.sh +1
-1@@ -86,7 +86,7 @@ test_expect_success '--orphan makes reflog by default' ' git rev-parse --verify delta@{0} ' -test_expect_success REFFILES '--orphan does not make reflog when core.logAllRefUpdates = false' ' +test_expect_success '--orphan does not make reflog when core.logAllRefUpdates = false' ' git checkout main && git config core.logAllRefUpdates false && git checkout --orphan epsilon &&
Re: [PATCH 03/12] t1414: convert test to use Git commands instead of writing refs manually
In reply to John Cai via GitGitGadgett/t1414-reflog-walk.sh test_expect_success 'min/max age uses entry date to limit' ' · line 131
Quoted 11 lines · John Cai via GitGitGadget
# Create a situation where the reflog and ref database disagree about the latest
# state of HEAD.t/t1414-reflog-walk.sh +6
-1-test_expect_success REFFILES 'walk prefers reflog to ref tip' ' +test_expect_success 'walk prefers reflog to ref tip' ' + test_commit A && + test_commit B && + git reflog delete HEAD@{0} && head=$(git rev-parse HEAD) && + A=$(git rev-parse A) && + echo $A >expect &&
You do not need an intermediate variable A, i.e.
git rev-parse A >expect &&
would suffice. Also it seems that $head is no longer used because you do not manufacture a reflog entry yourself, so the two assignments to $A and $head can be removed.
t/t1414-reflog-walk.sh test_expect_success 'min/max age uses entry date to limit' ' · line 134
Quoted 3 lines
t/t1414-reflog-walk.sh +0
-0git log -g --format=%H -1 >actual && test_cmp expect actual '
The resulting code makes the intent of the test much clearer. Nicely done.
Quoted 10 lines · John Cai via GitGitGadget
This series groups REFFILES specific tests together. These tests are currently grouped together across the test suite based on functionality. However, since they exercise low-level behavior specific to the refs backend being used (in these cases, the ref-files backend), group them together based on which refs backend they test. This way, in the near future when the reftables backend gets upstreamed we can add tests that exercise the reftables backend close by in the t06xx area.
These patches also remove the REFFILES prerequisite, since all the tests in t06xx are reffiles specific.
As we already have REFFILES lazy prereq, even _before_ we enable the reftable backend, I think that we should start t0600 and t0602 with
. ./test-lib.sh
if ! test_have_prereq REFFILES
then
skip_all='skipping reffiles specific tests' test_done
fi
which is more in line with the existing convention. It is more efficient than "forcing t0600 and t0602 to run always with reffiles" when you have a CI job that uses reftable for all tests and another CI job that uses reffiles for all tests.
Quoted 3 lines
In the near future, once the reftable backend is upstreamed, all the tests in t06xx will be forced to run with the reffiles backend.
Presumably if there are reftable backend specific tests, they will also be given names out of t06xx range, right? And then they will be skipped when the test is not using reftable as the default ref backend, using the REFTABLE prerequisite in a similar way as shown above for REFFILES, right?
Thanks.
Re: [PATCH 02/12] remove REFFILES prerequisite
In reply to Junio C HamanoQuoted 7 lines · Junio C Hamano
Quoted 4 lines · John Cai via GitGitGadget
From: John Cai <[email protected]>
These tests are compatible with the reftable backend and thus do not need the REFFILES prerequisite.
Quoted 12 lines
May want to give a bit more backstory here? After all,
53af25e4(t1405: mark test that checks existence as REFFILES, 2022-01-31) and53af25e4(t1405: mark test that checks existence as REFFILES, 2022-01-31) marked these tests to require REFFILES and they explain the reason for doing so was exactly because the reftable backend did not have the notion of "the reflog for this ref exists" that is independent from "the reflog for this ref exists and has one or more reflog records". If your work on the reftable backend during the past few years added support for "already exists, but there is no entry yet" state for reflogs, that would be great, but it would make sense to explain why they suddenly have become "compatible with the reftable backend".
I don't know a lot about the history any why we initially didn't think it would be compatible, mostly because there is no history of how the reftable backend itself evolved over time. I can only say that when I took over the effort that this indeed worked as expected by writing "existence" markers into the reflog, where this existence marker is a simple entry where both old and new object ID are set to the null OID.
Patrick
Re: [PATCH 01/12] t3210: move to t0602
In reply to Junio C HamanoQuoted 11 lines · Junio C Hamano
Quoted 8 lines · John Cai via GitGitGadget
From: John Cai <[email protected]>
Move t3210 to t0602, since these tests are reffiles specific in that they modify loose refs manually. This is part of the effort to categorize these tests together based on the ref backend they test. When we upstream the reftable backend, we can add more tests to t06xx. This way, all tests that test specific ref backend behavior will be grouped together.
Quoted 8 lines
So, ... is the idea to have (1) majority of ref tests, against which all backends ought to behave the same way, will be written in backend agnostic way (e.g., we have seen some patches to stop touching the filesystem .git/refs/ hierarchy manually), and (2) some backend specific tests will be grouped in a small number of test script files for each backend and they all will use t6xx numbrs?
OK. Sounds like a good plan to me.
Yes, that's the plan. The backend specific tests will be free to also exercise filesystem-level behaviour in order to pin down that things work as expected. But once their behaviour is nailed down all other generic tests should refrain from doing that to the best extent possible and instead use Git commands to do their thing.
Quoted 5 lines
Quoted 5 lines
Signed-off-by John Cai <[email protected]>--- t/{t3210-pack-refs.sh => t0602-reffiles-pack-refs.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename t/{t3210-pack-refs.sh => t0602-reffiles-pack-refs.sh} (100%)
Is there a reason why you picked t0602 instead of the not-yet-taken t0601? If it's only because I use t0601 in my reftable integration branch then I'd like us to pick t0601 here instead to avoid a weird gap. I'll adapt accordingly and rename the reftable tests to have a t061x prefix in that case so that they are nicely grouped together.
Patrick
Quoted 23 lines · Junio C Hamano
Quoted 10 lines · John Cai via GitGitGadget
This series groups REFFILES specific tests together. These tests are currently grouped together across the test suite based on functionality. However, since they exercise low-level behavior specific to the refs backend being used (in these cases, the ref-files backend), group them together based on which refs backend they test. This way, in the near future when the reftables backend gets upstreamed we can add tests that exercise the reftables backend close by in the t06xx area.
These patches also remove the REFFILES prerequisite, since all the tests in t06xx are reffiles specific.
As we already have REFFILES lazy prereq, even _before_ we enable the reftable backend, I think that we should start t0600 and t0602 with
. ./test-lib.sh
if !test_have_prereqREFFILES
then
skip_all='skipping reffiles specific tests'test_done
fi
Quoted 4 lines
which is more in line with the existing convention. It is more efficient than "forcing t0600 and t0602 to run always with reffiles" when you have a CI job that uses reftable for all tests and another CI job that uses reffiles for all tests.
I think it depends. If we use the REFFILES prereq for the files-specific tests, then we should likely also use the REFTABLE prereq for the reftable-specific tests.
But that raises the question of whether we want to add a CI job that exercises code with the reftable backend for every major platform (Linux, macOS, Windows). If so then your proposal would be fine with me as we make sure that things work alright on all of them. But if we think that this would be too expensive then I'd like to at least have very basic test coverage on all platforms by always running these backend-specific tests.
Patrick
Re: [PATCH 01/12] t3210: move to t0602
In reply to Patrick SteinhardtHi Patrick,
Quoted 33 lines · Patrick Steinhardt
Quoted 11 lines · Junio C Hamano
Quoted 8 lines · John Cai via GitGitGadget
From: John Cai <[email protected]>
Move t3210 to t0602, since these tests are reffiles specific in that they modify loose refs manually. This is part of the effort to categorize these tests together based on the ref backend they test. When we upstream the reftable backend, we can add more tests to t06xx. This way, all tests that test specific ref backend behavior will be grouped together.
Quoted 8 lines
So, ... is the idea to have (1) majority of ref tests, against which all backends ought to behave the same way, will be written in backend agnostic way (e.g., we have seen some patches to stop touching the filesystem .git/refs/ hierarchy manually), and (2) some backend specific tests will be grouped in a small number of test script files for each backend and they all will use t6xx numbrs?
OK. Sounds like a good plan to me.
Yes, that's the plan. The backend specific tests will be free to also exercise filesystem-level behaviour in order to pin down that things work as expected. But once their behaviour is nailed down all other generic tests should refrain from doing that to the best extent possible and instead use Git commands to do their thing.
Quoted 5 lines
Quoted 5 lines
Signed-off-by John Cai <[email protected]>--- t/{t3210-pack-refs.sh => t0602-reffiles-pack-refs.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename t/{t3210-pack-refs.sh => t0602-reffiles-pack-refs.sh} (100%)
Quoted 5 lines
Is there a reason why you picked t0602 instead of the not-yet-taken t0601? If it's only because I use t0601 in my reftable integration branch then I'd like us to pick t0601 here instead to avoid a weird gap. I'll adapt accordingly and rename the reftable tests to have a t061x prefix in that case so that they are nicely grouped together.
Yes if I remember correctly, that's the reason. I can move this to t0601 then, thanks.
Quoted 2 lines
Patrick
Quoted 3 lines · Patrick Steinhardt
I think it depends. If we use the REFFILES prereq for the files-specific tests, then we should likely also use the REFTABLE prereq for the reftable-specific tests.
Correct. I've assumed that as a given; while introducing any new implementation of a subsystem that has widespread impact, we would test things with the original and new implementations. It happened while we were moving "ort" to replace "recursive" as an internal tree merge machinery, for example. linux-TEST-vars job that is available both in GitHub and GitLab CI is an example of a separate job that runs everything with non-default configurations, and "use reftable as the default backend" GIT_TEST_REFTABLE knob may be an appropriate thing to set there.
Quoted 9 lines
But that raises the question of whether we want to add a CI job that exercises code with the reftable backend for every major platform (Linux, macOS, Windows). If so then your proposal would be fine with me as we make sure that things work alright on all of them. But if we think that this would be too expensive then I'd like to at least have very basic test coverage on all platforms by always running these backend-specific tests.
Patrick
Re: [PATCH 04/12] t1404: move reffiles specific tests to t0600
In reply to John Cai via GitGitGadgetQuoted 1 line · John Cai via GitGitGadget
From: John Cai <[email protected]>
[snip]
t/t0600-reffiles-backend.sh line 169
Quoted 3 lines
t/t0600-reffiles-backend.sh new file +3
-0+test_expect_success 'D/F conflict prevents add long + delete short' ' + df_test refs/df-al-ds --add-del foo/bar foo +'
All of the tests using df_test () pass with the reftable backend, the only thing that's incompatible is that there is an additional prefix in the "files" backend's error message. So I'd like to drop moving those D/F conflict tests so that we can instead make them generic in another iteration.
All the other tests where we verify how the "files" backend behaves when there are empty directories in the way do make sense to become backend specific though.
Patrick
Re: [PATCH 08/12] t1415: move reffiles specific tests to t0600
In reply to John Cai via GitGitGadgetQuoted 29 lines · John Cai via GitGitGadget
From: John Cai <[email protected]>
Move this test into t0600 with other reffiles specific tests since it checks for individua loose refs and thus is specific to the reffiles backend.
Signed-off-by John Cai <[email protected]>--- t/t0600-reffiles-backend.sh | 20 ++++++++++++++++++++ t/t1415-worktree-refs.sh | 11 ----------- 2 files changed, 20 insertions(+), 11 deletions(-)t/t0600-reffiles-backend.sh +9
-0@@ -502,4 +502,24 @@ test_expect_success 'empty reflog' ' test_must_be_empty err ' +# The 'packed-refs' file is stored directly in .git/. This means it is global +# to the repository, and can only contain refs that are shared across all +# worktrees. +test_expect_success 'refs/worktree must not be packed' ' + test_commit initial && + test_commit wt1 && + test_commit wt2 && + git worktree add wt1 wt1 && + git worktree add wt2 wt2 &&
t/t0600-reffiles-backend.sh test_expect_success 'empty reflog' ' · line 523
Quoted 10 lines
t/t0600-reffiles-backend.sh +10
-0+ git checkout initial && + git update-ref refs/worktree/foo HEAD && + git -C wt1 update-ref refs/worktree/foo HEAD && + git -C wt2 update-ref refs/worktree/foo HEAD && + git pack-refs --all && + test_path_is_missing .git/refs/tags/wt1 && + test_path_is_file .git/refs/worktree/foo && + test_path_is_file .git/worktrees/wt1/refs/worktree/foo && + test_path_is_file .git/worktrees/wt2/refs/worktree/foo +'
Given that this test exercises git-pack-refs(1), should we move it to t0601-reffiles-pack-refs.sh instead?
Patrick
Re: [PATCH 10/12] t3903: move reffiles specific tests to t0600
In reply to John Cai via GitGitGadgetQuoted 39 lines · John Cai via GitGitGadget
From: John Cai <[email protected]>
Move this test into t0600 with other reffiles specific tests since it modifies reflog refs manually and thus is specific to the reffiles backend.
This change also consolidates
setup_stash()intotest-lib-functions.shSigned-off-by John Cai <[email protected]>--- t/t0600-reffiles-backend.sh | 27 +++++++++++++++++++++++ t/t3903-stash.sh | 43 ------------------------------------- t/test-lib-functions.sh | 16 ++++++++++++++ 3 files changed, 43 insertions(+), 43 deletions(-)t/t0600-reffiles-backend.sh +16
-0@@ -527,4 +527,31 @@ test_expect_success SYMLINKS 'ref resolution not confused by broken symlinks' ' test_must_fail git rev-parse --verify broken ' +test_expect_success 'drop stash reflog updates refs/stash with rewrite' ' + git init repo && + ( + cd repo && + setup_stash + ) && + echo 9 >repo/file && + + old_oid="$(git -C repo rev-parse stash@{0})" && + git -C repo stash && + new_oid="$(git -C repo rev-parse stash@{0})" && + + cat >expect <<-EOF && + $(test_oid zero) $old_oid + $old_oid $new_oid + EOF
t/t0600-reffiles-backend.sh test_expect_success SYMLINKS 'ref resolution not confused by broken symlinks' ' · line 555
Quoted 10 lines
t/t0600-reffiles-backend.sh +10
-0+ cut -d" " -f1-2 repo/.git/logs/refs/stash >actual && + test_cmp expect actual && + + git -C repo stash drop stash@{1} && + cut -d" " -f1-2 repo/.git/logs/refs/stash >actual && + cat >expect <<-EOF && + $(test_oid zero) $new_oid + EOF + test_cmp expect actual +'
I think that there is no need to make this backend-specific. What we're testing here is that git stash drop is able to drop the latest reflog entry. The calls to cut(1) are only used to verify that the contents of the reflog entry look as expected while only verifying the old and new object IDs.
So how about below patch to make it generic instead?
Patrick
-- >8 --
t/t3903-stash.sh +6 -6
@@ -200,7 +200,7 @@ test_expect_success 'drop stash reflog updates refs/stash' ' test_cmp expect actual ' -test_expect_success REFFILES 'drop stash reflog updates refs/stash with rewrite' ' +test_expect_success 'drop stash reflog updates refs/stash with rewrite' ' git init repo && ( cd repo &&
@@ -213,16 +213,16 @@ test_expect_success REFFILES 'drop stash reflog updates refs/stash with rewrite' new_oid="$(git -C repo rev-parse stash@{0})" && cat >expect <<-EOF && - $(test_oid zero) $old_oid - $old_oid $new_oid + $new_oid + $old_oid EOF - cut -d" " -f1-2 repo/.git/logs/refs/stash >actual && + git -C repo reflog show refs/stash --format=%H >actual && test_cmp expect actual && git -C repo stash drop stash@{1} && - cut -d" " -f1-2 repo/.git/logs/refs/stash >actual && + git -C repo reflog show refs/stash --format=%H >actual && cat >expect <<-EOF && - $(test_oid zero) $new_oid + $new_oid EOF test_cmp expect actual '
Re: [PATCH 12/12] t5312: move reffiles specific tests to t0600
In reply to John Cai via GitGitGadgetQuoted 38 lines · John Cai via GitGitGadget
From: John Cai <[email protected]>
Move a few tests into t0600 since they specifically test the packed-refs file and thus are specific to the reffiles backend.
Signed-off-by John Cai <[email protected]>--- t/t0600-reffiles-backend.sh | 30 ++++++++++++++++++++++++++++++ t/t5312-prune-corruption.sh | 26 -------------------------- 2 files changed, 30 insertions(+), 26 deletions(-)t/t0600-reffiles-backend.sh +19
-0@@ -571,4 +571,34 @@ test_expect_success 'log diagnoses bogus HEAD symref' ' test_grep broken stderr ' +# we do not want to count on running pack-refs to +# actually pack it, as it is perfectly reasonable to +# skip processing a broken ref +test_expect_success 'create packed-refs file with broken ref' ' + test_tick && git commit --allow-empty -m one && + recoverable=$(git rev-parse HEAD) && + test_tick && git commit --allow-empty -m two && + missing=$(git rev-parse HEAD) && + rm -f .git/refs/heads/main && + cat >.git/packed-refs <<-EOF && + $missing refs/heads/main + $recoverable refs/heads/other + EOF + echo $missing >expect && + git rev-parse refs/heads/main >actual && + test_cmp expect actual +' + +test_expect_success 'pack-refs does not silently delete broken packed ref' '
t/t0600-reffiles-backend.sh test_expect_success 'log diagnoses bogus HEAD symref' ' · line 602
Quoted 10 lines
t/t0600-reffiles-backend.sh +10
-0+ git pack-refs --all --prune && + git rev-parse refs/heads/main >actual && + test_cmp expect actual +' + +test_expect_success 'pack-refs does not drop broken refs during deletion' ' + git update-ref -d refs/heads/other && + git rev-parse refs/heads/main >actual && + test_cmp expect actual +'
Should these tests be moved into t0601-reffiles-pack-refs.sh instead?
Patrick
Re: [PATCH 10/12] t3903: move reffiles specific tests to t0600
In reply to Patrick SteinhardtHi Patrick,
Quoted 57 lines · Patrick Steinhardt
Quoted 39 lines · John Cai via GitGitGadget
From: John Cai <[email protected]>
Move this test into t0600 with other reffiles specific tests since it modifies reflog refs manually and thus is specific to the reffiles backend.
This change also consolidates
setup_stash()intotest-lib-functions.shSigned-off-by John Cai <[email protected]>--- t/t0600-reffiles-backend.sh | 27 +++++++++++++++++++++++ t/t3903-stash.sh | 43 ------------------------------------- t/test-lib-functions.sh | 16 ++++++++++++++ 3 files changed, 43 insertions(+), 43 deletions(-)t/t0600-reffiles-backend.sh +16
-0@@ -527,4 +527,31 @@ test_expect_success SYMLINKS 'ref resolution not confused by broken symlinks' ' test_must_fail git rev-parse --verify broken ' +test_expect_success 'drop stash reflog updates refs/stash with rewrite' ' + git init repo && + ( + cd repo && + setup_stash + ) && + echo 9 >repo/file && + + old_oid="$(git -C repo rev-parse stash@{0})" && + git -C repo stash && + new_oid="$(git -C repo rev-parse stash@{0})" && + + cat >expect <<-EOF && + $(test_oid zero) $old_oid + $old_oid $new_oid + EOFt/t0600-reffiles-backend.sh test_expect_success SYMLINKS 'ref resolution not confused by broken symlinks' ' · line 555
Quoted 10 lines
t/t0600-reffiles-backend.sh +10
-0+ cut -d" " -f1-2 repo/.git/logs/refs/stash >actual && + test_cmp expect actual && + + git -C repo stash drop stash@{1} && + cut -d" " -f1-2 repo/.git/logs/refs/stash >actual && + cat >expect <<-EOF && + $(test_oid zero) $new_oid + EOF + test_cmp expect actual +'I think that there is no need to make this backend-specific. What we're testing here is that
git stash dropis able to drop the latest reflog entry. The calls to cut(1) are only used to verify that the contents of the reflog entry look as expected while only verifying the old and new object IDs.
Quoted 1 line
So how about below patch to make it generic instead?
Nice catch. This sounds perfect to me.
Quoted 40 lines
Patrick
-- >8 --
t/t3903-stash.sh +6
-6@@ -200,7 +200,7 @@ test_expect_success 'drop stash reflog updates refs/stash' ' test_cmp expect actual ' -test_expect_success REFFILES 'drop stash reflog updates refs/stash with rewrite' ' +test_expect_success 'drop stash reflog updates refs/stash with rewrite' ' git init repo && ( cd repo &&@@ -213,16 +213,16 @@ test_expect_success REFFILES 'drop stash reflog updates refs/stash with rewrite' new_oid="$(git -C repo rev-parse stash@{0})" && cat >expect <<-EOF && - $(test_oid zero) $old_oid - $old_oid $new_oid + $new_oid + $old_oid EOF - cut -d" " -f1-2 repo/.git/logs/refs/stash >actual && + git -C repo reflog show refs/stash --format=%H >actual && test_cmp expect actual && git -C repo stash drop stash@{1} && - cut -d" " -f1-2 repo/.git/logs/refs/stash >actual && + git -C repo reflog show refs/stash --format=%H >actual && cat >expect <<-EOF && - $(test_oid zero) $new_oid + $new_oid EOF test_cmp expect actual '
v2 cover Group reffiles tests
In reply to John Cai via GitGitGadgetThis series groups REFFILES specific tests together. These tests are currently grouped together across the test suite based on functionality. However, since they exercise low-level behavior specific to the refs backend being used (in these cases, the ref-files backend), group them together based on which refs backend they test. This way, in the near future when the reftables backend gets upstreamed we can add tests that exercise the reftables backend close by in the t06xx area.
These patches also remove the REFFILES prerequisite, since all the tests in t06xx are reffiles specific. In the near future, once the reftable backend is upstreamed, all the tests in t06xx will be forced to run with the reffiles backend.
Changes since V1:
* Moved some pack-refs tests to t0601 instead of t0600
* Clarified some commit messages
* Converted a test to be refs-backend agnostic
* Other minor rearranging of tests
John Cai (12):
t3210: move to t0601
remove REFFILES prerequisite for some tests in t1405 and t2017
t1414: convert test to use Git commands instead of writing refs
manually
t1404: move reffiles specific tests to t0600
t1405: move reffiles specific tests to t0601
t1406: move reffiles specific tests to t0600
t1410: move reffiles specific tests to t0600
t1415: move reffiles specific tests to t0601
t1503: move reffiles specific tests to t0600
t3903: make drop stash test ref backend agnostic
t4202: move reffiles specific tests to t0600
t5312: move reffiles specific tests to t0601
t/t0600-reffiles-backend.sh | 384 ++++++++++++++++++
...ck-refs.sh => t0601-reffiles-pack-refs.sh} | 64 +++
t/t1404-update-ref-errors.sh | 237 -----------
t/t1405-main-ref-store.sh | 10 +-
t/t1407-worktree-ref-store.sh | 37 --
t/t1410-reflog.sh | 42 --
t/t1414-reflog-walk.sh | 11 +-
t/t1415-worktree-refs.sh | 11 -
t/t1503-rev-parse-verify.sh | 5 -
t/t2017-checkout-orphan.sh | 2 +-
t/t3903-stash.sh | 12 +-
t/t4202-log.sh | 17 -
t/t5312-prune-corruption.sh | 26 --
13 files changed, 461 insertions(+), 397 deletions(-)
create mode 100755 t/t0600-reffiles-backend.sh
rename t/{t3210-pack-refs.sh => t0601-reffiles-pack-refs.sh} (81%)base-commit: 186b115d3062e6230ee296d1ddaa0c4b72a464b5
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1647%2Fjohn-cai%2Fjc%2Fgroup-reffiles-tests-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1647/john-cai/jc/group-reffiles-tests-v2
Pull-Request: https://github.com/git/git/pull/1647
Range-diff vs v1:
1: 0e2b6e197ab < -: ----------- t3210: move to t0602 -: ----------- > 1: ca65b9e6122 t3210: move to t0601 2: 624ad202305 ! 2: 29c32d3e6f7 remove REFFILES prerequisite
@@ Metadata
Author: John Cai <[email protected]>
## Commit message ##
- remove REFFILES prerequisite
+ remove REFFILES prerequisite for some tests in t1405 and t2017
These tests are compatible with the reftable backend and thus do not
- need the REFFILES prerequisite.
+ need the REFFILES prerequisite. Even though 53af25e4
+ (t1405: mark test that checks existence as REFFILES, 2022-01-31) and
+ 53af25e4 (t1405: mark test that checks existence as REFFILES,
+ 2022-01-31) marked these tests to require REFFILES, the reftable backend
+ in its current state does indeed work with these tests.
3: 19233aa0d44 ! 3: 122d19a9095 t1414: convert test to use Git commands instead of writing refs manually
@@ t/t1414-reflog-walk.sh: test_expect_success 'min/max age uses entry date to limi
- one=$(git rev-parse one) &&
- ident="$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE" &&
- echo "$head $one $ident broken reflog entry" >>.git/logs/HEAD &&
-+ A=$(git rev-parse A) &&
-
+-
- echo $one >expect &&
-+ echo $A >expect &&
++ git rev-parse A >expect &&
git log -g --format=%H -1 >actual &&
test_cmp expect actual
'
4: 0f6fea6d32d ! 4: c3f0b81200c t1404: move reffiles specific tests to t0600
@@ t/t0600-reffiles-backend.sh (new)
+TEST_PASSES_SANITIZE_LEAK=true
+. ./test-lib.sh
+
-+# Test adding and deleting D/F-conflicting references in a single
-+# transaction.
-+df_test() {
-+ prefix="$1"
-+ pack=: symadd=false symdel=false add_del=false addref= delref=
-+ shift
-+ while test $# -gt 0
-+ do
-+ case "$1" in
-+ --pack)
-+ pack="git pack-refs --all"
-+ shift
-+ ;;
-+ --sym-add)
-+ # Perform the add via a symbolic reference
-+ symadd=true
-+ shift
-+ ;;
-+ --sym-del)
-+ # Perform the del via a symbolic reference
-+ symdel=true
-+ shift
-+ ;;
-+ --del-add)
-+ # Delete first reference then add second
-+ add_del=false
-+ delref="$prefix/r/$2"
-+ addref="$prefix/r/$3"
-+ shift 3
-+ ;;
-+ --add-del)
-+ # Add first reference then delete second
-+ add_del=true
-+ addref="$prefix/r/$2"
-+ delref="$prefix/r/$3"
-+ shift 3
-+ ;;
-+ *)
-+ echo 1>&2 "Extra args to df_test: $*"
-+ return 1
-+ ;;
-+ esac
-+ done
-+ git update-ref "$delref" $C &&
-+ if $symadd
++if ! test_have_prereq REFFILES
+ then
-+ addname="$prefix/s/symadd" &&
-+ git symbolic-ref "$addname" "$addref"
-+ else
-+ addname="$addref"
-+ fi &&
-+ if $symdel
-+ then
-+ delname="$prefix/s/symdel" &&
-+ git symbolic-ref "$delname" "$delref"
-+ else
-+ delname="$delref"
-+ fi &&
-+ cat >expected-err <<-EOF &&
-+ fatal: cannot lock ref $SQ$addname$SQ: $SQ$delref$SQ exists; cannot create $SQ$addref$SQ
-+ EOF
-+ $pack &&
-+ if $add_del
-+ then
-+ printf "%s\n" "create $addname $D" "delete $delname"
-+ else
-+ printf "%s\n" "delete $delname" "create $addname $D"
-+ fi >commands &&
-+ test_must_fail git update-ref --stdin <commands 2>output.err &&
-+ test_cmp expected-err output.err &&
-+ printf "%s\n" "$C $delref" >expected-refs &&
-+ git for-each-ref --format="%(objectname) %(refname)" $prefix/r >actual-refs &&
-+ test_cmp expected-refs actual-refs
-+}
++ skip_all='skipping reffiles specific tests'
++ test_done
++fi
+
+test_expect_success 'setup' '
+ git commit --allow-empty -m Initial &&
@@ t/t0600-reffiles-backend.sh (new)
+ git update-ref --stdin
+'
+
-+test_expect_success 'D/F conflict prevents add long + delete short' '
-+ df_test refs/df-al-ds --add-del foo/bar foo
-+'
-+
-+test_expect_success 'D/F conflict prevents add short + delete long' '
-+ df_test refs/df-as-dl --add-del foo foo/bar
-+'
-+
-+test_expect_success 'D/F conflict prevents delete long + add short' '
-+ df_test refs/df-dl-as --del-add foo/bar foo
-+'
-+
-+test_expect_success 'D/F conflict prevents delete short + add long' '
-+ df_test refs/df-ds-al --del-add foo foo/bar
-+'
-+
-+test_expect_success 'D/F conflict prevents add long + delete short packed' '
-+ df_test refs/df-al-dsp --pack --add-del foo/bar foo
-+'
-+
-+test_expect_success 'D/F conflict prevents add short + delete long packed' '
-+ df_test refs/df-as-dlp --pack --add-del foo foo/bar
-+'
-+
-+test_expect_success 'D/F conflict prevents delete long packed + add short' '
-+ df_test refs/df-dlp-as --pack --del-add foo/bar foo
-+'
-+
-+test_expect_success 'D/F conflict prevents delete short packed + add long' '
-+ df_test refs/df-dsp-al --pack --del-add foo foo/bar
-+'
-+
-+# Try some combinations involving symbolic refs...
-+
-+test_expect_success 'D/F conflict prevents indirect add long + delete short' '
-+ df_test refs/df-ial-ds --sym-add --add-del foo/bar foo
-+'
-+
-+test_expect_success 'D/F conflict prevents indirect add long + indirect delete short' '
-+ df_test refs/df-ial-ids --sym-add --sym-del --add-del foo/bar foo
-+'
-+
-+test_expect_success 'D/F conflict prevents indirect add short + indirect delete long' '
-+ df_test refs/df-ias-idl --sym-add --sym-del --add-del foo foo/bar
-+'
-+
-+test_expect_success 'D/F conflict prevents indirect delete long + indirect add short' '
-+ df_test refs/df-idl-ias --sym-add --sym-del --del-add foo/bar foo
-+'
-+
-+test_expect_success 'D/F conflict prevents indirect add long + delete short packed' '
-+ df_test refs/df-ial-dsp --sym-add --pack --add-del foo/bar foo
-+'
-+
-+test_expect_success 'D/F conflict prevents indirect add long + indirect delete short packed' '
-+ df_test refs/df-ial-idsp --sym-add --sym-del --pack --add-del foo/bar foo
-+'
-+
-+test_expect_success 'D/F conflict prevents add long + indirect delete short packed' '
-+ df_test refs/df-al-idsp --sym-del --pack --add-del foo/bar foo
-+'
-+
-+test_expect_success 'D/F conflict prevents indirect delete long packed + indirect add short' '
-+ df_test refs/df-idlp-ias --sym-add --sym-del --pack --del-add foo/bar foo
-+'
-+
+test_expect_success 'non-empty directory blocks create' '
+ prefix=refs/ne-create &&
+ mkdir -p .git/$prefix/foo/bar &&
@@ t/t0600-reffiles-backend.sh (new)
+test_done ## t/t1404-update-ref-errors.sh ##
-@@ t/t1404-update-ref-errors.sh: test_update_rejected () {
- test_cmp unchanged actual
- }
-
--# Test adding and deleting D/F-conflicting references in a single
--# transaction.
--df_test() {
-- prefix="$1"
-- pack=: symadd=false symdel=false add_del=false addref= delref=
-- shift
-- while test $# -gt 0
-- do
-- case "$1" in
-- --pack)
-- pack="git pack-refs --all"
-- shift
-- ;;
-- --sym-add)
-- # Perform the add via a symbolic reference
-- symadd=true
-- shift
-- ;;
-- --sym-del)
-- # Perform the del via a symbolic reference
-- symdel=true
-- shift
-- ;;
-- --del-add)
-- # Delete first reference then add second
-- add_del=false
-- delref="$prefix/r/$2"
-- addref="$prefix/r/$3"
-- shift 3
-- ;;
-- --add-del)
-- # Add first reference then delete second
-- add_del=true
-- addref="$prefix/r/$2"
-- delref="$prefix/r/$3"
-- shift 3
-- ;;
-- *)
-- echo 1>&2 "Extra args to df_test: $*"
-- return 1
-- ;;
-- esac
-- done
-- git update-ref "$delref" $C &&
-- if $symadd
-- then
-- addname="$prefix/s/symadd" &&
-- git symbolic-ref "$addname" "$addref"
-- else
-- addname="$addref"
-- fi &&
-- if $symdel
-- then
-- delname="$prefix/s/symdel" &&
-- git symbolic-ref "$delname" "$delref"
-- else
-- delname="$delref"
-- fi &&
-- cat >expected-err <<-EOF &&
-- fatal: cannot lock ref $SQ$addname$SQ: $SQ$delref$SQ exists; cannot create $SQ$addref$SQ
-- EOF
-- $pack &&
-- if $add_del
-- then
-- printf "%s\n" "create $addname $D" "delete $delname"
-- else
-- printf "%s\n" "delete $delname" "create $addname $D"
-- fi >commands &&
-- test_must_fail git update-ref --stdin <commands 2>output.err &&
-- test_cmp expected-err output.err &&
-- printf "%s\n" "$C $delref" >expected-refs &&
-- git for-each-ref --format="%(objectname) %(refname)" $prefix/r >actual-refs &&
-- test_cmp expected-refs actual-refs
--}
--
- test_expect_success 'setup' '
-
- git commit --allow-empty -m Initial &&
@@ t/t1404-update-ref-errors.sh: test_expect_success 'one new ref is a simple prefix of another' '
'
@@ t/t1404-update-ref-errors.sh: test_expect_success 'one new ref is a simple prefi
- git update-ref --stdin
-'
-
--test_expect_success REFFILES 'D/F conflict prevents add long + delete short' '
-- df_test refs/df-al-ds --add-del foo/bar foo
--'
--
--test_expect_success REFFILES 'D/F conflict prevents add short + delete long' '
-- df_test refs/df-as-dl --add-del foo foo/bar
--'
--
--test_expect_success REFFILES 'D/F conflict prevents delete long + add short' '
-- df_test refs/df-dl-as --del-add foo/bar foo
--'
--
--test_expect_success REFFILES 'D/F conflict prevents delete short + add long' '
-- df_test refs/df-ds-al --del-add foo foo/bar
--'
--
--test_expect_success REFFILES 'D/F conflict prevents add long + delete short packed' '
-- df_test refs/df-al-dsp --pack --add-del foo/bar foo
--'
--
--test_expect_success REFFILES 'D/F conflict prevents add short + delete long packed' '
-- df_test refs/df-as-dlp --pack --add-del foo foo/bar
--'
--
--test_expect_success REFFILES 'D/F conflict prevents delete long packed + add short' '
-- df_test refs/df-dlp-as --pack --del-add foo/bar foo
--'
--
--test_expect_success REFFILES 'D/F conflict prevents delete short packed + add long' '
-- df_test refs/df-dsp-al --pack --del-add foo foo/bar
--'
--
--# Try some combinations involving symbolic refs...
--
--test_expect_success REFFILES 'D/F conflict prevents indirect add long + delete short' '
-- df_test refs/df-ial-ds --sym-add --add-del foo/bar foo
--'
--
--test_expect_success REFFILES 'D/F conflict prevents indirect add long + indirect delete short' '
-- df_test refs/df-ial-ids --sym-add --sym-del --add-del foo/bar foo
--'
--
--test_expect_success REFFILES 'D/F conflict prevents indirect add short + indirect delete long' '
-- df_test refs/df-ias-idl --sym-add --sym-del --add-del foo foo/bar
--'
--
--test_expect_success REFFILES 'D/F conflict prevents indirect delete long + indirect add short' '
-- df_test refs/df-idl-ias --sym-add --sym-del --del-add foo/bar foo
--'
--
--test_expect_success REFFILES 'D/F conflict prevents indirect add long + delete short packed' '
-- df_test refs/df-ial-dsp --sym-add --pack --add-del foo/bar foo
--'
--
--test_expect_success REFFILES 'D/F conflict prevents indirect add long + indirect delete short packed' '
-- df_test refs/df-ial-idsp --sym-add --sym-del --pack --add-del foo/bar foo
--'
--
--test_expect_success REFFILES 'D/F conflict prevents add long + indirect delete short packed' '
-- df_test refs/df-al-idsp --sym-del --pack --add-del foo/bar foo
--'
--
--test_expect_success REFFILES 'D/F conflict prevents indirect delete long packed + indirect add short' '
-- df_test refs/df-idlp-ias --sym-add --sym-del --pack --del-add foo/bar foo
--'
--
- # Test various errors when reading the old values of references...
-
- test_expect_success 'missing old value blocks update' '
+ test_expect_success REFFILES 'D/F conflict prevents add long + delete short' '
+ df_test refs/df-al-ds --add-del foo/bar foo
+ '
@@ t/t1404-update-ref-errors.sh: test_expect_success 'incorrect old value blocks indirect no-deref delete' '
test_cmp expected output.err
' 5: c2af695f551 ! 5: 42dc9948aa5 t1405: move reffiles specific tests to t0600
@@ Metadata
Author: John Cai <[email protected]>
## Commit message ##
- t1405: move reffiles specific tests to t0600
+ t1405: move reffiles specific tests to t0601
- Move this test to t0600 with other reffiles specific tests since it is
- reffiles specific in that it looks into the loose refs directory for an
- assertion.
+ Move this test to t0601 with other reffiles specific pack-refs tests
+ since it is reffiles specific in that it looks into the loose refs
+ directory for an assertion.
- ## t/t0600-reffiles-backend.sh ##
-@@ t/t0600-reffiles-backend.sh: test_expect_success 'setup' '
- E=$(git rev-parse HEAD)
+ ## t/t0601-reffiles-pack-refs.sh ##
+@@ t/t0601-reffiles-pack-refs.sh: test_expect_success 'prepare a trivial repository' '
+ HEAD=$(git rev-parse --verify HEAD)
'
+test_expect_success 'pack_refs(PACK_REFS_ALL | PACK_REFS_PRUNE)' '
@@ t/t0600-reffiles-backend.sh: test_expect_success 'setup' '
+ test -z "$N"
+'
+
- test_expect_success 'empty directory should not fool rev-parse' '
- prefix=refs/e-rev-parse &&
- git update-ref $prefix/foo $C &&
+ SHA1=
+
+ test_expect_success 'see if git show-ref works as expected' '
## t/t1405-main-ref-store.sh ##
@@ t/t1405-main-ref-store.sh: test_expect_success 'setup' '
6: 69ea950cfea = 6: 98e40a024b9 t1406: move reffiles specific tests to t0600 7: ae71747871c = 7: d93c9c410b9 t1410: move reffiles specific tests to t0600 8: 9d105263695 ! 8: 8327b12a313 t1415: move reffiles specific tests to t0600
@@ Metadata
Author: John Cai <[email protected]>
## Commit message ##
- t1415: move reffiles specific tests to t0600
+ t1415: move reffiles specific tests to t0601
- Move this test into t0600 with other reffiles specific tests since it
- checks for individua loose refs and thus is specific to the reffiles
- backend.
+ Move this test into t0601 with other reffiles pack-refs specific tests
+ since it checks for individua loose refs and thus is specific to the
+ reffiles backend.
- ## t/t0600-reffiles-backend.sh ##
-@@ t/t0600-reffiles-backend.sh: test_expect_success 'empty reflog' '
- test_must_be_empty err
+ ## t/t0601-reffiles-pack-refs.sh ##
+@@ t/t0601-reffiles-pack-refs.sh: test_expect_success SYMLINKS 'pack symlinked packed-refs' '
+ test "$(test_readlink .git/packed-refs)" = "my-deviant-packed-refs"
'
+# The 'packed-refs' file is stored directly in .git/. This means it is global
9: dcec7f10ab6 ! 9: 891a3d057d2 t1503: move reffiles specific tests to t0600
@@ Commit message
## t/t0600-reffiles-backend.sh ##
-@@ t/t0600-reffiles-backend.sh: test_expect_success 'refs/worktree must not be packed' '
- test_path_is_file .git/worktrees/wt2/refs/worktree/foo
+@@ t/t0600-reffiles-backend.sh: test_expect_success 'empty reflog' '
+ test_must_be_empty err
'
+test_expect_success SYMLINKS 'ref resolution not confused by broken symlinks' '
10: 56a9c8f20dd < -: ----------- t3903: move reffiles specific tests to t0600 -: ----------- > 10: bfd5b403170 t3903: make drop stash test ref backend agnostic 11: 39e69fde3d7 ! 11: 976be7efc89 t4202: move reffiles specific tests to t0600
@@ Commit message
## t/t0600-reffiles-backend.sh ##
-@@ t/t0600-reffiles-backend.sh: test_expect_success 'drop stash reflog updates refs/stash with rewrite' '
- test_cmp expect actual
+@@ t/t0600-reffiles-backend.sh: test_expect_success SYMLINKS 'ref resolution not confused by broken symlinks' '
+ test_must_fail git rev-parse --verify broken
'
+test_expect_success 'log diagnoses bogus HEAD hash' '
12: 316a20ed179 ! 12: 7329e87148a t5312: move reffiles specific tests to t0600
@@ Metadata
Author: John Cai <[email protected]>
## Commit message ##
- t5312: move reffiles specific tests to t0600
+ t5312: move reffiles specific tests to t0601
- Move a few tests into t0600 since they specifically test the packed-refs
+ Move a few tests into t0601 since they specifically test the packed-refs
file and thus are specific to the reffiles backend.
- ## t/t0600-reffiles-backend.sh ##
-@@ t/t0600-reffiles-backend.sh: test_expect_success 'log diagnoses bogus HEAD symref' '
- test_grep broken stderr
+ ## t/t0601-reffiles-pack-refs.sh ##
+@@ t/t0601-reffiles-pack-refs.sh: test_expect_success 'refs/worktree must not be packed' '
+ test_path_is_file .git/worktrees/wt2/refs/worktree/foo
'
+# we do not want to count on running pack-refs to
@@ t/t0600-reffiles-backend.sh: test_expect_success 'log diagnoses bogus HEAD symre
+ test_cmp expect actual
+'
+
-+test_expect_success 'pack-refs does not drop broken refs during deletion' ' ++test_expect_success 'pack-refs does not drop broken refs during deletion' '
+ git update-ref -d refs/heads/other &&
+ git rev-parse refs/heads/main >actual &&
+ test_cmp expect actual
Signature · 1 line
gitgitgadget
PATCH v2 1/12 t3210: move to t0601
From: John Cai <[email protected]>
Move t3210 to t0601, since these tests are reffiles specific in that they modify loose refs manually. This is part of the effort to categorize these tests together based on the ref backend they test. When we upstream the reftable backend, we can add more tests to t06xx. This way, all tests that test specific ref backend behavior will be grouped together.
---
t/{t3210-pack-refs.sh => t0601-reffiles-pack-refs.sh} | 6 ++++++
1 file changed, 6 insertions(+)
rename t/{t3210-pack-refs.sh => t0601-reffiles-pack-refs.sh} (98%)t/t0601-reffiles-pack-refs.sh renamed from t/t3210-pack-refs.sh +6 -0
@@ -15,6 +15,12 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh +if ! test_have_prereq REFFILES + then + skip_all='skipping reffiles specific tests' + test_done +fi + test_expect_success 'enable reflogs' ' git config core.logallrefupdates true '
Signature · 1 line
gitgitgadget
PATCH v2 2/12 remove REFFILES prerequisite for some tests in t1405 and t2017
In reply to John Cai via GitGitGadgetFrom: John Cai <[email protected]>
These tests are compatible with the reftable backend and thus do not need the REFFILES prerequisite. Even though 53af25e4
(t1405: mark test that checks existence as REFFILES, 2022-01-31) and 53af25e4 (t1405: mark test that checks existence as REFFILES, 2022-01-31) marked these tests to require REFFILES, the reftable backend in its current state does indeed work with these tests.
--- t/t1405-main-ref-store.sh | 2 +- t/t2017-checkout-orphan.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
t/t1405-main-ref-store.sh +1 -1
@@ -112,7 +112,7 @@ test_expect_success 'delete_reflog(HEAD)' ' test_must_fail git reflog exists HEAD ' -test_expect_success REFFILES 'create-reflog(HEAD)' ' +test_expect_success 'create-reflog(HEAD)' ' $RUN create-reflog HEAD && git reflog exists HEAD '
t/t2017-checkout-orphan.sh +1 -1
@@ -86,7 +86,7 @@ test_expect_success '--orphan makes reflog by default' ' git rev-parse --verify delta@{0} ' -test_expect_success REFFILES '--orphan does not make reflog when core.logAllRefUpdates = false' ' +test_expect_success '--orphan does not make reflog when core.logAllRefUpdates = false' ' git checkout main && git config core.logAllRefUpdates false && git checkout --orphan epsilon &&
Signature · 1 line
gitgitgadget
PATCH v2 3/12 t1414: convert test to use Git commands instead of writing refs manually
In reply to John Cai via GitGitGadgetFrom: John Cai <[email protected]>
This test can be re-written to use Git commands rather than writing a manual ref in the reflog. This way this test no longer needs the REFFILES prerequisite.
--- t/t1414-reflog-walk.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
t/t1414-reflog-walk.sh +5 -6
@@ -121,13 +121,12 @@ test_expect_success 'min/max age uses entry date to limit' ' # Create a situation where the reflog and ref database disagree about the latest # state of HEAD. -test_expect_success REFFILES 'walk prefers reflog to ref tip' ' +test_expect_success 'walk prefers reflog to ref tip' ' + test_commit A && + test_commit B && + git reflog delete HEAD@{0} && head=$(git rev-parse HEAD) && - one=$(git rev-parse one) && - ident="$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE" && - echo "$head $one $ident broken reflog entry" >>.git/logs/HEAD && - - echo $one >expect && + git rev-parse A >expect && git log -g --format=%H -1 >actual && test_cmp expect actual '
Signature · 1 line
gitgitgadget
PATCH v2 4/12 t1404: move reffiles specific tests to t0600
In reply to John Cai via GitGitGadgetFrom: John Cai <[email protected]>
These tests modify loose refs manually and are specific to the reffiles backend. Move these to t0600 to be part of a test suite of reffiles specific tests.
--- t/t0600-reffiles-backend.sh | 263 +++++++++++++++++++++++++++++++++++ t/t1404-update-ref-errors.sh | 237 ------------------------------- 2 files changed, 263 insertions(+), 237 deletions(-) create mode 100755 t/t0600-reffiles-backend.sh
t/t0600-reffiles-backend.sh new file +263 -0
@@ -0,0 +1,263 @@ +#!/bin/sh + +test_description='Test reffiles backend' + +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME + +TEST_PASSES_SANITIZE_LEAK=true +. ./test-lib.sh + +if ! test_have_prereq REFFILES + then + skip_all='skipping reffiles specific tests' + test_done +fi + +test_expect_success 'setup' ' + git commit --allow-empty -m Initial && + C=$(git rev-parse HEAD) && + git commit --allow-empty -m Second && + D=$(git rev-parse HEAD) && + git commit --allow-empty -m Third && + E=$(git rev-parse HEAD) +' + +test_expect_success 'empty directory should not fool rev-parse' ' + prefix=refs/e-rev-parse && + git update-ref $prefix/foo $C && + git pack-refs --all && + mkdir -p .git/$prefix/foo/bar/baz && + echo "$C" >expected && + git rev-parse $prefix/foo >actual && + test_cmp expected actual +' + +test_expect_success 'empty directory should not fool for-each-ref' ' + prefix=refs/e-for-each-ref && + git update-ref $prefix/foo $C && + git for-each-ref $prefix >expected && + git pack-refs --all && + mkdir -p .git/$prefix/foo/bar/baz && + git for-each-ref $prefix >actual && + test_cmp expected actual +' + +test_expect_success 'empty directory should not fool create' ' + prefix=refs/e-create && + mkdir -p .git/$prefix/foo/bar/baz && + printf "create %s $C\n" $prefix/foo | + git update-ref --stdin +' + +test_expect_success 'empty directory should not fool verify' ' + prefix=refs/e-verify && + git update-ref $prefix/foo $C && + git pack-refs --all && + mkdir -p .git/$prefix/foo/bar/baz && + printf "verify %s $C\n" $prefix/foo | + git update-ref --stdin +' + +test_expect_success 'empty directory should not fool 1-arg update' ' + prefix=refs/e-update-1 && + git update-ref $prefix/foo $C && + git pack-refs --all && + mkdir -p .git/$prefix/foo/bar/baz && + printf "update %s $D\n" $prefix/foo | + git update-ref --stdin +' + +test_expect_success 'empty directory should not fool 2-arg update' ' + prefix=refs/e-update-2 && + git update-ref $prefix/foo $C && + git pack-refs --all && + mkdir -p .git/$prefix/foo/bar/baz && + printf "update %s $D $C\n" $prefix/foo | + git update-ref --stdin +' + +test_expect_success 'empty directory should not fool 0-arg delete' ' + prefix=refs/e-delete-0 && + git update-ref $prefix/foo $C && + git pack-refs --all && + mkdir -p .git/$prefix/foo/bar/baz && + printf "delete %s\n" $prefix/foo | + git update-ref --stdin +' + +test_expect_success 'empty directory should not fool 1-arg delete' ' + prefix=refs/e-delete-1 && + git update-ref $prefix/foo $C && + git pack-refs --all && + mkdir -p .git/$prefix/foo/bar/baz && + printf "delete %s $C\n" $prefix/foo | + git update-ref --stdin +' + +test_expect_success 'non-empty directory blocks create' ' + prefix=refs/ne-create && + mkdir -p .git/$prefix/foo/bar && + : >.git/$prefix/foo/bar/baz.lock && + test_when_finished "rm -f .git/$prefix/foo/bar/baz.lock" && + cat >expected <<-EOF && + fatal: cannot lock ref $SQ$prefix/foo$SQ: there is a non-empty directory $SQ.git/$prefix/foo$SQ blocking reference $SQ$prefix/foo$SQ + EOF + printf "%s\n" "update $prefix/foo $C" | + test_must_fail git update-ref --stdin 2>output.err && + test_cmp expected output.err && + cat >expected <<-EOF && + fatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ + EOF + printf "%s\n" "update $prefix/foo $D $C" | + test_must_fail git update-ref --stdin 2>output.err && + test_cmp expected output.err +' + +test_expect_success 'broken reference blocks create' ' + prefix=refs/broken-create && + mkdir -p .git/$prefix && + echo "gobbledigook" >.git/$prefix/foo && + test_when_finished "rm -f .git/$prefix/foo" && + cat >expected <<-EOF && + fatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken + EOF + printf "%s\n" "update $prefix/foo $C" | + test_must_fail git update-ref --stdin 2>output.err && + test_cmp expected output.err && + cat >expected <<-EOF && + fatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken + EOF + printf "%s\n" "update $prefix/foo $D $C" | + test_must_fail git update-ref --stdin 2>output.err && + test_cmp expected output.err +' + +test_expect_success 'non-empty directory blocks indirect create' ' + prefix=refs/ne-indirect-create && + git symbolic-ref $prefix/symref $prefix/foo && + mkdir -p .git/$prefix/foo/bar && + : >.git/$prefix/foo/bar/baz.lock && + test_when_finished "rm -f .git/$prefix/foo/bar/baz.lock" && + cat >expected <<-EOF && + fatal: cannot lock ref $SQ$prefix/symref$SQ: there is a non-empty directory $SQ.git/$prefix/foo$SQ blocking reference $SQ$prefix/foo$SQ + EOF + printf "%s\n" "update $prefix/symref $C" | + test_must_fail git update-ref --stdin 2>output.err && + test_cmp expected output.err && + cat >expected <<-EOF && + fatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ + EOF + printf "%s\n" "update $prefix/symref $D $C" | + test_must_fail git update-ref --stdin 2>output.err && + test_cmp expected output.err +' + +test_expect_success 'broken reference blocks indirect create' ' + prefix=refs/broken-indirect-create && + git symbolic-ref $prefix/symref $prefix/foo && + echo "gobbledigook" >.git/$prefix/foo && + test_when_finished "rm -f .git/$prefix/foo" && + cat >expected <<-EOF && + fatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken + EOF + printf "%s\n" "update $prefix/symref $C" | + test_must_fail git update-ref --stdin 2>output.err && + test_cmp expected output.err && + cat >expected <<-EOF && + fatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken + EOF + printf "%s\n" "update $prefix/symref $D $C" | + test_must_fail git update-ref --stdin 2>output.err && + test_cmp expected output.err +' + +test_expect_success 'no bogus intermediate values during delete' ' + prefix=refs/slow-transaction && + # Set up a reference with differing loose and packed versions: + git update-ref $prefix/foo $C && + git pack-refs --all && + git update-ref $prefix/foo $D && + # Now try to update the reference, but hold the `packed-refs` lock + # for a while to see what happens while the process is blocked: + : >.git/packed-refs.lock && + test_when_finished "rm -f .git/packed-refs.lock" && + { + # Note: the following command is intentionally run in the + # background. We increase the timeout so that `update-ref` + # attempts to acquire the `packed-refs` lock for much longer + # than it takes for us to do the check then delete it: + git -c core.packedrefstimeout=30000 update-ref -d $prefix/foo & + } && + pid2=$! && + # Give update-ref plenty of time to get to the point where it tries + # to lock packed-refs: + sleep 1 && + # Make sure that update-ref did not complete despite the lock: + kill -0 $pid2 && + # Verify that the reference still has its old value: + sha1=$(git rev-parse --verify --quiet $prefix/foo || echo undefined) && + case "$sha1" in + $D) + # This is what we hope for; it means that nothing + # user-visible has changed yet. + : ;; + undefined) + # This is not correct; it means the deletion has happened + # already even though update-ref should not have been + # able to acquire the lock yet. + echo "$prefix/foo deleted prematurely" && + break + ;; + $C) + # This value should never be seen. Probably the loose + # reference has been deleted but the packed reference + # is still there: + echo "$prefix/foo incorrectly observed to be C" && + break + ;; + *) + # WTF? + echo "unexpected value observed for $prefix/foo: $sha1" && + break + ;; + esac >out && + rm -f .git/packed-refs.lock && + wait $pid2 && + test_must_be_empty out && + test_must_fail git rev-parse --verify --quiet $prefix/foo +' + +test_expect_success 'delete fails cleanly if packed-refs file is locked' ' + prefix=refs/locked-packed-refs && + # Set up a reference with differing loose and packed versions: + git update-ref $prefix/foo $C && + git pack-refs --all && + git update-ref $prefix/foo $D && + git for-each-ref $prefix >unchanged && + # Now try to delete it while the `packed-refs` lock is held: + : >.git/packed-refs.lock && + test_when_finished "rm -f .git/packed-refs.lock" && + test_must_fail git update-ref -d $prefix/foo >out 2>err && + git for-each-ref $prefix >actual && + test_grep "Unable to create $SQ.*packed-refs.lock$SQ: " err && + test_cmp unchanged actual +' + +test_expect_success 'delete fails cleanly if packed-refs.new write fails' ' + # Setup and expectations are similar to the test above. + prefix=refs/failed-packed-refs && + git update-ref $prefix/foo $C && + git pack-refs --all && + git update-ref $prefix/foo $D && + git for-each-ref $prefix >unchanged && + # This should not happen in practice, but it is an easy way to get a + # reliable error (we open with create_tempfile(), which uses O_EXCL). + : >.git/packed-refs.new && + test_when_finished "rm -f .git/packed-refs.new" && + test_must_fail git update-ref -d $prefix/foo && + git for-each-ref $prefix >actual && + test_cmp unchanged actual +' + +test_done
t/t1404-update-ref-errors.sh +0 -237
247 lines not on this page · raw message
Signature · 1 line
gitgitgadget
PATCH v2 5/12 t1405: move reffiles specific tests to t0601
In reply to John Cai via GitGitGadgetFrom: John Cai <[email protected]>
Move this test to t0601 with other reffiles specific pack-refs tests since it is reffiles specific in that it looks into the loose refs directory for an assertion.
--- t/t0601-reffiles-pack-refs.sh | 8 ++++++++ t/t1405-main-ref-store.sh | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-)
t/t0601-reffiles-pack-refs.sh +8 -0
@@ -32,6 +32,14 @@ test_expect_success 'prepare a trivial repository' ' HEAD=$(git rev-parse --verify HEAD) ' +test_expect_success 'pack_refs(PACK_REFS_ALL | PACK_REFS_PRUNE)' ' + N=`find .git/refs -type f | wc -l` && + test "$N" != 0 && + test-tool ref-store main pack-refs PACK_REFS_PRUNE,PACK_REFS_ALL && + N=`find .git/refs -type f` && + test -z "$N" +' + SHA1= test_expect_success 'see if git show-ref works as expected' '
t/t1405-main-ref-store.sh +0 -8
@@ -15,14 +15,6 @@ test_expect_success 'setup' ' test_commit one ' -test_expect_success REFFILES 'pack_refs(PACK_REFS_ALL | PACK_REFS_PRUNE)' ' - N=`find .git/refs -type f | wc -l` && - test "$N" != 0 && - $RUN pack-refs PACK_REFS_PRUNE,PACK_REFS_ALL && - N=`find .git/refs -type f` && - test -z "$N" -' - test_expect_success 'create_symref(FOO, refs/heads/main)' ' $RUN create-symref FOO refs/heads/main nothing && echo refs/heads/main >expected &&
Signature · 1 line
gitgitgadget
PATCH v2 6/12 t1406: move reffiles specific tests to t0600
In reply to John Cai via GitGitGadgetFrom: John Cai <[email protected]>
Move this test to t0600 with the rest of the tests that are specific to reffiles. This test reaches into reflog directories manually, and so are specific to reffiles.
--- t/t0600-reffiles-backend.sh | 48 +++++++++++++++++++++++++++++++++++ t/t1407-worktree-ref-store.sh | 37 --------------------------- 2 files changed, 48 insertions(+), 37 deletions(-)
t/t0600-reffiles-backend.sh +48 -0
@@ -260,4 +260,52 @@ test_expect_success 'delete fails cleanly if packed-refs.new write fails' ' test_cmp unchanged actual ' +RWT="test-tool ref-store worktree:wt" +RMAIN="test-tool ref-store worktree:main" + +test_expect_success 'setup worktree' ' + test_commit first && + git worktree add -b wt-main wt && + ( + cd wt && + test_commit second + ) +' + +# Some refs (refs/bisect/*, pseudorefs) are kept per worktree, so they should +# only appear in the for-each-reflog output if it is called from the correct +# worktree, which is exercised in this test. This test is poorly written for +# mulitple reasons: 1) it creates invalidly formatted log entres. 2) it uses +# direct FS access for creating the reflogs. 3) PSEUDO-WT and refs/bisect/random +# do not create reflogs by default, so it is not testing a realistic scenario. +test_expect_success 'for_each_reflog()' ' + echo $ZERO_OID > .git/logs/PSEUDO-MAIN && + mkdir -p .git/logs/refs/bisect && + echo $ZERO_OID > .git/logs/refs/bisect/random && + + echo $ZERO_OID > .git/worktrees/wt/logs/PSEUDO-WT && + mkdir -p .git/worktrees/wt/logs/refs/bisect && + echo $ZERO_OID > .git/worktrees/wt/logs/refs/bisect/wt-random && + + $RWT for-each-reflog | cut -d" " -f 2- | sort >actual && + cat >expected <<-\EOF && + HEAD 0x1 + PSEUDO-WT 0x0 + refs/bisect/wt-random 0x0 + refs/heads/main 0x0 + refs/heads/wt-main 0x0 + EOF + test_cmp expected actual && + + $RMAIN for-each-reflog | cut -d" " -f 2- | sort >actual && + cat >expected <<-\EOF && + HEAD 0x1 + PSEUDO-MAIN 0x0 + refs/bisect/random 0x0 + refs/heads/main 0x0 + refs/heads/wt-main 0x0 + EOF + test_cmp expected actual +' + test_done
t/t1407-worktree-ref-store.sh +0 -37
@@ -53,41 +53,4 @@ test_expect_success 'create_symref(FOO, refs/heads/main)' ' test_cmp expected actual ' -# Some refs (refs/bisect/*, pseudorefs) are kept per worktree, so they should -# only appear in the for-each-reflog output if it is called from the correct -# worktree, which is exercised in this test. This test is poorly written (and -# therefore marked REFFILES) for mulitple reasons: 1) it creates invalidly -# formatted log entres. 2) it uses direct FS access for creating the reflogs. 3) -# PSEUDO-WT and refs/bisect/random do not create reflogs by default, so it is -# not testing a realistic scenario. -test_expect_success REFFILES 'for_each_reflog()' ' - echo $ZERO_OID > .git/logs/PSEUDO-MAIN && - mkdir -p .git/logs/refs/bisect && - echo $ZERO_OID > .git/logs/refs/bisect/random && - - echo $ZERO_OID > .git/worktrees/wt/logs/PSEUDO-WT && - mkdir -p .git/worktrees/wt/logs/refs/bisect && - echo $ZERO_OID > .git/worktrees/wt/logs/refs/bisect/wt-random && - - $RWT for-each-reflog | cut -d" " -f 2- | sort >actual && - cat >expected <<-\EOF && - HEAD 0x1 - PSEUDO-WT 0x0 - refs/bisect/wt-random 0x0 - refs/heads/main 0x0 - refs/heads/wt-main 0x0 - EOF - test_cmp expected actual && - - $RMAIN for-each-reflog | cut -d" " -f 2- | sort >actual && - cat >expected <<-\EOF && - HEAD 0x1 - PSEUDO-MAIN 0x0 - refs/bisect/random 0x0 - refs/heads/main 0x0 - refs/heads/wt-main 0x0 - EOF - test_cmp expected actual -' - test_done
Signature · 1 line
gitgitgadget
PATCH v2 7/12 t1410: move reffiles specific tests to t0600
In reply to John Cai via GitGitGadgetFrom: John Cai <[email protected]>
Move these tests to t0600 with other reffiles specific tests since they do things like take a lock on an individual ref, and write directly into the reflog refs
--- t/t0600-reffiles-backend.sh | 51 +++++++++++++++++++++++++++++++++++++ t/t1410-reflog.sh | 42 ------------------------------ 2 files changed, 51 insertions(+), 42 deletions(-)
t/t0600-reffiles-backend.sh +51 -0
@@ -308,4 +308,55 @@ test_expect_success 'for_each_reflog()' ' test_cmp expected actual ' +# Triggering the bug detected by this test requires a newline to fall +# exactly BUFSIZ-1 bytes from the end of the file. We don't know +# what that value is, since it's platform dependent. However, if +# we choose some value N, we also catch any D which divides N evenly +# (since we will read backwards in chunks of D). So we choose 8K, +# which catches glibc (with an 8K BUFSIZ) and *BSD (1K). +# +# Each line is 114 characters, so we need 75 to still have a few before the +# last 8K. The 89-character padding on the final entry lines up our +# newline exactly. +test_expect_success SHA1 'parsing reverse reflogs at BUFSIZ boundaries' ' + git checkout -b reflogskip && + zf=$(test_oid zero_2) && + ident="abc <xyz> 0000000001 +0000" && + for i in $(test_seq 1 75); do + printf "$zf%02d $zf%02d %s\t" $i $(($i+1)) "$ident" && + if test $i = 75; then + for j in $(test_seq 1 89); do + printf X || return 1 + done + else + printf X + fi && + printf "\n" || return 1 + done >.git/logs/refs/heads/reflogskip && + git rev-parse reflogskip@{73} >actual && + echo ${zf}03 >expect && + test_cmp expect actual +' + +# This test takes a lock on an individual ref; this is not supported in +# reftable. +test_expect_success 'reflog expire operates on symref not referrent' ' + git branch --create-reflog the_symref && + git branch --create-reflog referrent && + git update-ref referrent HEAD && + git symbolic-ref refs/heads/the_symref refs/heads/referrent && + test_when_finished "rm -f .git/refs/heads/referrent.lock" && + touch .git/refs/heads/referrent.lock && + git reflog expire --expire=all the_symref +' + +test_expect_success 'empty reflog' ' + test_when_finished "rm -rf empty" && + git init empty && + test_commit -C empty A && + >empty/.git/logs/refs/heads/foo && + git -C empty reflog expire --all 2>err && + test_must_be_empty err +' + test_done
t/t1410-reflog.sh +0 -42
54 lines not on this page · raw message
Signature · 1 line
gitgitgadget
PATCH v2 8/12 t1415: move reffiles specific tests to t0601
In reply to John Cai via GitGitGadgetFrom: John Cai <[email protected]>
Move this test into t0601 with other reffiles pack-refs specific tests since it checks for individua loose refs and thus is specific to the reffiles backend.
--- t/t0601-reffiles-pack-refs.sh | 20 ++++++++++++++++++++ t/t1415-worktree-refs.sh | 11 ----------- 2 files changed, 20 insertions(+), 11 deletions(-)
t/t0601-reffiles-pack-refs.sh +20 -0
@@ -308,4 +308,24 @@ test_expect_success SYMLINKS 'pack symlinked packed-refs' ' test "$(test_readlink .git/packed-refs)" = "my-deviant-packed-refs" ' +# The 'packed-refs' file is stored directly in .git/. This means it is global +# to the repository, and can only contain refs that are shared across all +# worktrees. +test_expect_success 'refs/worktree must not be packed' ' + test_commit initial && + test_commit wt1 && + test_commit wt2 && + git worktree add wt1 wt1 && + git worktree add wt2 wt2 && + git checkout initial && + git update-ref refs/worktree/foo HEAD && + git -C wt1 update-ref refs/worktree/foo HEAD && + git -C wt2 update-ref refs/worktree/foo HEAD && + git pack-refs --all && + test_path_is_missing .git/refs/tags/wt1 && + test_path_is_file .git/refs/worktree/foo && + test_path_is_file .git/worktrees/wt1/refs/worktree/foo && + test_path_is_file .git/worktrees/wt2/refs/worktree/foo +' + test_done
t/t1415-worktree-refs.sh +0 -11
@@ -17,17 +17,6 @@ test_expect_success 'setup' ' git -C wt2 update-ref refs/worktree/foo HEAD ' -# The 'packed-refs' file is stored directly in .git/. This means it is global -# to the repository, and can only contain refs that are shared across all -# worktrees. -test_expect_success REFFILES 'refs/worktree must not be packed' ' - git pack-refs --all && - test_path_is_missing .git/refs/tags/wt1 && - test_path_is_file .git/refs/worktree/foo && - test_path_is_file .git/worktrees/wt1/refs/worktree/foo && - test_path_is_file .git/worktrees/wt2/refs/worktree/foo -' - test_expect_success 'refs/worktree are per-worktree' ' test_cmp_rev worktree/foo initial && ( cd wt1 && test_cmp_rev worktree/foo wt1 ) &&
Signature · 1 line
gitgitgadget
PATCH v2 9/12 t1503: move reffiles specific tests to t0600
In reply to John Cai via GitGitGadgetFrom: John Cai <[email protected]>
Move this test to t0600 with other reffiles specific tests since it checks for loose refs and is specific to the reffiles backend.
--- t/t0600-reffiles-backend.sh | 5 +++++ t/t1503-rev-parse-verify.sh | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-)
t/t0600-reffiles-backend.sh +5 -0
@@ -359,4 +359,9 @@ test_expect_success 'empty reflog' ' test_must_be_empty err ' +test_expect_success SYMLINKS 'ref resolution not confused by broken symlinks' ' + ln -s does-not-exist .git/refs/heads/broken && + test_must_fail git rev-parse --verify broken +' + test_done
t/t1503-rev-parse-verify.sh +0 -5
@@ -144,11 +144,6 @@ test_expect_success 'main@{n} for various n' ' test_must_fail git rev-parse --verify main@{$Np1} ' -test_expect_success SYMLINKS,REFFILES 'ref resolution not confused by broken symlinks' ' - ln -s does-not-exist .git/refs/heads/broken && - test_must_fail git rev-parse --verify broken -' - test_expect_success 'options can appear after --verify' ' git rev-parse --verify HEAD >expect && git rev-parse --verify -q HEAD >actual &&
Signature · 1 line
gitgitgadget
PATCH v2 10/12 t3903: make drop stash test ref backend agnostic
In reply to John Cai via GitGitGadgetFrom: John Cai <[email protected]>
In this test, the calls to cut(1) are only used to verify that the contents of the reflog entry look as expected. By replacing these with git-reflog(1) calls, we can make this test ref-backend agnostic.
--- t/t3903-stash.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
t/t3903-stash.sh +6 -6
@@ -200,7 +200,7 @@ test_expect_success 'drop stash reflog updates refs/stash' ' test_cmp expect actual ' -test_expect_success REFFILES 'drop stash reflog updates refs/stash with rewrite' ' +test_expect_success 'drop stash reflog updates refs/stash with rewrite' ' git init repo && ( cd repo &&
@@ -213,16 +213,16 @@ test_expect_success REFFILES 'drop stash reflog updates refs/stash with rewrite' new_oid="$(git -C repo rev-parse stash@{0})" && cat >expect <<-EOF && - $(test_oid zero) $old_oid - $old_oid $new_oid + $new_oid + $old_oid EOF - cut -d" " -f1-2 repo/.git/logs/refs/stash >actual && + git -C repo reflog show refs/stash --format=%H >actual && test_cmp expect actual && git -C repo stash drop stash@{1} && - cut -d" " -f1-2 repo/.git/logs/refs/stash >actual && + git -C repo reflog show refs/stash --format=%H >actual && cat >expect <<-EOF && - $(test_oid zero) $new_oid + $new_oid EOF test_cmp expect actual '
Signature · 1 line
gitgitgadget
PATCH v2 11/12 t4202: move reffiles specific tests to t0600
In reply to John Cai via GitGitGadgetFrom: John Cai <[email protected]>
Move two tests into t0600 since they write loose reflog refs manually and thus are specific to the reffiles backend.
--- t/t0600-reffiles-backend.sh | 17 +++++++++++++++++ t/t4202-log.sh | 17 ----------------- 2 files changed, 17 insertions(+), 17 deletions(-)
t/t0600-reffiles-backend.sh +17 -0
@@ -364,4 +364,21 @@ test_expect_success SYMLINKS 'ref resolution not confused by broken symlinks' ' test_must_fail git rev-parse --verify broken ' +test_expect_success 'log diagnoses bogus HEAD hash' ' + git init empty && + test_when_finished "rm -rf empty" && + echo 1234abcd >empty/.git/refs/heads/main && + test_must_fail git -C empty log 2>stderr && + test_grep broken stderr +' + +test_expect_success 'log diagnoses bogus HEAD symref' ' + git init empty && + test-tool -C empty ref-store main create-symref HEAD refs/heads/invalid.lock && + test_must_fail git -C empty log 2>stderr && + test_grep broken stderr && + test_must_fail git -C empty log --default totally-bogus 2>stderr && + test_grep broken stderr +' + test_done
t/t4202-log.sh +0 -17
@@ -2255,23 +2255,6 @@ test_expect_success 'log on empty repo fails' ' test_grep does.not.have.any.commits stderr ' -test_expect_success REFFILES 'log diagnoses bogus HEAD hash' ' - git init empty && - test_when_finished "rm -rf empty" && - echo 1234abcd >empty/.git/refs/heads/main && - test_must_fail git -C empty log 2>stderr && - test_grep broken stderr -' - -test_expect_success REFFILES 'log diagnoses bogus HEAD symref' ' - git init empty && - test-tool -C empty ref-store main create-symref HEAD refs/heads/invalid.lock && - test_must_fail git -C empty log 2>stderr && - test_grep broken stderr && - test_must_fail git -C empty log --default totally-bogus 2>stderr && - test_grep broken stderr -' - test_expect_success 'log does not default to HEAD when rev input is given' ' git log --branches=does-not-exist >actual && test_must_be_empty actual
Signature · 1 line
gitgitgadget
PATCH v2 12/12 t5312: move reffiles specific tests to t0601
In reply to John Cai via GitGitGadgetFrom: John Cai <[email protected]>
Move a few tests into t0601 since they specifically test the packed-refs file and thus are specific to the reffiles backend.
--- t/t0601-reffiles-pack-refs.sh | 30 ++++++++++++++++++++++++++++++ t/t5312-prune-corruption.sh | 26 -------------------------- 2 files changed, 30 insertions(+), 26 deletions(-)
t/t0601-reffiles-pack-refs.sh +30 -0
@@ -328,4 +328,34 @@ test_expect_success 'refs/worktree must not be packed' ' test_path_is_file .git/worktrees/wt2/refs/worktree/foo ' +# we do not want to count on running pack-refs to +# actually pack it, as it is perfectly reasonable to +# skip processing a broken ref +test_expect_success 'create packed-refs file with broken ref' ' + test_tick && git commit --allow-empty -m one && + recoverable=$(git rev-parse HEAD) && + test_tick && git commit --allow-empty -m two && + missing=$(git rev-parse HEAD) && + rm -f .git/refs/heads/main && + cat >.git/packed-refs <<-EOF && + $missing refs/heads/main + $recoverable refs/heads/other + EOF + echo $missing >expect && + git rev-parse refs/heads/main >actual && + test_cmp expect actual +' + +test_expect_success 'pack-refs does not silently delete broken packed ref' ' + git pack-refs --all --prune && + git rev-parse refs/heads/main >actual && + test_cmp expect actual +' + +test_expect_success 'pack-refs does not drop broken refs during deletion' ' + git update-ref -d refs/heads/other && + git rev-parse refs/heads/main >actual && + test_cmp expect actual +' + test_done
t/t5312-prune-corruption.sh +0 -26
@@ -111,30 +111,4 @@ test_expect_success 'pack-refs does not silently delete broken loose ref' ' test_cmp expect actual ' -# we do not want to count on running pack-refs to -# actually pack it, as it is perfectly reasonable to -# skip processing a broken ref -test_expect_success REFFILES 'create packed-refs file with broken ref' ' - rm -f .git/refs/heads/main && - cat >.git/packed-refs <<-EOF && - $missing refs/heads/main - $recoverable refs/heads/other - EOF - echo $missing >expect && - git rev-parse refs/heads/main >actual && - test_cmp expect actual -' - -test_expect_success REFFILES 'pack-refs does not silently delete broken packed ref' ' - git pack-refs --all --prune && - git rev-parse refs/heads/main >actual && - test_cmp expect actual -' - -test_expect_success REFFILES 'pack-refs does not drop broken refs during deletion' ' - git update-ref -d refs/heads/other && - git rev-parse refs/heads/main >actual && - test_cmp expect actual -' - test_done
Signature · 1 line
gitgitgadget
Re: [PATCH v2 01/12] t3210: move to t0601
In reply to John Cai via GitGitGadgetQuoted 23 lines · John Cai via GitGitGadget
From: John Cai <[email protected]>
Move t3210 to t0601, since these tests are reffiles specific in that they modify loose refs manually. This is part of the effort to categorize these tests together based on the ref backend they test. When we upstream the reftable backend, we can add more tests to t06xx. This way, all tests that test specific ref backend behavior will be grouped together.
Signed-off-by John Cai <[email protected]>--- t/{t3210-pack-refs.sh => t0601-reffiles-pack-refs.sh} | 6 ++++++ 1 file changed, 6 insertions(+) rename t/{t3210-pack-refs.sh => t0601-reffiles-pack-refs.sh} (98%)t/t0601-reffiles-pack-refs.sh renamed from t/t3210-pack-refs.sh +0
-0
t/t0601-reffiles-pack-refs.sh export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME · line 22
Quoted 8 lines
t/t0601-reffiles-pack-refs.sh renamed from t/t3210-pack-refs.sh +5
-0@@ -15,6 +15,12 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh +if ! test_have_prereq REFFILES + then + skip_all='skipping reffiles specific tests' + test_done +fi
Indentation here is off as we do not typically ident the then. So this should rather look like the following:
if ! test_have_prereq REFFILES
then
skip_all='skipping reffiles specific tests' test_done
fi
Patrick
Re: [PATCH v2 04/12] t1404: move reffiles specific tests to t0600
In reply to John Cai via GitGitGadgetQuoted 24 lines · John Cai via GitGitGadget
From: John Cai <[email protected]>
These tests modify loose refs manually and are specific to the reffiles backend. Move these to t0600 to be part of a test suite of reffiles specific tests.
Signed-off-by John Cai <[email protected]>--- t/t0600-reffiles-backend.sh | 263 +++++++++++++++++++++++++++++++++++ t/t1404-update-ref-errors.sh | 237 ------------------------------- 2 files changed, 263 insertions(+), 237 deletions(-) create mode 100755 t/t0600-reffiles-backend.sht/t0600-reffiles-backend.sh new file +5
-0@@ -0,0 +1,263 @@ +#!/bin/sh + +test_description='Test reffiles backend' + +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
t/t0600-reffiles-backend.sh line 15
Quoted 10 lines
t/t0600-reffiles-backend.sh new file +10
-0+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME + +TEST_PASSES_SANITIZE_LEAK=true +. ./test-lib.sh + +if ! test_have_prereq REFFILES + then + skip_all='skipping reffiles specific tests' + test_done +fi
Same issue here, indentation is off.
Patrick
Quoted 13 lines · John Cai via GitGitGadget
This series groups REFFILES specific tests together. These tests are currently grouped together across the test suite based on functionality. However, since they exercise low-level behavior specific to the refs backend being used (in these cases, the ref-files backend), group them together based on which refs backend they test. This way, in the near future when the reftables backend gets upstreamed we can add tests that exercise the reftables backend close by in the t06xx area.
These patches also remove the REFFILES prerequisite, since all the tests in t06xx are reffiles specific. In the near future, once the reftable backend is upstreamed, all the tests in t06xx will be forced to run with the reffiles backend.
Quoted 6 lines
Changes since V1:
* Moved some pack-refs tests to t0601 instead of t0600
* Clarified some commit messages
* Converted a test to be refs-backend agnostic
* Other minor rearranging of tests
I've got two minor nits, but other than that this looks good to me. I've also verified that all tests continue to pass with the current version of the reftable backend.
There's a minor merge conflict with db4192c364 (t: mark tests regarding git-pack-refs(1) to be backend specific, 2024-01-10). This conflict comes from the fact that both patch series add the REFFILES prereq to t3210, semantically the changes are the same. So it doesn't quite matter which of both versions we retain as they both do the same.
Patrick
Re: [PATCH v2 07/12] t1410: move reffiles specific tests to t0600
In reply to John Cai via GitGitGadgetQuoted 6 lines · John Cai via GitGitGadget
From: John Cai <[email protected]>
Move these tests to t0600 with other reffiles specific tests since they do things like take a lock on an individual ref, and write directly into the reflog refs
Nit: missing period.
Re: [PATCH v2 08/12] t1415: move reffiles specific tests to t0601
In reply to John Cai via GitGitGadgetQuoted 4 lines · John Cai via GitGitGadget
From: John Cai <[email protected]>
Move this test into t0601 with other reffiles pack-refs specific tests since it checks for individua loose refs and thus is specific to the
Nit: s/individua/individual
Quoted 3 lines · Patrick Steinhardt
I've got two minor nits, but other than that this looks good to me. I've also verified that all tests continue to pass with the current version of the reftable backend.
OK. I've squashed all the nits from you and Karthik into the copy in my tree. If there is nothing else, let's declare a victory and merge the topic down to 'next' soonish.
Quoted 5 lines
There's a minor merge conflict with
db4192c364(t: mark tests regarding git-pack-refs(1) to be backend specific, 2024-01-10). This conflict comes from the fact that both patch series add the REFFILES prereq to t3210, semantically the changes are the same. So it doesn't quite matter which of both versions we retain as they both do the same.
Yup, that is what I've been resolving them.
Thanks.
Hi Junio,
Quoted 9 lines · Junio C Hamano
Quoted 3 lines · Patrick Steinhardt
I've got two minor nits, but other than that this looks good to me. I've also verified that all tests continue to pass with the current version of the reftable backend.
OK. I've squashed all the nits from you and Karthik into the copy in my tree. If there is nothing else, let's declare a victory and merge the topic down to 'next' soonish.
Thank you for doing these tedious corrections!
Quoted 10 lines
Quoted 6 lines
There's a minor merge conflict with
db4192c364(t: mark tests regarding git-pack-refs(1) to be backend specific, 2024-01-10). This conflict comes from the fact that both patch series add the REFFILES prereq to t3210, semantically the changes are the same. So it doesn't quite matter which of both versions we retain as they both do the same.Yup, that is what I've been resolving them.
Thanks.
thanks
John