summaryrefslogtreecommitdiff
path: root/xdiff-interface.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2010-03-02 12:44:09 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-03-02 12:44:09 -0800
commitd5f61ce1574d0167fd0902bd3c6ed83bd072e976 (patch)
tree01713be3924217696fbabc53855ead5fd6ef3b63 /xdiff-interface.c
parentMerge branch 'ml/connect-refactor' (diff)
parentrefactor duplicated fill_mm() in checkout and merge-recursive (diff)
downloadtgif-d5f61ce1574d0167fd0902bd3c6ed83bd072e976.tar.xz
Merge branch 'ml/fill-mm-refactor'
* ml/fill-mm-refactor: refactor duplicated fill_mm() in checkout and merge-recursive
Diffstat (limited to 'xdiff-interface.c')
-rw-r--r--xdiff-interface.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/xdiff-interface.c b/xdiff-interface.c
index 01f14fb50f..ca5e3fbae8 100644
--- a/xdiff-interface.c
+++ b/xdiff-interface.c
@@ -218,6 +218,23 @@ int read_mmfile(mmfile_t *ptr, const char *filename)
return 0;
}
+void read_mmblob(mmfile_t *ptr, const unsigned char *sha1)
+{
+ unsigned long size;
+ enum object_type type;
+
+ if (!hashcmp(sha1, null_sha1)) {
+ ptr->ptr = xstrdup("");
+ ptr->size = 0;
+ return;
+ }
+
+ ptr->ptr = read_sha1_file(sha1, &type, &size);
+ if (!ptr->ptr || type != OBJ_BLOB)
+ die("unable to read blob object %s", sha1_to_hex(sha1));
+ ptr->size = size;
+}
+
#define FIRST_FEW_BYTES 8000
int buffer_is_binary(const char *ptr, unsigned long size)
{