diff mbox series

t1404: mark directory/file conflict tests with REFFILES

Message ID pull.1148.git.git.1637855828856.gitgitgadget@gmail.com (mailing list archive)
State Superseded
Headers show
Series t1404: mark directory/file conflict tests with REFFILES | expand

Commit Message

Han-Wen Nienhuys Nov. 25, 2021, 3:57 p.m. UTC
From: Han-Wen Nienhuys <hanwen@google.com>

The files backend uses file system locking on individual refs, which means a
directory/file conflict can prevent locks being taken. For example, in a repo
with just the ref "foo", an update

    (DELETE "foo") + (ADD "foo/bar")

cannot be executed in the files backend, as one cannot take a lock on foo/bar.

The result is a repo with just "foo/bar", which has no directory/file conflict,
and this is a valid transaction in reftable.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
---
    t1404: mark directory/file conflict tests with REFFILES
    
    The files backend uses file system locking on individual refs, which
    means a directory/file conflict can prevent locks being taken. For
    example, in a repo with just the ref "foo", an update
    
    (DELETE "foo") + (ADD "foo/bar")
    
    
    cannot be executed in the files backend, as one cannot take a lock on
    foo/bar.
    
    The result is a repo with just "foo/bar", which has no directory/file
    conflict, and this is a valid transaction in reftable.
    
    Signed-off-by: Han-Wen Nienhuys hanwen@google.com

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1148%2Fhanwen%2Ft1404-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1148/hanwen/t1404-v1
Pull-Request: https://github.com/git/git/pull/1148

 t/t1404-update-ref-errors.sh | 40 +++++++++++++++++++++---------------
 1 file changed, 24 insertions(+), 16 deletions(-)


base-commit: 35151cf0720460a897cde9b8039af364743240e7

Comments

Junio C Hamano Nov. 26, 2021, 7:39 a.m. UTC | #1
"Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com> writes:

> -test_expect_success 'D/F conflict prevents add long + delete short' '
> +test_expect_success REFFILES  'D/F conflict prevents add long + delete short' '

Two spaces after REFFILES here but ...

>  	df_test refs/df-al-ds --add-del foo/bar foo
>  '
>  
> -test_expect_success 'D/F conflict prevents add short + delete long' '
> +test_expect_success REFFILES 'D/F conflict prevents add short + delete long' '

... only one space here and then ...

>  	df_test refs/df-as-dl --add-del foo foo/bar
>  '
>  
> -test_expect_success 'D/F conflict prevents delete long + add short' '
> +test_expect_success REFFILES  'D/F conflict prevents delete long + add short' '

... two spaces here?  Let's be consistent.

>  	df_test refs/df-dl-as --del-add foo/bar foo
>  '

As all these df_test instances _expect_ to fail, not causing any
changes in the refs, I think skipping them would hopefully not
reveal unpleasant reliance of side effects by later tests.

And presumably, without REFFILES prerequisite, these operations
would be supported?  E.g. we can have 'main' branch, with 'main/1',
'main/2',... refs, at the same time, with reftable?  That would be
quite interesting.
Han-Wen Nienhuys Nov. 29, 2021, 10:57 a.m. UTC | #2
On Fri, Nov 26, 2021 at 8:39 AM Junio C Hamano <gitster@pobox.com> wrote:

> And presumably, without REFFILES prerequisite, these operations
> would be supported?  E.g. we can have 'main' branch, with 'main/1',
> 'main/2',... refs, at the same time, with reftable?  That would be
> quite interesting.

The storage format allows D/F conflicts, but transactions are checked
for not creating new D/F conflicts (depending on
the value of reftable_write_options.skip_name_check).
Junio C Hamano Nov. 29, 2021, 5:59 p.m. UTC | #3
Han-Wen Nienhuys <hanwen@google.com> writes:

> On Fri, Nov 26, 2021 at 8:39 AM Junio C Hamano <gitster@pobox.com> wrote:
>
>> And presumably, without REFFILES prerequisite, these operations
>> would be supported?  E.g. we can have 'main' branch, with 'main/1',
>> 'main/2',... refs, at the same time, with reftable?  That would be
>> quite interesting.
>
> The storage format allows D/F conflicts, but transactions are checked
> for not creating new D/F conflicts (depending on
> the value of reftable_write_options.skip_name_check).

OK.  Then once we let reffiles wither and die over time, hopefully
we can flip the bit and allow us to be in an interesting world ;-)

Nice.
diff mbox series

Patch

diff --git a/t/t1404-update-ref-errors.sh b/t/t1404-update-ref-errors.sh
index b729c1f4803..fe7b6447cae 100755
--- a/t/t1404-update-ref-errors.sh
+++ b/t/t1404-update-ref-errors.sh
@@ -261,69 +261,77 @@  test_expect_success REFFILES 'empty directory should not fool 1-arg delete' '
 	git update-ref --stdin
 '
 
-test_expect_success 'D/F conflict prevents add long + delete short' '
+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 'D/F conflict prevents add short + delete long' '
+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 'D/F conflict prevents delete long + add short' '
+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 'D/F conflict prevents delete short + add long' '
+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 'D/F conflict prevents add long + delete short packed' '
+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 'D/F conflict prevents add short + delete long packed' '
+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 'D/F conflict prevents delete long packed + add short' '
+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 'D/F conflict prevents delete short packed + add long' '
+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 'D/F conflict prevents indirect add long + delete short' '
+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 'D/F conflict prevents indirect add long + indirect delete short' '
+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 + 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 'D/F conflict prevents indirect add short + indirect delete long' '
+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 'D/F conflict prevents indirect delete long + indirect add short' '
+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 'D/F conflict prevents indirect add long + delete short packed' '
+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 'D/F conflict prevents indirect add long + indirect delete short packed' '
+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 'D/F conflict prevents add long + indirect delete short packed' '
+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 'D/F conflict prevents indirect delete long packed + indirect add short' '
+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
 '