[PATCH 3/8] tmp-objdir: expose function to retrieve path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---
 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

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux