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

Possible bug with git-rebase and post-rewrite hook

From
FMFrancis Moreau <francis.moro@gmail.com>
Date
Mar 5, 2015, 13:55 UTC
Message-ID
<54F86040.8060205@gmail.com>
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.
Next: Francis Moreau
Message 1 of 2 in “Possible bug with git-rebase and post-rewrite hook”
  1. Francis MoreauMar 5, 2015
  2. Francis MoreauMar 5, 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.