Merge branch 'ar/test-cleanup-unused-file-creation'

Test clean-up.

* ar/test-cleanup-unused-file-creation:
  t1507: assert output of rev-parse
  t1404: don't create unused file
  t1400: assert output of update-ref
  t1302: don't create unused file
  t1010: don't create unused files
  t1006: assert error output of cat-file
  t1005: assert output of ls-files
This commit is contained in:
Junio C Hamano 2023-04-04 14:28:29 -07:00
commit 45602dd029
7 changed files with 22 additions and 12 deletions

View File

@ -41,7 +41,8 @@ test_expect_success 'reset should remove remnants from a failed merge' '
git ls-files -s &&
read_tree_u_must_succeed --reset -u HEAD &&
git ls-files -s >actual &&
! test -f old
! test -f old &&
test_cmp expect actual
'
test_expect_success 'two-way reset should remove remnants too' '
@ -56,7 +57,8 @@ test_expect_success 'two-way reset should remove remnants too' '
git ls-files -s &&
read_tree_u_must_succeed --reset -u HEAD HEAD &&
git ls-files -s >actual &&
! test -f old
! test -f old &&
test_cmp expect actual
'
test_expect_success 'Porcelain reset should remove remnants too' '
@ -71,7 +73,8 @@ test_expect_success 'Porcelain reset should remove remnants too' '
git ls-files -s &&
git reset --hard &&
git ls-files -s >actual &&
! test -f old
! test -f old &&
test_cmp expect actual
'
test_expect_success 'Porcelain checkout -f should remove remnants too' '
@ -86,7 +89,8 @@ test_expect_success 'Porcelain checkout -f should remove remnants too' '
git ls-files -s &&
git checkout -f &&
git ls-files -s >actual &&
! test -f old
! test -f old &&
test_cmp expect actual
'
test_expect_success 'Porcelain checkout -f HEAD should remove remnants too' '
@ -101,7 +105,8 @@ test_expect_success 'Porcelain checkout -f HEAD should remove remnants too' '
git ls-files -s &&
git checkout -f HEAD &&
git ls-files -s >actual &&
! test -f old
! test -f old &&
test_cmp expect actual
'
test_done

View File

@ -603,7 +603,8 @@ do
fatal: Not a valid object name $(test_oid deadbeef_short)
EOF
test_must_fail git cat-file $arg1 $arg2 $(test_oid deadbeef_short) >out 2>err.actual &&
test_must_be_empty out
test_must_be_empty out &&
test_cmp expect.err err.actual
'
test_expect_success "cat-file $arg1 $arg2 error on missing full OID" '

View File

@ -60,11 +60,11 @@ test_expect_success 'allow missing object with --missing' '
'
test_expect_success 'mktree refuses to read ls-tree -r output (1)' '
test_must_fail git mktree <all >actual
test_must_fail git mktree <all
'
test_expect_success 'mktree refuses to read ls-tree -r output (2)' '
test_must_fail git mktree <all.withsub >actual
test_must_fail git mktree <all.withsub
'
test_done

View File

@ -37,7 +37,7 @@ test_expect_success 'gitdir selection on normal repos' '
test_expect_success 'gitdir selection on unsupported repo' '
# Make sure it would stop at test2, not trash
test_expect_code 1 git -C test2 config core.repositoryformatversion >actual
test_expect_code 1 git -C test2 config core.repositoryformatversion
'
test_expect_success 'gitdir not required mode' '

View File

@ -1568,6 +1568,7 @@ test_expect_success 'transaction can create and delete' '
EOF
git update-ref --stdin <stdin >actual &&
printf "%s: ok\n" start commit start commit >expect &&
test_cmp expect actual &&
test_must_fail git show-ref --verify refs/heads/create-and-delete
'
@ -1595,6 +1596,8 @@ test_expect_success 'transaction cannot restart ongoing transaction' '
commit
EOF
test_must_fail git update-ref --stdin <stdin >actual &&
printf "%s: ok\n" start >expect &&
test_cmp expect actual &&
test_must_fail git show-ref --verify refs/heads/restart
'

View File

@ -551,7 +551,6 @@ test_expect_success REFFILES 'no bogus intermediate values during delete' '
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 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 &&

View File

@ -263,7 +263,8 @@ test_expect_success '@{reflog}-parsing does not look beyond colon' '
git add @{yesterday} &&
git commit -m "funny reflog file" &&
git hash-object @{yesterday} >expect &&
git rev-parse HEAD:@{yesterday} >actual
git rev-parse HEAD:@{yesterday} >actual &&
test_cmp expect actual
'
test_expect_success '@{upstream}-parsing does not look beyond colon' '
@ -271,7 +272,8 @@ test_expect_success '@{upstream}-parsing does not look beyond colon' '
git add @{upstream} &&
git commit -m "funny upstream file" &&
git hash-object @{upstream} >expect &&
git rev-parse HEAD:@{upstream} >actual
git rev-parse HEAD:@{upstream} >actual &&
test_cmp expect actual
'
test_done