diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-10-22 10:48:14 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-10-22 22:04:53 +0400 |
commit | cbb3167ef8b73109ed5c5e54aa1915d9c50f83d5 (patch) | |
tree | 6e2326d89c92982c0e3bd0ecfb609c5f1c9980e5 /builtin/ls-files.c | |
parent | 0c8151b6ff5b79e6638e4f8339d62b051998dc2f (diff) |
ls-files -h: show usage even with corrupt index
Part of a campaign to avoid git <command> -h being distracted by
access to the repository. A caller hoping to use "git ls-files"
with an alternate index as part of a repair operation may well use
"git ls-files -h" to show usage while planning it out.
[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>
Diffstat (limited to 'builtin/ls-files.c')
-rw-r--r-- | builtin/ls-files.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin/ls-files.c b/builtin/ls-files.c index bb4f612b3d..87f0b8ac1d 100644 --- a/builtin/ls-files.c +++ b/builtin/ls-files.c @@ -530,6 +530,9 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix) OPT_END() }; + if (argc == 2 && !strcmp(argv[1], "-h")) + usage_with_options(ls_files_usage, builtin_ls_files_options); + memset(&dir, 0, sizeof(dir)); prefix = cmd_prefix; if (prefix) |