checkout: tone down the "forked status" diagnostic messages
[gitweb.git] / cache-tree.c
index 8f53c99f154ba2a717d7b99eea9249b5e6ee2fba..bfc95d2dc9600083b73b61c06d2b32c983db8511 100644 (file)
@@ -1,5 +1,4 @@
 #include "cache.h"
-#include "strbuf.h"
 #include "tree.h"
 #include "cache-tree.h"
 
@@ -321,13 +320,13 @@ static int update_one(struct cache_tree *it,
                }
                else {
                        sha1 = ce->sha1;
-                       mode = ntohl(ce->ce_mode);
+                       mode = ce->ce_mode;
                        entlen = pathlen - baselen;
                }
                if (mode != S_IFGITLINK && !missing_ok && !has_sha1_file(sha1))
                        return error("invalid object %s", sha1_to_hex(sha1));
 
-               if (!ce->ce_mode)
+               if (ce->ce_flags & CE_REMOVE)
                        continue; /* entry being removed */
 
                strbuf_grow(&buffer, entlen + 100);
@@ -370,10 +369,8 @@ int cache_tree_update(struct cache_tree *it,
        return 0;
 }
 
-static void write_one(struct cache_tree *it,
-                      char *path,
-                      int pathlen,
-                          struct strbuf *buffer)
+static void write_one(struct strbuf *buffer, struct cache_tree *it,
+                      const char *path, int pathlen)
 {
        int i;
 
@@ -408,20 +405,13 @@ static void write_one(struct cache_tree *it,
                                             prev->name, prev->namelen) <= 0)
                                die("fatal - unsorted cache subtree");
                }
-               write_one(down->cache_tree, down->name, down->namelen, buffer);
+               write_one(buffer, down->cache_tree, down->name, down->namelen);
        }
 }
 
-void *cache_tree_write(struct cache_tree *root, unsigned long *size_p)
+void cache_tree_write(struct strbuf *sb, struct cache_tree *root)
 {
-       char path[PATH_MAX];
-       struct strbuf buffer;
-
-       path[0] = 0;
-       strbuf_init(&buffer, 0);
-       write_one(root, path, 0, &buffer);
-       *size_p = buffer.len;
-       return strbuf_detach(&buffer);
+       write_one(sb, root, "", 0);
 }
 
 static struct cache_tree *read_one(const char **buffer, unsigned long *size_p)