Git development
 help / color / mirror / Atom feed
From: Justin Tobler <jltobler@gmail.com>
To: git@vger.kernel.org
Cc: ps@pks.im, karthik.188@gmail.com, Justin Tobler <jltobler@gmail.com>
Subject: [PATCH v2 3/6] tmp-objdir: inline `setup_tmp_objdir()`
Date: Wed, 18 Nov 2026 18:20:40 -0600	[thread overview]
Message-ID: <20261119002043.2108654-4-jltobler@gmail.com> (raw)
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 <jltobler@gmail.com>
---
 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


  parent reply	other threads:[~2026-11-19  0:20 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10  0:22 [PATCH 0/4] object-file: eagerly create ODB transaction temporary directory Justin Tobler
2026-11-10  0:22 ` [PATCH 1/4] object-file: rename default transaction prefix Justin Tobler
2026-11-11 13:15   ` Patrick Steinhardt
2026-11-11 14:36   ` Karthik Nayak
2026-11-10  0:22 ` [PATCH 2/4] object-file: only flush batched fsync writes when enabled Justin Tobler
2026-11-11 13:16   ` Patrick Steinhardt
2026-11-17 23:35     ` Justin Tobler
2026-11-11 14:48   ` Karthik Nayak
2026-11-17 23:42     ` Justin Tobler
2026-11-10  0:22 ` [PATCH 3/4] tmp-objdir: preserve errno when directory creation fails Justin Tobler
2026-11-11 13:16   ` Patrick Steinhardt
2026-11-11 16:44   ` Karthik Nayak
2026-11-17 23:46     ` Justin Tobler
2026-11-10  0:22 ` [PATCH 4/4] object-file: create ODB transaction temporary directory eagerly Justin Tobler
2026-11-11 13:15   ` Patrick Steinhardt
2026-11-17 23:48     ` Justin Tobler
2026-11-11 16:48   ` Karthik Nayak
2026-11-17 23:57     ` Justin Tobler
2026-11-11 14:33 ` [PATCH 0/4] object-file: eagerly create ODB transaction temporary directory Karthik Nayak
2026-11-19  0:20 ` [PATCH v2 0/6] " Justin Tobler
2026-11-19  0:20   ` [PATCH v2 1/6] object-file: rename default transaction prefix Justin Tobler
2026-11-19  0:20   ` [PATCH v2 2/6] object-file: only flush batched fsync writes when enabled Justin Tobler
2026-11-19  0:20   ` Justin Tobler [this message]
2026-11-19  0:20   ` [PATCH v2 4/6] tmp-objdir: preserve errno when directory creation fails Justin Tobler
2026-11-19  0:20   ` [PATCH v2 5/6] odb/transaction: avoid "ODB" in error messages Justin Tobler
2026-11-19  0:20   ` [PATCH v2 6/6] object-file: create ODB transaction temporary directory eagerly Justin Tobler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261119002043.2108654-4-jltobler@gmail.com \
    --to=jltobler@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=karthik.188@gmail.com \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox