All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Sixt <j6t@kdbg.org>
To: Lucien Kong <Lucien.Kong@ensimag.imag.fr>
Cc: tboegi@web.de, git@vger.kernel.org
Subject: Re: rebase [-i --exec | -ix] <CMD>...
Date: Thu, 07 Jun 2012 22:59:24 +0200	[thread overview]
Message-ID: <4FD1162C.50405@kdbg.org> (raw)
In-Reply-To: <1339087582-10040-1-git-send-email-Lucien.Kong@ensimag.imag.fr>

Am 07.06.2012 18:46, schrieb Lucien Kong:
> +# Add commands after a pick or after a squash/fixup serie
> +# in the todo list.
> +add_exec_commands () {
> +	OIFS=$IFS
> +	IFS=$LF
> +	for i in $cmd
> +	do
> +		tmp=$(sed "/^pick .*/i\exec $i" "$1")
> +		echo "$tmp" >"$1"
> +		tmp=$(sed '1d' "$1")
> +		echo "$tmp" >"$1"
> +		echo "exec $i" >>"$1"
> +	done
> +	IFS=$OIFS
> +}

How about this?

	{
		first=t
		while read -r insn rest
		do
			case $insn in
			pick)
				test -n "$first" ||
				printf "%s" "$cmd"
				;;
			esac
			printf "%s %s\n" "$insn" "$rest"
			first=
		done
		printf "%s" "$cmd"
	} <"$1" >"$1.new" &&
	mv "$1.new" "$1"

together with:

> +	-x)
> +		test 2 -le "$#" || usage
> +		cmd="${cmd:+"$cmd$LF"} $2"
> +		shift
> +		;;

		cmd="${cmd}exec $2${LF}"

(I did not test this.)

-- Hannes

  parent reply	other threads:[~2012-06-07 20:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-07 11:53 commit a63d7ed3017e312ddc752ac89a7d292a745d5f11 broken on MacOS Torsten Bögershausen
2012-06-07 14:20 ` konglu
2012-06-07 16:14   ` Torsten Bögershausen
2012-06-07 16:40     ` konglu
2012-06-07 16:46     ` rebase [-i --exec | -ix] <CMD> Lucien Kong
2012-06-07 17:57       ` Torsten Bögershausen
2012-06-07 18:07         ` konglu
2012-06-07 19:10           ` Torsten Bögershausen
2012-06-07 19:55             ` konglu
2012-06-07 20:35               ` Andreas Schwab
2012-06-07 20:44                 ` konglu
2012-06-07 21:12                   ` Andreas Schwab
2012-06-07 20:49               ` Matthieu Moy
2012-06-07 20:59       ` Johannes Sixt [this message]
2012-06-08 15:34         ` Junio C Hamano

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

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

  git send-email \
    --in-reply-to=4FD1162C.50405@kdbg.org \
    --to=j6t@kdbg.org \
    --cc=Lucien.Kong@ensimag.imag.fr \
    --cc=git@vger.kernel.org \
    --cc=tboegi@web.de \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.