summaryrefslogtreecommitdiff
path: root/builtin/ls-files.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-10-22 06:48:14 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-10-22 18:04:53 (GMT)
commitcbb3167ef8b73109ed5c5e54aa1915d9c50f83d5 (patch)
tree6e2326d89c92982c0e3bd0ecfb609c5f1c9980e5 /builtin/ls-files.c
parent0c8151b6ff5b79e6638e4f8339d62b051998dc2f (diff)
downloadgit-cbb3167ef8b73109ed5c5e54aa1915d9c50f83d5.zip
git-cbb3167ef8b73109ed5c5e54aa1915d9c50f83d5.tar.gz
git-cbb3167ef8b73109ed5c5e54aa1915d9c50f83d5.tar.bz2
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.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index bb4f612..87f0b8a 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)