From: Junio C Hamano <gitster@pobox.com>
To: Ben Peart <Ben.Peart@microsoft.com>
Cc: "git\@vger.kernel.org" <git@vger.kernel.org>,
"sbeller\@google.com" <sbeller@google.com>,
"johannes.schindelin\@gmx.de" <johannes.schindelin@gmx.de>
Subject: Re: [PATCH v3] handle lower case drive letters on Windows
Date: Thu, 12 Jul 2018 12:12:49 -0700 [thread overview]
Message-ID: <xmqqr2k8w9n2.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20180712154419.18100-1-benpeart@microsoft.com> (Ben Peart's message of "Thu, 12 Jul 2018 15:44:36 +0000")
Ben Peart <Ben.Peart@microsoft.com> writes:
> On Windows, if a tool calls SetCurrentDirectory with a lower case drive
> letter, the subsequent call to GetCurrentDirectory will return the same
> lower case drive letter. Powershell, for example, does not normalize the
> path. If that happens, test-drop-caches will error out as it does not
> correctly to handle lower case drive letters.
>
> Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> Signed-off-by: Ben Peart <Ben.Peart@microsoft.com>
> ---
Thanks. Will replace, even though showing the whole Buffer (I am
guessing it is the equivalent of result from getcwd(3) call) and
complaining about drive "letter" feels a bit strange ;-)
> Notes:
> Base Ref: master
> Web-Diff: https://github.com/benpeart/git/commit/1ff8de1b6c
> Checkout: git fetch https://github.com/benpeart/git drop-caches-v3 && git checkout 1ff8de1b6c
>
> ### Interdiff (v2..v3):
>
> diff --git a/t/helper/test-drop-caches.c b/t/helper/test-drop-caches.c
> index 37047189c3..f65e301f9d 100644
> --- a/t/helper/test-drop-caches.c
> +++ b/t/helper/test-drop-caches.c
> @@ -16,8 +16,8 @@ static int cmd_sync(void)
> if ((0 == dwRet) || (dwRet > MAX_PATH))
> return error("Error getting current directory");
>
> - if ((toupper(Buffer[0]) < 'A') || (toupper(Buffer[0]) > 'Z'))
> - return error("Invalid drive letter '%c'", Buffer[0]);
> + if (!has_dos_drive_prefix(Buffer))
> + return error("'%s': invalid drive letter", Buffer);
>
> szVolumeAccessPath[4] = Buffer[0];
> hVolWrite = CreateFile(szVolumeAccessPath, GENERIC_READ | GENERIC_WRITE,
>
> ### Patches
>
> t/helper/test-drop-caches.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/t/helper/test-drop-caches.c b/t/helper/test-drop-caches.c
> index d6bcfddf13..f65e301f9d 100644
> --- a/t/helper/test-drop-caches.c
> +++ b/t/helper/test-drop-caches.c
> @@ -16,8 +16,8 @@ static int cmd_sync(void)
> if ((0 == dwRet) || (dwRet > MAX_PATH))
> return error("Error getting current directory");
>
> - if ((Buffer[0] < 'A') || (Buffer[0] > 'Z'))
> - return error("Invalid drive letter '%c'", Buffer[0]);
> + if (!has_dos_drive_prefix(Buffer))
> + return error("'%s': invalid drive letter", Buffer);
>
> szVolumeAccessPath[4] = Buffer[0];
> hVolWrite = CreateFile(szVolumeAccessPath, GENERIC_READ | GENERIC_WRITE,
>
> base-commit: e3331758f12da22f4103eec7efe1b5304a9be5e9
next prev parent reply other threads:[~2018-07-12 19:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-11 17:54 [PATCH v1] handle lower case drive letters on Windows Ben Peart
2018-07-11 17:59 ` Stefan Beller
2018-07-11 19:07 ` Ben Peart
2018-07-11 20:11 ` Junio C Hamano
2018-07-11 21:30 ` Ben Peart
2018-07-11 21:41 ` [PATCH v2] " Ben Peart
2018-07-12 13:59 ` [PATCH v1] " Johannes Schindelin
2018-07-12 16:33 ` Junio C Hamano
2018-07-12 15:44 ` [PATCH v3] " Ben Peart
2018-07-12 19:12 ` Junio C Hamano [this message]
2018-07-12 19:23 ` Ben Peart
2018-07-12 19:53 ` Junio C Hamano
2018-07-12 20:09 ` Ben Peart
2018-07-12 20:34 ` Junio C Hamano
2018-07-14 22:15 ` 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=xmqqr2k8w9n2.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=Ben.Peart@microsoft.com \
--cc=git@vger.kernel.org \
--cc=johannes.schindelin@gmx.de \
--cc=sbeller@google.com \
/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).