git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Lukas Straub <lukasstraub2@web.de>
To: git <git@vger.kernel.org>
Cc: Elijah Newren <newren@gmail.com>,
	Brandon Williams <bwilliams.eng@gmail.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Jeff King <peff@peff.net>, Junio C Hamano <gitster@pobox.com>
Subject: [RFC PATCH 2/2] dir: Recurse into nested git repos if they aren't submodules
Date: Wed, 19 Aug 2020 18:43:48 +0200	[thread overview]
Message-ID: <52f2765689d0d56739b3ba2c08d9cf8db63b5794.1597853634.git.lukasstraub2@web.de> (raw)
In-Reply-To: <cover.1597853634.git.lukasstraub2@web.de>

[-- Attachment #1: Type: text/plain, Size: 893 bytes --]

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

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2020-08-19 16:44 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-19 16:43 [RFC PATCH 0/2] Allow adding .git files and directories Lukas Straub
2020-08-19 16:43 ` [RFC PATCH 1/2] dir/read-cache: " Lukas Straub
2020-08-19 16:43 ` Lukas Straub [this message]
2020-08-19 18:03 ` [RFC PATCH 0/2] " Junio C Hamano
2020-08-19 18:47   ` Randall S. Becker
2020-08-19 19:09     ` Junio C Hamano
2020-08-19 19:23       ` Randall S. Becker
2020-08-19 20:17       ` Jeff King
2020-08-19 20:32         ` Junio C Hamano
2020-08-19 20:38           ` Jeff King
2020-08-19 21:56             ` Randall S. Becker
2020-08-20 10:16             ` Johannes Schindelin
2020-08-20 11:34             ` Lukas Straub
2020-08-20 13:01               ` Jeff King
2020-08-21 12:39                 ` Lukas Straub
2020-08-21 13:11                   ` Randall S. Becker
2020-08-21 22:52                   ` brian m. carlson
2020-08-22 14:21                     ` Lukas Straub
2020-08-22 18:53                       ` brian m. carlson
2020-08-22 19:12                         ` Lukas Straub
2020-08-24 13:52                           ` Johannes Schindelin
2020-08-20 12:37         ` Lukas Straub
2020-08-20 13:08           ` Jeff King
2020-08-19 19:22     ` Lukas Straub
2020-08-19 18:47   ` Lukas Straub
2020-08-19 19:16     ` Randall S. Becker
2020-08-20 11:46       ` Lukas Straub

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52f2765689d0d56739b3ba2c08d9cf8db63b5794.1597853634.git.lukasstraub2@web.de \
    --to=lukasstraub2@web.de \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=bwilliams.eng@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=newren@gmail.com \
    --cc=peff@peff.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).