summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJeff Smith <whydoubt@gmail.com>2017-05-24 00:15:10 -0500
committerJunio C Hamano <gitster@pobox.com>2017-05-24 15:41:50 +0900
commit3a35cb2ea8ab5d44d6ea6290b7af8a7c8623e4c2 (patch)
tree0fd1226cd250882b3d38203e7509a880f129fdf4 /diff.c
parentb84bc9c3677c9746bfd81a64ed30b0670c8ff0f9 (diff)
downloadgit-3a35cb2ea8ab5d44d6ea6290b7af8a7c8623e4c2.tar.gz
blame: move textconv_object with related functions
textconv_object is used in places other than blame.c and should be moved to a more appropriate location. Other textconv related functions are located in diff.c so that seems as good a place as any. Signed-off-by: Jeff Smith <whydoubt@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/diff.c b/diff.c
index 74283d9001..040fb2567c 100644
--- a/diff.c
+++ b/diff.c
@@ -5270,6 +5270,29 @@ size_t fill_textconv(struct userdiff_driver *driver,
return size;
}
+int textconv_object(const char *path,
+ unsigned mode,
+ const struct object_id *oid,
+ int oid_valid,
+ char **buf,
+ unsigned long *buf_size)
+{
+ struct diff_filespec *df;
+ struct userdiff_driver *textconv;
+
+ df = alloc_filespec(path);
+ fill_filespec(df, oid->hash, oid_valid, mode);
+ textconv = get_textconv(df);
+ if (!textconv) {
+ free_filespec(df);
+ return 0;
+ }
+
+ *buf_size = fill_textconv(textconv, df, buf);
+ free_filespec(df);
+ return 1;
+}
+
void setup_diff_pager(struct diff_options *opt)
{
/*