All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: "Théo MAILLART via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, "Théo Maillart" <tmaillart@gmail.com>
Subject: Re: [PATCH] rebase: introduce allow-inline-reword option
Date: Thu, 04 Aug 2022 09:57:15 +0200	[thread overview]
Message-ID: <220804.861qtwe8dy.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <pull.1228.git.git.1659422389830.gitgitgadget@gmail.com>


On Tue, Aug 02 2022, Théo MAILLART via GitGitGadget wrote:

> From: =?UTF-8?q?Th=C3=A9o=20Maillart?= <tmaillart@gmail.com>
>
> This new option (false by default) for interactive rebase allows users
> to modify the subject of a commit directly in the todo list, when they
> select the "reword" action.
> If the option is enabled, "reword" is selected and the subject has not
> changed, then the default behaviour is used.
> It also introduces a test for this specific option, and a related
> function (set_inline_reword_editor) in the lib-rebase.sh to use a
> simpler custom fake editor to be able to modify the message part of the
> lines in a todo list (in the most simple cases).

I won't repeat what others have noted (e.g. reference to earlier
discussions).

Just an observation: When I use "git rebase -i" I use Emacs's
"git-rebase-mode.el" to view the resulting buffer, it has useful
shortcuts. E.g. M-p and M-n move a line up/down, "c" is pick", "r" is
reword etc.

Now that mode can mark the whole buffer read-only, there is a way to
insert into it, e.g. with "y" to insert a <rev>, or "x" to insert
"exec", but those bring up an interactive dialog.

But there's nothing that e.g. would warrant search/replacing the whole
buffer now.

It's no big deal for an Emacs mode to add it I'd think, just worth
considering what we're pushing to downstream UX's.

>     If the user only wants to modify the subject of a commit during
>     interactive rebase, now he can choose the "reword" command and change
>     the subject directly in the todo list. If "reword" is selected and the
>     subject has not changed, then we use the default behavior. Here is a
>     demo https://asciinema.org/a/T9tEmUjjl4dyDuaXalPzXNzo1
>     
>     This is probably not the correct way to implement this new feature, or
>     perhaps it is not desirable, so I would like some feedback. Thank you

Wouldn't another implementation of this be to do:

	exec EDITOR="..." git commit --amend

Where that "editor" is a sed one-liner to s/<first line>/replacement/?

I don't mind this feature per-se, but I will observe that since I
started using git-rebase-mode.el its keymap has gotten much more
cluttered over the years, as we've added more special modes (and it has
maps of its own).

I don't object to it, but wonder if we couldn't add something that's
more generic, and wouldn't require e.g. a
--allow-adding-a-new-paragraph-after-the-subject-that-is-already-there,
i.e. some users will want to reword the subject, others want to add a
signed-off-by.

For the SOB case we already have:

	git rebase -i -x 'git commit --no-edit --amend -s'

Perhaps we could/should have instead:

	git commit --amend-subject

Which would allow you to do:

	git rebase -i -x 'git commit --amend-subject -m"new subject here, does not touch anything past the first \n\n"'


      parent reply	other threads:[~2022-08-04  8:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-02  6:39 [PATCH] rebase: introduce allow-inline-reword option Théo MAILLART via GitGitGadget
2022-08-02 15:23 ` Junio C Hamano
2022-08-02 22:22   ` Théo Maillart
2022-08-02 22:36     ` Junio C Hamano
2022-08-02 22:59       ` Eric Sunshine
2022-08-03 14:16 ` Phillip Wood
2022-08-04  7:57 ` Ævar Arnfjörð Bjarmason [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=220804.861qtwe8dy.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=tmaillart@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.