Skip to contentSkip to conversation

Possible bug with git-rebase and post-rewrite hook

DISCUSSION Francis Moreau 1 participant 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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.

#1 lore raw

oops, I forgot to say that this happen with git 2.3.1.

Quoted 34 lines · Francis Moreau

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.