git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] builtin/grep.c: remote superflous submodule code

From
Stefan Beller <sbeller@google.com>
Date
Oct 9, 2018, 18:35 UTC
Message-ID
<20181009183549.195316-1-sbeller@google.com>

In f9ee2fcdfa (grep: recurse in-process using 'struct repository', 2017-08-02), we introduced a call to repo_read_gitmodules in builtin/grep to simplify the submodule handling.

After ff6f1f564c4 (submodule-config: lazy-load a repository's .gitmodules file, 2017-08-03) this is no longer necessary, but that commit did not cleanup the whole tree, but just show cased the new way how to deal with submodules in ls-files.

It claimed that grep would still need some explicit handling, but that is not the call to repo_read_gitmodules (applying this patch on top of ff6f1f564c4 still keep the test suite happy, specifically t7814-grep-recurse-submodules, which contains a test "grep history with moved submoules")

The special handling is the call to gitmodules_config_oid which was added already in 74ed43711f (grep: enable recurse-submodules to work on <tree> objects, 2016-12-16), but then was still named gitmodules_config_sha1.

Signed-off-by: Stefan Beller <sbeller@google.com>
Acked-by: Antonio Ospite <ao2@ao2.it>
---

This is a resend of origin/sb/grep-submodule-cleanup, and I think picking ff6f1f564c4 as the base for the series would also be appropriate.

Stefan
 builtin/grep.c | 2 --
 1 file changed, 2 deletions(-)
diff --git a/builtin/grep.c b/builtin/grep.c
index 601f801158..a6272b9c2f 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -427,8 +427,6 @@ static int grep_submodule(struct grep_opt *opt, struct repository *superproject,
 	if (repo_submodule_init(&submodule, superproject, path))
 		return 0;
 
-	repo_read_gitmodules(&submodule);
-
 	/*
 	 * NEEDSWORK: This adds the submodule's object directory to the list of
 	 * alternates for the single in-memory object store.  This has some bad
-- 
2.19.0
Next: Jonathan Tan
Message 1 of 3 in “builtin/grep.c: remote superflous submodule code”
  1. builtin/grep.c: remote superflous submodule codeStefan Beller, Oct 9, 2018
  2. Jonathan TanOct 10, 2018
  3. Stefan BellerOct 10, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.