Turn unpack_trees_options.msgs into an array + enum

The list of error messages was introduced as a structure, but an array
indexed over an enum is more flexible, since it allows one to store a
type of error message (index in the array) in a variable.

This change needs to rename would_lose_untracked ->
would_lose_untracked_file to avoid a clash with the function
would_lose_untracked in merge-recursive.c.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Matthieu Moy
2010-08-11 10:38:04 +02:00
committed by Junio C Hamano
parent 64fdc08dac
commit 08353ebbab
6 changed files with 46 additions and 52 deletions

View File

@ -373,7 +373,7 @@ static int merge_working_tree(struct checkout_opts *opts,
topts.src_index = &the_index;
topts.dst_index = &the_index;
topts.msgs.not_uptodate_file = "You have local changes to '%s'; cannot switch branches.";
topts.msgs[ERROR_NOT_UPTODATE_FILE] = "You have local changes to '%s'; cannot switch branches.";
refresh_cache(REFRESH_QUIET);