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

From: Junio C Hamano <[email-masked]>
Date: Thu, 20 Jan 2022 12:26:05 -0800

Jonathan Tan <[email-masked]> writes:

> When creating the sparse-checkout file, Git does not create the leading
> directory, "$GIT_DIR/info", if it does not exist. This causes problems
> if the repository does not have that directory. Therefore, ensure that
> the leading directory is created.
>
> This is the only "open" in builtin/sparse-checkout.c that does not have
> a leading directory check. (The other one in write_patterns_and_update()
> does.)
>
> Note that the test needs to explicitly specify a template when running
> "git init" because the default template used in the tests has the
> "info/" directory included.
>
> Signed-off-by: Jonathan Tan <[email-masked]>
> ---
> This problem is being discussed in [1], and we also noticed this problem
> internally at $DAYJOB. Here's a fix.

Interesting, as $GIT_DIR/info is created during "git init".

But it is possible to lose the directory if there is no need for any
of the files---the user may rmdir or rm -fr it, and it is too harsh
to call the repository "corrupted".

Will queue.