git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Philippe Blain <levraiphilippeblain@gmail.com>,
	Git mailing list <git@vger.kernel.org>,
	Derrick Stolee <dstolee@microsoft.com>
Subject: Re: t7900 failures when $HOME is symlinked
Date: Fri, 3 Dec 2021 12:42:20 -0500	[thread overview]
Message-ID: <YapW/CfjFiPvsVbj@coredump.intra.peff.net> (raw)
In-Reply-To: <xmqq1r2tty13.fsf@gitster.g>

On Fri, Dec 03, 2021 at 09:10:16AM -0800, Junio C Hamano wrote:

>  * TRASH_DIRECTORY is originally set to "trash directory." with a
>    suffix to make it unique across test scripts, but it immediately
>    gets turned into an absolute path by doing this:
> 
>         test -n "$root" && TRASH_DIRECTORY="$root/$TRASH_DIRECTORY"
>         case "$TRASH_DIRECTORY" in
>         /*) ;; # absolute path is good
>          *) TRASH_DIRECTORY="$TEST_OUTPUT_DIRECTORY/$TRASH_DIRECTORY" ;;
>         esac
> 
>    I notice that a root that is not absolute is silently lost during
>    this process.
> 
>    TEST_OUTPUT_DIRECTORY is set to TEST_DIRECTORY that comes from
>    $(pwd) we saw earlier, or TEST_OUTPUT_DIRECTORY_OVERRIDE, which
>    is also set to $(pwd) elsewhere, so the case statement does make
>    it absolute in the end.  It just loses --root=* without complaint
>    which is what I found iffy.

I don't think it's lost. It becomes part of $TRASH_DIRECTORY in the
first line, so the final line which prepends $TEST_OUTPUT_DIRECTORY
makes it relative to that. E.g.:

  $ cd t
  $ ./t0000-basic.sh --root=foo --debug
  [...]
  $ ls foo
  trash directory.t0000-basic/

I don't recall planning that in particular (there is not much point in
using it unless you are pointing outside the repo, though I guess you
could use ../../../foo or similar). But I think it has always worked
that way, since f423ef5f2b (tests: allow user to specify trash directory
location, 2009-08-09). It was perhaps a little easier to see back then
when the intermediate "$test" variable was not the final one.

-Peff

  reply	other threads:[~2021-12-03 17:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-03 14:56 t7900 failures when $HOME is symlinked Philippe Blain
2021-12-03 17:10 ` Junio C Hamano
2021-12-03 17:42   ` Jeff King [this message]
2021-12-05 10:02     ` Junio C Hamano
2021-12-03 22:40   ` Philippe Blain

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=YapW/CfjFiPvsVbj@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=dstolee@microsoft.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=levraiphilippeblain@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).