unpack-trees: split display_error_msgs() into two

display_error_msgs() is never called to show messages of both ERROR_*
and WARNING_* types at the same time; it is instead called multiple
times, separately for each type.  Since we want to display these types
differently, make two slightly different versions of this function.

A subsequent commit will further modify unpack_trees() and how it calls
the new display_warning_msgs().

Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Elijah Newren
2020-03-27 00:48:57 +00:00
committed by Junio C Hamano
parent 1ac83f42da
commit 6271d77cb1
3 changed files with 49 additions and 13 deletions

View File

@ -24,10 +24,12 @@ enum unpack_trees_error_types {
ERROR_BIND_OVERLAP,
ERROR_WOULD_LOSE_SUBMODULE,
NB_UNPACK_TREES_ERROR_TYPES,
WARNING_SPARSE_NOT_UPTODATE_FILE,
WARNING_SPARSE_ORPHANED_NOT_OVERWRITTEN,
NB_UNPACK_TREES_ERROR_TYPES,
NB_UNPACK_TREES_WARNING_TYPES,
};
/*
@ -66,13 +68,13 @@ struct unpack_trees_options {
struct dir_struct *dir;
struct pathspec *pathspec;
merge_fn_t fn;
const char *msgs[NB_UNPACK_TREES_ERROR_TYPES];
const char *msgs[NB_UNPACK_TREES_WARNING_TYPES];
struct argv_array msgs_to_free;
/*
* Store error messages in an array, each case
* corresponding to a error message type
*/
struct string_list unpack_rejects[NB_UNPACK_TREES_ERROR_TYPES];
struct string_list unpack_rejects[NB_UNPACK_TREES_WARNING_TYPES];
int head_idx;
int merge_size;