git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] show-index: uniform error messages for index read

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Jun 1, 2015, 13:50 UTC
Message-ID
<b87777a4de06a56472f2d23ab8bbce9a332bb2d7.1433166363.git.git@drmicha.warpmail.net>
In-Reply-To
<cover.1433166363.git.git@drmicha.warpmail.net>

Currently, we have different wordings for the same index read error message, which may be confusing to users and increase3s the risk of more severely different translated messages:

builtin/apply.c: die(_("unable to read index file")); show-index.c: die("unable to read index"); show-index.c: die("unable to read index"); test-dump-cache-tree.c: die("unable to read index file"); test-dump-untracked-cache.c: die("unable to read index file"); test-scrap-cache-tree.c: die("unable to read index file"); builtin/commit.c: die(_("Cannot read index")); rerere.c: return error("Could not read index"); rerere.c: return error("Could not read index"); rerere.c: return error("Could not read index");

Turn all of them into "unable to read index file" except for the rerere messages: They appear on a higher level (index file access + parsing) and are worded similarly to other rerere messages.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
 builtin/commit.c | 2 +-
 show-index.c     | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/builtin/commit.c b/builtin/commit.c
index 254477f..04d49d5 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -878,7 +878,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 		const char *parent = "HEAD";
 
 		if (!active_nr && read_cache() < 0)
-			die(_("Cannot read index"));
+			die(_("unable to read index file"));
 
 		if (amend)
 			parent = "HEAD^1";
diff --git a/show-index.c b/show-index.c
index 5a9eed7..e7797d0 100644
--- a/show-index.c
+++ b/show-index.c
@@ -22,11 +22,11 @@ int main(int argc, char **argv)
 		if (version < 2 || version > 2)
 			die("unknown index version");
 		if (fread(top_index, 256 * 4, 1, stdin) != 1)
-			die("unable to read index");
+			die("unable to read index file");
 	} else {
 		version = 1;
 		if (fread(&top_index[2], 254 * 4, 1, stdin) != 1)
-			die("unable to read index");
+			die("unable to read index file");
 	}
 	nr = 0;
 	for (i = 0; i < 256; i++) {
-- 
2.4.2.548.g1e81565
Previous: Michael J GruberNext: Michael J Gruber
Message 2 of 4 in “uniform error messages for index read and write”
  1. 0/2 uniform error messages for index read and writeMichael J Gruber, Jun 1, 2015
  2. 1/2 show-index: uniform error messages for index readMichael J Gruber, Jun 1, 2015
  3. 2/2 messages: uniform error messages for index writeMichael J Gruber, Jun 1, 2015
  4. Junio C HamanoJun 1, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.