aboutsummaryrefslogtreecommitdiff
path: root/convert.c
diff options
context:
space:
mode:
Diffstat (limited to 'convert.c')
-rw-r--r--convert.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/convert.c b/convert.c
index 12abdaf2a..c64880bdf 100644
--- a/convert.c
+++ b/convert.c
@@ -652,3 +652,18 @@ char *convert_to_working_tree(const char *path, const char *src, unsigned long *
return buf;
}
+
+void *convert_sha1_file(const char *path, const unsigned char *sha1,
+ unsigned int mode, enum object_type *type,
+ unsigned long *size)
+{
+ void *buffer = read_sha1_file(sha1, type, size);
+ if (S_ISREG(mode) && buffer) {
+ void *converted = convert_to_working_tree(path, buffer, size);
+ if (converted) {
+ free(buffer);
+ buffer = converted;
+ }
+ }
+ return buffer;
+}