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

Re: [PATCH v2 2/3] multi-pack-index: use --object-dir real path

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 25, 2022, 18:58 UTC
Message-ID
<xmqqy1ztuh0h.fsf@gitster.g>
In-Reply-To
<fd580e7947743db545a839e81f027984e70b7717.1650911234.git.gitgitgadget@gmail.com>
"Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 32 quoted lines
> From: Derrick Stolee <derrickstolee@github.com>
>
> The --object-dir argument to 'git multi-pack-index' allows a user to
> specify an alternate to use instead of the local $GITDIR. This is used
> by third-party tools like VFS for Git to maintain the pack-files in a
> "shared object cache" used by multiple clones.
>
> On Windows, the user can specify a path using a Windows-style file path
> with backslashes such as "C:\Path\To\ObjectDir". This same path style is
> used in the .git/objects/info/alternates file, so it already matches the
> path of that alternate. However, find_odb() converts these paths to
> real-paths for the comparison, which use forward slashes. As of the
> previous change, lookup_multi_pack_index() uses real-paths, so it
> correctly finds the target multi-pack-index when given these paths.
>
> Some commands such as 'git multi-pack-index repack' call child processes
> using the object_dir value, so it can be helpful to convert the path to
> the real-path before sending it to those locations.
>
> Add a callback to convert the real path immediately upon parsing the
> argument. We need to be careful that we don't store the exact value out
> of get_object_directory() and free it, or we could corrupt a later use
> of the_repository->objects->odb->path.
>
> We don't use get_object_directory() for the initial instantiation in
> cmd_multi_pack_index() because we need 'git multi-pack-index -h' to work
> without a Git repository.
>
> Signed-off-by: Derrick Stolee <derrickstolee@github.com>
> ---
>  builtin/multi-pack-index.c | 45 ++++++++++++++++++++++++++++----------
>  1 file changed, 34 insertions(+), 11 deletions(-)

Much nicer compared to the previous round, by doing the normalization early.

Will queue.  thanks.
Previous: Derrick Stolee via GitGitGadgetNext: Derrick Stolee via GitGitGadget
Message 10 of 11 in “multi-pack-index: use real paths for --object-dir”
  1. 0/2 multi-pack-index: use real paths for --object-dirDerrick Stolee via GitGitGadget, Apr 21, 2022
  2. 1/2 midx: use real paths in lookup_multi_pack_index()Derrick Stolee via GitGitGadget, Apr 21, 2022
  3. 2/2 multi-pack-index: use --object-dir real pathDerrick Stolee via GitGitGadget, Apr 21, 2022
  4. Victoria DyeApr 21, 2022
  5. Derrick StoleeApr 21, 2022
  6. Junio C HamanoApr 21, 2022
  7. 0/3 multi-pack-index: use real paths for --object-dirDerrick Stolee via GitGitGadget, Apr 25, 2022
  8. 1/3 midx: use real paths in lookup_multi_pack_index()Derrick Stolee via GitGitGadget, Apr 25, 2022
  9. 2/3 multi-pack-index: use --object-dir real pathDerrick Stolee via GitGitGadget, Apr 25, 2022
  10. Junio C HamanoApr 25, 2022
  11. 3/3 cache: use const char * for get_object_directory()Derrick Stolee via GitGitGadget, Apr 25, 2022

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.