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

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:52:13

Peter Oberndorfer [off-list ref] 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.
* 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
* Should git_rebase_editor be in git-rebase--interactive.sh instead
Probably yes.
* 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?

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.

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

From: Peter Oberndorfer <hidden>
Date: 2016-06-15 22:52:14

On Dienstag, 11. Oktober 2011, Junio C Hamano wrote:
Peter Oberndorfer [off-list ref] writes:
quoted
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...
quoted
* 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.
quoted
* Should git_rebase_editor be in git-rebase--interactive.sh instead
Probably yes.
OK, will do.
quoted
* 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help