From: "Manish Goregaokar via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Manish Goregaokar <manishsmail@gmail.com>,
Junio C Hamano <gitster@pobox.com>,
Manish Goregaokar <manishsmail@gmail.com>
Subject: [PATCH 1/1] submodule: Fix 'submodule status' when called from a subdirectory
Date: Sat, 23 Nov 2019 06:28:41 +0000 [thread overview]
Message-ID: <2004f4aaa99e5d936a3f3d141b5612df9b013f14.1574490521.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.472.git.1574490521.gitgitgadget@gmail.com>
From: Manish Goregaokar <manishsmail@gmail.com>
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@gmail.com>
---
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
next prev parent reply other threads:[~2019-11-23 6:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-23 6:28 [PATCH 0/1] submodule: Fix 'submodule status' when called from a subdirectory Manish Goregaokar via GitGitGadget
2019-11-23 6:28 ` Manish Goregaokar via GitGitGadget [this message]
2019-11-24 5:17 ` [PATCH 1/1] " Junio C Hamano
2019-11-24 8:01 ` [PATCH v2 0/1] " Manish Goregaokar via GitGitGadget
2019-11-24 8:01 ` [PATCH v2 1/1] submodule: fix " Manish Goregaokar via GitGitGadget
2019-11-25 1:56 ` Junio C Hamano
2019-11-25 4:08 ` Manish Goregaokar
2019-11-25 4:15 ` [PATCH v3 0/1] submodule: Fix " Manish Goregaokar via GitGitGadget
2019-11-25 4:15 ` [PATCH v3 1/1] submodule: fix " Manish Goregaokar via GitGitGadget
2019-11-25 4:51 ` Junio C Hamano
2019-11-25 6:32 ` Manish Goregaokar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2004f4aaa99e5d936a3f3d141b5612df9b013f14.1574490521.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=manishsmail@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).