From 08353ebbab2dfdee50a6daa616ec8b6483cb07c8 Mon Sep 17 00:00:00 2001 From: Matthieu Moy Date: Wed, 11 Aug 2010 10:38:04 +0200 Subject: 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 Signed-off-by: Junio C Hamano --- builtin/checkout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin/checkout.c') diff --git a/builtin/checkout.c b/builtin/checkout.c index 1994be92c6..7d1706e0f9 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -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); -- cgit v1.2.1 From 23cbf11b5c08c6d0ab0fd0d6f2dc5a32ca31c745 Mon Sep 17 00:00:00 2001 From: Diane Gasselin Date: Wed, 11 Aug 2010 10:38:05 +0200 Subject: merge-recursive: porcelain messages for checkout A porcelain message was first added in checkout.c in the commit 8ccba008 (Junio C Hamano, Sat May 17 21:03:49 2008, unpack-trees: allow Porcelain to give different error messages) to give better feedback in the case of merge errors. This patch adapts the porcelain messages for the case of checkout instead. This way, when having a checkout error, "merge" no longer appears in the error message. While we're there, we add an advice in the case of would_lose_untracked_file. Signed-off-by: Matthieu Moy Signed-off-by: Junio C Hamano --- builtin/checkout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin/checkout.c') diff --git a/builtin/checkout.c b/builtin/checkout.c index 7d1706e0f9..22bf47cb6f 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -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[ERROR_NOT_UPTODATE_FILE] = "You have local changes to '%s'; cannot switch branches."; + set_porcelain_error_msgs(topts.msgs, "checkout"); refresh_cache(REFRESH_QUIET); -- cgit v1.2.1 From e6c111b4c092c0dd24c541b9721f5bc04641dcb0 Mon Sep 17 00:00:00 2001 From: Matthieu Moy Date: Wed, 11 Aug 2010 10:38:07 +0200 Subject: unpack_trees: group error messages by type When an error is encountered, it calls add_rejected_file() which either - directly displays the error message and stops if in plumbing mode (i.e. if show_all_errors is not initialized at 1) - or stores it so that it will be displayed at the end with display_error_msgs(), Storing the files by error type permits to have a list of files for which there is the same error instead of having a serie of almost identical errors. As each bind_overlap error combines a file and an old file, a list cannot be done, therefore, theses errors are not stored but directly displayed. Signed-off-by: Matthieu Moy Signed-off-by: Junio C Hamano --- builtin/checkout.c | 1 + 1 file changed, 1 insertion(+) (limited to 'builtin/checkout.c') diff --git a/builtin/checkout.c b/builtin/checkout.c index 22bf47cb6f..894bb84db5 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -392,6 +392,7 @@ static int merge_working_tree(struct checkout_opts *opts, topts.dir = xcalloc(1, sizeof(*topts.dir)); topts.dir->flags |= DIR_SHOW_IGNORED; topts.dir->exclude_per_dir = ".gitignore"; + topts.show_all_errors = 1; tree = parse_tree_indirect(old->commit ? old->commit->object.sha1 : (unsigned char *)EMPTY_TREE_SHA1_BIN); -- cgit v1.2.1