Subject: Re: [PATCH] sparse-checkout: create leading directory

From: SZEDER Gábor <[email-masked]>
Date: Sat, 22 Jan 2022 08:58:51 +0100

On Thu, Jan 20, 2022 at 10:30:03PM +0100, Ævar Arnfjörð Bjarmason wrote:
> > diff --git a/t/t1091-sparse-checkout-builtin.sh b/t/t1091-sparse-checkout-builtin.sh
> > index 42776984fe..dba0737599 100755
> > --- a/t/t1091-sparse-checkout-builtin.sh
> > +++ b/t/t1091-sparse-checkout-builtin.sh
> > @@ -79,6 +79,13 @@ test_expect_success 'git sparse-checkout init' '
> >  	check_files repo a
> >  '
> >  
> > +test_expect_success 'git sparse-checkout init in empty repo' '
> > +	test_when_finished rm -rf empty-repo blank-template &&
> > +	mkdir blank-template &&
> > +	git init --template=blank-template empty-repo &&
> > +	git -C empty-repo sparse-checkout init
> > +'
> > +
> >  test_expect_success 'git sparse-checkout list after init' '
> >  	git -C repo sparse-checkout list >actual &&
> >  	cat >expect <<-\EOF &&
> 
> You're using an overly verbose way to say "no templates, please". You
> can squash this in, i.e. --template= is an explicitly supported way to
> do that.

It would be even more expressive to use 'git init --no-template', but,
alas, that doesn't work:

  $ git init --no-template /tmp/foo
  Initialized empty Git repository in /tmp/foo/.git/
  $ ls /tmp/foo/.git
  branches  config  description  HEAD  hooks  info  objects  refs