git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: "Mateusz Nowotyński" <maxmati4@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org, mattr94@gmail.com, bwilliams.eng@gmail.com
Subject: Re: [PATCH] config: use GIT_CONFIG in git config sequence
Date: Sun, 26 Apr 2020 20:08:45 +0000	[thread overview]
Message-ID: <20200426200845.GE6421@camp.crustytoothpaste.net> (raw)
In-Reply-To: <5c1005a7-273e-fab0-0d0d-78bd0d3d13f6@gmail.com>

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

On 2020-04-26 at 19:32:05, Mateusz Nowotyński wrote:
> On Sat, Apr 25, 2020 at 05:16:56PM -0700, Junio C Hamano wrote:
> > You can prepare a pretend-home directory for the use of your tests
> > and point the environment variable $HOME to it while running your
> > tests.  See how we do this in our test suite for inspiration---it
> > all happens in t/test-lib.sh, I think.
> 
> This is what we do currently but the problem with this solution is that
> it breaks other software that also uses HOME as base path for their
> data. For example asdf version manager.

I know nothing about the asdf version manager, but if you're relying on
it for programs, those programs should end up in PATH, and when invoked
appropriately in those locations, those programs should just work,
regardless of what $HOME is set to.  If they don't, that would be a
defect in asdf, since the Unix expectation is that programs in $PATH
should generally function without regard to the setting of $HOME.  From
my cursory poking around at the repo, it looks like it should do this
just fine.

So you can set $HOME to a temporary directory and still use asdf as long
as your don't reset $PATH.  Or, if you want to specifically load asdf
programs first, you could do something like this:

  #!/bin/sh

  . "$HOME/asdf/asdf.sh"
  export HOME=$(mktemp -d)
  # Run tests here.

Regardless of your tooling, you definitely want to reset $HOME in almost
every nontrivial shell testsuite, since many users have configuration
files or data storage that you wouldn't want to use.  For example, if
you generate a new GnuPG key on every run, the user won't appreciate it
if you import it as one of their private keys.
-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

  reply	other threads:[~2020-04-26 20:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-25 23:57 [PATCH] config: use GIT_CONFIG in git config sequence Mateusz Nowotyński
2020-04-26  0:16 ` Junio C Hamano
2020-04-26  9:58   ` Philip Oakley
2020-04-26 19:32   ` Mateusz Nowotyński
2020-04-26 20:08     ` brian m. carlson [this message]
2020-04-27 20:04       ` Mateusz Nowotynski
2020-04-26 21:01     ` Junio C Hamano
2020-04-26  1:12 ` Matt Rogers
2020-04-26 10:00   ` Philip Oakley
2020-04-26 13:30     ` Matt Rogers
2020-04-26 20:04       ` Philip Oakley
2020-04-26 21:16         ` Junio C Hamano
2020-04-26 22:32           ` Junio C Hamano
2020-04-27 19:39             ` Mateusz Nowotynski

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=20200426200845.GE6421@camp.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=bwilliams.eng@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mattr94@gmail.com \
    --cc=maxmati4@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).