All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: Derrick Stolee <stolee@gmail.com>,
	git@vger.kernel.org, Taylor Blau <me@ttaylorr.com>
Subject: Re: [PATCH] multi-pack-index: fix --object-dir from outside repo
Date: Mon, 23 Aug 2021 09:16:01 -0700	[thread overview]
Message-ID: <xmqqwnocqgqm.fsf@gitster.g> (raw)
In-Reply-To: <746f574d20c54b5f7d1eaae74f54a624573ad6bc.camel@sipsolutions.net> (Johannes Berg's message of "Mon, 23 Aug 2021 15:40:10 +0200")

Johannes Berg <johannes@sipsolutions.net> writes:

> On Mon, 2021-08-23 at 09:19 -0400, Derrick Stolee wrote:
>> 
>> We just add subshells this way:
>> 
>> test_expect_success 'test name' '
>> 	prep_step &&
>> 	(
>> 		# now in a subshell
>> 		cd wherever &&
>> 		do things
>> 		# don't need to cd again
>> 	) &&
>> 	continue test
>> '
>
> Sure. I know how to do subshells :)
>
> My point was that inside the subshell you cannot do test_path_is_file
> and similar, because the subshell didn't import the libs.

Everything the call to prep_step, and anything that came before that
call, did to the environment, like setting shell functions and
variables, is visible inside the ( ... subshell ... ).

> I was specifically asking Junio ;-)
>
> But realistically, if this is the requirement you want to impose, then
> you _cannot_ test for the segfault within git's test suite. Your loss.

With that "cannot", I think you are assuming too much.  

Because Git is a fairly long-lived project, we've had our share of
cases where we needed to test for bugs that happen only when outside
a repository.

And we have facility for just that, it's called "nongit" test helper
that comes from test-lib-functions.sh, which is dot-included already
so your subshells get it for free.

t5300-pack-object.sh, for example, wants to make sure that the "git
index-pack --stdin" command invoked in a directory that is not a
repository, but "git index-pack <packfile>" works outside a
repository, and has two tests that uses the nongit helper.

Thanks.

  reply	other threads:[~2021-08-23 16:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-20 19:35 [PATCH] multi-pack-index: fix --object-dir from outside repo Johannes Berg
2021-08-22 23:51 ` Derrick Stolee
2021-08-23  7:21   ` Johannes Berg
2021-08-23  8:05     ` Junio C Hamano
2021-08-23  8:10       ` Johannes Berg
2021-08-23 13:19         ` Derrick Stolee
2021-08-23 13:40           ` Johannes Berg
2021-08-23 16:16             ` Junio C Hamano [this message]
2021-08-23 16:06         ` Junio C Hamano
2021-08-23  0:54 ` Taylor Blau
2021-08-23  7:32   ` Johannes Berg

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

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

  git send-email \
    --in-reply-to=xmqqwnocqgqm.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=johannes@sipsolutions.net \
    --cc=me@ttaylorr.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.