Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
multi-pack-index: use --object-dir real path
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. Adding the normalization in builtin/multi-pack-index.c is a little complicated because of how the sub-commands were split in 60ca947 (builtin/multi-pack-index.c: split sub-commands, 2021-03-30). The --object-dir argument could be parsed before the sub-command name _or_ after it. Thus, create a normalize_object_dir() helper to call after all arguments are parsed, but before any logic is run on that object dir. Signed-off-by: Derrick Stolee <derrickstolee@github.com>
- Loading branch information