git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Christian Couder <christian.couder@gmail.com>
Cc: git@vger.kernel.org, "Junio C Hamano" <gitster@pobox.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Stefan Beller" <sbeller@google.com>,
	"Jonathan Nieder" <jrnieder@gmail.com>,
	"Jonathan Tan" <jonathantanmy@google.com>,
	"Duy Nguyen" <pclouds@gmail.com>,
	"Derrick Stolee" <stolee@gmail.com>,
	"Carlos Martín Nieto" <cmn@dwim.me>,
	"Michael Haggerty" <mhagger@alum.mit.edu>,
	"David Turner" <novalis@novalis.org>,
	"Christian Couder" <chriscool@tuxfamily.org>,
	"David Turner" <dturner@twopensource.com>
Subject: Re: [PATCH] t: make many tests depend less on the refs being files
Date: Mon, 21 May 2018 11:41:33 +0200 (DST)	[thread overview]
Message-ID: <nycvar.QRO.7.76.6.1805211126140.77@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <20180521055143.14701-1-chriscool@tuxfamily.org>

[-- Attachment #1: Type: text/plain, Size: 3645 bytes --]

Hi Chris,

On Mon, 21 May 2018, Christian Couder wrote:

> From: David Turner <dturner@twopensource.com>

I vaguely remember that Dave suggested using a different email address
these days...

*clicketyclick*

ah, yes:
https://public-inbox.org/git/1474935093-26757-3-git-send-email-dturner@twosigma.com/

So maybe update it here, too, to 

	From: David Turner <novalis@novalis.org>

?

> So that they work under alternate ref storage backends.
> 
> This will be really needed when such alternate ref storage backends are
> developed. But this could already help by making clear to readers that
> some tests do not depend on which ref backend is used.
> 
> This patch just takes care of many low hanging fruits. It does not try
> to completely solves the issue.
> 
> Signed-off-by: David Turner <dturner@twopensource.com>
> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
> ---

This is great. I am all for making the tests better ;-)

> diff --git a/t/lib-t6000.sh b/t/lib-t6000.sh
> index 3f2d873fec..b8567cdf94 100644
> --- a/t/lib-t6000.sh
> +++ b/t/lib-t6000.sh
> @@ -4,11 +4,10 @@ mkdir -p .git/refs/tags
>  
>  >sed.script
>  
> -# Answer the sha1 has associated with the tag. The tag must exist in .git/refs/tags
> +# Answer the sha1 has associated with the tag. The tag must exist under refs/tags
>  tag () {
>  	_tag=$1
> -	test -f ".git/refs/tags/$_tag" || error "tag: \"$_tag\" does not exist"
> -	cat ".git/refs/tags/$_tag"
> +	git rev-parse --verify "refs/tags/$_tag" || error "tag: \"$_tag\" does not exist"

Line longer than 80 columns...

> diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
> index 0680dec808..886a9e3b72 100755
> --- a/t/t5500-fetch-pack.sh
> +++ b/t/t5500-fetch-pack.sh
> @@ -30,7 +30,7 @@ add () {
>  	test_tick &&
>  	commit=$(echo "$text" | git commit-tree $tree $parents) &&
>  	eval "$name=$commit; export $name" &&
> -	echo $commit > .git/refs/heads/$branch &&
> +	git update-ref refs/heads/$branch $commit &&

I think we have to be careful here to quote both "refs/heads/$branch" and
"$commit" here, as a bug that introduces spaces into $commit or $branch
would have been caught earlier, but not now, unless we quote.

This goes for all introduced `update-ref` calls.

Maybe even for some `git rev-parse --verify` calls.

> diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
> index 8f5c811dd7..c3b89ae783 100755
> --- a/t/t9903-bash-prompt.sh
> +++ b/t/t9903-bash-prompt.sh
> @@ -148,7 +148,7 @@ test_expect_success 'prompt - inside .git directory' '
>  test_expect_success 'prompt - deep inside .git directory' '
>  	printf " (GIT_DIR!)" >expected &&
>  	(
> -		cd .git/refs/heads &&
> +		cd .git/objects &&
>  		__git_ps1 >"$actual"
>  	) &&
>  	test_cmp expected "$actual"
> -- 

This one looks wrong.

Upon cursory review, one might be tempted to assume that the file is now
written into .git/objects/ instead of .git/refs/heads/. And the patch
context provided in the email is not enough to see (gawd, I hate
mail-based patch review, it really takes all my Git tools away from me).
The trick is that `actual` points at an absolute path:

	#!/bin/sh
	#
	# Copyright (c) 2012 SZEDER Gábor
	#

	test_description='test git-specific bash prompt functions'

	. ./lib-bash.sh

	. "$GIT_BUILD_DIR/contrib/completion/git-prompt.sh"

	actual="$TRASH_DIRECTORY/actual"
	[...]

So the remaining question (which probably wants to be added to the commit
message together with a hint that `actual` points at an absolute path) is:
Why not `cd .git` instead?

Ciao,
Dscho

  reply	other threads:[~2018-05-21  9:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-21  5:51 [PATCH] t: make many tests depend less on the refs being files Christian Couder
2018-05-21  9:41 ` Johannes Schindelin [this message]
2018-05-21 11:49   ` SZEDER Gábor
2018-05-23  5:27     ` Christian Couder
2018-05-21 12:30   ` Christian Couder
2018-05-21 12:37   ` Johannes Schindelin
2018-05-21 19:34 ` Stefan Beller
2018-05-23  5:33   ` Christian Couder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=nycvar.QRO.7.76.6.1805211126140.77@tvgsbejvaqbjf.bet \
    --to=johannes.schindelin@gmx.de \
    --cc=avarab@gmail.com \
    --cc=chriscool@tuxfamily.org \
    --cc=christian.couder@gmail.com \
    --cc=cmn@dwim.me \
    --cc=dturner@twopensource.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jonathantanmy@google.com \
    --cc=jrnieder@gmail.com \
    --cc=mhagger@alum.mit.edu \
    --cc=novalis@novalis.org \
    --cc=pclouds@gmail.com \
    --cc=sbeller@google.com \
    --cc=stolee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).