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

Re: [RFC PATCH] add t3420-rebase-topology

From
Martin von Zweigbergk <martinvonz@gmail.com>
Date
Sep 28, 2012, 18:03 UTC
Message-ID
<CANiSa6hvs2253yb4s0PpaAfG=hoBK2psP896GMFWT-UjiPZDwA@mail.gmail.com>
In-Reply-To
<20120927122035.GL16059@arachsys.com>
On Thu, Sep 27, 2012 at 5:20 AM, Chris Webb <chris@arachsys.com> wrote:
> You're right that rebase --root without --onto always creates a brand new
> root as a result of the implementation using a sentinel commit. Clearly this
> is what's wanted with --interactive

That's not as clear as one might first think. "git rebase -i" actually honors --force; if one marks a commit for "edit", but then --continue without making any changes, the next commit(s) will be fast-forwarded. See the first few lines of pick_one (or pick_one_preserving_merges).

Show 7 quoted lines
> but rebase --root with neither --onto
> nor --interactive is a slightly odd combination for which I struggle to
> imagine a natural use. Perhaps you're right that for consistency it should
> be a no-op unless --force-rebase is given?
>
> If we did this, this combination would be a no-op unconditionally as by
> definition we're always descended from the root of our current commit.

For consistency, it seems like "git rebase -p --root" should always be a no-op, while "git rebase [-i/-m] --root" should be no-op if the history has no merges. Also, since "git rebase -i" tries to fast-forward through existing commits, it seems like "git rebase -i --root" should ideally not create a sentinel commit, but instead stop at the first commit marked for editing.

If, OTOH, --force-rebase is given, we should rewrite history from the first commit, which in the case of --root would mean creating a sentinel commit.

So, in short, I have a feeling that the sentinel commit should be created if and only if both --root and --force-rebase (but not --onto) are given.

> However, given the not-very-useful behaviour, I suspect that rebase --root
> is much more likely to be a mistyped version of rebase -i --root than rebase
> --root --force-rebase. (Unless I'm missing a reasonable use for this?
> History linearisation perhaps?)

Yes, the "not-very-useful"-ness of this is the clear argument against making them no-ops. But I have to say I was slightly surprised when I tried "git rebase --root" for the first time and it created completely new history for me. As you say, "git rebase --root" is probably often a mistyped "git rebase -i --root", and if that is the case, it seems nicer (in addition to being more consistent) if we don't do anything rather than rewriting the history. The history rewriting might even go unnoticed and come as an unpleasant surprise later.

When working on a new project, "git rebase -i --root" might even be a convenient replacement for "git rebase -i <initial commit>" even when one does not want to rewrite the initial commit itself, and in such a case, the user would clearly not want a sentinel commit either.

So I'm getting more and more convinced that the sentinel commit should only be created if --force-rebase was given. Let me know if I'm missing something.

