commit 51130c027d3d769ca63c1d9051231791ad5f2f39 from: Stefan Sperling date: Sat Apr 13 14:29:24 2019 UTC create blob's parent dir if missing in got_object_blob_create() commit - f970685c28a69b4ad4cb94b882bec962b274022f commit + 51130c027d3d769ca63c1d9051231791ad5f2f39 blob - 811852390009b439b1fa0ba6e06034eaee832a4f blob + cbb6de133806483e00d1d51b5acffb2ebf00b01b --- lib/object_create.c +++ lib/object_create.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -128,8 +129,21 @@ got_object_blob_create(struct got_object_id **id, cons goto done; err = got_opentemp_named(&outpath, &outfile, objpath); - if (err) - goto done; + if (err) { + char *parent_path; + if (!(err->code == GOT_ERR_ERRNO && errno == ENOENT)) + goto done; + err = got_path_dirname(&parent_path, objpath); + if (err) + goto done; + err = got_path_mkdir(parent_path); + free(parent_path); + if (err) + goto done; + err = got_opentemp_named(&outpath, &outfile, objpath); + if (err) + goto done; + } err = got_deflate_to_file(&outlen, blobfile, outfile); if (err)