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

Re: [PATCH 2/2] rebase -i: fix parsing of "fixup -C<commit>"

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 23, 2023, 22:35 UTC
Message-ID
<xmqq1qmg6md6.fsf@gitster.g>
In-Reply-To
<d670e284c175db67337ca7ce774ecd9afb089736.1677185702.git.gitgitgadget@gmail.com>
"Phillip Wood via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 6 quoted lines
>  	if (item->command == TODO_FIXUP) {
> -		if (skip_prefix(bol, "-C", &bol) &&
> -		   (*bol == ' ' || *bol == '\t')) {
> +		if (skip_prefix(bol, "-C", &bol)) {
>  			bol += strspn(bol, " \t");
>  			item->flags |= TODO_REPLACE_FIXUP_MSG;

OK. An explicit check followed by strspn() is an odd way to write this even if it meant to require at least one whitespace, but I agree that this one probably did not even mean to require a whitespace there, and the updated code looks much easier to read.

Show 13 quoted lines
> diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh
> index 1d2f0429aea..7ca5b918f04 100644
> --- a/t/lib-rebase.sh
> +++ b/t/lib-rebase.sh
> ...
> +test_expect_success 'fixup -[Cc]<commit> works' '
> +	test_when_finished "test_might_fail git rebase --abort" &&
> +	cat >todo <<-\EOF &&
> +	pick A
> +	fixup -CA1
> +	pick B
> +	fixup -cA2
> +	EOF

By the way, this is much easier to follow, than the todo file written in the ugly FAKE_LINES language, to see what is being tested.

Will queue.  Thanks.
Previous: Phillip Wood via GitGitGadgetNext: Johannes Schindelin
Message 6 of 8 in “sequencer parsing fixes”
  1. 0/2 sequencer parsing fixesPhillip Wood via GitGitGadget, Feb 23, 2023
  2. 1/2 rebase -i: match whole word in is_command()Phillip Wood via GitGitGadget, Feb 23, 2023
  3. Junio C HamanoFeb 23, 2023
  4. Jeff KingFeb 26, 2023
  5. 2/2 rebase -i: fix parsing of "fixup -C<commit>"Phillip Wood via GitGitGadget, Feb 23, 2023
  6. Junio C HamanoFeb 23, 2023
  7. Johannes SchindelinFeb 24, 2023
  8. Junio C HamanoFeb 24, 2023

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.