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

Re: [PATCH] rebase -i: remember merge options beyond continue actions

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 11, 2015, 20:07 UTC
Message-ID
<CAPc5daV_tPh9pt4YSpsBSCvrvGOqC7+9eTZkS1bV2ZAE2YoxzA@mail.gmail.com>
In-Reply-To
<1449863646-26067-1-git-send-email-ralf.thielow@gmail.com>
On Fri, Dec 11, 2015 at 11:54 AM, Ralf Thielow <ralf.thielow@gmail.com> wrote:
Show 24 quoted lines
> From: Fabian Ruch <bafain@gmail.com>
>
> If the user specifies a merge strategy or strategy options in
> "rebase --interactive", also use these in subsequent calls of
> "rebase --continue".
>
> In the implementation, the "do_merge" guard to check for a given
> merge strategy or strategy options is implied by passing these
> options, but not stored.  This prevents subsequent calls of
> "rebase --continue" to use this setting again later.  Remove this
> "do_merge" guard to allow a later usage.
>
> Reported-by: Diogo de Campos <campos@esss.com.br>
> Signed-off-by: Fabian Ruch <bafain@gmail.com>
> Helped-by: Michael Haggerty <mhagger@alum.mit.edu>
> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
> ---
> I've been applying the original patch for a long time to my tree,
> as it helps me to resolve conflicts e.g. when rebasing .po files.
> I also think it's a reasonable change for git-rebase.
>
> I've rebased it agains the current master and rewrote the
> commit message to try to make this change technically a bit more
> easy to understand.

Thanks. I wonder if Michael's rephrasing in $gmane/251386 still applies, which I found by far the most readable.

http://thread.gmane.org/gmane.comp.version-control.git/251147/focus=251386
Show 71 quoted lines
>
> Original patch submit:
> http://thread.gmane.org/gmane.comp.version-control.git/251147/
>
>  git-rebase--interactive.sh    | 18 +++++++-----------
>  t/t3404-rebase-interactive.sh | 16 ++++++++++++++++
>  2 files changed, 23 insertions(+), 11 deletions(-)
>
> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index b938a6d..c0cfe88 100644
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -81,17 +81,13 @@ rewritten_pending="$state_dir"/rewritten-pending
>  # and leaves CR at the end instead.
>  cr=$(printf "\015")
>
> -strategy_args=
> -if test -n "$do_merge"
> -then
> -       strategy_args=${strategy:+--strategy=$strategy}
> -       eval '
> -               for strategy_opt in '"$strategy_opts"'
> -               do
> -                       strategy_args="$strategy_args -X$(git rev-parse --sq-quote "${strategy_opt#--}")"
> -               done
> -       '
> -fi
> +strategy_args=${strategy:+--strategy=$strategy}
> +eval '
> +       for strategy_opt in '"$strategy_opts"'
> +       do
> +               strategy_args="$strategy_args -X$(git rev-parse --sq-quote "${strategy_opt#--}")"
> +       done
> +'
>
>  GIT_CHERRY_PICK_HELP="$resolvemsg"
>  export GIT_CHERRY_PICK_HELP
> diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
> index 98eb49a..9a2461c 100755
> --- a/t/t3404-rebase-interactive.sh
> +++ b/t/t3404-rebase-interactive.sh
> @@ -1006,6 +1006,22 @@ test_expect_success 'rebase -i with --strategy and -X' '
>         test $(cat file1) = Z
>  '
>
> +test_expect_success 'interrupted rebase -i with --strategy and -X' '
> +       git checkout -b conflict-merge-use-theirs-interrupted conflict-branch &&
> +       git reset --hard HEAD^ &&
> +       >breakpoint &&
> +       git add breakpoint &&
> +       git commit -m "breakpoint for interactive mode" &&
> +       echo five >conflict &&
> +       echo Z >file1 &&
> +       git commit -a -m "one file conflict" &&
> +       set_fake_editor &&
> +       FAKE_LINES="edit 1 2" git rebase -i --strategy=recursive -Xours conflict-branch &&
> +       git rebase --continue &&
> +       test $(git show conflict-branch:conflict) = $(cat conflict) &&
> +       test $(cat file1) = Z
> +'
> +
>  test_expect_success 'rebase -i error on commits with \ in message' '
>         current_head=$(git rev-parse HEAD) &&
>         test_when_finished "git rebase --abort; git reset --hard $current_head; rm -f error" &&
> --
> 2.7.0.rc0.174.g1b62464
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous: Ralf ThielowNext: Ralf Thielow
Message 7 of 8 in “rebase -i: Remember merge options beyond continue actions”
  1. rebase -i: Remember merge options beyond continue actionsFabian Ruch, Jun 10, 2014
  2. Eric SunshineJun 10, 2014
  3. Fabian RuchJun 10, 2014
  4. Michael HaggertyJun 11, 2014
  5. Ralf ThielowJul 18, 2014
  6. rebase -i: remember merge options beyond continue actionsRalf Thielow, Dec 11, 2015
  7. Junio C HamanoDec 11, 2015
  8. rebase -i: remember merge options beyond continue actionsRalf Thielow, Dec 11, 2015

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.