# [PATCH] update-index: allow "-h" to also display options

3 messages from 2013-02-23 to 2013-02-23. Participants: Antoine Pelisse, Junio C Hamano.
Thread: https://gitlist.dev/t/32988

## Antoine Pelisse, 2013-02-23 18:10

Subject: [PATCH] update-index: allow "-h" to also display options
Message-ID: <1361643041-19036-1-git-send-email-apelisse@gmail.com>
URL: https://gitlist.dev/e/1361643041-19036-1-git-send-email-apelisse%40gmail.com

```
Currently, when running "git update-index -h", you only have usage
displayed, but no options. That is not consistent with the behavior of
other commands. It also means that the only way to display options is to
use an unknown argument (or use the man page).

Display usage with options when "git update-index -h" is invoked.

Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
---
 builtin/update-index.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/update-index.c b/builtin/update-index.c
index ada1dff..3071ee6 100644
--- a/builtin/update-index.c
+++ b/builtin/update-index.c
@@ -796,7 +796,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
 	};
 
 	if (argc == 2 && !strcmp(argv[1], "-h"))
-		usage(update_index_usage[0]);
+		usage_with_options(&update_index_usage[0], options);
 
 	git_config(git_default_config, NULL);
 
-- 
1.7.9.5

```

## Antoine Pelisse, 2013-02-23 18:13

Subject: Re: [PATCH] update-index: allow "-h" to also display options
Message-ID: <CALWbr2x4En9qof7hFL+Onh1M1080=-OaJtAsNYY01qRj5R1a1w@mail.gmail.com>
URL: https://gitlist.dev/e/CALWbr2x4En9qof7hFL%2BOnh1M1080%3D-OaJtAsNYY01qRj5R1a1w%40mail.gmail.com
In-Reply-To: <1361643041-19036-1-git-send-email-apelisse@gmail.com>

```
> diff --git a/builtin/update-index.c b/builtin/update-index.c
> index ada1dff..3071ee6 100644
> --- a/builtin/update-index.c
> +++ b/builtin/update-index.c
> @@ -796,7 +796,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
>         };
>
>         if (argc == 2 && !strcmp(argv[1], "-h"))
> -               usage(update_index_usage[0]);
> +               usage_with_options(&update_index_usage[0], options);
>
>         git_config(git_default_config, NULL);
>

Ok I just realized that

    usage_with_options(update_index_usage, options);

would be better...

Antoine,

```

## Junio C Hamano, 2013-02-23 21:25

Subject: Re: [PATCH] update-index: allow "-h" to also display options
Message-ID: <7vfw0m7mff.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vfw0m7mff.fsf%40alter.siamese.dyndns.org
In-Reply-To: <CALWbr2x4En9qof7hFL+Onh1M1080=-OaJtAsNYY01qRj5R1a1w@mail.gmail.com>

```
Antoine Pelisse <apelisse@gmail.com> writes:

>> diff --git a/builtin/update-index.c b/builtin/update-index.c
>> index ada1dff..3071ee6 100644
>> --- a/builtin/update-index.c
>> +++ b/builtin/update-index.c
>> @@ -796,7 +796,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
>>         };
>>
>>         if (argc == 2 && !strcmp(argv[1], "-h"))
>> -               usage(update_index_usage[0]);
>> +               usage_with_options(&update_index_usage[0], options);
>>
>>         git_config(git_default_config, NULL);
>>
>
> Ok I just realized that
>
>     usage_with_options(update_index_usage, options);
>
> would be better...

Yeah, that probably is easier on the eyes, even though they are
equivalent.

Thanks, will queue.

```
