git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 0/9] t: reduce direct disk access to data structures

From
Patrick Steinhardt <ps@pks.im>
Date
Nov 2, 2023, 08:46 UTC
Message-ID
<cover.1698914571.git.ps@pks.im>
In-Reply-To
<cover.1697607222.git.ps@pks.im>
Hi,

this is the third version of my patch series that aims to reduce access to on-disk data structures in favor of using plumbing tools where possible.

There are no changes compared to v2 except for a rebase on top of 0497e6c611 (t: use git-show-ref(1) to check for ref existence, 2023-10-31), which has been merged to "next" now and conflicts with this patch series.

Patrick
Patrick Steinhardt (9):
  t: allow skipping expected object ID in `ref-store update-ref`
  t: convert tests to not write references via the filesystem
  t: convert tests to not access symrefs via the filesystem
  t: convert tests to not access reflog via the filesystem
  t1450: convert tests to remove worktrees via git-worktree(1)
  t4207: delete replace references via git-update-ref(1)
  t7300: assert exact states of repo
  t7900: assert the absence of refs via git-for-each-ref(1)
  t: mark several tests that assume the files backend with REFFILES
 t/helper/test-ref-store.c          | 11 ++++---
 t/t1400-update-ref.sh              | 50 ++++++++++++++++--------------
 t/t1430-bad-ref-name.sh            | 12 +++----
 t/t1450-fsck.sh                    | 44 +++++++++++++-------------
 t/t2011-checkout-invalid-head.sh   | 16 +++++-----
 t/t3200-branch.sh                  | 41 ++++++++++++------------
 t/t3400-rebase.sh                  |  2 +-
 t/t3404-rebase-interactive.sh      |  2 +-
 t/t4013-diff-various.sh            |  2 +-
 t/t4202-log.sh                     |  2 +-
 t/t4207-log-decoration-colors.sh   | 10 ++++--
 t/t5526-fetch-submodules.sh        |  2 +-
 t/t5605-clone-local.sh             |  4 +--
 t/t5702-protocol-v2.sh             | 24 ++++++++++----
 t/t7300-clean.sh                   | 23 ++++++++------
 t/t7900-maintenance.sh             |  3 +-
 t/t9133-git-svn-nested-git-repo.sh |  2 +-
 17 files changed, 142 insertions(+), 108 deletions(-)
