[PATCH 3/8] tmp-objdir: expose function to retrieve path
- From
Patrick Steinhardt <ps@pks.im>
- Date
- May 19, 2021, 19:13 UTC
- Message-ID
- <a5ca94e3f4df2abb38880385310e5cb02d7b5daa.1621451532.git.ps@pks.im>
- In-Reply-To
- <cover.1621451532.git.ps@pks.im>
It's currently impossible to tell the path of a temporary object directory for outside users of `struct tmp_objdir`. We'll soon need that information though so that we can reuse information from the quarantine environment in git-receive-pack(1).
Provide a new function `tmp_objdir_path()` which returns the path of a temporary object directory to prepare for this.
Signed-off-by: Patrick Steinhardt <ps@pks.im> --- tmp-objdir.c | 7 +++++++ tmp-objdir.h | 5 +++++ 2 files changed, 12 insertions(+)
diff --git a/tmp-objdir.c b/tmp-objdir.c index b8d880e362..6056917c63 100644 --- a/tmp-objdir.c +++ b/tmp-objdir.c @@ -288,6 +288,13 @@ const char **tmp_objdir_env(const struct tmp_objdir *t) return t->env.v; } +const char *tmp_objdir_path(const struct tmp_objdir *t) +{ + if (!t) + return NULL; + return t->path.buf; +} + void tmp_objdir_add_as_alternate(const struct tmp_objdir *t) { add_to_alternates_memory(t->path.buf); diff --git a/tmp-objdir.h b/tmp-objdir.h index b1e45b4c75..da3ccb98bc 100644 --- a/tmp-objdir.h +++ b/tmp-objdir.h @@ -51,4 +51,9 @@ int tmp_objdir_destroy(struct tmp_objdir *); */ void tmp_objdir_add_as_alternate(const struct tmp_objdir *); +/* + * Return the path of the temporary object directory. + */ +const char *tmp_objdir_path(const struct tmp_objdir *t); + #endif /* TMP_OBJDIR_H */
-- 2.31.1