From: Paolo Bonzini <bonzini@gnu.org>
To: Jason Holden <jason.k.holden@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] Don't clean any untracked submodule's .git dir by default in git-clean
Date: Tue, 30 Jun 2009 08:07:01 +0200 [thread overview]
Message-ID: <4A49AB85.40303@gnu.org> (raw)
In-Reply-To: <1246327845-22718-3-git-send-email-jason.k.holden@gmail.com>
Useful indeed.
Note that 'git clean -n -d ' however will still report the directory as
being removed. Also, I'm not sure what happens (and what should happen)
if an untracked directory foo.git is found.
Probably the best way to fix this is to add an is_dot_git_path function
to dir.c like this
int
is_dot_git_path (const char *s, int len);
{
while (len && s[len - 1] == '/')
len--;
return len >= 4 && !memcmp (s + len - 4, ".git", 5) &&
(len == 4 || s[len - 5] == '/');
}
This function is safer if the directory does not have a trailing slash,
as it might be for the paths in builtin-clean.c for the -n case. You
can have some adjustments if you decide do keep foo.git (just removing
the last && of course).
Thanks!
Paolo
next prev parent reply other threads:[~2009-06-30 6:07 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 [this message]
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 ` [PATCH 1/2] Add option to not delete a .git directory in remove_dir_recursively() Johannes Sixt
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=4A49AB85.40303@gnu.org \
--to=bonzini@gnu.org \
--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).