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

From: Francis Moreau <[email-masked]>
Date: Thu, 05 Mar 2015 14:55:12 +0100

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.