From: Junio C Hamano <gitster@pobox.com>
To: Johannes Sixt <j6t@kdbg.org>
Cc: Johannes Schindelin <johannes.schindelin@gmx.de>,
Jeff King <peff@peff.net>, Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] fix pushing to //server/share/dir paths on Windows
Date: Tue, 13 Dec 2016 14:48:47 -0800 [thread overview]
Message-ID: <xmqqpokvzbqo.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <2ff2613c-47da-a780-5d38-93e16cb16328@kdbg.org> (Johannes Sixt's message of "Tue, 13 Dec 2016 22:32:01 +0100")
Johannes Sixt <j6t@kdbg.org> writes:
> There is a change in behavior: \\server\share is not transformed
> into //server/share anymore, but all subsequent directory separators
> are rewritten to '/'. This should not make a difference; Windows can
> handle the mix.
I saw Dscho had a similar "windows can handle the mix" change in an
earlier development cycle, I think, and this is being consistent.
> Another long-standing bug uncovered by the quarantine series.
>
> Dscho, it looks like this could fix the original report at
> https://github.com/git-for-windows/git/issues/979
>
> This patch should cook well because of the change in behavior.
> I would not be surprised if there is some fall-out.
>
> The other bug I'm alluding to, I still have to investigate. I do
> not think that it can be counted as fall-out.
>
> path.c | 24 +++++++++++++++---------
> 1 file changed, 15 insertions(+), 9 deletions(-)
Thanks.
> diff --git a/path.c b/path.c
> index 52d889c88e..02dc70fb92 100644
> --- a/path.c
> +++ b/path.c
> @@ -991,7 +991,7 @@ const char *remove_leading_path(const char *in, const char *prefix)
> *
> * Performs the following normalizations on src, storing the result in dst:
> * - Ensures that components are separated by '/' (Windows only)
> - * - Squashes sequences of '/'.
> + * - Squashes sequences of '/' except "//server/share" on Windows
"on windows" because offset_1st_component() does the magic only
there? Makes sense.
> * - Removes "." components.
> * - Removes ".." components, and the components the precede them.
> * Returns failure (non-zero) if a ".." component appears as first path
> @@ -1014,17 +1014,23 @@ const char *remove_leading_path(const char *in, const char *prefix)
> int normalize_path_copy_len(char *dst, const char *src, int *prefix_len)
> {
> char *dst0;
> - int i;
> -
> - for (i = has_dos_drive_prefix(src); i > 0; i--)
> - *dst++ = *src++;
> - dst0 = dst;
> + int offset;
>
> - if (is_dir_sep(*src)) {
> + /*
> + * Handle initial part of absolute path: "/", "C:/", "\\server\share/".
> + */
> + offset = offset_1st_component(src);
> + if (offset) {
> + /* Convert the trailing separator to '/' on Windows. */
> + memcpy(dst, src, offset - 1);
> + dst += offset - 1;
> *dst++ = '/';
> - while (is_dir_sep(*src))
> - src++;
> + src += offset;
> }
> + dst0 = dst;
By resetting dst0 here, we ensure that up_one that is triggered by
seeing "../" will not escape the \\server\share\ part, which makes
sense to me.
> + while (is_dir_sep(*src))
> + src++;
>
> for (;;) {
> char c = *src;
next prev parent reply other threads:[~2016-12-13 22:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-13 21:32 [PATCH] fix pushing to //server/share/dir paths on Windows Johannes Sixt
2016-12-13 22:48 ` Junio C Hamano [this message]
2016-12-14 17:30 ` Jeff King
2016-12-14 19:37 ` [PATCH v2] fix pushing to //server/share/dir " Johannes Sixt
2016-12-15 7:30 ` Torsten Bögershausen
2016-12-15 11:01 ` Jeff King
2016-12-15 17:49 ` Junio C Hamano
2016-12-19 17:18 ` [PATCH] fix pushing to //server/share/dir paths " Johannes Schindelin
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=xmqqpokvzbqo.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=j6t@kdbg.org \
--cc=johannes.schindelin@gmx.de \
--cc=peff@peff.net \
/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).