Re: [PATCH] parse-opt: migrate builtin-checkout-index.
- From
Pierre Habouzit <madcoder@debian.org>
- Date
- Oct 16, 2008, 08:23 UTC
- Message-ID
- <20081016082340.GB15266@artemis.corp>
- In-Reply-To
- <1224111343-17433-1-git-send-email-vmiklos@frugalware.org>
On Wed, Oct 15, 2008 at 10:55:43PM +0000, Miklos Vajna wrote:
Show 8 quoted lines
> Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> > --- > > 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.
Show 22 quoted lines
> 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@debian.org OOO http://www.madism.org