Code

Merge branch 'cb/setup' into next
authorJunio C Hamano <gitster@pobox.com>
Wed, 5 Jan 2011 22:25:06 +0000 (14:25 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 5 Jan 2011 22:25:06 +0000 (14:25 -0800)
* cb/setup:
  setup: translate symlinks in filename when using absolute paths

1  2 
setup.c

diff --cc setup.c
index 3d732697af600ccc3c6017844c73e1d3b0dac738,8031f99e978a27d394b04c998623388d2ab762b6..424716be8ccdd8cbefdf78427934c361125aeda8
+++ b/setup.c
@@@ -4,13 -4,16 +4,16 @@@
  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);