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

Re: [PATCH] rebase -i: mark commits that begin empty in todo editor

From
Bryan Turner <bturner@atlassian.com>
Date
Apr 10, 2020, 02:06 UTC
Message-ID
<CAGyf7-H4jtnVjgZ20qC-mzJHRd7Ffqm=Vh18wJPiiSS4NPnhyQ@mail.gmail.com>
In-Reply-To
<xmqqimi8kvue.fsf@gitster.c.googlers.com>
On Thu, Apr 9, 2020 at 5:50 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 46 quoted lines
>
> "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > From: Elijah Newren <newren@gmail.com>
> >
> > While many users who intentionally create empty commits do not want them
> > thrown away by a rebase, there are third-party tools that generate empty
> > commits that a user might not want.  In the past, users have used rebase
> > to get rid of such commits (a side-effect of the fact that the --apply
> > backend is not currently capable of keeping them).  While such users
> > could fire up an interactive rebase and just remove the lines
> > corresponding to empty commits, that might be difficult if the
> > third-party tool generates many of them.  Simplify this task for users
> > by marking such lines with a suffix of " # empty" in the todo list.
> >
> > Suggested-by: Sami Boukortt <sami@boukortt.com>
> > Signed-off-by: Elijah Newren <newren@gmail.com>
> > ---
> >     rebase -i: mark commits that begin empty in todo editor
> >
> >     If this isn't enough, we could talk about resurrecting --no-keep-empty
> >     (and making --keep-empty just exist to countermand an earlier
> >     --no-keep-empty), but perhaps this is good enough?
>
> This does look like an unsatisfying substitute for the real thing,
> but perhaps looking for " # empty" and turning them a drop is simple
> enough?  Emacs types may do something like
>
>     C-x h C-u M-|
>     sed -e '/ # empty$/s/^pick /drop /'
>     <RET>
>
> and vi folks have something similar that begins with a ':'.
>
> But it would not beat just being able to say "--no-keep-empty" (or
> "--discard-empty"), would it?
>
> On the other hand, even if there were "--discard-empty" available,
> there may still be two classes of empty ones (e.g. ones that were
> created by third-party tools, the others that were deliberately
> empty) that the user may need and want to sift through, and for such
> a use case, the marking this patch does would be very valuable.
>
> So, from that point of view, this may not be enough, but a "throw
> away all" option is not enough, either.  We'd want to have both to
> serve such users better.

This was why I wondered whether it might be worth extending the --empty option to add another possible value, like "drop-all", that would allow the caller to say they want to drop all empty commits--both those that started out empty and those that became empty. That fourth mode would be distinct from the existing three. (I'm not sure what to call said mode; "drop-all" looks odd alongside the existing "drop". I just say "drop-all" here to help illustrate the idea.)

Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 27 in “rebase -i: mark commits that begin empty in todo editor”
  1. rebase -i: mark commits that begin empty in todo editorElijah Newren via GitGitGadget, Apr 9, 2020
  2. Junio C HamanoApr 10, 2020
  3. Bryan TurnerApr 10, 2020
  4. Junio C HamanoApr 10, 2020
  5. 0/3 rebase -i: mark commits that begin empty in todo editorElijah Newren via GitGitGadget, Apr 10, 2020
  6. 1/3 rebase -i: mark commits that begin empty in todo editorElijah Newren via GitGitGadget, Apr 10, 2020
  7. 2/3 rebase: reinstate --no-keep-emptyElijah Newren via GitGitGadget, Apr 10, 2020
  8. Junio C HamanoApr 10, 2020
  9. Elijah NewrenApr 10, 2020
  10. 3/3 rebase: fix an incompatible-options error messageElijah Newren via GitGitGadget, Apr 10, 2020
  11. Junio C HamanoApr 10, 2020
  12. Junio C HamanoApr 10, 2020
  13. Junio C HamanoApr 10, 2020
  14. Elijah NewrenApr 10, 2020
  15. Junio C HamanoApr 10, 2020
  16. Elijah NewrenApr 10, 2020
  17. Junio C HamanoApr 10, 2020
  18. Elijah NewrenApr 11, 2020
  19. Junio C HamanoApr 11, 2020
  20. 0/4 rebase -i: mark commits that begin empty in todo editorElijah Newren via GitGitGadget, Apr 11, 2020
  21. 2/4 rebase: reinstate --no-keep-emptyElijah Newren via GitGitGadget, Apr 11, 2020
  22. 1/4 rebase -i: mark commits that begin empty in todo editorElijah Newren via GitGitGadget, Apr 11, 2020
  23. Junio C HamanoApr 15, 2020
  24. 3/4 rebase: fix an incompatible-options error messageElijah Newren via GitGitGadget, Apr 11, 2020
  25. 4/4 rebase --merge: optionally skip upstreamed commitsJonathan Tan via GitGitGadget, Apr 11, 2020
  26. Jonathan TanApr 11, 2020
  27. Phillip WoodApr 14, 2020

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.