Skip to content

Commit 7e1888d

Browse files
dschoGit for Windows Build Agent
authored andcommitted
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 6c6cbbf commit 7e1888d

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
@@ -12,6 +12,7 @@
1212
#include "packfile.h"
1313
#include "object-store.h"
1414
#include "lockfile.h"
15+
#include "exec-cmd.h"
1516

1617
static int get_st_mode_bits(const char *path, int *mode)
1718
{
@@ -732,6 +733,10 @@ char *expand_user_path(const char *path, int real_home)
732733

733734
if (path == NULL)
734735
goto return_null;
736+
#ifdef __MINGW32__
737+
if (path[0] == '/')
738+
return system_path(path + 1);
739+
#endif
735740
if (path[0] == '~') {
736741
const char *first_slash = strchrnul(path, '/');
737742
const char *username = path + 1;

0 commit comments

Comments
 (0)