Merge branch 'jt/sparse-checkout-leading-dir-fix'

"git sparse-checkout init" failed to write into $GIT_DIR/info
directory when the repository was created without one, which has
been corrected to auto-create it.

* jt/sparse-checkout-leading-dir-fix:
  sparse-checkout: create leading directory
This commit is contained in:
Junio C Hamano
2022-02-09 14:21:00 -08:00
2 changed files with 9 additions and 0 deletions

View File

@ -471,6 +471,9 @@ static int sparse_checkout_init(int argc, const char **argv)
FILE *fp;
/* assume we are in a fresh repo, but update the sparse-checkout file */
if (safe_create_leading_directories(sparse_filename))
die(_("unable to create leading directories of %s"),
sparse_filename);
fp = xfopen(sparse_filename, "w");
if (!fp)
die(_("failed to open '%s'"), sparse_filename);