Range-diff against v2:
 1:  c868198f8c1 =  1:  3caf9e3f28f t: allow skipping expected object ID in `ref-store update-ref`
 2:  4c0939d868e =  2:  1884b7006cf t: convert tests to not write references via the filesystem
 3:  048583ed2c3 !  3:  d6307177132 t: convert tests to not access symrefs via the filesystem
    @@ t/t1430-bad-ref-name.sh: test_expect_success 'update-ref -d can delete broken na
     -	printf "ref: refs/heads/main\n" >.git/refs/heads/broken...symref &&
     +	test-tool ref-store main create-symref refs/heads/broken...symref refs/heads/main &&
      	test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...symref" &&
    + 	test_ref_exists refs/heads/broken...symref &&
      	git update-ref --no-deref -d refs/heads/broken...symref >output 2>error &&
    - 	test_path_is_missing .git/refs/heads/broken...symref &&
     @@ t/t1430-bad-ref-name.sh: test_expect_success 'update-ref --no-deref -d can delete symref with broken name
      '
      
    @@ t/t1430-bad-ref-name.sh: test_expect_success 'update-ref --no-deref -d can delet
     -	printf "ref: refs/heads/main\n" >.git/refs/heads/broken...symref &&
     +	test-tool ref-store main create-symref refs/heads/broken...symref refs/heads/main &&
      	test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...symref" &&
    + 	test_ref_exists refs/heads/broken...symref &&
      	git branch -d broken...symref >output 2>error &&
    - 	test_path_is_missing .git/refs/heads/broken...symref &&
     @@ t/t1430-bad-ref-name.sh: test_expect_success 'branch -d can delete symref with broken name' '
      '
      
    @@ t/t1430-bad-ref-name.sh: test_expect_success 'branch -d can delete symref with b
     -	printf "ref: refs/heads/idonotexist\n" >.git/refs/heads/broken...symref &&
     +	test-tool ref-store main create-symref refs/heads/broken...symref refs/heads/idonotexist &&
      	test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...symref" &&
    + 	test_ref_exists refs/heads/broken...symref &&
      	git update-ref --no-deref -d refs/heads/broken...symref >output 2>error &&
    - 	test_path_is_missing .git/refs/heads/broken...symref &&
     @@ t/t1430-bad-ref-name.sh: test_expect_success 'update-ref --no-deref -d can delete dangling symref with br
      '
      
    @@ t/t1430-bad-ref-name.sh: test_expect_success 'update-ref --no-deref -d can delet
     -	printf "ref: refs/heads/idonotexist\n" >.git/refs/heads/broken...symref &&
     +	test-tool ref-store main create-symref refs/heads/broken...symref refs/heads/idonotexist &&
      	test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...symref" &&
    + 	test_ref_exists refs/heads/broken...symref &&
      	git branch -d broken...symref >output 2>error &&
    - 	test_path_is_missing .git/refs/heads/broken...symref &&
     
      ## t/t1450-fsck.sh ##
     @@ t/t1450-fsck.sh: test_expect_success 'HEAD link pointing at a funny object' '
    @@ t/t3200-branch.sh: test_expect_success 'git branch -M should leave orphaned HEAD
     +		git symbolic-ref HEAD >expect &&
     +		echo refs/heads/lonely >actual &&
     +		test_cmp expect actual &&
    - 		test_path_is_missing .git/refs/head/lonely &&
    + 		test_ref_missing refs/head/lonely &&
      		git branch -M main mistress &&
     -		grep lonely .git/HEAD
     +		git symbolic-ref HEAD >expect &&
    @@ t/t3200-branch.sh: test_expect_success 'deleting a symref' '
     +	git symbolic-ref --no-recurse refs/heads/dangling-symref &&
      	echo "Deleted branch dangling-symref (was nowhere)." >expect &&
      	git branch -d dangling-symref >actual &&
    - 	test_path_is_missing .git/refs/heads/dangling-symref &&
    + 	test_ref_missing refs/heads/dangling-symref &&
     
      ## t/t4013-diff-various.sh ##
     @@ t/t4013-diff-various.sh: test_expect_success 'log -S requires an argument' '
 4:  5e7937e7904 !  4:  fdf67689227 t: convert tests to not access reflog via the filesystem
    @@ t/t3200-branch.sh: test_expect_success 'git branch HEAD should fail' '
      test_expect_success 'git branch --create-reflog d/e/f should create a branch and a log' '
      	GIT_COMMITTER_DATE="2005-05-26 23:30" \
      	git -c core.logallrefupdates=false branch --create-reflog d/e/f &&
    - 	test_path_is_file .git/refs/heads/d/e/f &&
    + 	test_ref_exists refs/heads/d/e/f &&
     -	test_path_is_file .git/logs/refs/heads/d/e/f &&
     -	test_cmp expect .git/logs/refs/heads/d/e/f
     +	git reflog show --no-abbrev-commit refs/heads/d/e/f >actual &&
    @@ t/t3200-branch.sh: test_expect_success '--set-upstream-to notices an error to se
      test_expect_success 'git checkout -b g/h/i -l should create a branch and a log' '
      	GIT_COMMITTER_DATE="2005-05-26 23:30" \
      	git checkout -b g/h/i -l main &&
    - 	test_path_is_file .git/refs/heads/g/h/i &&
    + 	test_ref_exists refs/heads/g/h/i &&
     -	test_path_is_file .git/logs/refs/heads/g/h/i &&
     -	test_cmp expect .git/logs/refs/heads/g/h/i
     +	git reflog show --no-abbrev-commit refs/heads/g/h/i >actual &&
 5:  089565a358e =  5:  a5d55b68828 t1450: convert tests to remove worktrees via git-worktree(1)
 6:  cb738888ed7 =  6:  3213d45b537 t4207: delete replace references via git-update-ref(1)
 7:  e730e011de4 =  7:  36e79f266c2 t7300: assert exact states of repo
 8:  a1bdea52397 =  8:  4af0dc00165 t7900: assert the absence of refs via git-for-each-ref(1)
 9:  497e43ae5c3 !  9:  9fc039a1764 t: mark several tests that assume the files backend with REFFILES
    @@ t/t2011-checkout-invalid-head.sh: test_expect_success 'create ref directory/file
     
      ## t/t3200-branch.sh ##
     @@ t/t3200-branch.sh: test_expect_success 'git branch --help should not have created a bogus branch' '
    - 	test_path_is_missing .git/refs/heads/--help
    + 	test_ref_missing refs/heads/--help
      '
      
     -test_expect_success 'branch -h in broken repository' '
    @@ t/t3200-branch.sh: test_expect_success 'git branch -M baz bam should succeed whe
      	git worktree add -f bazdir2 baz &&
      	touch .git/worktrees/bazdir1/HEAD.lock &&
     @@ t/t3200-branch.sh: test_expect_success 'renaming a symref is not allowed' '
    - 	test_path_is_missing .git/refs/heads/new-topic
    + 	test_ref_missing refs/heads/new-topic
      '
      
     -test_expect_success SYMLINKS 'git branch -m u v should fail when the reflog for u is a symlink' '
