Thread (2 messages) 2 messages, 2 authors, 2023-10-31

Re: [PATCH 0/3] Add `-p' option to `git-mv', inspired by `mkdir'

From: Dragan Simic <hidden>
Date: 2023-10-31 04:54:35

On 2023-10-31 05:30, Junio C Hamano wrote:
Hugo Sales [off-list ref] writes:
quoted
quoted
Both are plausible, and "mkdir -p" does not have such a nasty
ambiguity.  That is what makes me unsure about the new feature
(again, either with required "-p" or with implied "-p").
I think the ambiguity is resolved by the inclusion of lack thereof
of a trailing `/`.
The question is not if we can come up with a rule that the user can
use to disambiguate.  It is if the user will find that such a rule
is a naturally acceptable way to disambiguate.

When both of

    git mv file there/exists/such/a/directory
    git mv file there/exists/such/a/directory/

create "there/exists/such/a/directory/file" and removes "file", with
or without a trailing slash, "you should add a slash if you want a
directory, and otherwise you should not add a slash" is a rather
arbitrary rule.  Let's not go there.  I still view the downside more
grave than having to occasionally do "mkdir".
Please note that the above-described git-mv operation succeeds with no 
trailing slash if "there/exists/such/a/directory" doesn't already exist 
as a directory, and creates "there/exists/such/a/directory" as a file.  
With the trailing slash, the git-mv operation succeeds only if 
"there/exists/such/a/directory" already exists as a directory, and fails 
otherwise.

A quite similar ambiguity exists in cp(1) in mv(1), which is also 
resolved by the use of the trailing slash character.  However, I've 
encountered only one person aware of that disambiguation, and in cp(1) 
only, but in the "I always include the trailing slash" way, without 
actually understanding it fully.  Maybe I need to encounter more people, 
I don't know.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help