diff: add ability to insert additional headers for paths

When additional headers are provided, we need to
  * add diff_filepairs to diff_queued_diff for each paths in the
    additional headers map which, unless that path is part of
    another diff_filepair already found in diff_queued_diff
  * format the headers (colorization, line_prefix for --graph)
  * make sure the various codepaths that attempt to return early
    if there are "no changes" take into account the headers that
    need to be shown.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Elijah Newren
2022-02-02 02:37:34 +00:00
committed by Junio C Hamano
parent 6054d1aac3
commit 95433eeed9
3 changed files with 123 additions and 6 deletions

3
diff.h
View File

@ -395,6 +395,7 @@ struct diff_options {
struct repository *repo;
struct option *parseopts;
struct strmap *additional_path_headers;
int no_free;
};
@ -593,7 +594,7 @@ void diffcore_fix_diff_index(void);
" show all files diff when -S is used and hit is found.\n" \
" -a --text treat all files as text.\n"
int diff_queue_is_empty(void);
int diff_queue_is_empty(struct diff_options *o);
void diff_flush(struct diff_options*);
void diff_free(struct diff_options*);
void diff_warn_rename_limit(const char *varname, int needed, int degraded_cc);