mirror of
https://github.com/git/git.git
synced 2026-01-18 06:34:21 +00:00
Merge branch 'mingw-expand-absolute-user-path'
When compiling Git with a runtime prefix (so that it can be installed into any location, finding its libexec/ directory relative to the location of the `git` executable), it is convenient to provide "absolute" Unix-y paths e.g. for http.sslCAInfo, and have those absolute paths be resolved relative to the runtime prefix. This patch makes it so for Windows. It is up for discussion whether we want this for other platforms, too, as long as building with RUNTIME_PREFIX. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
5
path.c
5
path.c
@@ -11,6 +11,7 @@
|
||||
#include "path.h"
|
||||
#include "packfile.h"
|
||||
#include "object-store.h"
|
||||
#include "exec-cmd.h"
|
||||
|
||||
static int get_st_mode_bits(const char *path, int *mode)
|
||||
{
|
||||
@@ -709,6 +710,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;
|
||||
|
||||
Reference in New Issue
Block a user