On Wed, Jul 18, 2012 at 12:27:30AM -0700, Martin von Zweigbergk wrote:
> Extract the code that adds a possibly commented-out "pick" line to the
> todo file. This lets us reuse it more easily later.
> ---
> git-rebase--interactive.sh | 21 -
> 1 file changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index bef7bc0..fa722b6 100644
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -828,23 +828,26 @@ else
> revisions=$onto...$orig_head
> shortrevisions=$shorthead
> fi
> -git rev-list $merges_option --pretty=oneline --abbrev-commit \
> - --abbrev=7 --reverse --left-right --topo-order \
> - $revisions | \
> - sed -n "s/^>//p" |
> -while read -r shortsha1 rest
> -do
>
> - if test -z "$keep_empty" && is_empty_commit $shortsha1
> +add_pick_line () {
> + if test -z "$keep_empty" && is_empty_commit $1
> then
> comment_out="# "
> else
> comment_out=
> fi
> + printf '%s\n' "${comment_out}pick $1 $2" >>"$todo"
> +}
>
> +git rev-list $merges_option --pretty=oneline --abbrev-commit \
> + --abbrev=7 --reverse --left-right --topo-order \
> + $revisions | \
> + sed -n "s/^>//p" |
> +while read -r shortsha1 rest
> +do
> if test t != "$preserve_merges"
> then
> - printf '%s\n' "${comment_out}pick $shortsha1 $rest" >>"$todo"
> + add_pick_line $shortsha1 "$rest"
> else
> sha1=$(git rev-parse $shortsha1)
> if test -z "$rebase_root"
> @@ -863,7 +866,7 @@ do
> if test f = "$preserve"
> then
> touch "$rewritten"/$sha1
> - printf '%s\n' "${comment_out}pick $shortsha1 $rest"
> >>"$todo"
> + add_pick_line $shortsha1 "$rest"
> fi
> fi
> done
> --
> 1.7.11.1.104.ge7b44f1
>
>
Thanks!
Acked-by: Neil Horman
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html