From: Pierre Habouzit Date: Thu, 16 Oct 2008 08:23:40 GMT Subject: Re: [PATCH] parse-opt: migrate builtin-checkout-index. 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: > Signed-off-by: Miklos Vajna > --- > > 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=] [--temp] [--] ..."; > +static const char * const builtin_checkout_index_usage[] = { > + "git checkout-index [-u] [-q] [-a] [-f] [-n] [--stage=[123]|all] [--prefix=] [--temp] [--] ...", > + NULL > +}; Since git checkout-index -h will show you all the options, I usually prefer to use "[options] [--] ...", 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