]> asedeno.scripts.mit.edu Git - git.git/blobdiff - entry.c
Merge branch 'master' of git://repo.or.cz/git/fastimport
[git.git] / entry.c
diff --git a/entry.c b/entry.c
index 9545e895d001db8a011432bcfc2f579152258d4a..84f78025ff9f24d3ef9b2412894e18f3d9fc1859 100644 (file)
--- a/entry.c
+++ b/entry.c
@@ -82,7 +82,7 @@ static int write_entry(struct cache_entry *ce, char *path, struct checkout *stat
 
        switch (ntohl(ce->ce_mode) & S_IFMT) {
                char *buf, *new;
-               unsigned long size, nsize;
+               unsigned long size;
 
        case S_IFREG:
                new = read_blob_entry(ce, path, &size);
@@ -103,12 +103,10 @@ static int write_entry(struct cache_entry *ce, char *path, struct checkout *stat
                /*
                 * Convert from git internal format to working tree format
                 */
-               buf = new;
-               nsize = size;
-               if (convert_to_working_tree(ce->name, &buf, &nsize)) {
+               buf = convert_to_working_tree(ce->name, new, &size);
+               if (buf) {
                        free(new);
                        new = buf;
-                       size = nsize;
                }
 
                wrote = write_in_full(fd, new, size);
@@ -195,6 +193,9 @@ int checkout_entry(struct cache_entry *ce, struct checkout *state, char *topath)
                 */
                unlink(path);
                if (S_ISDIR(st.st_mode)) {
+                       /* If it is a gitlink, leave it alone! */
+                       if (S_ISDIRLNK(ntohl(ce->ce_mode)))
+                               return 0;
                        if (!state->force)
                                return error("%s is a directory", path);
                        remove_subtree(path);