Skip to content

Commit 76de159

Browse files
committed
mingw: handle absolute paths in expand_user_path()
On Windows, an absolute POSIX path needs to be turned into a Windows one. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 612de26 commit 76de159

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

path.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "strbuf.h"
66
#include "string-list.h"
77
#include "dir.h"
8+
#include "exec_cmd.h"
89

910
static int get_st_mode_bits(const char *path, int *mode)
1011
{
@@ -575,6 +576,10 @@ char *expand_user_path(const char *path)
575576

576577
if (path == NULL)
577578
goto return_null;
579+
#ifdef __MINGW32__
580+
if (path[0] == '/')
581+
return system_path(path + 1);
582+
#endif
578583
if (path[0] == '~') {
579584
const char *first_slash = strchrnul(path, '/');
580585
const char *username = path + 1;

0 commit comments

Comments
 (0)