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

[RFC PATCH 2/2] dir: Recurse into nested git repos if they aren't submodules

From
LSLukas Straub <lukasstraub2@web.de>
Date
Aug 19, 2020, 16:43 UTC
Message-ID
<52f2765689d0d56739b3ba2c08d9cf8db63b5794.1597853634.git.lukasstraub2@web.de>
In-Reply-To
<cover.1597853634.git.lukasstraub2@web.de>

Only stop recursing into a nested git repository if it actually is a submodule.

This allows adding nested git repositories as files as usual.
Signed-off-by: Lukas Straub <lukasstraub2@web.de>
---
 dir.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/dir.c b/dir.c
index a959885f50..359015748f 100644
--- a/dir.c
+++ b/dir.c
@@ -1787,10 +1787,8 @@ static enum path_treatment treat_directory(struct dir_struct *dir,
 
 	if ((dir->flags & DIR_SKIP_NESTED_GIT) ||
 		!(dir->flags & DIR_NO_GITLINKS)) {
-		struct strbuf sb = STRBUF_INIT;
-		strbuf_addstr(&sb, dirname);
-		nested_repo = is_nonbare_repository_dir(&sb);
-		strbuf_release(&sb);
+		nested_repo = !!submodule_from_path(the_repository, &null_oid,
+						    dirname);
 	}
 	if (nested_repo)
 		return ((dir->flags & DIR_SKIP_NESTED_GIT) ? path_none :
-- 
2.28.0.217.ge805fe7219
Previous: Lukas StraubNext: Lukas Straub
Message 2 of 27 in “Allow adding .git files and directories”
  1. 0/2 Allow adding .git files and directoriesLukas Straub, Aug 19, 2020
  2. 2/2 dir: Recurse into nested git repos if they aren't submodulesLukas Straub, Aug 19, 2020
  3. 1/2 dir/read-cache: Allow adding .git files and directoriesLukas Straub, Aug 19, 2020
  4. Junio C HamanoAug 19, 2020
  5. Randall S. BeckerAug 19, 2020
  6. Junio C HamanoAug 19, 2020
  7. Randall S. BeckerAug 19, 2020
  8. Jeff KingAug 19, 2020
  9. Junio C HamanoAug 19, 2020
  10. Jeff KingAug 19, 2020
  11. Randall S. BeckerAug 19, 2020
  12. Johannes SchindelinAug 20, 2020
  13. Lukas StraubAug 20, 2020
  14. Jeff KingAug 20, 2020
  15. Lukas StraubAug 21, 2020
  16. Randall S. BeckerAug 21, 2020
  17. brian m. carlsonAug 21, 2020
  18. Lukas StraubAug 22, 2020
  19. brian m. carlsonAug 22, 2020
  20. Lukas StraubAug 22, 2020
  21. Johannes SchindelinAug 24, 2020
  22. Lukas StraubAug 20, 2020
  23. Jeff KingAug 20, 2020
  24. Lukas StraubAug 19, 2020
  25. Lukas StraubAug 19, 2020
  26. Randall S. BeckerAug 19, 2020
  27. Lukas StraubAug 20, 2020

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.