git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Patrick Marlier <patrick.marlier@gmail.com>
To: git@vger.kernel.org, newren@gmail.com
Cc: Patrick Marlier <patrick.marlier@gmail.com>
Subject: [PATCH v2 1/2] clean: avoid looking for nested repositories when unnecessary
Date: Mon, 21 Feb 2022 10:00:33 +0100	[thread overview]
Message-ID: <20220221090034.4615-1-patrick.marlier@gmail.com> (raw)

With `git clean --ff` we will be deleting nested untracked repositories,
so there is no need to differentiate them from other untracked files.
Use the DIR_NO_GITLINKS flag in dir.flags to signify this and avoid the
is_nonbare_repository_dir() checks.
---
 builtin/clean.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/builtin/clean.c b/builtin/clean.c
index 3ff02bbbff..18b37e3fd9 100644
--- a/builtin/clean.c
+++ b/builtin/clean.c
@@ -955,9 +955,10 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
 				  " refusing to clean"));
 	}
 
-	if (force > 1)
+	if (force > 1) {
 		rm_flags = 0;
-	else
+		dir.flags |= DIR_NO_GITLINKS;
+	} else
 		dir.flags |= DIR_SKIP_NESTED_GIT;
 
 	dir.flags |= DIR_SHOW_OTHER_DIRECTORIES;
-- 
2.35.1


             reply	other threads:[~2022-02-21 17:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-21  9:00 Patrick Marlier [this message]
2022-02-21  9:00 ` [PATCH v2 2/2] clean: avoid traversing into untracked dirs when unnecessary Patrick Marlier
2022-02-22  1:48   ` Elijah Newren

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=20220221090034.4615-1-patrick.marlier@gmail.com \
    --to=patrick.marlier@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=newren@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.
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).