[PATCH 3/5 v2] unpack_trees_options: update porcelain messages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Update porcelain messages of unpack_trees_options in order to have a good layout
and add an advice for would_lose_untracked errors if advice_commit_before_merge
is enabled.

Update t3400 to have an expect_failure for the rebase verbose error message.

Signed-off-by: Diane Gasselin <diane.gasselin@xxxxxxxxxxxxxxx>
Signed-off-by: Clément Poulain <clement.poulain@xxxxxxxxxxxxxxx>
Signed-off-by: Axel Bonnet <axel.bonnet@xxxxxxxxxxxxxxx>
---
 builtin/checkout.c |    2 +-
 merge-recursive.c  |   18 +++++++++---------
 t/t3400-rebase.sh  |    2 +-
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/builtin/checkout.c b/builtin/checkout.c
index 23eae56..b9d056d 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -373,7 +373,7 @@ static int merge_working_tree(struct checkout_opts *opts,
 		topts.dst_index = &the_index;
 
 		topts.msgs = get_porcelain_error_msgs("checkout");
-		topts.msgs.not_uptodate_file = "You have local changes to '%s'; cannot switch branches.";
+		topts.msgs.not_uptodate_file = "You have local changes to the following files:\n%sCannot switch branches.";
 
 		refresh_cache(REFRESH_QUIET);
 
diff --git a/merge-recursive.c b/merge-recursive.c
index 80c9744..ee80553 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1183,31 +1183,31 @@ struct unpack_trees_error_msgs get_porcelain_error_msgs(const char *cmd)
 	struct unpack_trees_error_msgs msgs;
 
 	/* would_overwrite */
-	msgs.would_overwrite = malloc(sizeof(char) * 72);
+	msgs.would_overwrite = malloc(sizeof(char) * 80);
 	sprintf((char *)msgs.would_overwrite,
-		"Your local changes to '%%s' would be overwritten by %s.  Aborting.",
+		"Your local changes to the following files would be overwritten by %s:\n%%s",
 		cmd);
 	/* not_uptodate_file */
 	msgs.not_uptodate_file = msgs.would_overwrite;
 	/* not_uptodate_dir */
 	msgs.not_uptodate_dir =
-		"Updating '%s' would lose untracked files in it.  Aborting.";
+		"Updating the following directories would lose untracked files in it:\n%s";
 	/* would_lose_untracked */
-	msgs.would_lose_untracked = malloc(sizeof(char) * 72);
+	msgs.would_lose_untracked = malloc(sizeof(char) * 80);
 	sprintf((char *)msgs.would_lose_untracked,
-		"Untracked working tree file '%%s' would be %%s by %s.  Aborting.",
+		"The following untracked working tree files would be %%s by %s:\n%%s",
 		cmd);
 
 	if (advice_commit_before_merge) {
-		msgs.would_overwrite = malloc(sizeof(char) * 140);
+		msgs.would_overwrite = malloc(sizeof(char) * 160);
 		sprintf((char *)msgs.would_overwrite,
-			"Your local changes to '%%s' would be overwritten by %s.  Aborting.\n"
+			"Your local changes to the following files would be overwritten by %s:\n%%s"
 			"Please, commit your changes or stash them before you can %s.",
 			cmd, strcmp(cmd,"checkout") ? cmd : "swicth branches");
 		msgs.not_uptodate_file = msgs.would_overwrite;
-		msgs.would_lose_untracked = malloc (sizeof(char) * 135);
+		msgs.would_lose_untracked = malloc (sizeof(char) * 160);
 		sprintf((char *)msgs.would_lose_untracked,
-			"Untracked working tree file '%%s' would be %%s by %s.  Aborting.\n"
+			"The following untracked working tree files would be %%s by %s:\n%%s"
 			"Please move or remove them before you can %s.",
 			cmd, strcmp(cmd,"checkout") ? cmd : "swicth branches");
 	}
diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
index dbf7dfb..cbf160d 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -121,7 +121,7 @@ test_expect_success 'rebase a single mode change' '
      GIT_TRACE=1 git rebase master
 '
 
-test_expect_success 'Show verbose error when HEAD could not be detached' '
+test_expect_failure 'Show verbose error when HEAD could not be detached' '
      : > B &&
      test_must_fail git rebase topic 2> output.err > output.out &&
      grep "Untracked working tree file .B. would be overwritten" output.err
-- 
1.6.6.7.ga5fe3

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]