handle lower case drive letters on Windows

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ben Peart committed Jul 12, 2018 at 15:44 UTC 5a06a20e0c8820fb0ca8da019c7a9fe6eb30ec2f
1 file changed +2 -2
t/helper/test-drop-caches.c
+2 -2
@@ -16,8 +16,8 @@ static int cmd_sync(void)
16 if ((0 == dwRet) || (dwRet > MAX_PATH))
17 return error("Error getting current directory");
18
19 - if ((Buffer[0] < 'A') || (Buffer[0] > 'Z'))
20 - return error("Invalid drive letter '%c'", Buffer[0]);
19 + if (!has_dos_drive_prefix(Buffer))
20 + return error("'%s': invalid drive letter", Buffer);
21
22 szVolumeAccessPath[4] = Buffer[0];
23 hVolWrite = CreateFile(szVolumeAccessPath, GENERIC_READ | GENERIC_WRITE,