git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3] handle lower case drive letters on Windows

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 12, 2018, 19:12 UTC
Message-ID
<xmqqr2k8w9n2.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20180712154419.18100-1-benpeart@microsoft.com>
Ben Peart <Ben.Peart@microsoft.com> writes:
Show 9 quoted lines
> 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 ;-)

Show 45 quoted lines
> 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
Previous: Ben PeartNext: Ben Peart
Message 10 of 15 in “handle lower case drive letters on Windows”
  1. handle lower case drive letters on WindowsBen Peart, Jul 11, 2018
  2. Stefan BellerJul 11, 2018
  3. Ben PeartJul 11, 2018
  4. Junio C HamanoJul 11, 2018
  5. Ben PeartJul 11, 2018
  6. handle lower case drive letters on WindowsBen Peart, Jul 11, 2018
  7. Johannes SchindelinJul 12, 2018
  8. Junio C HamanoJul 12, 2018
  9. handle lower case drive letters on WindowsBen Peart, Jul 12, 2018
  10. Junio C HamanoJul 12, 2018
  11. Ben PeartJul 12, 2018
  12. Junio C HamanoJul 12, 2018
  13. Ben PeartJul 12, 2018
  14. Junio C HamanoJul 12, 2018
  15. Johannes SchindelinJul 14, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.