Subject: [PATCH v4 4/5] Updating tests and unpack-tress.c [GSOC]

From: "Arsh Srivastava via GitGitGadget" <[email-masked]>
Date: Wed, 11 Mar 2026 08:50:27 +0000

From: Arsh Srivastava <[email-masked]>

While submitting my previous commit found that
previous testcases weren't working properly
with my updates

So fixed the test updates and advice conflict issue.

Signed-off-by: Arsh Srivastava <[email-masked]>
---
 t/t6439-merge-co-error-msgs.sh | 4 ++++
 t/t7406-submodule-update.sh    | 2 ++
 unpack-trees.c                 | 6 +-----
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/t/t6439-merge-co-error-msgs.sh b/t/t6439-merge-co-error-msgs.sh
index 643c9368e0..6ebc1d2565 100755
--- a/t/t6439-merge-co-error-msgs.sh
+++ b/t/t6439-merge-co-error-msgs.sh
@@ -77,6 +77,8 @@ error: Your local changes to the following files would be overwritten by checkou
 	rep/one
 	rep/two
 Please commit your changes or stash them before you switch branches.
+Try using 'git checkout -m <branch>' for a quick fix.
+Please Note :- that using -m (merge) will not save your changes, rather would directly merge them. Meaning if you are not able to resolve conflicts and does --hard reset your local changes would be gone.
 Aborting
 EOF
 
@@ -99,6 +101,8 @@ error: Your local changes to the following files would be overwritten by checkou
 	rep/one
 	rep/two
 Please commit your changes or stash them before you switch branches.
+Try using 'git checkout -m <branch>' for a quick fix.
+Please Note :- that using -m (merge) will not save your changes, rather would directly merge them. Meaning if you are not able to resolve conflicts and does --hard reset your local changes would be gone.
 Aborting
 EOF
 
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index 3adab12091..a359429bf5 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -212,6 +212,8 @@ test_expect_success 'submodule update should fail due to local changes' '
 	> error: Your local changes to the following files would be overwritten by checkout:
 	> 	file
 	> Please commit your changes or stash them before you switch branches.
+	> Try using '\''git checkout -m <branch>'\'' for a quick fix.
+	> Please Note :- that using -m (merge) will not save your changes, rather would directly merge them. Meaning if you are not able to resolve conflicts and does --hard reset your local changes would be gone.
 	> Aborting
 	> fatal: Unable to checkout OID in submodule path '\''submodule'\''
 	EOF
diff --git a/unpack-trees.c b/unpack-trees.c
index 9449ee8203..cb4cdee9b9 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -134,11 +134,7 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
 			  "Meaning if you are not able to resolve conflicts and does --hard reset your local changes would be gone."
 			  )
 		      : _("Your local changes to the following files would be overwritten by checkout:\n%%s"
-				"Please commit your changes or stash them before you switch branches.\n"
-			  "Try using 'git checkout -m <branch>' for a quick fix.\n"
-			  "Please Note :- that using -m (merge) will not save your changes, rather would directly merge them.\n"
-			  "Meaning if you are not able to resolve conflicts and does --hard reset your local changes would be gone."
-			  );
+				"Please commit your changes or stash them before you switch branches.");
 	else if (!strcmp(cmd, "merge"))
 		msg = advice_enabled(ADVICE_COMMIT_BEFORE_MERGE)
 		      ? _("Your local changes to the following files would be overwritten by merge:\n%%s"
-- 
gitgitgadget