update-index -h: show usage even with corrupt index
When trying to fix up a corrupt repository, one might prefer that "update-index -h" print an accurate usage message and exit rather than reading the repository and complaining about the corruption. [jn: with rewritten log message and tests] Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
da53eec688
commit
9c7c27eeab
@ -589,6 +589,9 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
|
||||
int lock_error = 0;
|
||||
struct lock_file *lock_file;
|
||||
|
||||
if (argc == 2 && !strcmp(argv[1], "-h"))
|
||||
usage(update_index_usage);
|
||||
|
||||
git_config(git_default_config, NULL);
|
||||
|
||||
/* We can't free this memory, it becomes part of a linked list parsed atexit() */
|
||||
|
Reference in New Issue
Block a user