Skip to content

Commit

Permalink
Merge branch 'getcwd-fix-case'
Browse files Browse the repository at this point in the history
This makes sure that Git's idea of the current working directory matches
what is recorded on disk (which should be the same as Git's idea).

This helps in particular PowerShell users where the current working
directory can differ in case from what's stored on disk.

Signed-off-by: Johannes Schindelin <[email protected]>
  • Loading branch information
dscho committed Sep 29, 2015
2 parents c7a9700 + a249a6f commit 755b622
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions compat/mingw.c
Original file line number Diff line number Diff line change
Expand Up @@ -921,8 +921,13 @@ struct tm *localtime_r(const time_t *timep, struct tm *result)
char *mingw_getcwd(char *pointer, int len)
{
int i;
wchar_t wpointer[MAX_PATH];
if (!_wgetcwd(wpointer, ARRAY_SIZE(wpointer)))
wchar_t cwd[MAX_PATH], wpointer[MAX_PATH];
DWORD ret = GetCurrentDirectoryW(ARRAY_SIZE(cwd), cwd);

if (ret < 0 || ret >= ARRAY_SIZE(cwd))
return NULL;
ret = GetLongPathNameW(cwd, wpointer, ARRAY_SIZE(wpointer));
if (!ret || ret >= ARRAY_SIZE(wpointer))
return NULL;
if (xwcstoutf(pointer, wpointer, len) < 0)
return NULL;
Expand Down

0 comments on commit 755b622

Please sign in to comment.