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

Bug in test-lib.sh: test_create_repo() / RFC

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Apr 20, 2009, 14:51 UTC
Message-ID
<49EC8BE6.2030709@drmicha.warpmail.net>
Hi there,

running the test suite with -v for the upcoming release exposed a certain problem with test_create_repo() whose consequences I can't quite fathom at the moment. That means: I don't know whether it's maint material or forbidden fruits during rc-cycle...

Problem: Since a6d63b7 (test-lib: avoid assuming that templates/ are in the GIT_EXEC_PATH, 2009-02-04), test_create_repo() assumes to be called from a directory such that `pwd`/../templates/blt/ contains templates for git-init.

Several tests (see below) call test_create_repo() from a different directory, which means the repo is created without any of the default files (and that a mv .git/hooks .git/hooks-disabled later in the function errors out). Now, for most tests this probably doesn't matter at all but it's not nice.

RFC: I see several possible solutions:

- Make sure all tests use test_create_repo() from t/. Cumbersome and
fragile.
- Simply use $(TEST_DIRECTORY)/../templates/blt/. Nice and easy. But
uses the templates from the git repo containing t/ even when testing
against and installed git (just like now, for most of the tests).
- Teach git a "--templates-dir" option similar to "--html-path" and use
that (from the git actually being tested). Means we use the templates
belonging to the tested git; but also means we can test only git
versions containing that new option.
What do you think?
Michael

Affected tests: t0050-filesystem.sh t1007-hash-object.sh t1302-repo-version.sh t2103-update-index-ignore-missing.sh t4027-diff-submodule.sh t5300-pack-object.sh t5513-fetch-track.sh t5600-clone-fail-cleanup.sh t5601-clone.sh t5700-clone-reference.sh t5710-info-alternate.sh t6026-merge-attr.sh t7001-mv.sh t7010-setup.sh t7401-submodule-summary.sh t7506-status-submodule.sh t7508-status.sh

Next: Jeff King
Message 1 of 7 in “Bug in test-lib.sh: test_create_repo() / RFC”
  1. Michael J GruberApr 20, 2009
  2. Jeff KingApr 21, 2009
  3. Junio C HamanoApr 21, 2009
  4. test-lib.sh: Help test_create_repo() find the templates dirMichael J Gruber, Apr 21, 2009
  5. test-lib.sh: Help test_create_repo() find the templates dirMichael J Gruber, Apr 21, 2009
  6. Johannes SchindelinApr 21, 2009
  7. Michael J GruberApr 21, 2009

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.