Skip to content

Commit

Permalink
Merge branch 'cb/setup'
Browse files Browse the repository at this point in the history
* cb/setup:
  setup: translate symlinks in filename when using absolute paths
  • Loading branch information
Junio C Hamano committed Feb 10, 2011
2 parents 70ec868 + 18e051a commit 05f08e4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ static int inside_work_tree = -1;
char *prefix_path(const char *prefix, int len, const char *path)
{
const char *orig = path;
char *sanitized = xmalloc(len + strlen(path) + 1);
if (is_absolute_path(orig))
strcpy(sanitized, path);
else {
char *sanitized;
if (is_absolute_path(orig)) {
const char *temp = make_absolute_path(path);
sanitized = xmalloc(len + strlen(temp) + 1);
strcpy(sanitized, temp);
} else {
sanitized = xmalloc(len + strlen(path) + 1);
if (len)
memcpy(sanitized, prefix, len);
strcpy(sanitized + len, path);
Expand Down

0 comments on commit 05f08e4

Please sign in to comment.