Subject: Re: [PATCH] ignore trailing slash when creating leading directories

From: Junio C Hamano <[email-masked]>
Date: Tue, 02 Sep 2008 13:36:38 -0700

Clemens Buchacher <[email-masked]> writes:

> Unfortunately, if we simply add strerror to the error message, in place of
>
> fatal: could not create work tree dir 'path/'.
>
> the new version would print
>
> fatal: could not create work tree dir 'path/': File exists.
>
> which makes things worse IMO. We could of course strip trailing slashes in
> builtin-clone.c for now and revert that as soon as the cleanup patch is in,

I think the above statement is a wrong way to think about it.

This particular caller (and nobody else), even when it does not want the
"create all directories" behaviour, is giving such an instruction to the
existing function, without validating the user input.  That is a bug that
needs to be fixed, regardless of what the final semantics of c-l-d should
be, isn't it?

> but I think it's not worth the trouble.

What I think is not worth the trouble is, after fixing this caller, to
revert that fix, when/if we decide that c-l-d should strip trailing
slashes for all callers.

I am not saying the current semantics of c-l-d is optimal.  I am just
worried about breaking people's private patches that may depend on the
current behaviour.  It would be nice if we can clean it up without
breaking people, and after doing so, if somebody really want to have
"create all directories, the last one is also a directory", they can
invent a cleaner function that takes that insn as a separate paremeter,
not as an obscure "trailing slash means create all", which may be cute but
not clean nor clear at all, which is what c-l-d does.