Despite ls-files being a plumbing command, which promises to not change its output ever, and to be easy on machines (e.g. non-localized output), it may make sense to localize the error message for a corrupt index nevertheless: 1. that is more consistent with the rest of Git. 2. Searching for "ls-tree corrupt index file" on the web doesn't yield any hits, that suggest the exact string is parsed for. Probably the script authors rely on the exit code of ls-tree anyways. Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx> --- builtin/ls-files.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/builtin/ls-files.c b/builtin/ls-files.c index a71f6bd088a..502f2f6db04 100644 --- a/builtin/ls-files.c +++ b/builtin/ls-files.c @@ -20,6 +20,7 @@ #include "run-command.h" #include "submodule.h" #include "submodule-config.h" +#include "repository.h" static int abbrev; static int show_deleted; @@ -210,8 +211,7 @@ static void show_submodule(struct repository *superproject, if (repo_submodule_init(&submodule, superproject, path)) return; - if (repo_read_index(&submodule) < 0) - die("index file corrupt"); + repo_read_index_or_die(&submodule); show_files(&submodule, dir); @@ -579,8 +579,7 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix) prefix_len = strlen(prefix); git_config(git_default_config, NULL); - if (repo_read_index(the_repository) < 0) - die("index file corrupt"); + repo_read_index_or_die(the_repository); argc = parse_options(argc, argv, prefix, builtin_ls_files_options, ls_files_usage, 0); -- 2.17.0.582.gccdcbd54c44.dirty