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

[PATCH 0/2] rebase: broken behavior with --keep-empty

From
Patrick Steinhardt <ps@pks.im>
Date
Nov 20, 2015, 12:04 UTC
Message-ID
<1448021080-4994-1-git-send-email-ps@pks.im>

I've recently run into broken behavior with `git-rebase` and `--keep-empty`. As soon as `--keep-empty` is specified, we fall back on using `git cherry-pick` instead of `git am` for rebasing the commits, which seems to not work correctly.

In fact I guess there are two different bugs in here. The first bug is in using `git cherry-pick --allow-empty` instead of `git cherry-pick --keep-redundant-commits`, as judging from git-rebase(1) we also want to keep commits that are already included in the branch that is being rebased upon whe we use `--keep-empty`.

The second bug is that we fail to correctly record the rebasing-state when using cherry-pick. This causes us to end up in cherry-picking mode as soon as the invoked cherry-pick command runs into any error (e.g. due to a conflict or the broken behavior with `--allow-empty`). There is also no possibility to get back into rebase-mode from here.

I've written two tests that document these breakages, as well as a fix to the first described breakage. I did not fix the second breakage of not recording rebase-state, though, as this is somewhat more involved.

Patrick
Patrick Steinhardt (2):
  rebase: test broken behavior with --keep-empty
  rebase: fix preserving commits with --keep-empty
 git-rebase--am.sh |  2 +-
 t/t3400-rebase.sh | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)
-- 
2.6.3
Next: Patrick Steinhardt
Message 1 of 5 in “rebase: broken behavior with --keep-empty”
  1. 0/2 rebase: broken behavior with --keep-emptyPatrick Steinhardt, Nov 20, 2015
  2. 1/2 rebase: test broken behavior with --keep-emptyPatrick Steinhardt, Nov 20, 2015
  3. 2/2 rebase: fix preserving commits with --keep-emptyPatrick Steinhardt, Nov 20, 2015
  4. Michael BlumeDec 10, 2015
  5. Patrick SteinhardtDec 14, 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.