From: Junio C Hamano Date: Tue, 14 May 2013 23:27:00 GMT Subject: Re: [PATCH v9 1/9] git-clean: refactor git-clean into two phases Message-ID: <7vvc6ldtx7.fsf@alter.siamese.dyndns.org> In-Reply-To: <7c551bf22bc45cfcdd62d1baf6300f3f86244312.1368518327.git.worldhello.net@gmail.com> Jiang Xin writes: > +/* > + * Give path as relative to prefix. > + * > + * This function is a combination of path_relative (in quote.c) and > + * relative_path (in path.c) > + */ > +static const char *path_relative(const char *in, const char *prefix) > +{ > +... Hmph. Is it possible to reuse the public one (in path.c) here and in quote.c, perhaps after enhancing it a bit to serve needs of the callers of two existing ones and the new callers of this one? > @@ -242,11 +287,6 @@ int cmd_clean(int argc, const char **argv, const char *prefix) > continue; /* Yup, this one exists unmerged */ > } > > - /* > - * we might have removed this as part of earlier > - * recursive directory removal, so lstat() here could > - * fail with ENOENT. > - */ > if (lstat(ent->name, &st)) > continue; I am guessing that the reason why you removed the comment is because during this phase there is no way we "might have removed". But if that is the case, does it still make sense to run lstat() and ignore errors from the call?