From: Justin Tobler Date: Thu, 19 Nov 2026 00:20:40 GMT Subject: [PATCH v2 3/6] tmp-objdir: inline `setup_tmp_objdir()` Message-ID: <20261119002043.2108654-4-jltobler@gmail.com> In-Reply-To: <20261119002043.2108654-1-jltobler@gmail.com> In a subsequent commit, `tmp_objdir_create()` is updated to preserve `errno` when it fails to create the temporary object directory. In preparation for this change, inline `setup_tmp_objdir()` into its only caller so `errno` only has to be preserved in the single function. Signed-off-by: Justin Tobler --- tmp-objdir.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/tmp-objdir.c b/tmp-objdir.c index 5307717354..c78fc0e6b6 100644 --- a/tmp-objdir.c +++ b/tmp-objdir.c @@ -144,18 +144,6 @@ static void env_replace(struct strvec *env, const char *key, const char *val) strvec_pushf(env, "%s=%s", key, val); } -static int setup_tmp_objdir(const char *root) -{ - char *path; - int ret = 0; - - path = xstrfmt("%s/pack", root); - ret = mkdir(path, 0777); - free(path); - - return ret; -} - struct tmp_objdir *tmp_objdir_create(struct repository *r, const char *prefix, int will_destroy) @@ -163,6 +151,8 @@ struct tmp_objdir *tmp_objdir_create(struct repository *r, struct odb_source_files *files = odb_source_files_downcast(r->objects->source); static int installed_handlers; struct tmp_objdir *t; + char *path; + int ret; if (the_tmp_objdir) BUG("only one tmp_objdir can be used at a time"); @@ -196,7 +186,10 @@ struct tmp_objdir *tmp_objdir_create(struct repository *r, installed_handlers++; } - if (setup_tmp_objdir(t->path.buf)) { + path = xstrfmt("%s/pack", t->path.buf); + ret = mkdir(path, 0777); + free(path); + if (ret) { tmp_objdir_destroy(t); return NULL; } -- 2.56.0.173.gf57c9a7388