Skip to content

Commit

Permalink
mingw: handle absolute paths in expand_user_path()
Browse files Browse the repository at this point in the history
On Windows, an absolute POSIX path needs to be turned into a Windows
one.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho authored and Git for Windows Build Agent committed Feb 19, 2020
1 parent 87370ea commit d923895
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions path.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "packfile.h"
#include "object-store.h"
#include "lockfile.h"
#include "exec-cmd.h"

static int get_st_mode_bits(const char *path, int *mode)
{
Expand Down Expand Up @@ -732,6 +733,10 @@ char *expand_user_path(const char *path, int real_home)

if (path == NULL)
goto return_null;
#ifdef __MINGW32__
if (path[0] == '/')
return system_path(path + 1);
#endif
if (path[0] == '~') {
const char *first_slash = strchrnul(path, '/');
const char *username = path + 1;
Expand Down

0 comments on commit d923895

Please sign in to comment.