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

Re: [PATCH 1/2] make show-index a builtin

From
Junio C Hamano <gitster@pobox.com>
Date
May 28, 2018, 15:31 UTC
Message-ID
<xmqqlgc3iyom.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20180528093853.GA20229@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 8 quoted lines
> diff --git a/show-index.c b/builtin/show-index.c
> similarity index 96%
> rename from show-index.c
> rename to builtin/show-index.c
> index 1ead41e211..65fa86dd08 100644
> --- a/show-index.c
> +++ b/builtin/show-index.c
> @@ -4,7 +4,7 @@
I squashed
#include "builtin.h"

near the beginning of this file to squelch -DDEVELOPER extra warnings. Otherwise looks obviously good.

Show 17 quoted lines
>  static const char show_index_usage[] =
>  "git show-index";
>  
> -int cmd_main(int argc, const char **argv)
> +int cmd_show_index(int argc, const char **argv, const char *prefix)
>  {
>  	int i;
>  	unsigned nr;
> diff --git a/git.c b/git.c
> index 5771d62a32..c91e144d9a 100644
> --- a/git.c
> +++ b/git.c
> @@ -470,6 +470,7 @@ static struct cmd_struct commands[] = {
>  	{ "shortlog", cmd_shortlog, RUN_SETUP_GENTLY | USE_PAGER },
>  	{ "show", cmd_show, RUN_SETUP },
>  	{ "show-branch", cmd_show_branch, RUN_SETUP },
> +	{ "show-index", cmd_show_index },

Hmph, this does not need SETUP? Ah, of course, because its subcommand body used to do everything itself, and this patch just turns cmd_main() to cmd_show_index().

>  	{ "show-ref", cmd_show_ref, RUN_SETUP },
>  	{ "stage", cmd_add, RUN_SETUP | NEED_WORK_TREE },
>  	{ "status", cmd_status, RUN_SETUP | NEED_WORK_TREE },
Previous: Jeff KingNext: Jeff King
Message 3 of 5 in “minor show-index modernizations”
  1. 0/2 minor show-index modernizationsJeff King, May 28, 2018
  2. 1/2 make show-index a builtinJeff King, May 28, 2018
  3. Junio C HamanoMay 28, 2018
  4. Jeff KingMay 28, 2018
  5. 2/2 show-index: update documentation for index v2Jeff King, May 28, 2018

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.