threads / bug / 38708

Possible bug with git-rebase and post-rewrite hook

Subject: Possible bug with git-rebase and post-rewrite hook

## tl;dr

2 messages between Mar 5, 2015 and Mar 5, 2015.

replies: 1people: 1as markdown or json

Francis Moreau· Mar 5, 2015, 13:55 UTC · lore
Hi,
I have a suspect case which happens when rebasing a branch.

I'm using the post-rewrite hook and during certain circumstance, my hook is called by git-rebase with wrong parameters: <old-sha1> argument is not related to <new-sha1> one.

This actually happens when git-rebase stops and reports:
  The previous cherry-pick is now empty, possibly due to conflict
  resolution.
  If you wish to commit it anyway, use:
      git commit --allow-empty
  Otherwise, please use 'git reset'
  rebase in progress; onto 2889531
  You are currently rebasing branch 'foo' on '2889531'.

If I decide to skip it by doing 'git rebase --continue' then I get the issue when my hook is run.

BTW, I find that the message is not really clear since it tells me to run 'git-reset' in the case I want to ignore this empty commit. I'm not sure that 'git-reset' is really helping in that case (my index is clean) but 'git rebase --continue' would have been more appropriate IMHO.

If I do 'git commit --allow-empty' then there's no issue when the hook is run.

Thanks.
Francis Moreau· Mar 5, 2015, 14:05 UTC · re: Francis Moreau · lore

Re: Possible bug with git-rebase and post-rewrite hook

oops, I forgot to say that this happen with git 2.3.1.
On 03/05/2015 02:55 PM, Francis Moreau wrote:
Show 34 quoted lines
> Hi,
> 
> I have a suspect case which happens when rebasing a branch.
> 
> I'm using the post-rewrite hook and during certain circumstance, my hook
> is called by git-rebase with wrong parameters: <old-sha1> argument is
> not related to <new-sha1> one.
> 
> This actually happens when git-rebase stops and reports:
> 
>   The previous cherry-pick is now empty, possibly due to conflict
>   resolution.
>   If you wish to commit it anyway, use:
> 
>       git commit --allow-empty
> 
>   Otherwise, please use 'git reset'
>   rebase in progress; onto 2889531
>   You are currently rebasing branch 'foo' on '2889531'.
> 
> 
> If I decide to skip it by doing 'git rebase --continue' then I get the
> issue when my hook is run.
> 
> BTW, I find that the message is not really clear since it tells me to
> run 'git-reset' in the case I want to ignore this empty commit. I'm not
> sure that 'git-reset' is really helping in that case (my index is clean)
> but 'git rebase --continue' would have been more appropriate IMHO.
> 
> If I do 'git commit --allow-empty' then there's no issue when the hook
> is run.
> 
> Thanks.
> 

← back to recent threads