From 8d33c3af0b2113091ea2c2c94990d0332c9551e7 Mon Sep 17 00:00:00 2001 From: Jonathan Tan Date: Mon, 16 Aug 2021 14:09:52 -0700 Subject: grep: use submodule-ODB-as-alternate lazy-addition In the parent commit, Git was taught to add submodule ODBs as alternates lazily, but grep does not use this because it computes the path to add directly, not going through add_submodule_odb(). Add an equivalent to add_submodule_odb() that takes the exact ODB path and teach grep to use it. Signed-off-by: Jonathan Tan Reviewed-by: Emily Shaffer Reviewed-by: Matheus Tavares Signed-off-by: Junio C Hamano --- submodule.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'submodule.c') diff --git a/submodule.c b/submodule.c index 8fde90e906..8de1aecaeb 100644 --- a/submodule.c +++ b/submodule.c @@ -187,6 +187,11 @@ done: return ret; } +void add_submodule_odb_by_path(const char *path) +{ + string_list_insert(&added_submodule_odb_paths, xstrdup(path)); +} + int register_all_submodule_odb_as_alternates(void) { int i; -- cgit v1.2.3