Re: [PATCH] parse-opt: migrate builtin-checkout-index.
- Date: Thu, 16 Oct 2008 10:23:40 +0200
- From: Pierre Habouzit <madcoder@xxxxxxxxxx>
- Subject: Re: [PATCH] parse-opt: migrate builtin-checkout-index.
On Wed, Oct 15, 2008 at 10:55:43PM +0000, Miklos Vajna wrote:
> Signed-off-by: Miklos Vajna <vmiklos@xxxxxxxxxxxxxx>
> ---
>
> NOTE: I introduced the force/quiet/not_new helper variables because they
> are originally bitfields, so passing their address is not possible. One
> could say that introducing helper functions for those as well would be
> nicer, but I think that would just make the code even longer with no
> good reason.
Well the alternative is to replace the bitfields with an enum, but it's
not always that nice as a result. C bit-fields sucks when it comes to
address them, it's silly not to be able to have the same as offsetof in
"bits" for a structure, but oh well.
> diff --git a/builtin-checkout-index.c b/builtin-checkout-index.c
> index 4ba2702..e241cd1 100644
> --- a/builtin-checkout-index.c
> +++ b/builtin-checkout-index.c
> @@ -40,6 +40,7 @@
> #include "cache.h"
> #include "quote.h"
> #include "cache-tree.h"
> +#include "parse-options.h"
>
> #define CHECKOUT_ALL 4
> static int line_termination = '\n';
> @@ -153,11 +154,55 @@ static void checkout_all(const char *prefix, int prefix_length)
> exit(128);
> }
>
> -static const char checkout_cache_usage[] =
> -"git checkout-index [-u] [-q] [-a] [-f] [-n] [--stage=[123]|all] [--prefix=<string>] [--temp] [--] <file>...";
> +static const char * const builtin_checkout_index_usage[] = {
> + "git checkout-index [-u] [-q] [-a] [-f] [-n] [--stage=[123]|all] [--prefix=<string>] [--temp] [--] <file>...",
> + NULL
> +};
Since git checkout-index -h will show you all the options, I usually
prefer to use "[options] [--] <file>...", it's 10x as readable, and the
user will have the [options] detail just below.
--
·O· Pierre Habouzit
··O madcoder@xxxxxxxxxx
OOO http://www.madism.org
Attachment:
pgpkHwKwoBQq6.pgp
Description: PGP signature
- Follow-Ups:
- [PATCH v2] parse-opt: migrate builtin-checkout-index.
- From: Miklos Vajna
- [PATCH v2] parse-opt: migrate builtin-checkout-index.
- References:
- [PATCH] parse-opt: migrate builtin-checkout-index.
- From: Miklos Vajna
- [PATCH] parse-opt: migrate builtin-checkout-index.
- Prev by Date: Re: [PATCH] reset --hard/read-tree --reset -u: remove unmerged new paths
- Next by Date: Re: Untracked working tree files
- Previous by thread: [PATCH] parse-opt: migrate builtin-checkout-index.
- Next by thread: [PATCH v2] parse-opt: migrate builtin-checkout-index.
- Index(es):