On Thu, Aug 26, 2021 at 05:22:15PM -0400, Taylor Blau wrote: > > I did some research[1] on what parts of `--object-dir` have worked (and not > > worked) in the past, and came to the conclusion that although this > > behavior is surprising, we do bear the responsibility of continuing to > > maintain it. > > Hmm. Upon thinking on in more, here is some evidence to the contrary. > The new test, specifically this snippet: > > git init repo && > test_when_finished "rm -fr repo" && > ( > cd repo && > test_commit base && > git repack -d > ) && > > nongit git multi-pack-index --object-dir=$(pwd)/repo/.git/objects write > > will fail with GIT_TEST_DEFAULT_HASH=sha256, since the MIDX internals > settle on the hash size via `the_hash_algo` which doesn't respect the > hash algorithm used by the target repository. Yeah, I think this is a good example of the class of things that might fail: anything that requires the repo config to behave correctly. I do think the hash format is somewhat unusual here. Most of the changes to the on-disk files are reflected in the files themselves (e.g., pack index v2 is chosen by config at _write_ time, but readers can interpret the file stand-alone). There may be other config that could influence the writing of the midx, and we'd skip it in this kind of non-repo setup. An example here is repack.usedeltabaseoffset, which midx_repack() tries to respect. Ignoring that doesn't produce a nonsense result, but it doesn't follow what would happen if run from inside the repo. The other class of problems I'd expect is where part of the midx operation needs to look at other parts of the repo. Bitmap generation is an obvious one there, since we'd want to look at refs to find the reachable tips. Now obviously that's a new feature we're trying to introduce here, so it can't be an existing breakage. But it does make me wonder what other problems might be lurking. So I dunno. Even if it mostly works now, I'm not sure it's something that I'm all that happy about supporting going forward. It seems like a recipe for subtle bugs where the midx code calls into other library code that assumes that it can look at the repository struct. -Peff