git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Miklos VajnaNext: Miklos Vajna
Message 2 of 9 in “parse-opt: migrate builtin-checkout-index.”
  1. parse-opt: migrate builtin-checkout-index.Miklos Vajna, Oct 15, 2008
  2. Pierre HabouzitOct 16, 2008
  3. parse-opt: migrate builtin-checkout-index.Miklos Vajna, Oct 16, 2008
  4. Junio C HamanoOct 17, 2008
  5. parse-opt: migrate builtin-checkout-index.Miklos Vajna, Oct 18, 2008
  6. Raphael ZimmererOct 19, 2008
  7. Pierre HabouzitOct 19, 2008
  8. Junio C HamanoOct 19, 2008
  9. Pierre HabouzitOct 18, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.