git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Derrick Stolee <derrickstolee@github.com>,
	Phillip Wood via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Phillip Wood <phillip.wood123@gmail.com>
Subject: Re: [PATCH v2] rebase -i: check labels and refs when parsing todo list
Date: Tue, 21 Feb 2023 16:29:59 +0000	[thread overview]
Message-ID: <09ba35c3-1434-ac23-7ac0-1295dd8aca60@dunelm.org.uk> (raw)
In-Reply-To: <f99d7043-7757-2e19-d1e1-4ee9b887af1f@github.com>

On 21/02/2023 14:24, Derrick Stolee wrote:
> On 2/20/2023 9:19 AM, Phillip Wood via GitGitGadget wrote:
>> From: Phillip Wood <phillip.wood@dunelm.org.uk>
> 
>> +static int check_label_or_ref_arg(enum todo_command command, const char *arg)
>> +{
>> +	switch (command) {
>> +	case TODO_LABEL:
>> +	  /*
>> +	   * '#' is not a valid label as the merge command uses it to
>> +	   * separate merge parents from the commit subject.
>> +	   */
>> +	  if (!strcmp(arg, "#") ||
>> +		    check_refname_format(arg, REFNAME_ALLOW_ONELEVEL))
> 
> Tabbing is strange here. Within the case there seems to be "\t  " to
> the left of each line. Then the conditional has strange spacing. I
> think it should be:
> 
> 		if (!strcmp(arg, "#") ||
> 		    check_refname_format(arg, REFNAME_ALLOW_ONELEVEL))
> 
> (The "check_refname_format()" line is correct in your patch, but the
> lines above it are not, for some reason.)

Yes you're right, I'm not sure what happened there. I'll re-roll

Thanks

Phillip

> The rest of the switch statement is correctly tabbed.
> 
>> @@ -2525,10 +2553,19 @@ static int parse_insn_line(struct repository *r, struct todo_item *item,
>>   
>>   	if (item->command == TODO_EXEC || item->command == TODO_LABEL ||
>>   	    item->command == TODO_RESET || item->command == TODO_UPDATE_REF) {
>> +		int ret = 0;
>> +
>>   		item->commit = NULL;
>>   		item->arg_offset = bol - buf;
>>   		item->arg_len = (int)(eol - bol);
>> -		return 0;
>> +		if (item->command == TODO_LABEL ||
>> +		    item->command == TODO_UPDATE_REF) {
>> +			saved = *eol;
>> +			*eol = '\0';
>> +			ret = check_label_or_ref_arg(item->command, bol);
>> +			*eol = saved;
>> +		}
>> +		return ret;
>>   	}
> 
> This diff is much simpler to understand for the purpose of this
> patch. I saw your comment about splitting out TODO_EXEC for a
> future change, and that would be fine when it happens, too.
> 
> Thanks for the updates. Outside of that strange whitespace issue,
> this patch LGTM.
> 
> Thanks,
> -Stolee

  reply	other threads:[~2023-02-21 16:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17 14:37 [PATCH] rebase -i: check labels and refs when parsing todo list Phillip Wood via GitGitGadget
2023-02-17 15:32 ` Derrick Stolee
2023-02-20  9:24   ` Phillip Wood
2023-02-20 10:03     ` Phillip Wood
2023-02-20 14:19 ` [PATCH v2] " Phillip Wood via GitGitGadget
2023-02-21 14:24   ` Derrick Stolee
2023-02-21 16:29     ` Phillip Wood [this message]
2023-02-21 17:26       ` Junio C Hamano
2023-02-21 17:05   ` [PATCH v3] " Phillip Wood via GitGitGadget
2023-02-21 17:07     ` Derrick Stolee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=09ba35c3-1434-ac23-7ac0-1295dd8aca60@dunelm.org.uk \
    --to=phillip.wood123@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=derrickstolee@github.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=phillip.wood@dunelm.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).