]> git.ipfire.org Git - thirdparty/git.git/commit - builtin/submodule--helper.c
submodule: fix 'submodule status' when called from a subdirectory
authorManish Goregaokar <manishsmail@gmail.com>
Mon, 25 Nov 2019 04:15:44 +0000 (04:15 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 25 Nov 2019 05:08:25 +0000 (14:08 +0900)
commit1f3aea22c781d603d56ce794879a8fe8d8dd77d1
tree2885e4bdb247daa8a8e8227cc1c433c943821a04
parent5fa0f5238b0cd46cfe7f6fa76c3f526ea98148d9
submodule: fix 'submodule status' when called from a subdirectory

When calling `git submodule status` while in a subdirectory, we are
incorrectly not detecting modified submodules and
thus reporting that all of the submodules are unchanged.

This is because the submodule helper is calling `diff-index` with the
submodule path assuming the path is relative to the current prefix
directory, however the submodule path used is actually relative to the root.

Always pass NULL as the `prefix` when running diff-files on the
submodule, to make sure the submodule's path is interpreted as relative
to the superproject's repository root.

Signed-off-by: Manish Goregaokar <manishsmail@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/submodule--helper.c
t/t7400-submodule-basic.sh