git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: "SZEDER Gábor" <szeder.dev@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org, Phillip Wood <phillip.wood@talktalk.net>,
	Elijah Newren <newren@gmail.com>,
	Eric Sunshine <sunshine@sunshineco.com>, ch <cr@onlinehome.de>,
	Phillip Wood <phillip.wood@dunelm.org.uk>
Subject: Re: [PATCH] t/lib-rebase.sh: support explicit 'pick' commands in 'fake_editor.sh'
Date: Thu, 23 Aug 2018 22:53:41 +0200 (DST)	[thread overview]
Message-ID: <nycvar.QRO.7.76.6.1808232253220.73@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <20180823100915.22855-1-szeder.dev@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2404 bytes --]

Hi Gábor,

On Thu, 23 Aug 2018, SZEDER Gábor wrote:

> The verbose output of the test 'reword without issues functions as
> intended' in 't3423-rebase-reword.sh', added in a9279c6785 (sequencer:
> do not squash 'reword' commits when we hit conflicts, 2018-06-19),
> contains the following error output:
> 
>   sed: -e expression #1, char 2: extra characters after command
> 
> This error comes from within the 'fake-editor.sh' script created by
> 'lib-rebase.sh's set_fake_editor() function, and the root cause is the
> FAKE_LINES="pick 1 reword 2" variable in the test in question, in
> particular the "pick" word.  'fake-editor.sh' assumes 'pick' to be the
> default rebase command and doesn't support an explicit 'pick' command
> in FAKE_LINES.  As a result, 'pick' will be used instead of a line
> number when assembling the following 'sed' script:
> 
>   sed -n picks/^pick/pick/p
> 
> which triggers the aforementioned error.
> 
> Luckily, this didn't affect the test's correctness: the erroring 'sed'
> command doesn't write anything to the todo script, and processing the
> rest of FAKE_LINES generates the desired todo script, as if that
> 'pick' command were not there at all.
> 
> The minimal fix would be to remove the 'pick' word from FAKE_LINES,
> but that would leave us susceptible to similar issues in the future.
> 
> Instead, teach the fake-editor script to recognize an explicit 'pick'
> command, which is still a fairly trivial change.
> 
> In the future we might want to consider reinforcing this fake editor
> script with an &&-chain and stricter parsing of the FAKE_LINES
> variable (e.g. to error out when encountering unknown rebase commands
> or commands and line numbers in the wrong order).
> 
> Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>

ACK!

Thank you very much,
Dscho

> ---
>  t/lib-rebase.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh
> index 25a77ee5cb..592865d019 100644
> --- a/t/lib-rebase.sh
> +++ b/t/lib-rebase.sh
> @@ -47,7 +47,7 @@ set_fake_editor () {
>  	action=pick
>  	for line in $FAKE_LINES; do
>  		case $line in
> -		squash|fixup|edit|reword|drop)
> +		pick|squash|fixup|edit|reword|drop)
>  			action="$line";;
>  		exec*)
>  			echo "$line" | sed 's/_/ /g' >> "$1";;
> -- 
> 2.19.0.rc0.136.gd2dd172e64
> 
> 

  parent reply	other threads:[~2018-08-23 20:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-11 16:06 [BUG] git-rebase: reword squashes commits in case of merge-conflicts ch
2018-06-12 10:08 ` Jeff King
2018-06-15 14:35   ` ch
2018-06-16 16:08 ` Elijah Newren
2018-06-17  3:36   ` Eric Sunshine
2018-06-17  5:37     ` [PATCH v2] sequencer: do not squash 'reword' commits when we hit conflicts Elijah Newren
2018-06-17 15:04       ` Phillip Wood
2018-06-17 19:28         ` Johannes Schindelin
2018-06-18 10:20           ` Phillip Wood
2018-06-18 15:42             ` Junio C Hamano
2018-06-18 21:42             ` Johannes Schindelin
2018-06-19 10:00               ` [PATCH v2] sequencer: do not squash 'reword' commits when wehit conflicts Phillip Wood
2018-06-19 12:46               ` [PATCH v3] sequencer: do not squash 'reword' commits when we hit conflicts Phillip Wood
2018-06-19 14:29                 ` Elijah Newren
2018-06-19 16:59                   ` Junio C Hamano
2018-08-23 10:09                 ` [PATCH] t/lib-rebase.sh: support explicit 'pick' commands in 'fake_editor.sh' SZEDER Gábor
2018-08-23 16:20                   ` Junio C Hamano
2018-08-23 20:53                   ` Johannes Schindelin [this message]
2018-06-17 18:46       ` [PATCH v2] sequencer: do not squash 'reword' commits when we hit conflicts Johannes Schindelin

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=nycvar.QRO.7.76.6.1808232253220.73@tvgsbejvaqbjf.bet \
    --to=johannes.schindelin@gmx.de \
    --cc=cr@onlinehome.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=newren@gmail.com \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=phillip.wood@talktalk.net \
    --cc=sunshine@sunshineco.com \
    --cc=szeder.dev@gmail.com \
    /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).