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

Re: [PATCH/RFC] builtin: move builtin retrieval to get_builtin()

From
Slavomir Vlcek <svlc@inventati.org>
Date
Nov 16, 2014, 23:33 UTC
Message-ID
<54693454.1040704@inventati.org>
In-Reply-To
<xmqq389n2cac.fsf@gitster.dls.corp.google.com>
On 11/13/2014 07:19 PM, Junio C Hamano wrote:
Show 44 quoted lines
>>  git.c | 27 +++++++++++++++------------
>>  1 file changed, 15 insertions(+), 12 deletions(-)
>>
>> diff --git a/git.c b/git.c
>> index 18fbf79..e32c5b8 100644
>> --- a/git.c
>> +++ b/git.c
>> @@ -487,15 +487,20 @@ static struct cmd_struct commands[] = {
>>  	{ "write-tree", cmd_write_tree, RUN_SETUP },
>>  };
>>  
>> -int is_builtin(const char *s)
>> +struct cmd_struct *get_builtin(const char *s)
> 
> I do not think this has to be extern.
> 
> 	static struct cmd_struct *get_builtin(const char *s)
> 
> perhaps.
> 
>> @@ -519,15 +525,12 @@ static void handle_builtin(int argc, const char **argv)
>>  		argv[0] = cmd = "help";
>>  	}
>>  
>> -	for (i = 0; i < ARRAY_SIZE(commands); i++) {
>> -		struct cmd_struct *p = commands+i;
>> -		if (strcmp(p->cmd, cmd))
>> -			continue;
>> -		if (saved_environment && (p->option & NO_SETUP)) {
>> +	builtin = get_builtin(cmd);
> 
> Nice.
> 
>> +	if (builtin) {
>> +		if (saved_environment && (builtin->option & NO_SETUP))
>>  			restore_env();
>> -			break;
>> -		}
>> -		exit(run_builtin(p, argc, argv));
>> +		else
>> +			exit(run_builtin(builtin, argc, argv));
> 
> This change does not seem to have anything to do with the topic of
> the change.  Why is it necessary?

Does the commit message lack some explanation or the patch would better be divided into several parts?

I noticed that the patch has been modified (suggested 'static' scope modification, commit message) and added to the 'next' branch. So does this mean my task is done or is there still something I should explain?

Thank you for your corrections.
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 9 in “builtin: move builtin retrieval to get_builtin()”
  1. builtin: move builtin retrieval to get_builtin()slavomir vlcek, Nov 12, 2014
  2. SubmittingPatches: fix an inconsistencyslavomir vlcek, Nov 13, 2014
  3. Junio C HamanoNov 13, 2014
  4. Junio C HamanoNov 13, 2014
  5. Junio C HamanoNov 13, 2014
  6. slavomir vlcekNov 13, 2014
  7. Junio C HamanoNov 13, 2014
  8. Slavomir VlcekNov 16, 2014
  9. Junio C HamanoNov 17, 2014

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.