git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Elijah Newren <newren@gmail.com>
Date
May 20, 2021, 00:16 UTC
Message-ID
<CABPp-BGXH1oSVn9jS-CC2P0snUzgo5CN=nPbXtWrOm0Ugjz1Hg@mail.gmail.com>
In-Reply-To
<a5ca94e3f4df2abb38880385310e5cb02d7b5daa.1621451532.git.ps@pks.im>
On Wed, May 19, 2021 at 1:22 PM Patrick Steinhardt <ps@pks.im> wrote:
Show 8 quoted lines
>
> 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.

Oh, sweet, someone else wants this too. I have a local patch introducing the same function, which I needed for --remerge-diff. I hadn't submitted the patch yet, and if yours is accepted then I won't need to. :-)

Show 40 quoted lines
> 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
Looks good to me.
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 9 of 22 in “Speed up connectivity checks via quarantine dir”
  1. 0/8 Speed up connectivity checks via quarantine dirPatrick Steinhardt, May 19, 2021
  2. 1/8 perf: fix when running with TEST_OUTPUT_DIRECTORYPatrick Steinhardt, May 19, 2021
  3. Chris TorekMay 20, 2021
  4. 2/8 p5400: add perf tests for git-receive-pack(1)Patrick Steinhardt, May 19, 2021
  5. Chris TorekMay 20, 2021
  6. Jeff KingMay 20, 2021
  7. SZEDER GáborMay 21, 2021
  8. 3/8 tmp-objdir: expose function to retrieve pathPatrick Steinhardt, May 19, 2021
  9. Elijah NewrenMay 20, 2021
  10. 4/8 packfile: have `for_each_file_in_pack_dir()` return error codesPatrick Steinhardt, May 19, 2021
  11. 5/8 object-file: allow reading loose objects without reading their contentsPatrick Steinhardt, May 19, 2021
  12. 6/8 connected: implement connectivity check via temporary object dirsPatrick Steinhardt, May 19, 2021
  13. 7/8 receive-pack: skip connectivity checks on delete-only commandsPatrick Steinhardt, May 19, 2021
  14. Felipe ContrerasMay 21, 2021
  15. Jeff KingMay 27, 2021
  16. 8/8 receive-pack: check connectivity via quarantined objectsPatrick Steinhardt, May 19, 2021
  17. Chris TorekMay 20, 2021
  18. Jeff KingMay 20, 2021
  19. Junio C HamanoMay 20, 2021
  20. Jeff KingMay 21, 2021
  21. Patrick SteinhardtMay 21, 2021
  22. Ævar Arnfjörð BjarmasonMay 21, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.