[PATCH 1/1] submodule: Fix 'submodule status' when called from a subdirectory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Manish Goregaokar <manishsmail@xxxxxxxxx>

Previously, when calling `git submodule status` while in a
subdirectory, it was incorrectly not detecting modified submodules and
thus reporting that all of the submodules were unchanged.

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

This fixes the bug by setting the `prefix` to NULL when running
`diff-index` from the helper, so that it correctly interprets the path
as relative to the repository root.

Signed-off-by: Manish Goregaokar <manishsmail@xxxxxxxxx>
---
 builtin/submodule--helper.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 909e77e802..abc5b46d46 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -802,7 +802,10 @@ 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);
+	/*
+	 * prefix is NULL since path is an absolute path
+	 */
+	repo_init_revisions(the_repository, &rev, NULL);
 	rev.abbrev = 0;
 	diff_files_args.argc = setup_revisions(diff_files_args.argc,
 					       diff_files_args.argv,
-- 
gitgitgadget



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux