From: Shawn Bohrer <shawn.bohrer@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: git@vger.kernel.org, frank@lichtenheld.de, gitster@pobox.com
Subject: Re: [PATCH] Make git-clean a builtin
Date: Sun, 7 Oct 2007 10:41:26 -0500 [thread overview]
Message-ID: <20071007154126.GD5642@mediacenter.austin.rr.com> (raw)
In-Reply-To: <alpine.LFD.0.999.0710061827010.23684@woody.linux-foundation.org>
Thanks for the input.
On Sat, Oct 06, 2007 at 06:31:36PM -0700, Linus Torvalds wrote:
> This looks better, but I think you'd be even better off actually using the
> "read_directory()" interface directly, instead of exec'ing off "git
> ls-files" and parsing the line output.
Perhaps, I'll take a look at how git-ls-files does it and see if I can
do that directly. Since I'm new to git (and C) it will probably take me
a while to re-implement though.
> I also would still worry a bit about 'chdir(x)' and 'chdir("..")', because
> quite frankly, they are *not* mirrors of each other (think symlinks, but
> also error behaviour due to directories that might be non-executable).
> Now, admittedly, if a directory isn't executable, I can imagine other git
> things having problems (anybody want to test?), but that whole pattern is
> just very fragile and not very reliable.
Yes it does seem fragile, but 'chdir("-")' doesn't work in C and I
couldn't find any equivalents. I actually did think about symlinks, and
my code does do the right thing since I test if it is a directory before
doing the 'chdir(x)'. Symlinks are therefore treated as normal files and
removed.
I did not think about non-executable directories, and you are correct
that my code will fail to remove a directory if it is non-executable. I
also tested a git-ls-files with non-executable directories, and it will
fail to show you any files that are more than one level deep for
example:
|-- docs
| |-- contributing
| | `-- patches.txt
| `-- manual.txt
If docs is non-executable it will only return 'docs/manual.txt'
--
Shawn
next prev parent reply other threads:[~2007-10-07 15:40 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-07 1:17 [PATCH] Make git-clean a builtin Shawn Bohrer
2007-10-07 1:31 ` Linus Torvalds
2007-10-07 15:41 ` Shawn Bohrer [this message]
2007-10-07 16:42 ` rae l
2007-10-07 16:38 ` Johannes Schindelin
-- strict thread matches above, loose matches on Subject: below --
2007-11-12 1:48 Shawn Bohrer
2007-11-07 5:18 Shawn Bohrer
2007-11-07 11:10 ` Johannes Schindelin
2007-11-07 13:29 ` Bill Lear
2007-11-07 14:17 ` Johannes Schindelin
2007-11-07 14:45 ` Matthieu Moy
2007-11-07 19:46 ` Jon Loeliger
2007-11-10 22:43 ` Miles Bader
2007-11-07 14:54 ` Shawn Bohrer
2007-11-07 15:04 ` Johannes Schindelin
2007-11-07 20:51 ` Brian Downing
2007-11-07 21:49 ` Junio C Hamano
2007-11-07 20:42 ` Junio C Hamano
2007-11-08 5:37 ` Shawn Bohrer
2007-11-04 19:02 [RFC] Second attempt at making " Shawn Bohrer
2007-11-04 19:02 ` [PATCH] Add more tests for git-clean Shawn Bohrer
2007-11-04 19:02 ` [PATCH] Make git-clean a builtin Shawn Bohrer
2007-11-04 19:41 ` Pierre Habouzit
2007-11-05 21:14 ` Junio C Hamano
2007-11-05 22:10 ` Carlos Rica
2007-11-05 23:54 ` Junio C Hamano
2007-11-06 5:05 ` Shawn Bohrer
2007-11-06 5:30 ` Junio C Hamano
2007-10-07 23:57 Shawn Bohrer
2007-10-08 3:57 ` Johannes Schindelin
2007-10-06 20:54 Shawn Bohrer
2007-10-06 21:52 ` Frank Lichtenheld
2007-10-07 1:13 ` Shawn Bohrer
2007-10-08 2:04 ` Jeff King
2007-10-08 2:08 ` Jeff King
2007-10-08 2:17 ` Linus Torvalds
2007-10-08 2:22 ` Jeff King
2007-10-08 6:37 ` Johannes Sixt
2007-10-08 18:27 ` Linus Torvalds
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=20071007154126.GD5642@mediacenter.austin.rr.com \
--to=shawn.bohrer@gmail.com \
--cc=frank@lichtenheld.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=torvalds@linux-foundation.org \
/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).