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

Re: [PATCH 2/2] rebase -i: Preserve whitespace at beginning of commit header in $GIT_EDITOR

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 9, 2010, 22:37 UTC
Message-ID
<7vpqywl1sb.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1278652843-30872-2-git-send-email-ayiehere@gmail.com>
Nazri Ramliy <ayiehere@gmail.com> writes:
Show 13 quoted lines
> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index 31e6860..726cb6a 100755
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -889,14 +889,15 @@ first and then run 'git rebase --continue' again."
>  		fi
>  		git rev-list $MERGES_OPTION --pretty=oneline --abbrev-commit \
>  			--abbrev=7 --reverse --left-right --topo-order \
> +			$REVISIONS | sed -n "s/^>//p" > "$TODO.tmp"
> +
> +		if test t != "$PRESERVE_MERGES"
> +		then
> +			cat "$TODO.tmp" | sed "s/^/pick /" > "$TODO"
Do not cat a single file into a pipeline.
	sed "s/^/pick /" <"$TODO.tmp" >"$TODO"
> +		else
> +			cat "$TODO.tmp" |
Likewise.
Show 10 quoted lines
> +			while read -r shortsha1 rest
> +			do
>  				sha1=$(git rev-parse $shortsha1)
>  				if test -z "$REBASE_ROOT"
>  				then
> @@ -914,10 +915,12 @@ first and then run 'git rebase --continue' again."
>  				if test f = "$preserve"
>  				then
>  					touch "$REWRITTEN"/$sha1
> +					grep "^$shortsha1" "$TODO.tmp" | sed "s/^/pick /" >> "$TODO"
Don't pipe output of grep into sed.
	sed -ne "/^$shortsha1 /s/^/pick /p" <"$TODO.tmp" >>"$TODO"
Previous: Nazri RamliyNext: Nazri Ramliy
Message 3 of 5 in “lib-rebase.sh: fake-editor.sh: Allow checking of non-comment lines in $GIT_EDITOR”
  1. 1/2 lib-rebase.sh: fake-editor.sh: Allow checking of non-comment lines in $GIT_EDITORNazri Ramliy, Jul 9, 2010
  2. 2/2 rebase -i: Preserve whitespace at beginning of commit header in $GIT_EDITORNazri Ramliy, Jul 9, 2010
  3. Junio C HamanoJul 9, 2010
  4. Nazri RamliyJul 10, 2010
  5. Junio C HamanoJul 9, 2010

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.