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

Re: [PATCH] t1020: cleanup subdirectory tests a little

From
Junio C Hamano <gitster@pobox.com>
Date
May 18, 2015, 18:29 UTC
Message-ID
<xmqqwq05buz1.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1431972817-18178-1-git-send-email-sbeller@google.com>
Stefan Beller <sbeller@google.com> writes:
Show 5 quoted lines
> When looking through existing tests to point out good style I came across
> t1020, which has a test commented out and the comment wasn't helping me
> either of what the test should accomplish in the future. The code of the
> test is the same as the test before except setting GIT_DIR=. explicitly,
> so it did not ring a bell for me as well.

I think this one should be clear, especially if you did notice the one that sets GIT_DIR=. explicitly. It is saying that "git show -s HEAD" inside the bare repository should be intelligent enough to realize that it is inside bare repository (hence HEAD cannot be a file in the working tree); the user's asking for "HEAD" therefore must mean "the tip commit", and never "(by default the tip commit) filtered to the pathspec HEAD".

If it does not still work, shouldn't it be marked as test_expect_failure instead of being commented out?

The first and last hunk to use when-finished looks like a good change, but is unrelated.

Show 41 quoted lines
>
> This removes the test, which may have been confusing readers since 2010.
>
> Additionally moves the "rm -fr foo.git" of the next test (where it is
> unrelated) to the previous test, where it makes sense as a cleanup.
>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
>  t/t1020-subdirectory.sh | 11 +----------
>  1 file changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/t/t1020-subdirectory.sh b/t/t1020-subdirectory.sh
> index 2edb4f2..4470ede 100755
> --- a/t/t1020-subdirectory.sh
> +++ b/t/t1020-subdirectory.sh
> @@ -163,6 +163,7 @@ test_expect_success 'no file/rev ambiguity check inside .git' '
>  '
>  
>  test_expect_success 'no file/rev ambiguity check inside a bare repo' '
> +	test_when_finished "rm -fr foo.git" &&
>  	git clone -s --bare .git foo.git &&
>  	(
>  		cd foo.git &&
> @@ -170,17 +171,7 @@ test_expect_success 'no file/rev ambiguity check inside a bare repo' '
>  	)
>  '
>  
> -# This still does not work as it should...
> -: test_expect_success 'no file/rev ambiguity check inside a bare repo' '
> -	git clone -s --bare .git foo.git &&
> -	(
> -		cd foo.git &&
> -		git show -s HEAD
> -	)
> -'
> -
>  test_expect_success SYMLINKS 'detection should not be fooled by a symlink' '
> -	rm -fr foo.git &&
>  	git clone -s .git another &&
>  	ln -s another yetanother &&
>  	(
Previous: Stefan BellerNext: Junio C Hamano
Message 2 of 10 in “t1020: cleanup subdirectory tests a little”
  1. t1020: cleanup subdirectory tests a littleStefan Beller, May 18, 2015
  2. Junio C HamanoMay 18, 2015
  3. Junio C HamanoMay 18, 2015
  4. Stefan BellerMay 18, 2015
  5. Junio C HamanoMay 18, 2015
  6. subdirectory tests: code cleanup, uncomment testStefan Beller, May 18, 2015
  7. Junio C HamanoMay 18, 2015
  8. Stefan BellerMay 18, 2015
  9. Jonathan NiederMay 18, 2015
  10. Junio C HamanoMay 19, 2015

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.