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

[PATCH v2 0/7] tests: don't depend on "git init" using the template

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jun 3, 2022, 11:15 UTC
Message-ID
<cover-v2-0.7-00000000000-20220603T110506Z-avarab@gmail.com>
In-Reply-To
<cover-00.13-00000000000-20211212T201308Z-avarab@gmail.com>

This reduced-in-scope re-roll of [1] changes those tests that implicitly relied on the existence of the default "git init" template to no longer do so. This makes the intent of the tests more explicit, e.g. in the case of the .git/branch directory.

Parts of the v1 were already split up, re-rolled and merged as a5bf611cc4f (Merge branch 'ab/hook-tests-updates', 2022-03-30).

Future goals: I then have a local topic on top of this to add the "--no-template" option to "git init", and to have the test suite run in that mode by default, that's currently one of the blockers for making the test run without the bin-wrappers[2], which as noted in [3] leaves us with some blind spots in our tests.

But for now this is all relatively straightforward conversion of existing tests to make them not rely on "git init" giving them a template, which they opt-in to with a new TEST_CREATE_REPO_NO_TEMPLATE variable.

Junio: There's a trivial conflict in one of the tests with "next",
i.e.:
	diff --cc t/t6101-rev-parse-parents.sh
	index 5f55ab98d35,a3a41c7a3e4..00000000000
	--- a/t/t6101-rev-parse-parents.sh
	+++ b/t/t6101-rev-parse-parents.sh
	@@@ -8,7 -8,7 +8,11 @@@ test_description='Test git rev-parse wi
	  GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
	  export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
	++<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< HEAD
	 +TEST_CREATE_REPO_NO_TEMPLATE=1
	++================================
	+ TEST_PASSES_SANITIZE_LEAK=true
	++>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> origin/seen
The resolution is to keep both sides, i.e. to end up with:
	TEST_CREATE_REPO_NO_TEMPLATE=1
	TEST_PASSES_SANITIZE_LEAK=true
1. https://lore.kernel.org/git/cover-00.13-00000000000-20211212T201308Z-avarab@gmail.com/
2. https://lore.kernel.org/git/220405.86k0c3lt2l.gmgdl@evledraar.gmail.com/
3. https://lore.kernel.org/git/211124.86sfvld4cl.gmgdl@evledraar.gmail.com/
Ævar Arnfjörð Bjarmason (7):
  t0008: don't rely on default ".git/info/exclude"
  tests: don't depend on template-created .git/branches
  tests: don't assume a .git/info for .git/info/grafts
  tests: don't assume a .git/info for .git/info/attributes
  tests: don't assume a .git/info for .git/info/refs
  tests: don't assume a .git/info for .git/info/exclude
  tests: don't assume a .git/info for .git/info/sparse-checkout
 t/annotate-tests.sh                    |  3 ++-
 t/lib-submodule-update.sh              |  7 +++++--
 t/t0003-attributes.sh                  |  5 ++++-
 t/t0008-ignores.sh                     | 12 +++++++-----
 t/t0028-working-tree-encoding.sh       |  2 ++
 t/t1011-read-tree-sparse-checkout.sh   |  2 ++
 t/t1090-sparse-checkout-scope.sh       |  5 ++++-
 t/t1301-shared-repo.sh                 |  3 ++-
 t/t2018-checkout-branch.sh             |  4 +++-
 t/t2400-worktree-add.sh                |  4 ++++
 t/t3426-rebase-submodule.sh            |  1 +
 t/t3507-cherry-pick-conflict.sh        |  2 ++
 t/t5000-tar-tree.sh                    |  5 ++++-
 t/t5001-archive-attr.sh                |  5 ++++-
 t/t5002-archive-attr-pattern.sh        |  5 ++++-
 t/t5003-archive-zip.sh                 |  5 ++++-
 t/t5318-commit-graph.sh                |  3 ++-
 t/t5505-remote.sh                      |  6 ++++--
 t/t5516-fetch-push.sh                  | 16 ++++++++++++++--
 t/t5550-http-fetch-dumb.sh             |  3 ++-
 t/t6001-rev-list-graft.sh              |  1 +
 t/t6101-rev-parse-parents.sh           |  2 ++
 t/t6435-merge-sparse.sh                |  2 ++
 t/t7063-status-untracked-cache.sh      |  3 ++-
 t/t7418-submodule-sparse-gitmodules.sh |  3 ++-
 t/t7814-grep-recurse-submodules.sh     |  8 ++++++--
 t/t8001-annotate.sh                    |  1 +
 t/t8002-blame.sh                       |  1 +
 t/t8012-blame-colors.sh                |  1 +
 t/test-lib.sh                          |  4 +++-
 30 files changed, 97 insertions(+), 27 deletions(-)
Range-diff against v1:
 1:  5526d3dc838 <  -:  ----------- t0001: fix gaps in "TEMPLATE DIRECTORY" coverage
 2:  ef2b67768cf <  -:  ----------- init: split out template population from create_default_files()
 3:  784b7947512 <  -:  ----------- init: unconditionally create the "info" directory
 4:  3d4ea5c5d30 =  1:  21927e21832 t0008: don't rely on default ".git/info/exclude"
 5:  6bbb39f13fc <  -:  ----------- init & clone: add a --no-template option
 6:  2f478f7ba4a <  -:  ----------- init & clone: add init.templateDir=[bool]
 7:  9402fb23b40 <  -:  ----------- test-lib: create test data with "git init --no-template" (almost)
 8:  0c9b953dd43 <  -:  ----------- tests: don't depend on template-created .git/branches
 9:  d97122f5fd8 <  -:  ----------- t5540: don't rely on "hook/post-update.sample"
