]> git.ipfire.org Git - thirdparty/git.git/blobdiff - xdiff-interface.c
list-objects.c: factor out traverse_trees_and_blobs
[thirdparty/git.git] / xdiff-interface.c
index 50702a215d10729dca6a59b69a7e9bd27b29316e..018e03308921e3b44bb75b8bc1e005424ca4fc1b 100644 (file)
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "config.h"
 #include "xdiff-interface.h"
 #include "xdiff/xtypes.h"
 #include "xdiff/xdiffi.h"
@@ -164,9 +165,9 @@ int read_mmfile(mmfile_t *ptr, const char *filename)
        size_t sz;
 
        if (stat(filename, &st))
-               return error("Could not stat %s", filename);
+               return error_errno("Could not stat %s", filename);
        if ((f = fopen(filename, "rb")) == NULL)
-               return error("Could not open %s", filename);
+               return error_errno("Could not open %s", filename);
        sz = xsize_t(st.st_size);
        ptr->ptr = xmalloc(sz ? sz : 1);
        if (sz && fread(ptr->ptr, sz, 1, f) != 1) {
@@ -178,20 +179,20 @@ int read_mmfile(mmfile_t *ptr, const char *filename)
        return 0;
 }
 
-void read_mmblob(mmfile_t *ptr, const unsigned char *sha1)
+void read_mmblob(mmfile_t *ptr, const struct object_id *oid)
 {
        unsigned long size;
        enum object_type type;
 
-       if (!hashcmp(sha1, null_sha1)) {
+       if (!oidcmp(oid, &null_oid)) {
                ptr->ptr = xstrdup("");
                ptr->size = 0;
                return;
        }
 
-       ptr->ptr = read_sha1_file(sha1, &type, &size);
+       ptr->ptr = read_sha1_file(oid->hash, &type, &size);
        if (!ptr->ptr || type != OBJ_BLOB)
-               die("unable to read blob object %s", sha1_to_hex(sha1));
+               die("unable to read blob object %s", oid_to_hex(oid));
        ptr->size = size;
 }