Subject: [PATCH v10 06/12] merge-index: improve die() error messages

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Thu, 15 Dec 2022 09:52:10 +0100

From: Alban Gruin <[email-masked]>

Our usual convention is not to repeat the program name back at the
user, and to quote path arguments. Let's do that now to reduce the
size of the subsequent commit.

Signed-off-by: Alban Gruin <[email-masked]>
Signed-off-by: Ævar Arnfjörð Bjarmason <[email-masked]>
---
 builtin/merge-index.c  | 4 ++--
 t/t6060-merge-index.sh | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/builtin/merge-index.c b/builtin/merge-index.c
index 3855531c579..2dc789fb787 100644
--- a/builtin/merge-index.c
+++ b/builtin/merge-index.c
@@ -16,7 +16,7 @@ static int merge_entry(int pos, const char *path)
 	struct child_process cmd = CHILD_PROCESS_INIT;
 
 	if (pos >= the_index.cache_nr)
-		die("git merge-index: %s not in the cache", path);
+		die("'%s' is not in the cache", path);
 	found = 0;
 	do {
 		const struct cache_entry *ce = the_index.cache[pos];
@@ -31,7 +31,7 @@ static int merge_entry(int pos, const char *path)
 		arguments[stage + 4] = ownbuf[stage];
 	} while (++pos < the_index.cache_nr);
 	if (!found)
-		die("git merge-index: %s not in the cache", path);
+		die("'%s' is not in the cache", path);
 
 	strvec_pushv(&cmd.args, arguments);
 	if (run_command(&cmd)) {
diff --git a/t/t6060-merge-index.sh b/t/t6060-merge-index.sh
index 6c59e7bc4e5..bc201a69552 100755
--- a/t/t6060-merge-index.sh
+++ b/t/t6060-merge-index.sh
@@ -13,7 +13,7 @@ test_expect_success 'usage: 1 argument' '
 
 test_expect_success 'usage: 2 arguments' '
 	cat >expect <<-\EOF &&
-	fatal: git merge-index: b not in the cache
+	fatal: '\''b'\'' is not in the cache
 	EOF
 	test_expect_code 128 git merge-index a b >out 2>actual &&
 	test_must_be_empty out &&
-- 
2.39.0.rc2.1048.g0e5493b8d5b