From: Chaitanya Tata <chaitanya.tk17@gmail.com>
To: Taylor Blau <me@ttaylorr.com>
Cc: git@vger.kernel.org
Subject: Re: Add support for `git rebase -no-edit`
Date: Fri, 12 Jan 2024 01:37:35 +0530 [thread overview]
Message-ID: <CADA7-FNh_7OrFFb7qmYFf4i2t_VsjRSjtVngtRKS6HkADKrGYw@mail.gmail.com> (raw)
In-Reply-To: <ZaBHooq6ORZ3TTkL@nand.local>
Cheers,
Chaitanya.
On Fri, Jan 12, 2024 at 1:25 AM Taylor Blau <me@ttaylorr.com> wrote:
>
> Hi Chaitanya,
>
> On Thu, Jan 11, 2024 at 10:55:47PM +0530, Chaitanya Tata wrote:
> > Hi,
> >
> > I have a feature request to add `--no-edit` option to `git rebase`
> > like we do for `git commit`.
> > The workflow I typically follow is:
> >
> > * `git commit -a --fixup=XXX`
> > * `git rebase -i HEAD~15 --autosquash`
> >
> > But it requires closing the editor without any changes. I can
> > workaround this using the `GIT_EDITOR` option, see [1]. But it would
> > be good to have this built-in.
>
> The easiest workaround would be setting GIT_EDITOR=true, which matches
> the recommendation in [1].
Thanks for the quick response.
>
> Short of that, you can't do a non-interactive rebase, since we rely on
> the todo list generated by interactive rebases in order for
> `--autosquash` to work.
IIUC, creating a todo list needs access to the file used in interactive
rebase?
> Presumably plumbing in a new `--[no-]edit` option would be fairly
> straightforward, and once that is done, the change boils down to just:
I am bit confused by this as this seems to contradict above statement,
I guess the below patch will only work without `--autosquash`? Sorry, not
familiar with git internals.
>
> index 3cc88d8a80..5235a003f2 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -6169,7 +6169,7 @@ int complete_action(struct repository *r, struct replay_opts *opts, unsigned fla
> struct todo_list new_todo = TODO_LIST_INIT;
> struct strbuf *buf = &todo_list->buf, buf2 = STRBUF_INIT;
> struct object_id oid = onto->object.oid;
> - int res;
> + int res = 0;
>
> repo_find_unique_abbrev_r(r, shortonto, &oid,
> DEFAULT_ABBREV);
> @@ -6197,8 +6197,9 @@ int complete_action(struct repository *r, struct replay_opts *opts, unsigned fla
> return error(_("nothing to do"));
> }
>
> - res = edit_todo_list(r, todo_list, &new_todo, shortrevisions,
> - shortonto, flags);
> + if (!opts->edit)
> + res = edit_todo_list(r, todo_list, &new_todo, shortrevisions,
> + shortonto, flags);
> if (res == -1)
> return -1;
> else if (res == -2) {
>
> > [1] - https://stackoverflow.com/a/45783848
>
> Thanks,
> Taylor
next prev parent reply other threads:[~2024-01-11 20:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-11 17:25 Add support for `git rebase -no-edit` Chaitanya Tata
2024-01-11 19:55 ` Taylor Blau
2024-01-11 20:07 ` Chaitanya Tata [this message]
2024-01-11 21:30 ` Junio C Hamano
2024-01-11 21:42 ` Taylor Blau
2024-01-11 21:46 ` Chaitanya Tata
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=CADA7-FNh_7OrFFb7qmYFf4i2t_VsjRSjtVngtRKS6HkADKrGYw@mail.gmail.com \
--to=chaitanya.tk17@gmail.com \
--cc=git@vger.kernel.org \
--cc=me@ttaylorr.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).