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
Peter Oberndorfer <kumbayo84@arcor.de>
Date
Oct 11, 2011, 21:16 UTC
Message-ID
<201110112316.11738.kumbayo84@arcor.de>
In-Reply-To
<7vipnvfk70.fsf@alter.siamese.dyndns.org>
On Dienstag, 11. Oktober 2011, Junio C Hamano wrote:
Show 8 quoted lines
> Peter Oberndorfer <kumbayo84@arcor.de> writes:
> 
> > Using $GIT_EDITOR or core.editor config var for this is not possible
> > since it is also used to start the commit message editor for reword action.
> 
> Your tool _could_ be smart about this issue and inspect the contents to
> launch a real editor when it is fed a material not for sequencing, but
> that feels hacky.

I already tried this, but my first version did not redirect stdin/stdout so vi stayed in background and the whole thing just hung. I did not try further because i assumed more problems would appear when redirecting stdin/stdout...

Show 10 quoted lines
> > * GIT_EDITOR env var is not honored anymore after this change.
> 
> Care to explain?  "git var" knows magic about a few variables like
> GIT_EDITOR and GIT_PAGER.
> 
> 	$ git config core.editor vim
> 	$ GIT_EDITOR=vi EDITOR=emacs git var GIT_EDITOR
>         vi
> 	$ unset GIT_EDITOR; EDITOR=emacs git var GIT_EDITOR
>         emacs
Sorry i was wrong, i missed that git var looks at $GIT_EDITOR.

So the sequence for choosing the sequencer editor is: $GIT_SEQUENCE_EDITOR config sequence.editor var GIT_EDITOR

Which looks OK to me.
> > * Should git_rebase_editor be in git-rebase--interactive.sh instead
> 
> Probably yes.
OK, will do.
Show 7 quoted lines
> 
> > * How should the config be called?
> 
> Given that in the longer term we would be using a unified sequencer
> machinery for not just rebase-i but for am and cherry-pick, I would advise
> against calling this anything "rebase".  How does "sequence.edit" sound?
> 

I do not really care very much, but how about sequence.editor? Sounds more similar to core.editor

> You need to be prepared to adjust your code to deal with new kinds of
> sequencing insns in the insn sheet and possibly a format change of the
> insn sheet itself.

I assume instruction sheet is the commented out part that looks like: # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message

Currently all lines starting with # are ignored. (They are also not written to the output when finished which is a point I might have to change...)

Also the instructions are currently not taken from this instruction sheet. They are all hardcoded.

Thanks for the feedback Greetings Peter

Previous: Junio C Hamano
Message 4 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.