checkout: tone down the "forked status" diagnostic messages
[gitweb.git] / entry.c
diff --git a/entry.c b/entry.c
index ef88f62ce82e7188a8d1863227a87033543958fb..44f4b897d4ff7afff7dbab92ce8754645ad8da6a 100644 (file)
--- a/entry.c
+++ b/entry.c
@@ -103,8 +103,9 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
        int fd;
        long wrote;
 
-       switch (ntohl(ce->ce_mode) & S_IFMT) {
-               char *buf, *new;
+       switch (ce->ce_mode & S_IFMT) {
+               char *new;
+               struct strbuf buf;
                unsigned long size;
 
        case S_IFREG:
@@ -116,17 +117,19 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
                /*
                 * Convert from git internal format to working tree format
                 */
-               buf = convert_to_working_tree(ce->name, new, &size);
-               if (buf) {
+               strbuf_init(&buf, 0);
+               if (convert_to_working_tree(ce->name, new, size, &buf)) {
+                       size_t newsize = 0;
                        free(new);
-                       new = buf;
+                       new = strbuf_detach(&buf, &newsize);
+                       size = newsize;
                }
 
                if (to_tempfile) {
                        strcpy(path, ".merge_file_XXXXXX");
                        fd = mkstemp(path);
                } else
-                       fd = create_file(path, ntohl(ce->ce_mode));
+                       fd = create_file(path, ce->ce_mode);
                if (fd < 0) {
                        free(new);
                        return error("git-checkout-index: unable to create file %s (%s)",
@@ -218,7 +221,7 @@ int checkout_entry(struct cache_entry *ce, const struct checkout *state, char *t
                unlink(path);
                if (S_ISDIR(st.st_mode)) {
                        /* If it is a gitlink, leave it alone! */
-                       if (S_ISGITLINK(ntohl(ce->ce_mode)))
+                       if (S_ISGITLINK(ce->ce_mode))
                                return 0;
                        if (!state->force)
                                return error("%s is a directory", path);