Merge branch 'jk/clone-copy-alternates-fix'
[gitweb.git] / builtin / clone.c
index 6c80690adf32dfe55a3a587a85f36e279ccd150e..6c76a6ed66fef567ca06e3e864b37fc3bed151d5 100644 (file)
@@ -351,8 +351,11 @@ static void copy_alternates(struct strbuf *src, struct strbuf *dst,
                        continue;
                }
                abs_path = mkpathdup("%s/objects/%s", src_repo, line.buf);
-               normalize_path_copy(abs_path, abs_path);
-               add_to_alternates_file(abs_path);
+               if (!normalize_path_copy(abs_path, abs_path))
+                       add_to_alternates_file(abs_path);
+               else
+                       warning("skipping invalid relative alternate: %s/%s",
+                               src_repo, line.buf);
                free(abs_path);
        }
        strbuf_release(&line);