# Re: \[PATCH v2 12/14\] rebase --apply: fix reflog

- From: Junio C Hamano \<hidden\>
- Date: 2021-12-09 20:49:45 
- List: git
- Page: https://ratatoskr.run/git/2021/12/7915332

```text
"Phillip Wood via GitGitGadget" [ref] writes:

> +	if (opts->orig_head_msg && !update_orig_head)
> +		BUG("ORIG_HEAD reflog message given without updating ORIG_HEAD");
> +
> +	if (opts->branch_msg && !opts->branch)
> +		BUG("branch reflog message given without a branch");
> +

Looking pretty good.

> diff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh
> index 77a313f62eb..d17b450e811 100755
> --- a/t/t3406-rebase-message.sh
> +++ b/t/t3406-rebase-message.sh
> @@ -105,6 +105,29 @@ test_expect_success 'GIT_REFLOG_ACTION' '
>  	test_cmp expect actual
>  '
>  
> +test_expect_success 'rebase --apply reflog' '
> +	git checkout -b reflog-apply start &&
> +	old_head_reflog="$(git log -g --format=%gs -1 HEAD)" &&
> +
> +	git rebase --apply Y &&
> +
> +	git log -g --format=%gs -4 HEAD >actual &&
> +	cat >expect <<-EOF &&
> +	rebase finished: returning to refs/heads/reflog-apply
> +	rebase: Z
> +	rebase: checkout Y
> +	$old_head_reflog
> +	EOF
> +	test_cmp expect actual &&
> +
> +	git log -g --format=%gs -2 reflog-apply >actual &&
> +	cat >expect <<-EOF &&
> +	rebase finished: refs/heads/reflog-apply onto $(git rev-parse Y)
> +	branch: Created from start
> +	EOF
> +	test_cmp expect actual
> +'
> +
>  test_expect_success 'rebase -i onto unrelated history' '
>  	git init unrelated &&
>  	test_commit -C unrelated 1 &&
```
