From 1f3aea22c781d603d56ce794879a8fe8d8dd77d1 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 25 Nov 2019 04:15:44 +0000 Subject: 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 Signed-off-by: Junio C Hamano --- builtin/submodule--helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'builtin') diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index 909e77e802..eeea8dfa97 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -802,7 +802,8 @@ static void status_submodule(const char *path, const struct object_id *ce_oid, path, NULL); git_config(git_diff_basic_config, NULL); - repo_init_revisions(the_repository, &rev, prefix); + + repo_init_revisions(the_repository, &rev, NULL); rev.abbrev = 0; diff_files_args.argc = setup_revisions(diff_files_args.argc, diff_files_args.argv, -- cgit v1.2.3