base-commit: 0497e6c61172faabf412e013f2fc30a05054a46d
-- 
2.42.0
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 50 of 59 in “t: reduce direct disk access to data structures”
  1. 00/11 t: reduce direct disk access to data structuresPatrick Steinhardt, Oct 18, 2023
  2. 01/11 t: add helpers to test for reference existencePatrick Steinhardt, Oct 18, 2023
  3. Junio C HamanoOct 18, 2023
  4. Patrick SteinhardtOct 23, 2023
  5. Eric SunshineOct 18, 2023
  6. Patrick SteinhardtOct 23, 2023
  7. 02/11 t: allow skipping expected object ID in `ref-store update-ref`Patrick Steinhardt, Oct 18, 2023
  8. Junio C HamanoOct 18, 2023
  9. Patrick SteinhardtOct 23, 2023
  10. Junio C HamanoOct 23, 2023
  11. 03/11 t: convert tests to use helpers for reference existencePatrick Steinhardt, Oct 18, 2023
  12. Junio C HamanoOct 18, 2023
  13. 04/11 t: convert tests to not write references via the filesystemPatrick Steinhardt, Oct 18, 2023
  14. Junio C HamanoOct 18, 2023
  15. Patrick SteinhardtOct 23, 2023
  16. Junio C HamanoOct 23, 2023
  17. Junio C HamanoOct 18, 2023
  18. Patrick SteinhardtOct 23, 2023
  19. 05/11 t: convert tests to not access symrefs via the filesystemPatrick Steinhardt, Oct 18, 2023
  20. Junio C HamanoOct 20, 2023
  21. 06/11 t: convert tests to not access reflog via the filesystemPatrick Steinhardt, Oct 18, 2023
  22. Junio C HamanoOct 21, 2023
  23. 07/11 t1450: convert tests to remove worktrees via git-worktree(1)Patrick Steinhardt, Oct 18, 2023
  24. 08/11 t4207: delete replace references via git-update-ref(1)Patrick Steinhardt, Oct 18, 2023
  25. Han-Wen NienhuysOct 18, 2023
  26. Patrick SteinhardtOct 23, 2023
  27. Taylor BlauOct 23, 2023
  28. Patrick SteinhardtOct 24, 2023
  29. 09/11 t7300: assert exact states of repoPatrick Steinhardt, Oct 18, 2023
  30. 10/11 t7900: assert the absence of refs via git-for-each-ref(1)Patrick Steinhardt, Oct 18, 2023
  31. 11/11 t: mark several tests that assume the files backend with REFFILESPatrick Steinhardt, Oct 18, 2023
  32. Patrick SteinhardtOct 18, 2023
  33. Junio C HamanoOct 18, 2023
  34. Patrick SteinhardtOct 23, 2023
  35. Junio C HamanoOct 18, 2023
  36. Han-Wen NienhuysOct 19, 2023
  37. Junio C HamanoOct 19, 2023
  38. Patrick SteinhardtOct 23, 2023
  39. 0/9 t: reduce direct disk access to data structuresPatrick Steinhardt, Oct 24, 2023
  40. 1/9 t: allow skipping expected object ID in `ref-store update-ref`Patrick Steinhardt, Oct 24, 2023
  41. 2/9 t: convert tests to not write references via the filesystemPatrick Steinhardt, Oct 24, 2023
  42. 3/9 t: convert tests to not access symrefs via the filesystemPatrick Steinhardt, Oct 24, 2023
  43. 4/9 t: convert tests to not access reflog via the filesystemPatrick Steinhardt, Oct 24, 2023
  44. 5/9 t1450: convert tests to remove worktrees via git-worktree(1)Patrick Steinhardt, Oct 24, 2023
  45. Eric SunshineOct 27, 2023
  46. 6/9 t4207: delete replace references via git-update-ref(1)Patrick Steinhardt, Oct 24, 2023
  47. 7/9 t7300: assert exact states of repoPatrick Steinhardt, Oct 24, 2023
  48. 8/9 t7900: assert the absence of refs via git-for-each-ref(1)Patrick Steinhardt, Oct 24, 2023
  49. 9/9 t: mark several tests that assume the files backend with REFFILESPatrick Steinhardt, Oct 24, 2023
  50. 0/9 t: reduce direct disk access to data structuresPatrick Steinhardt, Nov 2, 2023
  51. 1/9 t: allow skipping expected object ID in `ref-store update-ref`Patrick Steinhardt, Nov 2, 2023
  52. 2/9 t: convert tests to not write references via the filesystemPatrick Steinhardt, Nov 2, 2023
  53. 3/9 t: convert tests to not access symrefs via the filesystemPatrick Steinhardt, Nov 2, 2023
  54. 4/9 t: convert tests to not access reflog via the filesystemPatrick Steinhardt, Nov 2, 2023
  55. 5/9 t1450: convert tests to remove worktrees via git-worktree(1)Patrick Steinhardt, Nov 2, 2023
  56. 6/9 t4207: delete replace references via git-update-ref(1)Patrick Steinhardt, Nov 2, 2023
  57. 7/9 t7300: assert exact states of repoPatrick Steinhardt, Nov 2, 2023
  58. 8/9 t7900: assert the absence of refs via git-for-each-ref(1)Patrick Steinhardt, Nov 2, 2023
  59. 9/9 t: mark several tests that assume the files backend with REFFILESPatrick Steinhardt, Nov 2, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.