Code

gitweb: Fix bug in "blobdiff" view for split (e.g. file to symlink) patches
[git.git] / entry.c
diff --git a/entry.c b/entry.c
index 21b5f2e26d77a2e7b10a6336d9e14db72b1f7e45..d72f811580ad10e792e38b40fe79bf4af3868846 100644 (file)
--- a/entry.c
+++ b/entry.c
@@ -111,9 +111,12 @@ static int write_entry(struct cache_entry *ce, char *path, struct checkout *stat
                        return error("git-checkout-index: unable to write file %s", path);
                break;
        case S_IFLNK:
-               if (to_tempfile) {
-                       strcpy(path, ".merge_link_XXXXXX");
-                       fd = mkstemp(path);
+               if (to_tempfile || !has_symlinks) {
+                       if (to_tempfile) {
+                               strcpy(path, ".merge_link_XXXXXX");
+                               fd = mkstemp(path);
+                       } else
+                               fd = create_file(path, 0666);
                        if (fd < 0) {
                                free(new);
                                return error("git-checkout-index: unable to create "