author | Junio C Hamano <gitster@pobox.com> | |
Mon, 31 Jan 2011 03:03:00 +0000 (19:03 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 31 Jan 2011 03:03:00 +0000 (19:03 -0800) |
* cb/setup:
setup: translate symlinks in filename when using absolute paths
setup: translate symlinks in filename when using absolute paths
1 | 2 | |||
---|---|---|---|---|
setup.c | patch | | diff1 | | diff2 | | blob | history |
diff --cc setup.c
index dadc66659a4037b614b215b7f812c4df8969562b,8031f99e978a27d394b04c998623388d2ab762b6..021d0133ae1d6cf7f3a6a8284cb5b6e9a42dbe0d
+++ b/setup.c
static int inside_git_dir = -1;
static int inside_work_tree = -1;
-const 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;
- 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);