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

Re: [PATCH 1/2] rebase -i: demonstrate incorrect behavior of post-rewrite hook with exec

From
Eric Sunshine <sunshine@sunshineco.com>
Date
May 21, 2015, 21:12 UTC
Message-ID
<CAPig+cRFwruC8DwPhH_=Jb8YAZPB5J2e0F2NBob3zLPGoMLWgA@mail.gmail.com>
In-Reply-To
<1432231982-31314-2-git-send-email-Matthieu.Moy@imag.fr>
On Thu, May 21, 2015 at 2:13 PM, Matthieu Moy <Matthieu.Moy@imag.fr> wrote:
Show 20 quoted lines
> The 'exec' command is sending the current commit to stopped-sha, which is
> supposed to contain the original commit (before rebase). As a result, if
> an 'exec' command fails, the next 'git rebase --continue' will send the
> current commit as <old-sha1> to the post-rewrite hook.
> [...]
>
> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
> ---
> diff --git a/t/t5407-post-rewrite-hook.sh b/t/t5407-post-rewrite-hook.sh
> index ea2e0d4..ecef820 100755
> --- a/t/t5407-post-rewrite-hook.sh
> +++ b/t/t5407-post-rewrite-hook.sh
> @@ -212,4 +212,21 @@ EOF
>         verify_hook_input
>  '
>
> +test_expect_failure 'git rebase -i (exec)' '
> +       git reset --hard D &&
> +       clear_hook_input &&
> +       FAKE_LINES="edit 1 exec_false 2" git rebase -i B
Broken &&-chain.
Show 16 quoted lines
> +       echo something >bar &&
> +       git add bar &&
> +       # Fail because of exec false
> +       test_must_fail git rebase --continue &&
> +       git rebase --continue &&
> +       echo rebase >expected.args &&
> +       cat >expected.data <<EOF &&
> +$(git rev-parse C) $(git rev-parse HEAD^)
> +$(git rev-parse D) $(git rev-parse HEAD)
> +EOF
> +       verify_hook_input
> +'
> +
>  test_done
> --
> 2.4.1.171.g060e6ae.dirty
Previous: Matthieu MoyNext: Matthieu Moy
Message 3 of 5 in “fix post-rewrite hook with 'git rebase -i --exec'”
  1. 0/2 fix post-rewrite hook with 'git rebase -i --exec'Matthieu Moy, May 21, 2015
  2. 1/2 rebase -i: demonstrate incorrect behavior of post-rewrite hook with execMatthieu Moy, May 21, 2015
  3. Eric SunshineMay 21, 2015
  4. Matthieu MoyMay 22, 2015
  5. 2/2 rebase -i: fix post-rewrite hook with failed exec commandMatthieu Moy, May 21, 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.