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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 21, 2009, 05:32 UTC
Message-ID
<7vocuqbmgu.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20090421030638.GE14479@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 36 quoted lines
> On Mon, Apr 20, 2009 at 04:51:18PM +0200, Michael J Gruber wrote:
>
>> 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.
>
> If I am understanding it correctly, I think this is simply a bug
> introduced by a6d63b7, and the fix is maint-worthy.
>
> And I think the right fix is:
>
>> - 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).
>
> The original code (before a6d63b7) used $(GIT_EXEC_PATH), since it
> handily pointed to "$(TEST_DIRECTORY)/.." (and I didn't check, but I
> suspect that line predates $(TEST_DIRECTORY) entirely). So I think this
> is just doing what the a6d63b7 should have done in the first place,
> instead of using `pwd` to guess at the top-level location.
>
> One thing to consider: we now have code to test an installed version of
> git. Should it be using the vanilla hooks from the source directory, or
> should it be using the regular templates? I think that question is
> orthogonal to the bug you mention, though -- the current code is trying
> to use the hooks from the source directory, but it is just failing to do
> so; by fixing it, you certainly won't be breaking the
> test-installed-version case.
Yup, I think that is the right approach.
Previous: Jeff KingNext: Michael J Gruber
Message 3 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.