Martin
Previous: Chris WebbNext: Chris Webb
Message 7 of 75 in “add t3420-rebase-topology”
  1. add t3420-rebase-topologyMartin von Zweigbergk, Sep 18, 2012
  2. Junio C HamanoSep 18, 2012
  3. Martin von ZweigbergkSep 21, 2012
  4. Johannes SixtSep 18, 2012
  5. Martin von ZweigbergkSep 26, 2012
  6. Chris WebbSep 27, 2012
  7. Martin von ZweigbergkSep 28, 2012
  8. Chris WebbSep 29, 2012
  9. 0/7 Rebase topology testMartin von Zweigbergk, May 29, 2013
  10. 1/7 add simple tests of consistency across rebase typesMartin von Zweigbergk, May 29, 2013
  11. Martin von ZweigbergkJun 3, 2013
  12. Junio C HamanoJun 3, 2013
  13. Martin von ZweigbergkJun 3, 2013
  14. 2/7 add tests for rebasing with patch-equivalence presentMartin von Zweigbergk, May 29, 2013
  15. Johannes SixtMay 29, 2013
  16. Martin von ZweigbergkMay 30, 2013
  17. Felipe ContrerasMay 30, 2013
  18. Martin von ZweigbergkMay 30, 2013
  19. Felipe ContrerasMay 30, 2013
  20. Martin von ZweigbergkMay 30, 2013
  21. Johannes SixtMay 30, 2013
  22. Martin von ZweigbergkMay 30, 2013
  23. 3/7 add tests for rebasing of empty commitsMartin von Zweigbergk, May 29, 2013
  24. 4/7 add tests for rebasing rootMartin von Zweigbergk, May 29, 2013
  25. Johannes SixtMay 29, 2013
  26. Martin von ZweigbergkMay 30, 2013
  27. 5/7 add tests for rebasing merged historyMartin von Zweigbergk, May 29, 2013
  28. Johannes SixtMay 29, 2013
  29. Martin von ZweigbergkMay 31, 2013
  30. Johannes SixtMay 29, 2013
  31. 6/7 t3406: modernize styleMartin von Zweigbergk, May 29, 2013
  32. 7/7 tests: move test for rebase messages from t3400 to t3406Martin von Zweigbergk, May 29, 2013
  33. Felipe ContrerasMay 29, 2013
  34. Ramkumar RamachandraMay 29, 2013
  35. Felipe ContrerasMay 29, 2013
  36. 0/7 Rebase topology testMartin von Zweigbergk, May 31, 2013
  37. 1/7 add simple tests of consistency across rebase typesMartin von Zweigbergk, May 31, 2013
  38. 2/7 add tests for rebasing with patch-equivalence presentMartin von Zweigbergk, May 31, 2013
  39. 3/7 add tests for rebasing of empty commitsMartin von Zweigbergk, May 31, 2013
  40. 4/7 add tests for rebasing rootMartin von Zweigbergk, May 31, 2013
  41. 5/7 add tests for rebasing merged historyMartin von Zweigbergk, May 31, 2013
  42. Johannes SixtMay 31, 2013
  43. 5/7 add tests for rebasing merged historyMartin von Zweigbergk, Jun 1, 2013
  44. 6/7 t3406: modernize styleMartin von Zweigbergk, May 31, 2013
  45. 7/7 tests: move test for rebase messages from t3400 to t3406Martin von Zweigbergk, May 31, 2013
  46. 0/7 Rebase topology testMartin von Zweigbergk, Jun 3, 2013
  47. 1/7 add simple tests of consistency across rebase typesMartin von Zweigbergk, Jun 3, 2013
  48. Junio C HamanoJun 3, 2013
  49. Martin von ZweigbergkJun 4, 2013
  50. Junio C HamanoJun 4, 2013
  51. Johannes SixtJun 4, 2013
  52. Martin von ZweigbergkJun 5, 2013
  53. 2/7 add tests for rebasing with patch-equivalence presentMartin von Zweigbergk, Jun 3, 2013
  54. 3/7 add tests for rebasing of empty commitsMartin von Zweigbergk, Jun 3, 2013
  55. 4/7 add tests for rebasing rootMartin von Zweigbergk, Jun 3, 2013
  56. 5/7 add tests for rebasing merged historyMartin von Zweigbergk, Jun 3, 2013
  57. Junio C HamanoJun 4, 2013
  58. Martin von ZweigbergkJun 5, 2013
  59. Johannes SixtJun 5, 2013
  60. 6/7 t3406: modernize styleMartin von Zweigbergk, Jun 3, 2013
  61. 7/7 tests: move test for rebase messages from t3400 to t3406Martin von Zweigbergk, Jun 3, 2013
  62. 0/8 Rebase topology testMartin von Zweigbergk, Jun 7, 2013
  63. 1/7 add simple tests of consistency across rebase typesMartin von Zweigbergk, Jun 7, 2013
  64. 2/7 add tests for rebasing with patch-equivalence presentMartin von Zweigbergk, Jun 7, 2013
  65. 3/7 add tests for rebasing of empty commitsMartin von Zweigbergk, Jun 7, 2013
  66. 4/7 add tests for rebasing rootMartin von Zweigbergk, Jun 7, 2013
  67. 5/7 add tests for rebasing merged historyMartin von Zweigbergk, Jun 7, 2013
  68. 6/7 t3406: modernize styleMartin von Zweigbergk, Jun 7, 2013
  69. 7/7 tests: move test for rebase messages from t3400 to t3406Martin von Zweigbergk, Jun 7, 2013
  70. Junio C HamanoJun 7, 2013
  71. Johannes SixtJun 7, 2013
  72. rebase topology tests: fix commit names on case-insensitive file systemsJohannes Sixt, Jun 18, 2013
  73. Junio C HamanoJun 18, 2013
  74. Martin von ZweigbergkJun 18, 2013
  75. Johannes SixtJun 19, 2013

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.