diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-10-10 14:22:29 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-10-10 14:22:30 -0700 |
commit | 3eb4cc451ed97123ff76e183a5be8a7dc164d1f6 (patch) | |
tree | e461fea00a0f4780a41b9baa13de7fd056f644f2 /diff.c | |
parent | 31bc4454de66c22bc8570fd3af52a99843ac69b0 (diff) | |
parent | 1164e270b5af80516625b628945ec7365d992055 (diff) |
Merge branch 'jk/output-prefix-cleanup'
Code clean-up.
* jk/output-prefix-cleanup:
diff: store graph prefix buf in git_graph struct
diff: return line_prefix directly when possible
diff: return const char from output_prefix callback
diff: drop line_prefix_length field
line-log: use diff_line_prefix() instead of custom helper
Diffstat (limited to 'diff.c')
-rw-r--r-- | diff.c | 10 |
1 files changed, 3 insertions, 7 deletions
@@ -2317,12 +2317,9 @@ const char *diff_get_color(int diff_use_color, enum color_diff ix) 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; + return opt->output_prefix ? + opt->output_prefix(opt, opt->output_prefix_data) : + ""; } static unsigned long sane_truncate_line(char *line, unsigned long len) @@ -5400,7 +5397,6 @@ static int diff_opt_line_prefix(const struct option *opt, BUG_ON_OPT_NEG(unset); options->line_prefix = optarg; - options->line_prefix_length = strlen(options->line_prefix); graph_setup_line_prefix(options); return 0; } |