]> git.ipfire.org Git - thirdparty/git.git/commit
sparse-checkout: create leading directories
authorDerrick Stolee <dstolee@microsoft.com>
Fri, 24 Jan 2020 21:19:33 +0000 (21:19 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 24 Jan 2020 21:26:54 +0000 (13:26 -0800)
commit3c754067a1164ffafd965dcd44a9f004e6100e42
tree619430fbdc567577d6d95fc382382bbf83d1ba89
parentd622c34396b3ea1a81f07d951ee1112f83d9330c
sparse-checkout: create leading directories

The 'git init' command creates the ".git/info" directory and fills it
with some default files. However, 'git worktree add' does not create
the info directory for that worktree. This causes a problem when running
"git sparse-checkout init" inside a worktree. While care was taken to
allow the sparse-checkout config to be specific to a worktree, this
initialization was untested.

Safely create the leading directories for the sparse-checkout file. This
is the safest thing to do even without worktrees, as a user could delete
their ".git/info" directory and expect Git to recover safely.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/sparse-checkout.c
t/t1091-sparse-checkout-builtin.sh