summaryrefslogtreecommitdiffstats
path: root/contrib/persistent-https
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-11-15 23:02:57 -0800
committerJunio C Hamano <gitster@pobox.com>2025-11-25 08:43:20 -0800
commitdd8e8c786efdfb3ba588d807bfb0dc0d5196c343 (patch)
tree9a748dd74255dcbc30ec68992dbd5de1cde014d3 /contrib/persistent-https
parentbb5c624209fcaebd60b9572b2cc8c61086e39b57 (diff)
downloadgit-dd8e8c786efdfb3ba588d807bfb0dc0d5196c343.tar.gz
git-dd8e8c786efdfb3ba588d807bfb0dc0d5196c343.zip
submodule add: sanity check existing .gitmodules
"git submodule add" tries to find if a submodule with the same name already exists at a different path, by looking up an entry in the .gitmodules file. If the entry in the file is incomplete, e.g., when the submodule.<name>.something variable is defined but there is no definition of submodule.<name>.path variable, it accesses the missing .path member of the submodule structure and triggers a segfault. A brief audit was done to make sure that the code does not assume members other than those that are absolutely certain to exist: a submodule obtained by submodule_from_name() should have .name member, while a submodule obtained by submodule_from_path() should also have .path as well as .name member, and we cannot assume anything else. Luckily, the module_add() codepath was the only problematic one. It is fairly recent code that comes from 1fa06ced (submodule: prevent overwriting .gitmodules on path reuse, 2025-07-24). A helper used by update_submodule() seems to assume that its call to submodule_from_path() always yields a submodule object without a failure, which seems to rely on the caller making sure it is the case. Leave an assert() with a NEEDSWORK comment there for future developers to make sure the assumption actually holds. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/persistent-https')
0 files changed, 0 insertions, 0 deletions