From: Johannes Sixt <j.sixt@viscovery.net>
To: Jason Holden <jason.k.holden@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/2] Add option to not delete a .git directory in remove_dir_recursively()
Date: Tue, 30 Jun 2009 08:48:09 +0200 [thread overview]
Message-ID: <4A49B529.7030900@viscovery.net> (raw)
In-Reply-To: <1246327845-22718-2-git-send-email-jason.k.holden@gmail.com>
Jason Holden schrieb:
> @@ -812,6 +812,19 @@ int remove_dir_recursively(struct strbuf *path, int only_empty)
> strbuf_addch(path, '/');
>
> len = path->len;
> +
> + if (keep_dot_git) {
> + char end_of_path[6]; /* enough space for ".git/"*/
> + memset(end_of_path, '\0', 6);
> + if (len >= 5) {
> + strncpy(end_of_path, path->buf + len - 5, 5);
> + if (strcmp(end_of_path, ".git/") == 0) {
> + printf("********Found .git!!!! Skipping delete\n");
I see no reason to ***shout!!!*** here. IOW:
warning("not removing %s", dir);
is enough. This also sends the text to stderr.
> + return 0;
> + }
> + }
> + }
> +
> while ((e = readdir(dir)) != NULL) {
> struct stat st;
> if (is_dot_or_dotdot(e->d_name))
I think it is even better to move the check for ".git" below this 'if'. It
should not make a difference in practice.
-- Hannes
prev parent reply other threads:[~2009-06-30 6:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-30 2:10 [PATCH 0/2] Don't delete untracked submodule's .git dirs by default Jason Holden
2009-06-30 2:10 ` [PATCH 1/2] Add option to not delete a .git directory in remove_dir_recursively() Jason Holden
2009-06-30 2:10 ` [PATCH 2/2] Don't clean any untracked submodule's .git dir by default in git-clean Jason Holden
2009-06-30 6:07 ` Paolo Bonzini
2009-06-30 6:40 ` Johannes Sixt
2009-06-30 7:34 ` Junio C Hamano
2009-06-30 23:05 ` Junio C Hamano
2009-07-01 1:44 ` Jason Holden
2009-07-01 2:13 ` Junio C Hamano
2009-06-30 6:48 ` Johannes Sixt [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A49B529.7030900@viscovery.net \
--to=j.sixt@viscovery.net \
--cc=git@vger.kernel.org \
--cc=jason.k.holden@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.
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 NNTP newsgroup(s).