#include "tree.h"
#include "cache-tree.h"
+#ifndef DEBUG
#define DEBUG 0
+#endif
struct cache_tree *cache_tree(void)
{
baselen + sublen + 1,
missing_ok,
dryrun);
+ if (subcnt < 0)
+ return subcnt;
i += subcnt - 1;
sub->used = 1;
}
mode = ntohl(ce->ce_mode);
entlen = pathlen - baselen;
}
- if (!missing_ok && !has_sha1_file(sha1))
+ if (mode != S_IFDIRLNK && !missing_ok && !has_sha1_file(sha1))
return error("invalid object %s", sha1_to_hex(sha1));
if (!ce->ce_mode)
#endif
}
- if (dryrun) {
- unsigned char hdr[200];
- int hdrlen;
- write_sha1_file_prepare(buffer, offset, tree_type, it->sha1,
- hdr, &hdrlen);
- }
+ if (dryrun)
+ hash_sha1_file(buffer, offset, tree_type, it->sha1);
else
write_sha1_file(buffer, offset, tree_type, it->sha1);
free(buffer);