{"thread":{"id":"2220","subject":"[PATCH] Add usage string to git-update-index","startedAt":"2005-10-25T15:26:25Z","lastAt":"2005-10-25T15:26:25Z","messageCount":1,"participants":["Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"10583","messageId":"20051025152625.17299.10333.stgit@machine.or.cz","threadId":"2220","inReplyTo":null,"subject":"[PATCH] Add usage string to git-update-index","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2005-10-25T15:26:25Z","receivedAt":"2005-10-25T15:26:25Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"This patch adds usage string to git-update-index, can be printed by the -h\nor --help parameter.\n\nSigned-off-by: Petr Baudis <pasky@suse.cz>\n---\n\n update-index.c |    5 +++++\n 1 files changed, 5 insertions(+), 0 deletions(-)\n\ndiff --git a/update-index.c b/update-index.c\nindex a84836b..661b86a 100644\n--- a/update-index.c\n+++ b/update-index.c\n@@ -392,6 +392,9 @@ static void read_index_info(int line_ter\n \t}\n }\n \n+static const char update_index_usage[] =\n+\"git-update-index [-q] [--add] [--replace] [--remove] [--unmerged] [--refresh] [--cacheinfo] [--chmod=(+|-)x] [--info-only] [--force-remove] [--stdin] [--index-info] [--ignore-missing] [-z] [--version] [--] <file>...\";\n+\n int main(int argc, const char **argv)\n {\n \tint i, newfd, entries, has_errors = 0, line_termination = '\\n';\n@@ -489,6 +492,8 @@ int main(int argc, const char **argv)\n \t\t\t\tverbose = 1;\n \t\t\t\tcontinue;\n \t\t\t}\n+\t\t\tif (!strcmp(path, \"-h\") || !strcmp(path, \"--help\"))\n+\t\t\t\tusage(update_index_usage);\n \t\t\tdie(\"unknown option %s\", path);\n \t\t}\n \t\tupdate_one(path, prefix, prefix_length);\n"}]}