Re: [PATCH 2/2] rebase -i: Preserve whitespace at beginning of commit header in $GIT_EDITOR
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" |
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"