From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <johannes.schindelin@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] git mv: do not keep slash in `git mv dir non-existing-dir/`
Date: Fri, 05 Aug 2016 08:52:49 -0700 [thread overview]
Message-ID: <xmqqtwezxlf2.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <e0415c55e9bc651e7fa9f5f7717b4f6e44eb9ce1.1470407827.git.johannes.schindelin@gmx.de> (Johannes Schindelin's message of "Fri, 5 Aug 2016 16:41:12 +0200 (CEST)")
Johannes Schindelin <johannes.schindelin@gmx.de> writes:
> When calling `rename("dir", "non-existing-dir/")` on Linux, it silently
> succeeds, stripping the trailing slash of the second argument.
>
> This is all good and dandy but this behavior disagrees with the specs at
>
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/rename.html
>
> that state clearly regarding the 2nd parameter (called `new`):
>
> If the `new` argument does not resolve to an existing directory
> entry for a file of type directory and the `new` argument
> contains at least one non- <slash> character and ends with one
> or more trailing <slash> characters after all symbolic links
> have been processed, `rename()` shall fail.
I agree with all of the above. But
> Of course, we would like `git mv dir non-existing-dir/` to succeed (and
> rename the directory "dir" to "non-existing-dir").
I do not think I want that. When I say "mv A B/", I want it to fail
if I made a typo for B; the trailing slash after B is an explicit
statement "I expect B to exist and I want A to appear at B/A".
Current Git behaviour on Linux seems to allow "git mv dir no-such-dir/"
but "dir" is renamed to "no-such-dir", which fails two expectations,
and I think this is broken. If Windows port does not share this
breakage, that is a good thing. We should fix Git behaviour on Linux
instead, I would think.
next prev parent reply other threads:[~2016-08-05 15:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-05 14:41 [PATCH] git mv: do not keep slash in `git mv dir non-existing-dir/` Johannes Schindelin
2016-08-05 15:52 ` Junio C Hamano [this message]
2016-08-05 15:58 ` Johannes Schindelin
2016-08-05 16:18 ` Junio C Hamano
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqtwezxlf2.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=johannes.schindelin@gmx.de \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).