diff options
| author | brian m. carlson <sandals@crustytoothpaste.net> | 2025-11-15 00:58:17 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-11-15 11:51:37 -0800 |
| commit | 66c78e0653a4e60c625b8400da31da0ba5bd1286 (patch) | |
| tree | bae64a12e70c9537d7ce2eafd340de38bcb91e49 /t/unit-tests/u-string-list.c | |
| parent | bb5c624209fcaebd60b9572b2cc8c61086e39b57 (diff) | |
object-file: disallow adding submodules of different hash algo
The design of the hash algorithm transition plan is that objects stored
must be entirely in one algorithm since we lack any way to indicate a
mix of algorithms. This also includes submodules, but we have
traditionally not enforced this, which leads to various problems when
trying to clone or check out the the submodule from the remote.
Since this cannot work in the general case, restrict adding a submodule
of a different algorithm to the index. Add tests for git add and git
submodule add that these are rejected.
Note that we cannot check this in git fsck because the malformed
submodule is stored in the tree as an object ID which is either
truncated (when a SHA-256 submodule is added to a SHA-1 repository) or
padded with zeros (when a SHA-1 submodule is added to a SHA-256
repository). We cannot detect even the latter case because someone
could have an actual submodule that actually ends in 24 zeros, which
would be a false positive.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/unit-tests/u-string-list.c')
0 files changed, 0 insertions, 0 deletions
