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

Re: rebase [-i --exec | -ix] <CMD>...

From
Johannes Sixt <j6t@kdbg.org>
Date
Jun 7, 2012, 20:59 UTC
Message-ID
<4FD1162C.50405@kdbg.org>
In-Reply-To
<1339087582-10040-1-git-send-email-Lucien.Kong@ensimag.imag.fr>
Am 07.06.2012 18:46, schrieb Lucien Kong:
Show 15 quoted lines
> +# 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:
Show 5 quoted lines
> +	-x)
> +		test 2 -le "$#" || usage
> +		cmd="${cmd:+"$cmd$LF"} $2"
> +		shift
> +		;;
		cmd="${cmd}exec $2${LF}"
(I did not test this.)
-- Hannes
Previous: Matthieu MoyNext: Junio C Hamano
Message 14 of 15 in “commit a63d7ed3017e312ddc752ac89a7d292a745d5f11 broken on MacOS”
  1. Torsten BögershausenJun 7, 2012
  2. konglu@minatec.inpg.frJun 7, 2012
  3. Torsten BögershausenJun 7, 2012
  4. konglu@minatec.inpg.frJun 7, 2012
  5. rebase [-i --exec | -ix] <CMD>...Lucien Kong, Jun 7, 2012
  6. Torsten BögershausenJun 7, 2012
  7. konglu@minatec.inpg.frJun 7, 2012
  8. Torsten BögershausenJun 7, 2012
  9. konglu@minatec.inpg.frJun 7, 2012
  10. Andreas SchwabJun 7, 2012
  11. konglu@minatec.inpg.frJun 7, 2012
  12. Andreas SchwabJun 7, 2012
  13. Matthieu MoyJun 7, 2012
  14. Johannes SixtJun 7, 2012
  15. Junio C HamanoJun 8, 2012

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.