Commit b56166c
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.
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 <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>1 parent eafcc6d commit b56166c
1 file changed
+34
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
55 | 67 | | |
56 | | - | |
57 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
58 | 72 | | |
59 | 73 | | |
60 | 74 | | |
| |||
232 | 246 | | |
233 | 247 | | |
234 | 248 | | |
| 249 | + | |
235 | 250 | | |
236 | 251 | | |
237 | 252 | | |
238 | 253 | | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
239 | 259 | | |
240 | 260 | | |
241 | 261 | | |
242 | 262 | | |
243 | 263 | | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | 264 | | |
248 | 265 | | |
249 | 266 | | |
250 | 267 | | |
251 | | - | |
| 268 | + | |
252 | 269 | | |
253 | | - | |
| 270 | + | |
254 | 271 | | |
255 | | - | |
| 272 | + | |
256 | 273 | | |
257 | | - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
258 | 282 | | |
259 | | - | |
260 | 283 | | |
261 | 284 | | |
262 | 285 | | |
| |||
0 commit comments