Merge branch 'cb/setup'
authorJunio C Hamano <gitster@pobox.com>
Thu, 10 Feb 2011 00:41:16 +0000 (16:41 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 10 Feb 2011 00:41:16 +0000 (16:41 -0800)
* cb/setup:
  setup: translate symlinks in filename when using absolute paths

1  2 
setup.c

diff --cc setup.c
index dadc66659a4037b614b215b7f812c4df8969562b,8031f99e978a27d394b04c998623388d2ab762b6..021d0133ae1d6cf7f3a6a8284cb5b6e9a42dbe0d
+++ 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);