diff: add diff_line_prefix function
[gitweb.git] / diff.c
diff --git a/diff.c b/diff.c
index e00fc9053892f0923fc9c6ae7f9ac47968c0a8be..b768b7d38425e24286fad4e224d4c7157154ec1c 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -1105,6 +1105,16 @@ const char *diff_get_color(int diff_use_color, enum color_diff ix)
        return "";
 }
 
+const char *diff_line_prefix(struct diff_options *opt)
+{
+       struct strbuf *msgbuf;
+       if (!opt->output_prefix)
+               return "";
+
+       msgbuf = opt->output_prefix(opt, opt->output_prefix_data);
+       return msgbuf->buf;
+}
+
 static unsigned long sane_truncate_line(struct emit_callback *ecb, char *line, unsigned long len)
 {
        const char *cp;