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

Re: [RFC/WIP PATCH] Use config value rebase.editor as editor when starting git rebase -i

From
Phil Hord <phil.hord@gmail.com>
Date
Oct 11, 2011, 18:15 UTC
Message-ID
<CABURp0oQJ_rUQyOmm+CmZaqBp2mZYCwZRAz_mO5BshK4E+6eCA@mail.gmail.com>
In-Reply-To
<201110111956.08829.kumbayo84@arcor.de>
On Tue, Oct 11, 2011 at 1:56 PM, Peter Oberndorfer <kumbayo84@arcor.de> wrote:
Show 5 quoted lines
> i wrote a (not yet released) git rebase -i helper that allows to order commits
> by drag/drop and allows to select the action from a combo box.
> (written in Qt)
> See http://i55.tinypic.com/2d94gg0.jpg for how it currently looks like. :-)
> No more typos, no more lost commit by cutting without pasting...
[+1]
Show 38 quoted lines
>
> To integrate this properly into git i need something like this patch.
>
> Open questions/problems:
> * GIT_EDITOR env var is not honored anymore after this change.
>  Help from somebody with more bash knowledge is highly appreciated!
>
> * Should git_rebase_editor be in git-rebase--interactive.sh instead
>  (since it is only used there)
>
> * How should the config be called?
>  It is not directly used during rebase, only during rebase -i
>  that might not be fully clear from the config name.
>
> * Better config.txt description?
>
> Thanks,
> Greetings Peter
>
> PS: My tool will hopefully be released soon.
> Cleanup code, test(lin/ win), write some doc (how to use with git),
> choose name :-), choose license...
>
>  Documentation/config.txt   |    6 ++++++
>  git-rebase--interactive.sh |    2 +-
>  git-sh-setup.sh            |   13 +++++++++++++
>  3 files changed, 20 insertions(+), 1 deletions(-)
>
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index 03296b7..1d9ae79 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -1591,6 +1591,12 @@ rebase.stat::
>        Whether to show a diffstat of what changed upstream since the last
>        rebase. False by default.
>
> +rebase.editor::
> +       Text editor used by git rebase -i for editing the rebasse todo file.
s/rebasse/rebase/
>  cp "$todo" "$todo".backup
> -git_editor "$todo" ||
> +git_rebase_editor "$todo" ||
>        die_abort "Could not execute editor"
Maybe something like this would work:
  git_rebase_editor "$todo" ||
  git_editor "$todo" ||
       die_abort "Could not execute editor"

If git_rebase_editor call returns an error (non-zero exit code), then git_editor will be invoked. If that also returns an error, then the die_abort is called.

I think this will allow your env:GIT_EDITOR to work as expected.
Phil
Previous: Peter OberndorferNext: Junio C Hamano
Message 2 of 4 in “Use config value rebase.editor as editor when starting git rebase -i”
  1. Use config value rebase.editor as editor when starting git rebase -iPeter Oberndorfer, Oct 11, 2011
  2. Phil HordOct 11, 2011
  3. Junio C HamanoOct 11, 2011
  4. Peter OberndorferOct 11, 2011

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.