mirror of
https://github.com/git/git
synced 2024-09-13 21:34:42 +00:00
Merge branch 'cb/setup'
* cb/setup: setup: translate symlinks in filename when using absolute paths
This commit is contained in:
commit
05f08e4c9e
11
setup.c
11
setup.c
|
@ -7,10 +7,13 @@ static int inside_work_tree = -1;
|
||||||
char *prefix_path(const char *prefix, int len, const char *path)
|
char *prefix_path(const char *prefix, int len, const char *path)
|
||||||
{
|
{
|
||||||
const char *orig = path;
|
const char *orig = path;
|
||||||
char *sanitized = xmalloc(len + strlen(path) + 1);
|
char *sanitized;
|
||||||
if (is_absolute_path(orig))
|
if (is_absolute_path(orig)) {
|
||||||
strcpy(sanitized, path);
|
const char *temp = make_absolute_path(path);
|
||||||
else {
|
sanitized = xmalloc(len + strlen(temp) + 1);
|
||||||
|
strcpy(sanitized, temp);
|
||||||
|
} else {
|
||||||
|
sanitized = xmalloc(len + strlen(path) + 1);
|
||||||
if (len)
|
if (len)
|
||||||
memcpy(sanitized, prefix, len);
|
memcpy(sanitized, prefix, len);
|
||||||
strcpy(sanitized + len, path);
|
strcpy(sanitized + len, path);
|
||||||
|
|
Loading…
Reference in a new issue