Skip to content

Commit d50e93b

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 bcf75af commit d50e93b

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
@@ -11,6 +11,7 @@
1111
#include "path.h"
1212
#include "packfile.h"
1313
#include "object-store.h"
14+
#include "exec-cmd.h"
1415

1516
static int get_st_mode_bits(const char *path, int *mode)
1617
{
@@ -714,6 +715,10 @@ char *expand_user_path(const char *path, int real_home)
714715

715716
if (path == NULL)
716717
goto return_null;
718+
#ifdef __MINGW32__
719+
if (path[0] == '/')
720+
return system_path(path + 1);
721+
#endif
717722
if (path[0] == '~') {
718723
const char *first_slash = strchrnul(path, '/');
719724
const char *username = path + 1;

0 commit comments

Comments
 (0)