10:  ca55471d134 <  -:  ----------- test-lib-functions: add and use a "write_hook" wrapper
11:  6f805f7ebac <  -:  ----------- tests: change "cat && chmod +x" to use "write_hook"
12:  2acbaa77f8d <  -:  ----------- tests: migrate miscellaneous "write_script" to "write_hooks"
13:  d021a5981a1 <  -:  ----------- tests: don't depend on template-created .git/hooks
 -:  ----------- >  2:  c4d0e6c684b tests: don't depend on template-created .git/branches
 -:  ----------- >  3:  967762b4670 tests: don't assume a .git/info for .git/info/grafts
 -:  ----------- >  4:  64292c20c84 tests: don't assume a .git/info for .git/info/attributes
 -:  ----------- >  5:  b9f667bf292 tests: don't assume a .git/info for .git/info/refs
 -:  ----------- >  6:  29da5a3d431 tests: don't assume a .git/info for .git/info/exclude
 -:  ----------- >  7:  0149c80f09c tests: don't assume a .git/info for .git/info/sparse-checkout
-- 
2.36.1.1119.g5a713b43bd4
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 34 of 44 in “tests + init: don't rely on templates & add --no-template + config”
  1. 00/13 tests + init: don't rely on templates & add --no-template + configÆvar Arnfjörð Bjarmason, Dec 12, 2021
  2. 01/13 t0001: fix gaps in "TEMPLATE DIRECTORY" coverageÆvar Arnfjörð Bjarmason, Dec 12, 2021
  3. 02/13 init: split out template population from create_default_files()Ævar Arnfjörð Bjarmason, Dec 12, 2021
  4. 03/13 init: unconditionally create the "info" directoryÆvar Arnfjörð Bjarmason, Dec 12, 2021
  5. Derrick StoleeDec 20, 2021
  6. Ævar Arnfjörð BjarmasonDec 20, 2021
  7. Derrick StoleeDec 20, 2021
  8. Ævar Arnfjörð BjarmasonDec 20, 2021
  9. Junio C HamanoDec 20, 2021
  10. Ævar Arnfjörð BjarmasonDec 21, 2021
  11. Junio C HamanoDec 21, 2021
  12. Ævar Arnfjörð BjarmasonDec 21, 2021
  13. Junio C HamanoDec 21, 2021
  14. Ævar Arnfjörð BjarmasonDec 24, 2021
  15. Junio C HamanoDec 25, 2021
  16. Ævar Arnfjörð BjarmasonJan 12, 2022
  17. Derrick StoleeJan 18, 2022
  18. Ævar Arnfjörð BjarmasonJan 19, 2022
  19. 04/13 t0008: don't rely on default ".git/info/exclude"Ævar Arnfjörð Bjarmason, Dec 12, 2021
  20. 05/13 init & clone: add a --no-template optionÆvar Arnfjörð Bjarmason, Dec 12, 2021
  21. 06/13 init & clone: add init.templateDir=[bool]Ævar Arnfjörð Bjarmason, Dec 12, 2021
  22. 07/13 test-lib: create test data with "git init --no-template" (almost)Ævar Arnfjörð Bjarmason, Dec 12, 2021
  23. 08/13 tests: don't depend on template-created .git/branchesÆvar Arnfjörð Bjarmason, Dec 12, 2021
  24. 11/13 tests: change "cat && chmod +x" to use "write_hook"Ævar Arnfjörð Bjarmason, Dec 12, 2021
  25. 10/13 test-lib-functions: add and use a "write_hook" wrapperÆvar Arnfjörð Bjarmason, Dec 12, 2021
  26. Eric SunshineDec 13, 2021
  27. Ævar Arnfjörð BjarmasonDec 13, 2021
  28. Eric SunshineDec 13, 2021
  29. Ævar Arnfjörð BjarmasonDec 13, 2021
  30. Eric SunshineDec 13, 2021
  31. 09/13 t5540: don't rely on "hook/post-update.sample"Ævar Arnfjörð Bjarmason, Dec 12, 2021
  32. 12/13 tests: migrate miscellaneous "write_script" to "write_hooks"Ævar Arnfjörð Bjarmason, Dec 12, 2021
  33. 13/13 tests: don't depend on template-created .git/hooksÆvar Arnfjörð Bjarmason, Dec 12, 2021
  34. 0/7 tests: don't depend on "git init" using the templateÆvar Arnfjörð Bjarmason, Jun 3, 2022
  35. 1/7 t0008: don't rely on default ".git/info/exclude"Ævar Arnfjörð Bjarmason, Jun 3, 2022
  36. 2/7 tests: don't depend on template-created .git/branchesÆvar Arnfjörð Bjarmason, Jun 3, 2022
  37. 3/7 tests: don't assume a .git/info for .git/info/graftsÆvar Arnfjörð Bjarmason, Jun 3, 2022
  38. 4/7 tests: don't assume a .git/info for .git/info/attributesÆvar Arnfjörð Bjarmason, Jun 3, 2022
  39. 5/7 tests: don't assume a .git/info for .git/info/refsÆvar Arnfjörð Bjarmason, Jun 3, 2022
  40. 6/7 tests: don't assume a .git/info for .git/info/excludeÆvar Arnfjörð Bjarmason, Jun 3, 2022
  41. 7/7 tests: don't assume a .git/info for .git/info/sparse-checkoutÆvar Arnfjörð Bjarmason, Jun 3, 2022
  42. Junio C HamanoJun 3, 2022
  43. Ævar Arnfjörð BjarmasonJun 4, 2022
  44. Junio C HamanoJun 6, 2022

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.